@php /** @var \App\Models\PC\MwsMeeting $meeting */ $state = is_array($noticeLetterState ?? null) ? $noticeLetterState : []; $agendaByDepartment = $agendaByDepartment ?? collect(); $mt = trim((string) ($meeting->meeting_type ?? '')); $noticeParty = match (\Illuminate\Support\Str::lower($mt)) { 'pdwp' => 'Provincial Development Working Party (PDWP)', 'pre-pdwp' => 'Pre-Provincial Development Working Party (PRE-PDWP)', 'ddwp' => 'Departmental Development Working Party (DDWP)', default => $mt !== '' ? $mt : '', }; $dateStr = $meeting->meeting_date?->format('Y-m-d') ?? date('Y-m-d'); $timePart = \Illuminate\Support\Str::substr((string) $meeting->start_time, 0, 5); try { $noticeWhen = \Carbon\Carbon::parse($dateStr.' '.$timePart.':00'); } catch (\Throwable) { $noticeWhen = \Carbon\Carbon::parse($dateStr.' 10:00:00'); } $noticeDate = $noticeWhen->format('F j, Y'); $noticeTime = $noticeWhen->format('g:iA'); $noticeWeekday = $noticeWhen->format('l'); $loc = trim((string) ($meeting->location ?? '')); $noticeLocation = $loc !== '' ? $loc : 'Committee Room of Planning & Development Department, Govt. of Sindh, Karachi'; $agendaTypeBanner = match (\Illuminate\Support\Str::lower($mt)) { 'pdwp' => 'PDWP', 'pre-pdwp' => 'PRE-PDWP', 'ddwp' => 'DDWP', default => $mt !== '' ? mb_strtoupper($mt, 'UTF-8') : 'PDWP', }; $agendaDateBanner = mb_strtoupper($noticeWhen->format('l F j, Y'), 'UTF-8'); $agendaTimeBanner = $noticeWhen->format('g:i A'); $agendaLocationBanner = mb_strtoupper($noticeLocation, 'UTF-8'); $letterIsPdwp = \Illuminate\Support\Str::lower($mt) === 'pdwp'; $showPrePdwpCol = in_array(\Illuminate\Support\Str::lower($mt), ['pdwp', 'pre-pdwp'], true); $agendaDepartmentTimesPdf = []; if (! empty($state['agenda_department_times']) && is_array($state['agenda_department_times'])) { foreach ($state['agenda_department_times'] as $__k => $__v) { $__dk = mws_notice_decode_plain(trim((string) $__k)); $agendaDepartmentTimesPdf[$__dk] = trim((string) $__v); } } $mwsNlPdfDeptBannerTimeCell = static function (string $deptName) use ($agendaDepartmentTimesPdf): string { $key = mws_notice_decode_plain(trim($deptName)); $raw = $agendaDepartmentTimesPdf[$key] ?? ''; if ($raw === '' || ! preg_match('/^([01]\d|2[0-3]):[0-5]\d$/', $raw)) { return '—'; } try { return \Carbon\Carbon::createFromFormat('H:i', $raw)->format('g:i A'); } catch (\Throwable) { return $raw; } }; $agendaBreakTimesPdf = []; if (! empty($state['break_times']) && is_array($state['break_times'])) { foreach ($state['break_times'] as $__bid => $__btv) { $idRaw = trim(str_replace("\0", '', (string) $__bid)); if ($idRaw === '' || ! ctype_digit($idRaw)) { continue; } $id = (int) $idRaw; if ($id <= 0) { continue; } $t = trim((string) $__btv); if ($t === '' || ! preg_match('/^([01]\d|2[0-3]):[0-5]\d$/', $t)) { continue; } $agendaBreakTimesPdf[(string) $id] = $t; } } $noticeDgBlocks = []; $subjectPlain = mws_notice_decode_plain(trim((string) ($state['subject_line'] ?? ''))); if ($subjectPlain === '') { $subjectPlain = mb_strtoupper(mws_notice_decode_plain(trim((string) ($meeting->title ?? ''))), 'UTF-8') ?: '—'; } $headerDeptRaw = mws_notice_decode_plain(trim((string) ($state['header_dept_text'] ?? ''))); $headerSplit = $headerDeptRaw !== '' ? preg_split("/\r\n|\r|\n/", $headerDeptRaw) : false; $headerDeptLines = $headerDeptRaw !== '' && is_array($headerSplit) ? array_values(array_filter(array_map(static fn ($ln) => mws_notice_decode_plain(trim((string) $ln)), $headerSplit), static fn ($ln) => $ln !== '')) : ['PLANNING & DEVELOPMENT DEPARTMENT', 'GOVERNMENT OF SINDH', '(DEVELOPMENT SECTION)']; $recipientCityLinePdf = mws_notice_decode_plain(trim((string) ($state['recipient_city_line'] ?? ''))); if ($recipientCityLinePdf === '') { $recipientCityLinePdf = 'Karachi.'; } $bodyLeadInner = mws_notice_decode_inline_html(trim((string) ($state['body_lead_html'] ?? ''))); if ($bodyLeadInner === '' && empty($mwsIsGeneralMeetingNotice)) { $bodyLeadInner = 'I am directed to refer to the subject captioned above and to enclose herewith agenda notice of meeting of the '.e($noticeParty).' is scheduled to be held on '.e($noticeDate).' at '.e($noticeTime).' ('.e($noticeWeekday).') in '.e($noticeLocation).'. The Chairman, Planning & Development Board, Sindh, will Chair the meeting as per the following agenda.'; } $bodyNumRowsPdf = []; if (! empty($state['body_num_rows']) && is_array($state['body_num_rows'])) { foreach ($state['body_num_rows'] as $row) { if (! is_array($row)) { continue; } $num = mws_notice_decode_plain(trim((string) ($row['num'] ?? ''))); $itemHtml = mws_notice_decode_inline_html(trim((string) ($row['item_html'] ?? ''))); if ($num === '' || $itemHtml === '') { continue; } $pClass = ($row['p_class'] ?? '') === 'notice-body-para2' ? 'notice-body-para2' : ''; $itemClass = trim((string) preg_replace('/[^a-zA-Z\s]/', '', (string) ($row['item_class'] ?? ''))); $bodyNumRowsPdf[] = ['num' => $num, 'item_html' => $itemHtml, 'p_class' => $pClass, 'item_class' => $itemClass]; } } if (count($bodyNumRowsPdf) === 0 && empty($mwsIsGeneralMeetingNotice)) { $bodyNumRowsPdf = [ ['num' => '2.', 'item_html' => 'I am further directed to inform that outstation participants can join meeting via zoom link will be shared on whatsapp and optional online or physical for close proximity of Karachi city participants. Moreover presence of concerned Secretary accompanied with only one well versed officer of Sponsoring / Executing Agency is mandatory. Failing to comply, the agenda item will not be considered/entertained.', 'p_class' => 'notice-body-para2', 'item_class' => 'bold italic'], ['num' => '3.', 'item_html' => 'It is, therefore, requested to kindly make it convenient to attend the meeting.', 'p_class' => '', 'item_class' => ''], ]; } $bodyHtml = '

'.$bodyLeadInner.'

'; foreach ($bodyNumRowsPdf as $br) { $pExtra = trim((string) ($br['p_class'] ?? '')); $pClasses = 'notice-body-num-row'.($pExtra !== '' ? ' '.$pExtra : ''); $ic = trim((string) ($br['item_class'] ?? '')); $itemClasses = 'notice-body-item-text'.($ic !== '' ? ' '.$ic : ''); $bodyHtml .= '

'.e((string) $br['num']).''.$br['item_html'].'

'; } $noticeSignersListPdf = $noticeSignersListPdf ?? []; $noticeSignersStackAPdf = []; $noticeSignersStackBPdf = []; foreach ($noticeSignersListPdf as $idx => $row) { if ($idx % 2 === 0) { $noticeSignersStackAPdf[] = $row; } else { $noticeSignersStackBPdf[] = $row; } } // AA letter pattern: when only the primary (odd) stack has a signer, mirror it below CC. if ($noticeSignersStackBPdf === [] && $noticeSignersStackAPdf !== []) { $noticeSignersStackBPdf = $noticeSignersStackAPdf; } $noticeCopyForwardRecipients = []; $noticeMeetingForwardListSentences = array_values(array_filter(array_map( static fn ($s) => mws_notice_decode_plain(trim((string) $s)), $state['copy_forward'] ?? [] ), static fn ($s) => $s !== '')); $noticeCcListSentences = array_values(array_filter(array_map( static fn ($s) => mws_notice_decode_plain(trim((string) $s)), $state['cc_items'] ?? [] ), static fn ($s) => $s !== '')); @endphp {{-- Letter sheet: table-based; layout matches meeting/meeting-notice-dompdf.blade.php --}}
{{-- Header: logo | title | reference (logo cell styling scoped to this table only) --}}
{{ $noticeBannerTitle ?? 'PDWP MEETING NOTICE' }}
{{ $noticeReferenceNo ?? 'No.' }}
@foreach ($headerDeptLines as $deptLine)
{{ $deptLine }}
@endforeach
{{ $datedLine ?? '' }}
{{-- Recipients --}}
@php $__mwsNlNoticeQrCodesPdf = array_values(array_slice($noticeSchemeQrCodes ?? [], 0, 1)); @endphp @if ($__mwsNlNoticeQrCodesPdf !== []) @endif
To,
@php $__pdfTo = is_array($state['to_recipients'] ?? null) ? $state['to_recipients'] : []; $__pdfToPairs = array_chunk($__pdfTo, 2); @endphp @forelse ($__pdfToPairs as $__pdfPair) @foreach ($__pdfPair as $__pdfRec) @endforeach @if (count($__pdfPair) === 1) @endif @empty @endforelse
{{ mws_notice_decode_plain((string) ($__pdfRec['designation'] ?? '')) }}
@if (trim((string) ($__pdfRec['department'] ?? '')) !== '')
{{ mws_notice_decode_plain((string) $__pdfRec['department']) }}
@endif @if (trim((string) ($__pdfRec['location'] ?? '')) !== '')
{{ mws_notice_decode_plain((string) $__pdfRec['location']) }}
@endif
@foreach ($__mwsNlNoticeQrCodesPdf as $qr) @endforeach
@if (! empty($noticeDgBlocks))
@foreach (array_chunk($noticeDgBlocks, 2) as $dgPair) @foreach ($dgPair as $index => $dgBlock) @endforeach @if (count($dgPair) === 1) @endif @endforeach
{!! $dgBlock['title_html'] ?? '' !!}
@php $_dgSubs = array_values(array_filter(array_map(fn ($s) => trim((string) $s), $dgBlock['sublines'] ?? []))); @endphp @if (count($_dgSubs)) {{ implode(', ', $_dgSubs) }}
@endif {!! $dgBlock['location_html'] ?? e('Karachi.') !!}
@endif {{-- Subject + body: one grid — text column aligns with subject value; numbered paras use label column --}}
Subject:
{{ $subjectPlain }}
{!! $bodyHtml !!}
{{-- Row1: Encl + odd sigs; Row2: full-width CC; Row3: even sigs right-aligned after CC --}} @if (count($noticeSignersStackAPdf) > 0) @endif @if (count($noticeSignersStackBPdf) > 0) @endif
Encl: As above
@foreach ($noticeSignersStackAPdf as $sigRow) @endforeach
@php $sigSrc = !empty($sigRow['signature_pdf_src']) ? $sigRow['signature_pdf_src'] : ($sigRow['signature_url'] ?? ''); @endphp @if (!empty($sigSrc)) @else
@endif @if (!empty($sigRow['name']))
({{ mb_strtoupper($sigRow['name'], 'UTF-8') }})
@endif @if (!empty($sigRow['designation']))
{{ mb_strtoupper($sigRow['designation'], 'UTF-8') }}
@endif
@if (! empty($noticeCopyForwardRecipients))
A copy is forwarded to @foreach ($noticeCopyForwardRecipients as $i => $r)@if ($i > 0), @endif{{ $r }}@endforeach, with a request to attend meeting.
@endif
A copy is forwarded with a request to attend the meeting, to:
@if (! empty($noticeMeetingForwardListSentences)) @foreach ($noticeMeetingForwardListSentences as $mfLine) @endforeach
{{ $mfLine }}
@endif
CC:-
@if (! empty($noticeCcListSentences)) @foreach ($noticeCcListSentences as $ccLine) @endforeach
{{ $ccLine }}
@endif
@foreach ($noticeSignersStackBPdf as $sigRow) @endforeach
@php $sigSrc = !empty($sigRow['signature_pdf_src']) ? $sigRow['signature_pdf_src'] : ($sigRow['signature_url'] ?? ''); @endphp @if (!empty($sigSrc)) @else
@endif @if (!empty($sigRow['name']))
({{ mb_strtoupper($sigRow['name'], 'UTF-8') }})
@endif @if (!empty($sigRow['designation']))
{{ mb_strtoupper($sigRow['designation'], 'UTF-8') }}
@endif
@if ($agendaByDepartment->isNotEmpty())
{{ $agendaTypeBanner }} meeting on {{ $agendaDateBanner }}
AT {{ $agendaTimeBanner }} IN THE {{ $agendaLocationBanner }}
@if ($showPrePdwpCol) @endif @if ($showPrePdwpCol) @else @endif @php $noticeAgendaStripeN = 0; @endphp @foreach ($agendaByDepartment as $deptName => $deptRows) @if ($showPrePdwpCol) @endif @php $__pdfFr = $deptRows->first(); $__pdfBreakId = isset($__pdfFr['department_id']) && $__pdfFr['department_id'] !== null ? (int) $__pdfFr['department_id'] : 0; $__pdfBreakRaw = $__pdfBreakId > 0 ? ($agendaBreakTimesPdf[(string) $__pdfBreakId] ?? '') : ''; $__pdfBreakView = ''; if ($__pdfBreakRaw !== '' && preg_match('/^([01]\d|2[0-3]):[0-5]\d$/', $__pdfBreakRaw)) { try { $__pdfBreakView = \Carbon\Carbon::createFromFormat('H:i', $__pdfBreakRaw)->format('g:i A'); } catch (\Throwable) { $__pdfBreakView = $__pdfBreakRaw; } } @endphp @if ($__pdfBreakView !== '') @if ($showPrePdwpCol) @endif @endif @foreach ($deptRows as $row) @php $noticeAgendaStripeN++; $stripeBg = ($noticeAgendaStripeN % 2 === 1) ? '#ffffff' : '#f3f3f3'; @endphp @if ($showPrePdwpCol) @endif @endforeach @endforeach @php $noticeAgendaStripeN++; $footerStripe = ($noticeAgendaStripeN % 2 === 1) ? '#ffffff' : '#f3f3f3'; @endphp @if ($showPrePdwpCol) @endif
S/Item.# ADP# Department /
Name of Scheme
Estimated
Cost
PRE-PDWP
Date
Time
1 2 3 45 65
{{ mb_strtoupper((string) $deptName, 'UTF-8') }} {{ $mwsNlPdfDeptBannerTimeCell((string) $deptName) }}
Break Time {{ $__pdfBreakView }}
{{ (int) ($row['serial'] ?? 0) }} {{ $row['adp_display'] ?? '' }} {{ $row['scheme'] ?? '' }} {{ $row['cost'] ?? '' }}{{ $letterIsPdwp ? ($row['pre_pdwp_date'] ?? '') : '—' }}
Any other agenda item(s) will be added with the permission of chair.
@if($meeting->status === \App\MeetingWorkspace\MeetingLifecycleStatus::Draft) @endif
@endif