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 <noreply@anthropic.com>
This commit is contained in:
2026-09-08 07:23:06 +00:00
parent b0433b66c7
commit 7c0c728347
2 changed files with 11 additions and 6 deletions
@@ -25,7 +25,14 @@ class PaymentsRelationManager extends RelationManager
{ {
return $schema->components([ return $schema->components([
Forms\Components\DatePicker::make('paid_at')->label(__('Data'))->default(today())->required(), 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') Forms\Components\Select::make('method')
->options(\App\Support\I18n::opts(Payment::METHODS)) ->options(\App\Support\I18n::opts(Payment::METHODS))
->default('cash') ->default('cash')
+3 -5
View File
@@ -225,10 +225,9 @@
<table class="items"> <table class="items">
<thead> <thead>
<tr> <tr>
<th style="width: 40%;">{{ __('Denumire') }}</th> <th style="width: 55%;">{{ __('Denumire') }}</th>
<th style="width: 18%;">{{ __('Cod') }}</th>
<th class="r" style="width: 10%;">{{ __('Cant.') }}</th> <th class="r" style="width: 10%;">{{ __('Cant.') }}</th>
<th class="r" style="width: 14%;">{{ __('Preț') }}</th> <th class="r" style="width: 17%;">{{ __('Preț') }}</th>
<th class="r" style="width: 18%;">{{ __('Total') }}</th> <th class="r" style="width: 18%;">{{ __('Total') }}</th>
</tr> </tr>
</thead> </thead>
@@ -236,7 +235,6 @@
@foreach ($wo->parts as $p) @foreach ($wo->parts as $p)
<tr> <tr>
<td>{{ $p->name }}@if ($p->brand) <span style="color:#9ca3af;">({{ $p->brand }})</span>@endif</td> <td>{{ $p->name }}@if ($p->brand) <span style="color:#9ca3af;">({{ $p->brand }})</span>@endif</td>
<td>{{ $p->article ?? '—' }}</td>
<td class="r">{{ number_format((float) $p->qty, 2) }} {{ $p->unit }}</td> <td class="r">{{ number_format((float) $p->qty, 2) }} {{ $p->unit }}</td>
<td class="r">{{ number_format((float) $p->sell_price, 2, '.', ' ') }}</td> <td class="r">{{ number_format((float) $p->sell_price, 2, '.', ' ') }}</td>
<td class="r"><b>{{ number_format((float) $p->total, 2, '.', ' ') }}</b></td> <td class="r"><b>{{ number_format((float) $p->total, 2, '.', ' ') }}</b></td>
@@ -245,7 +243,7 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<td colspan="4" class="r">{{ __('Subtotal piese:') }}</td> <td colspan="3" class="r">{{ __('Subtotal piese:') }}</td>
<td class="r">{{ number_format((float) $partsTotal, 2, '.', ' ') }} {{ $currency }}</td> <td class="r">{{ number_format((float) $partsTotal, 2, '.', ' ') }} {{ $currency }}</td>
</tr> </tr>
</tfoot> </tfoot>