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'))
|
||||
->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')),
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user