Add Achitat + Rest de achitat display fields in payment section
Shows the financial breakdown inline in the Plată & total section: - Total (MDL) — bold, computed - Achitat (MDL) — green, from paidAmount() - Rest de achitat (MDL) — red if unpaid, green if fully paid All three fields are readOnly/dehydrated (display only). To register payments, use the Plăți relation manager tab. Translations added for RO/RU/EN. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -173,7 +173,22 @@ class WorkOrderResource extends Resource
|
|||||||
->placeholder(__('Ex: 25'))
|
->placeholder(__('Ex: 25'))
|
||||||
->helperText(__('Doar pentru cazuri speciale. Lasă gol → folosește marja mecanicului.'))
|
->helperText(__('Doar pentru cazuri speciale. Lasă gol → folosește marja mecanicului.'))
|
||||||
->visible(fn () => auth()->user()?->canDo(\App\Auth\Permissions::FINANCE_VIEW_INTERNAL_MARGIN) ?? false),
|
->visible(fn () => auth()->user()?->canDo(\App\Auth\Permissions::FINANCE_VIEW_INTERNAL_MARGIN) ?? false),
|
||||||
Forms\Components\TextInput::make('total')->label(__('Total'))->numeric()->readOnly()->dehydrated(false),
|
Forms\Components\TextInput::make('total')
|
||||||
|
->label(__('Total (MDL)'))
|
||||||
|
->numeric()->readOnly()->dehydrated(false)
|
||||||
|
->extraAttributes(['style' => 'font-weight:600']),
|
||||||
|
Forms\Components\TextInput::make('_achitat')
|
||||||
|
->label(__('Achitat (MDL)'))
|
||||||
|
->readOnly()->dehydrated(false)
|
||||||
|
->default(fn ($record) => $record ? number_format($record->paidAmount(), 2, '.', '') : '0.00')
|
||||||
|
->extraAttributes(['style' => 'color:#16a34a;font-weight:600']),
|
||||||
|
Forms\Components\TextInput::make('_rest')
|
||||||
|
->label(__('Rest de achitat (MDL)'))
|
||||||
|
->readOnly()->dehydrated(false)
|
||||||
|
->default(fn ($record) => $record ? number_format(max(0, (float)$record->total - $record->paidAmount()), 2, '.', '') : '0.00')
|
||||||
|
->extraAttributes(fn ($record) => [
|
||||||
|
'style' => 'font-weight:600;color:' . ($record && $record->paidAmount() >= (float)$record->total ? '#16a34a' : '#dc2626'),
|
||||||
|
]),
|
||||||
Forms\Components\Toggle::make('approved')->label(__('Aprobat de client')),
|
Forms\Components\Toggle::make('approved')->label(__('Aprobat de client')),
|
||||||
Forms\Components\DatePicker::make('closed_at')->label(__('Închis')),
|
Forms\Components\DatePicker::make('closed_at')->label(__('Închis')),
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -59,6 +59,9 @@
|
|||||||
"Această acțiune este ireversibilă": "This action is irreversible",
|
"Această acțiune este ireversibilă": "This action is irreversible",
|
||||||
"Acest email a fost generat automat. Vă rugăm nu răspundeți.": "This email was auto-generated. Please do not reply.",
|
"Acest email a fost generat automat. Vă rugăm nu răspundeți.": "This email was auto-generated. Please do not reply.",
|
||||||
"Achitat": "Paid",
|
"Achitat": "Paid",
|
||||||
|
"Achitat (MDL)": "Paid (MDL)",
|
||||||
|
"Rest de achitat (MDL)": "Balance due (MDL)",
|
||||||
|
"Total (MDL)": "Total (MDL)",
|
||||||
"Achitat azi": "Paid today",
|
"Achitat azi": "Paid today",
|
||||||
"Achitat:": "Paid:",
|
"Achitat:": "Paid:",
|
||||||
"Achiziție piese": "Parts purchase",
|
"Achiziție piese": "Parts purchase",
|
||||||
|
|||||||
@@ -59,6 +59,9 @@
|
|||||||
"Această acțiune este ireversibilă": "Это действие необратимо",
|
"Această acțiune este ireversibilă": "Это действие необратимо",
|
||||||
"Acest email a fost generat automat. Vă rugăm nu răspundeți.": "Это письмо сгенерировано автоматически. Пожалуйста, не отвечайте.",
|
"Acest email a fost generat automat. Vă rugăm nu răspundeți.": "Это письмо сгенерировано автоматически. Пожалуйста, не отвечайте.",
|
||||||
"Achitat": "Оплачено",
|
"Achitat": "Оплачено",
|
||||||
|
"Achitat (MDL)": "Оплачено (MDL)",
|
||||||
|
"Rest de achitat (MDL)": "Остаток к оплате (MDL)",
|
||||||
|
"Total (MDL)": "Итого (MDL)",
|
||||||
"Achitat azi": "Оплачено сегодня",
|
"Achitat azi": "Оплачено сегодня",
|
||||||
"Achitat:": "Оплачено:",
|
"Achitat:": "Оплачено:",
|
||||||
"Achiziție piese": "Закупка запчастей",
|
"Achiziție piese": "Закупка запчастей",
|
||||||
|
|||||||
Reference in New Issue
Block a user