@php
/**
* Pre-PDWP Working Paper Form (Word-like).
* Expects: $data (array)
*/
$data = \App\Support\WorkingPaperRichTextHtml::decodePayloadStrings(is_array($data ?? null) ? $data : []);
$v = function (string $key, $default = '') use ($data) {
$raw = data_get($data ?? [], $key, $default);
if (is_string($raw)) {
return \App\Support\HtmlDisplay::decodeEntities($raw, 8);
}
if (is_array($raw)) {
return \App\Support\WorkingPaperRichTextHtml::decodePayloadStrings($raw);
}
return $raw;
};
$m = function (string $key) use ($data): string {
$raw = data_get($data ?? [], $key, '');
if ($raw === null || $raw === '') {
return '';
}
return \App\Helpers\PC\AmountMillionHelper::amountToMillion($raw);
};
$pcLinkedKeys = is_array($pcLinkedKeys ?? null) ? $pcLinkedKeys : [];
$ro = function (string $key) use ($pcLinkedKeys): string {
return in_array($key, $pcLinkedKeys, true) ? 'readonly' : '';
};
$rbmRows = data_get($data ?? [], 'rbm', []);
$rbmCount = max(1, is_array($rbmRows) ? count($rbmRows) : 0);
$phys = is_array($v('schedule.physical', [])) ? $v('schedule.physical', []) : [];
$fin = is_array($v('schedule.financial', [])) ? $v('schedule.financial', []) : [];
$physCount = max(1, count($phys));
$finCount = max(1, count($fin));
// Section 17 (Revised Project) - support new structure (revised.items[*]) with fallback to older (revised.compare[*])
$revItems = data_get($data ?? [], 'revised.items', null);
if (!is_array($revItems)) {
$legacy = is_array($v('revised.compare', [])) ? $v('revised.compare', []) : [];
$revItems = [];
foreach ($legacy as $row) {
$revItems[] = [
'compare' => is_array($row) ? $row : [],
'reasons' => '',
'expenditure' => '',
];
}
}
$revItems = is_array($revItems) ? $revItems : [];
$revItemsCount = max(1, count($revItems));
$revProg = is_array($v('revised.progress', [])) ? $v('revised.progress', []) : [];
$revProgCount = max(1, count($revProg));
$veh = is_array($v('vehicles', [])) ? $v('vehicles', []) : [];
$vehCount = max(1, count($veh));
$fac = is_array($v('facilities', [])) ? $v('facilities', []) : [];
$facCount = max(1, count($fac));
$assets = is_array($v('assets', [])) ? $v('assets', []) : [];
$assetsCount = max(1, count($assets));
$ta = is_array($v('tech_appraisal', [])) ? $v('tech_appraisal', []) : [];
$taCount = max(1, count($ta));
$cFin = is_array($v('comments.financial', [])) ? $v('comments.financial', []) : [];
$cSoc = is_array($v('comments.social', [])) ? $v('comments.social', []) : [];
$cEnv = is_array($v('comments.environmental', [])) ? $v('comments.environmental', []) : [];
$cRes = is_array($v('comments.results', [])) ? $v('comments.results', []) : [];
$cOther = is_array($v('comments.other', [])) ? $v('comments.other', []) : [];
$cRisk = is_array($v('comments.risks', [])) ? $v('comments.risks', []) : [];
$cFinN = max(1, count($cFin));
$cSocN = max(1, count($cSoc));
$cEnvN = max(1, count($cEnv));
$cResN = max(1, count($cRes));
$cOtherN = max(1, count($cOther));
$cRiskN = max(1, count($cRisk));
$ce = is_array($ceProjectCostBreakdown ?? null) ? $ceProjectCostBreakdown : [];
$ceHasCostBreakdown = ! empty($ce['has_lines']);
@endphp
@push('stylesheets')
@endpush
GOVERNMENT OF SINDH
PLANNING AND DEVELOPMENT DEPARTMENT
WORKING PAPER FOR PRE-PDWP
@include('working-papers.partials.scheme-meta-header', [
'v' => $v,
'inputClass' => 'prepwp-input',
'textareaClass' => 'prepwp-textarea',
'fontSize' => '14px',
])
{{-- RBM table --}}
{{-- 14 Breakdown of the Project Cost --}}
{{-- 15 Physical and Financial Scheduling --}}
{{-- 16 feasibility study status --}}
{{-- 17 revised project (note) --}}
{{-- 17 (i)-(iii) revised project details (match screenshot) --}}
{{-- 18-24 --}}
{{-- 25 technical appraisal --}}
{{-- PART C --}}
@include('working-papers.partials.comments-inline', ['variant' => 'pre-pdwp'])
@include('working-papers.partials.attachments', ['variant' => 'pre-pdwp'])
@push('scripts')
@endpush