@php /* A customer's signature, inked darker and thicker so it reads clearly: contrast turns faint strokes black and keeps paper white; two copies half a point apart, multiplied, thicken each stroke without drawing a box around a photographed one. */ $ink = fn (?string $src, string $alt = '') => $src ? ''.e($alt).'' : ''; $date = fn ($value) => $value ? \Illuminate\Support\Carbon::parse($value) : null; $compoundDate = $date($compound->compound_date); $complianceFrom = $date($compound->compliance_from); $officerDate = $date($compound->officer_signed_at) ?? $compoundDate; $customerDate = $compound->customer_signed_at; $accepted = $compound->customer_acceptance === 'accepted'; $declined = $compound->customer_acceptance === 'declined'; $answered = $compound->customer_acceptance !== null; $amount = $compound->compound_amount === null ? null : (float) $compound->compound_amount; /* A ruled answer line with the answer written on it, as the form is filled in by hand. */ $answer = fn ($value) => filled($value) ? e($value) : ' '; $days = fn ($value) => $value ? e((string) $value) : '    '; $dmy = fn ($value) => $value ? $value->format('d/m/Y') : str_repeat(' ', 10); /* A blank of the paper form's width when nothing has been written on it yet. */ $fill = fn ($value, int $width = 18) => filled($value) ? e((string) $value) : str_repeat(' ', $width); /* The form prints in the language it was filled in - Kiswahili unless the officer chose English. */ $lang = \Modules\Compounding\Support\FormLanguage::normalise($compound->language); $t = \Modules\Compounding\Support\FormLanguage::text($lang); /* A phrase that follows a filled-in name: English joins it with a comma, Kiswahili with a space. */ $after = fn (string $text) => (str_starts_with($text, ',') ? '' : ' ').e($text); @endphp {{-- FOMU YA UFIFILISHAJI - the official compounding form under section 46 of the Weights and Measures Act, Cap. 340, printed. The wording, the order of the sections, the numbered particulars, the declarations, the signature lines and the office-use box are the official form's; nothing here is a redesign. It is two pages because the official form is two pages: the offender's particulars, the offence and their agreement on the first; their disagreement, the compounding officer's declaration, the order or warning, the signatures and the office-use box on the second. Where the paper form has a blank the officer fills by hand - a name, a number of days, a sum, the sum in words - the printed form shows the recorded value on the same ruled line. Where the paper offers two alternatives - nakuamuru/nakuonya, Bwana/Bibi - both are printed as they are on the form, so a filled sheet reads exactly like a hand-filled one. Long text flows: the offence and the order wrap and continue onto the next page rather than being cut, and a section heading never sits alone at the foot of a page. --}} Fomu ya Ufifilishaji - {{ $compound->compound_number }} @php // The Regional Manager's stamp as it is struck at the signatures: the region's own stamp where one // was uploaded under Settings → Collection Centres, else set in type with the region's name. $stampMark = $stampImage ? ''.e($t['uf_stamp_alt']).'' : ''; @endphp {{-- ══════════════════════ UKURASA WA 1 ══════════════════════ --}}
{{ $t['country'] }}
{{ $t['ministry'] }}
{{ $t['agency'] }}
@if ($emblem){{ $t['emblem_alt'] }}@endif
{{ $t['uf_title'] }}
[{{ \Modules\Compounding\Support\FormLanguage::lawReferenceFor($compound->law_reference, $lang) }}]
{{ $t['ref_no'] }} {{ $compound->compound_number }}@if ($inspection)  ·  {{ $t['uf_inspection_no'] }} {{ $inspection->inspection_number }}@endif
{{-- ── TAARIFA ZA MKOSAJI ─────────────────────────────────────── --}}
{{ $t['uf_offender_head'] }}
{{ $t['uf_name'] }}{!! $answer($compound->offender_name) !!}
{{ $t['uf_age'] }}{!! $answer($compound->offender_age) !!}
{{ $t['uf_tribe'] }}{!! $answer($compound->offender_tribe) !!}
{{ $t['uf_nationality'] }}{!! $answer($compound->offender_nationality) !!}
{{ $t['uf_religion'] }}{!! $answer($compound->offender_religion) !!}
{{ $t['uf_occupation'] }}{!! $answer($compound->offender_occupation) !!}
{{ $t['uf_address'] }}{!! $answer($compound->offender_address) !!}
{{ $t['uf_phone'] }}{!! $answer(\Modules\Compounding\Support\TanzanianPhone::display(\Modules\Compounding\Support\TanzanianPhone::normalise($compound->offender_phone) ?? $compound->offender_phone)) !!}
{{-- ── KOSA/MAKOSA ────────────────────────────────────────────── --}}
{{ $t['uf_offence_head'] }}
@if (filled($compound->offence_description))
{{ $compound->offence_description }}
@else
@endif {{-- ── The offender's declaration ─────────────────────────────── --}}

{{ $t['uf_decl_i'] }} {!! $fill($compound->offender_name, 18) !!}{!! $after($t['uf_decl_body']) !!}

{{ $t['uf_accept_body'] }} {!! $days($compound->compliance_days) !!} {{ $t['uf_accept_from'] }} {!! $dmy($complianceFrom) !!} {{ $t['uf_accept_end'] }}

@if ($customerSignature && $accepted){!! $ink($customerSignature, $t['uf_sig_offender']) !!}@endif
{{ $t['uf_sig_offender'] }}
@if ($accepted && $customerDate)
{{ $t['date_label'] }} {{ $customerDate->format('d/m/Y H:i') }}
@endif
{{-- ══════════════════════ UKURASA WA 2 ══════════════════════ --}}
{{-- ── Sikubaliani - no longer part of the form or the blank template: the offender's only answer is to agree. A form answered "Sikubaliani" before this still prints that answer, so its record stands. ── --}} @if ($declined)

{{ $t['uf_decline'] }}

@if ($declined && filled($compound->disagreement_reason))
{{ $compound->disagreement_reason }}
@else
@endif
@if ($customerSignature && $declined){!! $ink($customerSignature, $t['uf_sig_offender']) !!}@endif
{{ $t['uf_sig_offender'] }}
@if ($declined && $customerDate)
{{ $t['date_label'] }} {{ $customerDate->format('d/m/Y H:i') }}
@endif
@endif {{-- The officer's part - the sum, the order and the office's use - reaches the offender only in round 2 of a two-round form; their copy before then carries their answer alone. --}} @if (empty($hideOfficerPart)) {{-- ── AFISA MFIFILISHAJI ─────────────────────────────────────── --}} @php /* How many offences are compounded: the inspection's findings, where they were listed. */ $offenceCount = $compound->inspection && $compound->inspection->findingsFormat() === 'list' ? count($compound->inspection->findingList()) : 0; @endphp

{{ $t['uf_officer_i'] }} {!! $fill($officerName, 18) !!}{!! $after($t['uf_officer_body']) !!} {!! $offenceCount > 0 ? e((string) $offenceCount) : str_repeat(' ', 6) !!} {{ $t['uf_officer_offences'] }} {!! $fill($compound->offender_name, 18) !!} {{ $t['uf_officer_pay'] }} {!! ($amount !== null) ? e(number_format($amount, 0).'/=') : str_repeat(' ', 12) !!} {{ $t['uf_in_words'] }} {!! $fill($compound->amount_in_words, 24) !!} {{ $t['uf_appeal'] }}

{{-- The officer signs on the left; the office's rubber stamp is set on the right. --}}
@if ($officerSignature){{ $t['uf_sig_officer'] }}@endif
{{ $t['uf_sig_officer'] }}
{{ $officerName }}
@if ($officerStamped) {!! $stampMark !!} @endif
{{ $t['uf_rubber_stamp'] }}
{{-- ── AMRI/ONYO ──────────────────────────────────────────────── --}}
{{ $t['uf_order_head'] }}

{{ $t['uf_order_i'] }} {!! $fill($officerName, 18) !!}{!! $after($t['uf_order_body']) !!} {!! $fill($compound->offender_name, 18) !!} {{ $t['uf_order_that'] }}

@if (filled($compound->order_text))
{{ $compound->order_text }}
@else
@endif

{{ $t['uf_order_fail'] }} {!! $days($compound->order_days ?: $compound->compliance_days) !!} {{ $t['uf_order_action'] }}

@if ($officerSignature){{ $t['uf_sig_officer'] }}@endif {{-- The Regional Manager's stamp struck over the officer's signature once the form is issued. --}} @if ($officerStamped) {!! $stampMark !!} @endif
{{ $t['uf_sig_officer'] }}
{{ $officerName }}
{{ $t['date_label'] }} {!! $dmy($officerDate) !!}
@if ($finalSignature){!! $ink($finalSignature, $t['uf_sig_offender']) !!}@endif
{{ $t['uf_sig_offender'] }}
{{ $compound->offender_name }}
{{ $t['date_label'] }} {!! $dmy($finalSignature ? $finalSignedAt : null) !!}
{{-- ── KWA MATUMIZI YA OFISI TU ───────────────────────────────── --}}
{{ $t['uf_office_head'] }}

{{ $t['uf_office_paid'] }} {!! ($officeUse['amountPaid'] !== null) ? e(number_format($officeUse['amountPaid'], 0).'/=') : str_repeat(' ', 12) !!} @if (filled($officeUse['amountWords'] ?? null)) ({{ $officeUse['amountWords'] }}) @else {!! str_repeat(' ', 30) !!} {{ $t['uf_office_words'] }} @endif {{ $t['uf_office_receipt'] }} {!! $fill($officeUse['receiptNumber'], 12) !!} {{ $t['uf_office_dated'] }} {!! $dmy($date($officeUse['receiptDate'])) !!}, {{ $t['uf_office_issued'] }}

{{-- The receiving officer - the region's accountant - signs; the Regional Manager's stamp is struck over it. --}}
@if ($confirmerSignature){{ $t['uf_office_receiver'] }}@endif @if ($officeStamped && ($stampImage || $stampRegion)) {!! $stampMark !!} @endif
{{ $t['uf_office_receiver'] }}
@if ($confirmerName)
{{ $confirmerName }}
@endif @if (filled($confirmerTitle ?? null))
{{ $confirmerTitle }}
@endif
@endif
{{ $compound->compound_number }} @if ($office['name']) · {{ $office['name'] }} @endif @if ($office['tel']) · {{ $t['tel'] }} {{ $office['tel'] }} @endif