From 7c0c72834737969889fb5e2b9f8a1a56424d8829 Mon Sep 17 00:00:00 2001 From: Vasyka Date: Tue, 8 Sep 2026 07:23:06 +0000 Subject: [PATCH] PDF: remove part codes; payments: pre-fill amount with balance due - PDF parts table: removed Cod/article column, widened Denumire column, fixed colspan in tfoot from 4 to 3 - PaymentsRelationManager: amount field now defaults to (total - paidAmount) so it pre-fills with the remaining balance; always editable Co-Authored-By: Claude Sonnet 4.6 --- .../RelationManagers/PaymentsRelationManager.php | 9 ++++++++- resources/views/pdf/work-order.blade.php | 8 +++----- 2 files changed, 11 insertions(+), 6 deletions(-) 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 @@ - - + - + @@ -236,7 +235,6 @@ @foreach ($wo->parts as $p) - @@ -245,7 +243,7 @@ - +
{{ __('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, '.', ' ') }}
{{ __('Subtotal piese:') }}{{ __('Subtotal piese:') }} {{ number_format((float) $partsTotal, 2, '.', ' ') }} {{ $currency }}