diff --git a/app/Filament/Tenant/Resources/WorkOrderResource/RelationManagers/PaymentsRelationManager.php b/app/Filament/Tenant/Resources/WorkOrderResource/RelationManagers/PaymentsRelationManager.php index 71aa7aa..6621fcf 100644 --- a/app/Filament/Tenant/Resources/WorkOrderResource/RelationManagers/PaymentsRelationManager.php +++ b/app/Filament/Tenant/Resources/WorkOrderResource/RelationManagers/PaymentsRelationManager.php @@ -25,7 +25,14 @@ class PaymentsRelationManager extends RelationManager { return $schema->components([ Forms\Components\DatePicker::make('paid_at')->label(__('Data'))->default(today())->required(), - Forms\Components\TextInput::make('amount')->label(__('Sumă'))->numeric()->required(), + Forms\Components\TextInput::make('amount') + ->label(__('Sumă')) + ->numeric() + ->required() + ->default(function (RelationManager $livewire): float { + $wo = $livewire->getOwnerRecord(); + return max(0.0, (float) $wo->total - $wo->paidAmount()); + }), Forms\Components\Select::make('method') ->options(\App\Support\I18n::opts(Payment::METHODS)) ->default('cash') diff --git a/resources/views/pdf/work-order.blade.php b/resources/views/pdf/work-order.blade.php index 79289b7..4616a47 100644 --- a/resources/views/pdf/work-order.blade.php +++ b/resources/views/pdf/work-order.blade.php @@ -225,10 +225,9 @@
| {{ __('Denumire') }} | -{{ __('Cod') }} | +{{ __('Denumire') }} | {{ __('Cant.') }} | -{{ __('Preț') }} | +{{ __('Preț') }} | {{ __('Total') }} | |
|---|---|---|---|---|---|---|---|
| {{ $p->name }}@if ($p->brand) ({{ $p->brand }})@endif | -{{ $p->article ?? '—' }} | {{ number_format((float) $p->qty, 2) }} {{ $p->unit }} | {{ number_format((float) $p->sell_price, 2, '.', ' ') }} | {{ number_format((float) $p->total, 2, '.', ' ') }} | @@ -245,7 +243,7 @@|||
| {{ __('Subtotal piese:') }} | +{{ __('Subtotal piese:') }} | {{ number_format((float) $partsTotal, 2, '.', ' ') }} {{ $currency }} | |||||