@php
$date = fn ($value) => $value ? \Illuminate\Support\Carbon::parse($value) : null;
$inspectionDate = $date($inspection->inspection_date);
$followUp = $date($inspection->follow_up_date);
$findings = $inspection->findingList();
$findingsAsParagraph = $inspection->findingsFormat() === 'paragraph' && count($findings) > 0;
$details = $inspection->instrumentDetailList();
$detailsAsParagraph = $inspection->instrumentDetailsFormat() === 'paragraph' && count($details) > 0;
$foundErrors = $inspection->foundErrors();
$notPresent = $inspection->customer_agreement === 'not_present';
$answered = $inspection->customer_agreement !== null;
/* The pad prints both alternatives and the trader strikes one out. Until they have, neither
is struck - a sheet that pre-strikes both reads as if they refused to answer at all. */
$mark = fn (string $value) => $answered
? ($inspection->customer_agreement === $value ? 'chosen' : 'struck')
: '';
$respondedAt = $inspection->customer_responded_at;
/* A ruled answer line with the answer written on it, as the pad is filled in by hand. */
$answer = fn ($value) => filled($value) ? e($value) : ' ';
/* A blank the width of the paper's ruled space. `{{ }}` would escape the entity and print
it, so every blank on this sheet goes through here and is echoed unescaped. */
$blank = fn (int $width = 1) => str_repeat(' ', $width);
/* The blank template, printed to be filled by hand: nothing struck, nothing awaited. */
$blankForm = $blankForm ?? false;
/* 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
? ''
: '';
/* The form prints in the language it was filled in - Kiswahili unless the officer chose English. */
$lang = \Modules\Compounding\Support\FormLanguage::normalise($inspection->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 UKAGUZI WA VIPIMO - the statutory inspection form, printed.
The body follows the statutory Form I (Inspection Form, made under regulation 164): PARTICULARS
1-7, the description of the measuring instrument/goods, 3. OBSERVATIONS AND FINDINGS, the
owner's "I, ... agree/disagree" with their signature, the ORDER, and the inspector's and the
owner's signatures with their dates. The agency masthead stays above it. Where the pad asks the officer to strike out one of two alternatives - kuna
makosa / hakuna makosa, nakubaliana / sikubaliani - the printed form shows the same pair with
the one that does not apply struck through, so a filled sheet reads exactly like a hand-filled
one and cannot be misread as a blank.
Long findings and a long order flow onto a second page: each section heading stays with its
first lines, a finding is never split across pages, and the signature block moves as one. What
is never done is hiding text to keep to one sheet - a form that cuts off an order is not the
order that was given.
The masthead is the agency's, in Swahili: this is a Swahili form and the trader signing it
reads Swahili. The office beneath the agency name is the one that raised the form, not a fixed
region - a Katavi pad says KATAVI because Katavi printed it.
--}}
| 1. | {{ $t['fi_name'] }} | {!! $answer($inspection->customer_name) !!} |
| 2. | {{ $t['fi_place'] }} | {!! $answer($place) !!} |
| 3. | {{ $t['fi_business'] }} | {!! $answer($inspection->customer_business) !!}@if ($inspection->licence_number) ({{ rtrim($t['ins_licence'], ':') }}: {{ $inspection->licence_number }})@endif |
| 4. | {{ $t['fi_address'] }} | {!! $answer($inspection->customer_address) !!} |
| 5. | {{ $t['fi_responsible'] }} | {!! $answer($blankForm ? null : $responsible) !!} |
| 6. | {{ $t['fi_occupation'] }} | {!! $answer($blankForm || $notPresent ? null : $capacity) !!} |
| 7. | {{ $t['fi_mobile'] }} | {!! $answer($phoneShown) !!} |
{{ $t['fi_i'] }} {!! $notPresent ? ' - ' : (filled($responsible) && ! $blankForm ? e($responsible) : $blank(40)) !!} @if ($notPresent) {{ $t['fi_agree'] }}/{{ $t['fi_disagree'] }} {{ $t['fi_with'] }} ({{ $t['ins_c_not_present'] }}{{ $inspection->customer_response_note ? ': '.$inspection->customer_response_note : '' }}.) @else {{ $t['fi_agree'] }}/{{ $t['fi_disagree'] }} {{ $t['fi_with'] }} @if (! $answered && ! $blankForm) {{ $t['ins_c_awaiting'] }} @endif @endif
{{ $t['fi_order_i'] }}
@if (filled($inspection->officer_order)){{ $t['ins_d_report'] }} {!! e($inspection->follow_up_office) ?: $blank(1) !!} {{ $t['on_date'] }} {!! e($followUp?->format('d/m/Y')) ?: $blank(8) !!} {{ $t['ins_d_time'] }} {!! ($inspection->follow_up_time) ? e(substr((string) $inspection->follow_up_time, 0, 5)) : $blank(3) !!} {{ $t['ins_d_more'] }}
@endif {{-- ── Inspector's signature / Owner/user/possessor's signature ─── --}}|
@if ($officerSignature)
{{ $t['fi_inspector_sig'] }}
@if (! $blankForm && filled($officerName)){{ $officerName }} @endif
{{ $t['fi_date'] }} {{ $blankForm ? $dots : ($inspectorDate ?? $dots) }}
|
@if ($customerSignature && ! $notPresent)
{!! $ink($customerSignature, $t['fi_owner_sig']) !!}
@endif
{{ $t['fi_owner_sig'] }}
@if (! $blankForm){{ $notPresent ? '-' : $inspection->signatoryName() }} @endif
{{ $t['fi_date'] }} {{ $ownerDate ?? $dots }}
|
{{ $t['ins_att_declaration'] }}
|
@if ($attendeeSignature)
{{ $t['ins_att_signature'] }}
{{ $inspection->attendee_name }}
{{ $t['date_label'] }} {{ $inspection->attendee_signed_at?->format('d/m/Y') ?? '......... / ......... / 20.........' }}
|
{{-- The officer named to deal with it at the office signs beside the attendee. --}}
@if ($attendanceOfficerSignature ?? null)
{{ $t['ins_att_officer'] }}
{{ $attendanceOfficerName ?? '' }}
{{ $t['date_label'] }} {{ $inspection->attendance_recorded_at?->copy()->timezone('Africa/Dar_es_Salaam')->format('d/m/Y') ?? '......... / ......... / 20.........' }}
|