@extends('layouts.app') @php $dec = static fn ($v): string => mws_notice_decode_plain((string) ($v ?? '')); $decHtml = static fn ($v): string => mws_notice_decode_inline_html((string) ($v ?? '')); $formVal = static fn ($v): string => mws_notice_form_value((string) ($v ?? '')); $formValHtml = static fn ($v): string => mws_notice_decode_inline_html((string) ($v ?? '')); $schemeLabel = trim($dec($letter['scheme_name'] ?? '')); if ($schemeLabel === '') { $schemeLabel = 'PC Form #'.(int) ($pcForm->id ?? 0); } $sigCode = (string) ($letter['sig_code'] ?? 'DEV-V'); $bodyParagraphs = $letter['body_paragraphs'] ?? []; if (! is_array($bodyParagraphs) || $bodyParagraphs === []) { $bodyParagraphs = [ 'The Secretary to Government of Sindh may kindly refer to the department\'s letters on the subject noted above.', ]; } $ccLines = $letter['cc_lines'] ?? []; $editBodyParagraphs = $editDefaults['body_paragraphs'] ?? $bodyParagraphs; if (! is_array($editBodyParagraphs)) { $editBodyParagraphs = $bodyParagraphs; } $schemeRows = is_array($letter['scheme_rows'] ?? null) ? $letter['scheme_rows'] : []; $editSchemeRows = $editDefaults['scheme_rows'] ?? null; if (! is_array($editSchemeRows) || $editSchemeRows === []) { $editSchemeRows = []; foreach ($schemeRows as $row) { if (! is_array($row)) { continue; } $editSchemeRows[] = [ 'adp_no' => (string) ($row['adp_no'] ?? ''), 'name' => (string) ($row['name'] ?? ''), 'cost' => (string) ($row['cost'] ?? ''), ]; } } $sigState = is_array($letterSignature ?? null) ? $letterSignature : []; $sigEffective = trim((string) ($sigState['effective_url'] ?? ($letter['letter_signature_url'] ?? ''))); $sigDrawn = trim((string) ($sigState['drawn_url'] ?? '')); $sigUploaded = trim((string) ($sigState['uploaded_url'] ?? '')); $canEditSignature = ! empty($canEdit) && ! empty($canEditSignature ?? $canEdit); $aaBackLabel = str_contains((string) ($returnUrl ?? ''), 'meeting-workspace') ? '← Back to workspace' : '← Back to PC Forms'; $aaBodyParaHtml = static function ($para) use ($decHtml): string { $raw = preg_replace('/^[ \t\r\n]+|[ \t\r\n]+$/u', '', $decHtml($para)) ?? ''; if ($raw === '') { return ''; } $raw = str_replace(["\t", "\u{00A0}"], [str_repeat(' ', 4), ' '], $raw); if (preg_match('/<[a-z][\s\S]*>/i', $raw) || str_contains($raw, ' ')) { return nl2br($raw, false); } return nl2br(e($raw)); }; $adminDept = trim($dec($letter['admin_department'] ?? 'Administrative Department')); @endphp @section('title', 'Authentication of AA — '.$schemeLabel) @push('styles') @endpush @section('contents')
{{ $aaBackLabel }} @if ($canEdit) @endif
@if ($canEdit)

Forwarding saves Authentication of AA and notifies the Administrative Department for this scheme.

@endif
Government of Sindh
{{ $dec($letter['reference_no'] ?? '') }}
GOVERNMENT OF SINDH
{{ $dec($letter['department_upper'] ?? 'FINANCE DEPARTMENT') }}
Karachi, dated the {{ $dec($letter['letter_date_long'] ?? '') }}
To,
The Secretary to Govt. of Sindh,
{{ $dec($adminDept) }}
Karachi.
SUBJECT:
{{ $dec($letter['subject'] ?? 'ADMINISTRATIVE APPROVAL.') }}
@if ($canEdit) @endif
@foreach ($bodyParagraphs as $idx => $para)

{!! $aaBodyParaHtml($para) !!}

@if ($canEdit) @endif
@endforeach
@if ($canEdit) @endif
@if ($canEdit) @endif @forelse ($schemeRows as $idx => $row) @php $editRow = is_array($editSchemeRows[$idx] ?? null) ? $editSchemeRows[$idx] : [ 'adp_no' => (string) ($row['adp_no'] ?? ''), 'name' => (string) ($row['name'] ?? ''), 'cost' => (string) ($row['cost'] ?? ''), ]; $adpVal = (string) ($editRow['adp_no'] ?? ($row['adp_no'] ?? '')); $nameVal = (string) ($editRow['name'] ?? ($row['name'] ?? '')); $costVal = (string) ($editRow['cost'] ?? ($row['cost'] ?? '')); @endphp @if ($canEdit) @endif @empty @unless ($canEdit) @endunless @endforelse @if ($canEdit) @endif
Sr. No. ADP No. Name of Scheme Approved Cost Total
{{ (int) ($row['sr'] ?? ($idx + 1)) }} {{ $dec($row['adp_no'] ?? '—') }} @if ($canEdit) @endif {{ $dec($row['name'] ?? '') }} @if ($canEdit) @endif {{ $dec($row['cost'] ?? '—') }} @if ($canEdit) @endif {{ $dec($row['cost'] ?? '—') }}
No schemes
Total {{ $dec($letter['total_cost'] ?? '—') }} {{ $dec($letter['total_cost'] ?? '—') }}
@if ($canEdit) @endif
Encls: As above.
@if ($sigEffective !== '')
@else @endif
@if ($canEditSignature) @endif @php $signerName = trim((string) ($letter['signer_name'] ?? '')); @endphp @if ($signerName !== '')
({{ $dec($signerName) }})
@endif
SECTION OFFICER ({{ $dec($sigCode) }})
FOR SECRETARY TO GOVERNMENT OF SINDH
{{ $dec($letter['cc_reference_line'] ?? '') }}
A copy for information is forwarded to: -
    @foreach ($ccLines as $ccLine)
  1. {{ $dec($ccLine) }}
  2. @endforeach
@if ($canEdit) @endif
@endsection @push('styles_after_adminlte') @endpush @push('scripts') @endpush