@extends('layouts.plan-preview', [ 'planPreviewTitle' => __('Visit Plan :ref', ['ref' => plan_print_reference_id($plan)]), 'planPreviewBackUrl' => route('plan.index'), ]) @section('content') @php $visitFrequencyOrdinal = static function (int $n): string { if ($n <= 0) { return '—'; } if ($n % 100 >= 11 && $n % 100 <= 13) { return $n.'th'; } return match ($n % 10) { 1 => $n.'st', 2 => $n.'nd', 3 => $n.'rd', default => $n.'th', }; }; $normSchemeText = static function (?string $s): string { return trim(preg_replace('/\x{00A0}/u', ' ', (string) $s)); }; $periodMonth = strtoupper(\Carbon\Carbon::create()->month((int) $plan->month)->format('F')); $periodYear = (int) $plan->year; $schemes = $plan->latestVersion?->schemes ?? collect(); $planTypeShort = match ($plan->plan_type ?? '') { 'RVP' => __('Regular'), 'CVP' => __('Compliance'), 'SVP' => __('Special'), 'DRP' => __('Desk Review'), 'ERP' => __('Evaluation'), 'PMP' => __('Project Monitoring'), default => $plan->plan_type ?? '—', }; $status = (string) ($plan->status ?? ''); $watermark = match ($status) { 'approved' => null, 'draft' => 'DRAFT', 'rejected' => 'DECLINED', default => 'UNDER APPROVAL', }; $watermarkMod = match ($status) { 'rejected' => 'is-declined', 'draft' => 'is-draft', default => '', }; $submittedOn = $plan->submitted_at ?? $plan->created_at; $dist = $planPrintSummary['distribution'] ?? []; $districtRows = $planPrintSummary['district_rows'] ?? []; $moBreakdown = $planPrintSummary['mo_breakdown_rows'] ?? []; $moTotals = $planPrintSummary['mo_breakdown_totals'] ?? []; $districtTotal = array_sum(array_column($districtRows, 'count')); $planSignatoryDisplay = static function ($user): array { $name = trim((string) ($user?->name ?? '')); if ($name === '') { $name = trim((string) ($user?->user_name ?? '')); } return [ 'name' => $name !== '' ? $name : '—', 'designation' => plan_pc_user_designation_label($user), ]; }; $sigChecked = $planSignatoryDisplay($plan->checker); $sigVerified = $planSignatoryDisplay($plan->verifier); $sigApproved = $planSignatoryDisplay($plan->approver); $fmtSigDate = static function ($d) { return $d ? $d->format('d-M-Y') : '—'; }; @endphp
@if($watermark) @endif
{{ __('Plan ID') }}: {{ plan_print_reference_id($plan) }}

{{ __('Visit Plan for the') }}
{{ __('Month of') }} {{ $periodMonth }} {{ $periodYear }}

{{ __('M&E Cell') }} · {{ __('P&D Department') }} · {{ __('Government of Sindh') }}

{{ __('Region') }}
{{ $planMeta['region_label'] ?? '—' }}
{{ __('Submitted By') }}
{{ $planMeta['created_by_display'] ?? ($plan->creator->name ?? '—') }}
{{ __('Submitted On') }}
{{ $submittedOn ? $submittedOn->format('d-M-Y') : '—' }}
{{ __('Total Schemes') }}
{{ $schemes->count() }}
{{ __('Plan Type') }}
{{ $planTypeShort }}
{{ __('Status') }}
{{ plan_status_display_label($plan) }}
@include('plan.print.partials.filters', ['schemes' => $schemes])
@forelse($schemes as $idx => $scheme) @include('plan.print.partials.scheme-row', compact( 'scheme', 'idx', 'plan', 'projectsMap', 'publishedCountByProjectId', 'umbrellaByProjectId', 'visitFrequencyOrdinal', 'normSchemeText', 'mecCategoryLabelByProjectId' )) @empty @endforelse
{{ __('S.#') }} {{ __('UID / ADP#') }} {{ __('Scheme Name') }} {{ __('Location') }} {{ __('Department') }} {{ __('MEC Sub-Sector') }} {{ __('Planned Visit Date') }} {{ __('Reporting Officer') }} {{ __('Visiting Team') }} {{ __('Cost (M)') }} {{ __('Cum. Expd.') }}
{{ __('No schemes on the latest version.') }}
{{ __('Summary of Visit Plan') }} — {{ $periodMonth }} {{ $periodYear }}
{{ __('Category Wise') }}
{{ __('Distribution') }}
{{ __('Criteria') }} CAT-ICAT-IICAT-III
{{ __('Schemes in plan') }} {{ $dist['cat']['i'] ?? 0 }} {{ $dist['cat']['ii'] ?? 0 }} {{ $dist['cat']['iii'] ?? 0 }}
% {{ $dist['cat_pct']['i'] ?? 0 }}% {{ $dist['cat_pct']['ii'] ?? 0 }}% {{ $dist['cat_pct']['iii'] ?? 0 }}%
{{ __('Sector Wise') }}
{{ __('Distribution') }}
{{ __('Infrastructure') }}{{ __('Social') }}{{ __('Production') }}
{{ $dist['sector']['infrastructure'] ?? 0 }} {{ $dist['sector']['social'] ?? 0 }} {{ $dist['sector']['production'] ?? 0 }}
{{ $dist['sector_pct']['infrastructure'] ?? 0 }}% {{ $dist['sector_pct']['social'] ?? 0 }}% {{ $dist['sector_pct']['production'] ?? 0 }}%
{{ __('Frequency') }}
{{ __('of Visit') }}
{{ __('First Visit') }}{{ __('Second Visit') }}{{ __('Third+ Visit') }}
{{ $dist['freq']['first'] ?? 0 }} {{ $dist['freq']['second'] ?? 0 }} {{ $dist['freq']['third'] ?? 0 }}
{{ $dist['freq_pct']['first'] ?? 0 }}% {{ $dist['freq_pct']['second'] ?? 0 }}% {{ $dist['freq_pct']['third'] ?? 0 }}%
{{ __('Scheme Type') }}
{{ __('Distribution') }}
{{ __('Independent') }}{{ __('Umbrella') }}
{{ $dist['location']['independent'] ?? 0 }} {{ $dist['location']['umbrella'] ?? 0 }}
{{ $dist['location_pct']['independent'] ?? 0 }}% {{ $dist['location_pct']['umbrella'] ?? 0 }}%
{{ __('Cost Wise') }}
{{ __('Distribution') }}
>200 M<=200 M
{{ ($dist['cost']['gt_200'] ?? 0) > 0 ? $dist['cost']['gt_200'] : '—' }} {{ ($dist['cost']['lte_200'] ?? 0) > 0 ? $dist['cost']['lte_200'] : '—' }}
{{ ($dist['cost']['gt_200'] ?? 0) > 0 ? ($dist['cost_pct']['gt_200'] ?? 0).'%' : '—' }} {{ ($dist['cost']['lte_200'] ?? 0) > 0 ? ($dist['cost_pct']['lte_200'] ?? 0).'%' : '—' }}
@forelse($moBreakdown as $row) @empty @endforelse @if(count($moBreakdown) > 0) @endif
{{ __('Reporting Officer') }} {{ __('No. of') }}
{{ __('Schemes') }}
{{ __('Infrastructure') }} {{ __('Social') }} {{ __('Production') }}
{{ __('Irrigation') }} {{ __('Roads') }} {{ __('Buildings') }} {{ __('Total') }} {{ __('Social') }} {{ __('W&SD') }} {{ __('Production') }}
{{ $row['mo_name'] }} {{ $row['total'] }} {{ $row['irrigation'] ?: '—' }} {{ $row['roads'] ?: '—' }} {{ $row['buildings'] ?: '—' }} {{ $row['infra_total'] ?: '—' }} {{ $row['social'] ?: '—' }} {{ $row['wsd'] ?: '—' }} {{ $row['production'] ?: '—' }}
{{ __('No reporting officer assignments.') }}
{{ __('Total') }} ⇒ {{ $moTotals['total'] ?? 0 }} {{ $moTotals['irrigation'] ?? 0 }} {{ $moTotals['roads'] ?? 0 }} {{ $moTotals['buildings'] ?? 0 }} {{ $moTotals['infra_total'] ?? 0 }} {{ $moTotals['social'] ?? 0 }} {{ $moTotals['wsd'] ?? 0 }} {{ $moTotals['production'] ?? 0 }}
@forelse($districtRows as $dRow) @empty @endforelse @if(count($districtRows) > 0) @endif
{{ __('District') }} {{ __('No. of Schemes') }}
{{ $dRow['district'] }} {{ $dRow['count'] }}
{{ __('No location data.') }}
{{ __('Total') }}: {{ $districtTotal }}
{{ __('Checked by') }}
{{ $sigChecked['name'] }}
{{ $sigChecked['designation'] }}
{{ __('Checked on') }} {{ $fmtSigDate($planPrintSignatureDates['checked'] ?? null) }}
{{ __('Verified by') }}
{{ $sigVerified['name'] }}
{{ $sigVerified['designation'] }}
{{ __('Verified on') }} {{ $fmtSigDate($planPrintSignatureDates['verified'] ?? null) }}
{{ __('Approved by') }}
{{ $sigApproved['name'] }}
{{ $sigApproved['designation'] }}
{{ __('Approved on') }} {{ $fmtSigDate($planPrintSignatureDates['approved'] ?? null) }}
@endsection @push('preview-scripts') @include('plan.print.partials.filters-script') @endpush