From 2caac4ae8ed83b54072df6863d304e97272f8d35 Mon Sep 17 00:00:00 2001 From: Vasyka Date: Sun, 6 Sep 2026 12:24:59 +0000 Subject: [PATCH] Add subcontract jobs section to work order PDF Loads subcontractJobs.subcontractor relation and renders a new table in the PDF after parts: description, subcontractor, category, client price. Adds ru/en translations for the new section labels. Co-Authored-By: Claude Sonnet 4.6 --- app/Services/WorkOrderPdfService.php | 2 +- lang/en.json | 4 +++- lang/ru.json | 6 +++-- resources/views/pdf/work-order.blade.php | 30 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/Services/WorkOrderPdfService.php b/app/Services/WorkOrderPdfService.php index 92c0b9c..8db8a26 100644 --- a/app/Services/WorkOrderPdfService.php +++ b/app/Services/WorkOrderPdfService.php @@ -9,7 +9,7 @@ class WorkOrderPdfService { public function generate(WorkOrder $wo): \Barryvdh\DomPDF\PDF { - $wo->load(['client', 'vehicle', 'master', 'works.master', 'parts', 'payments']); + $wo->load(['client', 'vehicle', 'master', 'works.master', 'parts', 'payments', 'subcontractJobs.subcontractor']); $company = $wo->company ?: \App\Models\Central\Company::find($wo->company_id); $themeColor = $company?->settings['theme_color'] ?? '#3B82F6'; diff --git a/lang/en.json b/lang/en.json index 1394534..c96ea3c 100644 --- a/lang/en.json +++ b/lang/en.json @@ -931,7 +931,7 @@ "GPL": "LPG", "GRANT — adaugă dreptul": "GRANT — add permission", "Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Gallery of up to 8 images. First is shown in the catalog. Max 2 MB / image.", - "Gata": "Ready", + "Gata": "Done", "Gata de ridicare": "Ready for pickup", "Gata estimat (ETA)": "Gata estimat (ETA)", "Gearbox": "Gearbox", @@ -1119,6 +1119,7 @@ "Lucrare blocată": "Work blocked", "Lucrări": "Tasks", "Lucrări la terți": "Subcontracted work", + "Lucrări terțe": "Subcontract jobs", "Lucrări terți": "Outsourced jobs", "Luna aceasta": "This month", "Luna curentă": "Current month", @@ -1959,6 +1960,7 @@ "Subtotal": "Subtotal", "Subtotal manopere:": "Labor subtotal:", "Subtotal piese:": "Parts subtotal:", + "Subtotal terțe:": "Subcontract subtotal:", "Subtotal:": "Subtotal:", "Succes": "Success", "Sugerează revizie / piese de uzură.": "Suggest service / wear parts.", diff --git a/lang/ru.json b/lang/ru.json index 5b0e1db..ea79b43 100644 --- a/lang/ru.json +++ b/lang/ru.json @@ -931,7 +931,7 @@ "GPL": "LPG", "GRANT — adaugă dreptul": "GRANT — добавить право", "Galerie de până la 8 imagini. Prima e afișată în catalog. Max 2 MB / imagine.": "Галерея до 8 изображений. Первое отображается в каталоге. Максимум 2 МБ / изображение.", - "Gata": "Готов", + "Gata": "Готово", "Gata de ridicare": "Готово к выдаче", "Gata estimat (ETA)": "Gata estimat (ETA)", "Gearbox": "КПП", @@ -1119,6 +1119,7 @@ "Lucrare blocată": "Работа заблокирована", "Lucrări": "Работы", "Lucrări la terți": "Работы у субподрядчиков", + "Lucrări terțe": "Сторонние работы", "Lucrări terți": "Работы у третьих лиц", "Luna aceasta": "В этом месяце", "Luna curentă": "Текущий месяц", @@ -1589,7 +1590,7 @@ "Preț": "Цена", "Preț achiziție": "Цена закупки", "Preț anual": "Годовая цена", - "Preț client": "Цена клиенту", + "Preț client": "Цена клиента", "Preț contextual": "Preț contextual", "Preț de bază (markup)": "Preț de bază (markup)", "Preț fix": "Фикс. цена", @@ -1959,6 +1960,7 @@ "Subtotal": "Промежуточный итог", "Subtotal manopere:": "Итого работы:", "Subtotal piese:": "Итого запчасти:", + "Subtotal terțe:": "Итого сторонние:", "Subtotal:": "Подытог:", "Succes": "Успех", "Sugerează revizie / piese de uzură.": "Предложите ТО / расходники.", diff --git a/resources/views/pdf/work-order.blade.php b/resources/views/pdf/work-order.blade.php index 57bb725..06efd9d 100644 --- a/resources/views/pdf/work-order.blade.php +++ b/resources/views/pdf/work-order.blade.php @@ -252,6 +252,36 @@ @endif + @if ($wo->subcontractJobs->isNotEmpty()) +

{{ __('Lucrări terțe') }}

+ + + + + + + + + + + @foreach ($wo->subcontractJobs as $sj) + + + + + + + @endforeach + + + + + + + +
{{ __('Denumire') }}{{ __('Terț') }}{{ __('Categorie') }}{{ __('Preț client') }}
{{ $sj->description ?? '—' }}{{ $sj->subcontractor?->name ?? '—' }}{{ $sj->category ? __($sj->category) : '—' }}{{ number_format((float) $sj->client_price, 2, '.', ' ') }}
{{ __('Subtotal terțe:') }}{{ number_format((float) $wo->subcontractJobs->sum('client_price'), 2, '.', ' ') }} {{ $currency }}
+ @endif +
@if ($wo->discount_pct > 0)
{{ __('Subtotal:') }} {{ number_format((float) ($worksTotal + $partsTotal), 2, '.', ' ') }} {{ $currency }}