From aa231f4b084122998c4ad69e73bc52d7c11c6d1a Mon Sep 17 00:00:00 2001 From: Vasyka Date: Tue, 8 Sep 2026 07:56:36 +0000 Subject: [PATCH] Add Achitat + Rest de achitat display fields in payment section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../Tenant/Resources/WorkOrderResource.php | 17 ++++++++++++++++- lang/en.json | 3 +++ lang/ru.json | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Filament/Tenant/Resources/WorkOrderResource.php b/app/Filament/Tenant/Resources/WorkOrderResource.php index 2ef13a1..f42fb49 100644 --- a/app/Filament/Tenant/Resources/WorkOrderResource.php +++ b/app/Filament/Tenant/Resources/WorkOrderResource.php @@ -173,7 +173,22 @@ class WorkOrderResource extends Resource ->placeholder(__('Ex: 25')) ->helperText(__('Doar pentru cazuri speciale. Lasă gol → folosește marja mecanicului.')) ->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\DatePicker::make('closed_at')->label(__('Închis')), ]), diff --git a/lang/en.json b/lang/en.json index 60132ca..25dbf41 100644 --- a/lang/en.json +++ b/lang/en.json @@ -59,6 +59,9 @@ "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.", "Achitat": "Paid", + "Achitat (MDL)": "Paid (MDL)", + "Rest de achitat (MDL)": "Balance due (MDL)", + "Total (MDL)": "Total (MDL)", "Achitat azi": "Paid today", "Achitat:": "Paid:", "Achiziție piese": "Parts purchase", diff --git a/lang/ru.json b/lang/ru.json index c1862e7..21d4668 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -59,6 +59,9 @@ "Această acțiune este ireversibilă": "Это действие необратимо", "Acest email a fost generat automat. Vă rugăm nu răspundeți.": "Это письмо сгенерировано автоматически. Пожалуйста, не отвечайте.", "Achitat": "Оплачено", + "Achitat (MDL)": "Оплачено (MDL)", + "Rest de achitat (MDL)": "Остаток к оплате (MDL)", + "Total (MDL)": "Итого (MDL)", "Achitat azi": "Оплачено сегодня", "Achitat:": "Оплачено:", "Achiziție piese": "Закупка запчастей",