@extends('layouts.app') @section('title', 'Minutes of Meeting — ' . \Illuminate\Support\Str::limit((string) ($meeting->title ?? ''), 80, '…')) @push('stylesheets') @if (! empty($momShowAttendedParticipantsPicker) || ! empty($momShowCoSignerPicker) || ! empty($momShowCoSignerSignatureSection) || ! empty($momShowCoSignerForwardSection) || ! empty($momShowOtherParticipantsEditor)) @endif @endpush @section('contents') @php $momLockedAfterSave = filter_var($momLockedAfterSave ?? false, FILTER_VALIDATE_BOOLEAN); $momFieldsReadOnly = filter_var($momFieldsReadOnly ?? true, FILTER_VALIDATE_BOOLEAN); $momRichTextHasContent = static function (?string $html): bool { if ($html === null || trim((string) $html) === '') { return false; } if (preg_match('/ 0 ? 'project_concept_note_id='.$pcnId : ($pcFormId > 0 ? 'pc_form_id='.$pcFormId : ''); } $schemeMomModel = $schemeMom ?? null; $momDeliberationsHtml = old('mom', $schemeMomModel instanceof \App\Models\PC\MwsMeetingSchemeMom ? ($schemeMomModel->mom ?? '') : ($meeting->mom ?? '')); $momUnwrapRootOlToParagraphs = static function (?string $html): string { $html = trim((string) $html); if ($html === '' || ! preg_match('/^\s*]*>(.*)<\/ol>(?:\s*(?:

\s*(?:)?\s*<\/p>|))*\s*$/is', $html, $m)) { return $html; } if (! preg_match_all('/]*>(.*?)<\/li>/is', $m[1], $lis) || $lis[1] === []) { return $html; } $out = ''; foreach ($lis[1] as $inner) { $inner = trim((string) $inner); if ($inner === '' || preg_match('/^$/i', $inner)) { $out .= '


'; continue; } $out .= preg_match('/^\s*'.$inner.'

'; } return $out !== '' ? $out : $html; }; $momDeliberationsHtml = $momUnwrapRootOlToParagraphs($momDeliberationsHtml); $momDecisionsHtml = old('mom_decisions', $schemeMomModel instanceof \App\Models\PC\MwsMeetingSchemeMom ? ($schemeMomModel->mom_decisions ?? '') : ($meeting->mom_decisions ?? '')); $momTranscriptionValue = old('mom_transcription', $schemeMomModel instanceof \App\Models\PC\MwsMeetingSchemeMom ? ($schemeMomModel->mom_transcription ?? '') : ($meeting->mom_transcription ?? '')); $momDeliberationsHasContent = $momRichTextHasContent($momDeliberationsHtml); $momDecisionsHasContent = $momRichTextHasContent($momDecisionsHtml); $momDecisionsUseNestedScheme = ! $momDecisionsHasContent || \App\Support\MwsMomGovtPreviewHtml::usesNestedDecisionScheme($momDecisionsHtml); $momShowCoSignerPicker = filter_var($momShowCoSignerPicker ?? false, FILTER_VALIDATE_BOOLEAN); $momExpectedCoSignerCount = (int) ($momExpectedCoSignerCount ?? 0); // max 0 = no upper limit (see MwsMeeting::momCoSignerPickBounds); do not clamp 0 up to min. $momExpectedCoSignerMaxCount = (int) ($momExpectedCoSignerMaxCount ?? 0); if ($momExpectedCoSignerMaxCount > 0 && $momExpectedCoSignerMaxCount < $momExpectedCoSignerCount) { $momExpectedCoSignerMaxCount = $momExpectedCoSignerCount; } $momParticipantSignerOptions = is_array($momParticipantSignerOptions ?? null) ? $momParticipantSignerOptions : []; $momSelectedCoSignerUserIds = is_array($momSelectedCoSignerUserIds ?? null) ? array_map('intval', $momSelectedCoSignerUserIds) : []; $momShowCoSignerSignatureSection = filter_var($momShowCoSignerSignatureSection ?? false, FILTER_VALIDATE_BOOLEAN); $momShowCoSignerForwardSection = filter_var($momShowCoSignerForwardSection ?? false, FILTER_VALIDATE_BOOLEAN); $momCoSignerInteractive = $momShowCoSignerSignatureSection || $momShowCoSignerForwardSection; $momCoSignerSignature = is_array($momCoSignerSignature ?? null) ? $momCoSignerSignature : []; $momCoSignerSignUrl = $momCoSignerSignUrl ?? ''; $momSigRequired = $schemeMomModel instanceof \App\Models\PC\MwsMeetingSchemeMom ? ($schemeMomModel->effectiveMomSignatureCounts()['required'] ?? 0) : (int) ($meeting->required_count_signature ?? 0); $momSigApproved = $schemeMomModel instanceof \App\Models\PC\MwsMeetingSchemeMom ? ($schemeMomModel->effectiveMomSignatureCounts()['approved'] ?? 0) : (int) ($meeting->approve_count_signature ?? 0); $momPreviewUrl = $momPreviewUrl ?? route('meeting-workspace.meetings.mom.preview', $meeting).($momSubjectQuery !== '' ? '?'.$momSubjectQuery : ''); $schemeTitleDisplay = trim((string) ($schemeTitle ?? '')); $momHistoryDisplayRows = is_array($momHistoryDisplayRows ?? null) ? $momHistoryDisplayRows : []; $momVersionDisplayRows = is_array($momVersionDisplayRows ?? null) ? $momVersionDisplayRows : []; $momCoSignerChainDisplayRows = is_array($momCoSignerChainDisplayRows ?? null) ? $momCoSignerChainDisplayRows : []; if ($momCoSignerChainDisplayRows !== []) { $momSigApproved = count(array_filter( $momCoSignerChainDisplayRows, static fn (array $row): bool => ($row['status'] ?? '') === 'signed' )); $momSigRequired = count($momCoSignerChainDisplayRows); } $momPostSaveEditable = filter_var($momPostSaveEditable ?? false, FILTER_VALIDATE_BOOLEAN); $momReturnedToPrimary = filter_var($momReturnedToPrimary ?? false, FILTER_VALIDATE_BOOLEAN); $momPrimaryMayReviseReturned = filter_var($momPrimaryMayReviseReturned ?? false, FILTER_VALIDATE_BOOLEAN); $momAllParticipantOptions = is_array($momAllParticipantOptions ?? null) ? $momAllParticipantOptions : []; $momSelectedAttendedParticipantIds = is_array($momSelectedAttendedParticipantIds ?? null) ? array_map('intval', $momSelectedAttendedParticipantIds) : []; $momAttendedParticipantsDisplay = is_array($momAttendedParticipantsDisplay ?? null) ? $momAttendedParticipantsDisplay : []; $momAttendedParticipantLayout = is_array($momAttendedParticipantLayout ?? null) ? $momAttendedParticipantLayout : []; $momShowAttendedParticipantsPicker = filter_var($momShowAttendedParticipantsPicker ?? false, FILTER_VALIDATE_BOOLEAN); $momShowInChairPicker = filter_var($momShowInChairPicker ?? false, FILTER_VALIDATE_BOOLEAN); $momShowInChairReadonly = filter_var($momShowInChairReadonly ?? false, FILTER_VALIDATE_BOOLEAN); $momInChairOptions = is_array($momInChairOptions ?? null) ? $momInChairOptions : []; $momSelectedInChairUserId = (int) ($momSelectedInChairUserId ?? 0); $momInChairSelectedName = (string) ($momInChairSelectedName ?? ''); $momLetterheadSectionOptions = is_array($momLetterheadSectionOptions ?? null) ? $momLetterheadSectionOptions : []; $momSelectedLetterheadSectionId = (int) ($momSelectedLetterheadSectionId ?? 0); $momShowLetterheadSectionPicker = filter_var($momShowLetterheadSectionPicker ?? false, FILTER_VALIDATE_BOOLEAN); $momShowLetterheadSectionReadonly = filter_var($momShowLetterheadSectionReadonly ?? false, FILTER_VALIDATE_BOOLEAN); $momLetterheadSectionSelectedName = (string) ($momLetterheadSectionSelectedName ?? ''); $momShowAttendedParticipantsReadonly = filter_var($momShowAttendedParticipantsReadonly ?? false, FILTER_VALIDATE_BOOLEAN); $momOtherParticipants = is_array($momOtherParticipants ?? null) ? $momOtherParticipants : []; $momShowOtherParticipantsEditor = filter_var($momShowOtherParticipantsEditor ?? false, FILTER_VALIDATE_BOOLEAN); $momShowOtherParticipantsReadonly = filter_var($momShowOtherParticipantsReadonly ?? false, FILTER_VALIDATE_BOOLEAN); $momOtherParticipantDepartmentOptions = is_array($momOtherParticipantDepartmentOptions ?? null) ? array_values(array_filter(array_map('strval', $momOtherParticipantDepartmentOptions), static fn ($v) => trim($v) !== '')) : []; $momOtherParticipantDesignationOptions = is_array($momOtherParticipantDesignationOptions ?? null) ? array_values(array_filter(array_map('strval', $momOtherParticipantDesignationOptions), static fn ($v) => trim($v) !== '')) : []; $mwsMomOtherSelectOptionsHtml = static function (array $options, string $selected): string { $selected = trim($selected); $html = ''; $matched = false; foreach ($options as $opt) { $opt = trim((string) $opt); if ($opt === '') { continue; } $isSel = $selected !== '' && strcasecmp($opt, $selected) === 0; if ($isSel) { $matched = true; } $html .= ''; } if ($selected !== '' && ! $matched) { $html .= ''; } return $html; }; $momWorkingPaperAttached = filter_var($momWorkingPaperAttached ?? false, FILTER_VALIDATE_BOOLEAN); $momShowWorkingPaperAttachedCheckbox = filter_var($momShowWorkingPaperAttachedCheckbox ?? false, FILTER_VALIDATE_BOOLEAN); $mwsMomMayPersist = ($canEdit && ! $momLockedAfterSave) || $momPostSaveEditable || $momPrimaryMayReviseReturned; // Keep existing workflow: co-signatory Sign/Forward/Return has no extra Save button. $mwsMomShowSaveButton = $mwsMomMayPersist && ! $momCoSignerInteractive; $mwsMomShowDraftPreviewButton = $mwsMomShowSaveButton || $momCoSignerInteractive; @endphp
Back to meeting @if ($mwsMomShowDraftPreviewButton) @elseif ($momFieldsReadOnly) Preview / Print @endif

{{ $momFieldsReadOnly ? 'View Minutes of Meeting' : 'Minutes of Meeting' }}

{{ $meeting->title }}

@if ($schemeTitleDisplay !== '')

{{ $schemeTitleDisplay }}

@endif
@if ($momReturnedToPrimary && $momPrimaryMayReviseReturned)
A co-signatory returned these minutes for revision. Update the content below and resubmit to restart the co-signatory approval chain.
@elseif ($momReturnedToPrimary)
These minutes were returned to the MoM generator for revision.
@endif
@if ($mwsMomMayPersist) @csrf @if (! empty($momIsRegenerate)) @endif @if ($pcFormId > 0) @elseif ($pcnId > 0) @endif @endif
Transcription
@if ($canEdit && ! $momLockedAfterSave)
@endif
@php $momSchemeCostRows = is_array($momSchemeCostRows ?? null) ? $momSchemeCostRows : []; $momSchemeCostsIsPcn = (int) ($pcnId ?? 0) > 0; $isGeneralMom = ! empty($isGeneralMom); if ($momSchemeCostRows === [] && ! $momFieldsReadOnly && ! $isGeneralMom) { $momSchemeCostRows = [ ['key' => 'approved', 'label' => 'Approved Cost', 'amount' => '', 'date' => null], ]; } @endphp @if (! $isGeneralMom && ($momSchemeCostRows !== [] || ! $momFieldsReadOnly))
Scheme Costs (Approved / Revised)

@if ($momSchemeCostsIsPcn) Prefilled from Core. Edit amounts/dates as needed for this MoM. Considered Cost on preview comes from PCN section 5 Total Estimated Cost (PKR Million) and is not listed here. @else Prefilled from Core. Edit amounts/dates as needed for this MoM. Considered Cost is calculated for preview from the current PC and is not listed here. @endif

@if (! $momFieldsReadOnly) @endif @foreach ($momSchemeCostRows as $costIdx => $costRow) @php $costKey = (string) ($costRow['key'] ?? ''); $isRevisedCostRow = str_starts_with(strtolower($costKey), 'revised'); $costDateHtml = (string) ($costRow['date'] ?? ''); @endphp @if (! $momFieldsReadOnly) @endif @endforeach
Cost Amount (million) Date
{{ $costRow['label'] ?? '—' }} @if ($isRevisedCostRow) @endif
@if (! $momFieldsReadOnly) @endif
@endif
Deliberations
@if (! $momFieldsReadOnly || $momDeliberationsHasContent)
@if ($canEdit && ! $momLockedAfterSave)
Deliberations are read-only until you unlock or save.
@endif
@endif
Decisions
@if (! $momFieldsReadOnly) @if (! empty($momDecisionsUseNestedScheme))

Numbered as i, ii, iii. Press Enter for the next item; Indent (or Tab) for sub-points a, b, c. Numbering in the preview matches the editor.

@else

Numbered as i, ii, iii… to match how this MoM was saved. Press Enter for the next item.

@endif @endif @if (! $momFieldsReadOnly || $momDecisionsHasContent)
@endif {{-- Temporarily hidden: restore MOM Versions by uncommenting this block. @if (count($momVersionDisplayRows) > 0)
MOM Versions

Content edits only. Co-signatory sign, forward, and return stay in MOM History.

    @foreach ($momVersionDisplayRows as $versionRow)
  • Version {{ (int) ($versionRow['version_number'] ?? 0) }} @if (! empty($versionRow['is_latest'])) Latest @endif {{ $versionRow['user_name'] ?? 'System' }} @if (! empty($versionRow['created_at'])) ({{ $versionRow['created_at'] }}) @endif
    @if (! empty($versionRow['changed_labels']) && is_array($versionRow['changed_labels']))
    Changed: {{ implode(', ', $versionRow['changed_labels']) }}
    @endif @foreach (($versionRow['changes'] ?? []) as $change)
    {{ $change['label'] ?? 'Field' }}
    Previous: {{ $change['previous'] ?? '—' }}
    Updated: {{ $change['updated'] ?? '—' }}
    @endforeach
  • @endforeach
@endif --}} @if ($momCoSignerInteractive)
Your remarks

Optional remarks with approval. Remarks are required if you return the minutes.

@endif @if ($momShowCoSignerPicker) @php $mwsMomCoSignerSlotCount = 1; @endphp
Minutes of Meeting co-signatories

@if ($momPrimaryMayReviseReturned) Select the first co-signatory again (same or a different user) before resubmitting. After you resubmit, they must sign and forward to the next co-signatory in sequence. @else Select the first co-signatory to receive these minutes. After you save, they must sign and forward to the next co-signatory in sequence. @endif All active users are listed (organizer and yourself are excluded).

@if (count($momParticipantSignerOptions) < $momExpectedCoSignerCount)
There are not enough eligible active user accounts to satisfy the required number of co-signatories (need at least {{ $momExpectedCoSignerCount }}, have {{ count($momParticipantSignerOptions) }}).
@endif
@for ($slot = 1; $slot <= $mwsMomCoSignerSlotCount; $slot++) @php $slotSelectedId = (int) ($momSelectedCoSignerUserIds[$slot - 1] ?? 0); @endphp
@endfor Additional co-signatories are added when each recipient forwards the minutes after signing.
@endif @if ($momShowLetterheadSectionPicker || $momShowLetterheadSectionReadonly)
Letterhead section
@if ($momShowLetterheadSectionPicker)

More than one section shares this scheme’s sector. Pick the section that should appear on the minutes letterhead.

@else

{{ $momLetterheadSectionSelectedName !== '' ? $momLetterheadSectionSelectedName : '—' }}

@endif @endif @if ($momShowInChairPicker || $momShowInChairReadonly)
In Chair
@if ($momShowInChairPicker)

The selected person appears as In Chair in the Minutes participants list.

@else

{{ $momInChairSelectedName !== '' ? $momInChairSelectedName : '—' }}

@endif @endif @if ($momShowAttendedParticipantsPicker || $momShowAttendedParticipantsReadonly)
Meeting attendance
@if ($momShowAttendedParticipantsPicker)

Participants invited when this meeting was created are listed below. Remove anyone who did not attend, or search to add others. Drag rows to reorder them; you can move people between department sections.

@endif
@if ($momShowAttendedParticipantsPicker) @endif @if ($momShowAttendedParticipantsPicker) @endif @if ($momShowAttendedParticipantsReadonly) @forelse ($momAttendedParticipantsDisplay as $attIdx => $attRow) @empty @endforelse @endif
 # Name Designation Phone 
{{ $attIdx + 1 }} {{ display_text($attRow['name']) }} {{ display_text($attRow['role']) }} {{ display_text($attRow['phone'] ?? '—') }}
No participants selected.
@endif @if ($momShowOtherParticipantsEditor || $momShowOtherParticipantsReadonly)
Other Participants
@if ($momShowOtherParticipantsEditor)
@foreach ($momOtherParticipants as $otherIdx => $otherRow) @endforeach
# Name Designation Department Email Phone  
{{ $otherIdx + 1 }}
@else
@foreach ($momOtherParticipants as $otherIdx => $otherRow) @endforeach
# Name Designation Department Email Phone
{{ $otherIdx + 1 }} {{ $otherRow['name'] ?? '—' }} {{ ($otherRow['designation'] ?? '') !== '' ? $otherRow['designation'] : '—' }} {{ ($otherRow['department'] ?? '') !== '' ? $otherRow['department'] : '—' }} {{ ($otherRow['email'] ?? '') !== '' ? $otherRow['email'] : '—' }} {{ ($otherRow['phone'] ?? '') !== '' ? $otherRow['phone'] : '—' }}
@endif @endif @if ($momShowWorkingPaperAttachedCheckbox)
When checked, the scheme working paper is included on the Minutes of Meeting preview and printout.
@endif @if (! empty($momShowOrganizerSignatureSection)) @php $mwsMomSigState = is_array($momOrganizerSignature ?? null) ? $momOrganizerSignature : []; $mwsMomSigEffective = trim((string) ($mwsMomSigState['effective_url'] ?? '')); $mwsMomSigDrawn = trim((string) ($mwsMomSigState['drawn_url'] ?? '')); $mwsMomSigUploaded = trim((string) ($mwsMomSigState['uploaded_url'] ?? '')); // Always re-ask on create / returned resubmit / any fresh signature action; skip only for this submit. $momIncludeCreatorSignatureChecked = true; @endphp
{{ ($momPrimarySignerIsOrganizer ?? true) ? 'Organizer Signature' : 'Your Signature' }}

{{ ($momPrimarySignerIsOrganizer ?? true) ? 'Use your signature as meeting host/organizer. It is saved to your profile when you save minutes. Uncheck to skip your signature for this submit.' : 'Use your signature when saving minutes. It is saved to your profile and recorded as the primary Minutes of Meeting signatory. Uncheck to skip your signature for this submit.' }}

@php $momCanBackdateSignature = filter_var($momCanBackdateSignature ?? false, FILTER_VALIDATE_BOOLEAN); $momSignatureDateDefault = (string) ($momSignatureDateDefault ?? now()->toDateString()); @endphp @elseif (! empty($momShowOrganizerSignatureReadonly) && ! empty($momOrganizerSignature)) @php $mwsMomSigReadonly = is_array($momOrganizerSignature) ? $momOrganizerSignature : []; $mwsMomSigReadonlyEff = trim((string) ($mwsMomSigReadonly['effective_url'] ?? '')); $momReadonlyIncludeCreatorSig = filter_var($momIncludeCreatorSignature ?? true, FILTER_VALIDATE_BOOLEAN); @endphp @if ($momReadonlyIncludeCreatorSig && $mwsMomSigReadonlyEff !== '')
Organizer Signature
@endif @endif @if (($momShowCoSignerSignatureSection || $momShowCoSignerForwardSection) && ! empty($momCoSignerSignature)) @php $mwsMomCoSigState = $momCoSignerSignature; $mwsMomCoSigEffective = trim((string) ($mwsMomCoSigState['effective_url'] ?? '')); $mwsMomCoSigDrawn = trim((string) ($mwsMomCoSigState['drawn_url'] ?? '')); $mwsMomCoSigUploaded = trim((string) ($mwsMomCoSigState['uploaded_url'] ?? '')); $momCoSignerForwardOptions = is_array($momCoSignerForwardOptions ?? null) ? $momCoSignerForwardOptions : []; $momCoSignerReturnTargetName = trim((string) ($momCoSignerReturnTargetName ?? '')); @endphp
Your Co-Signature (Minutes of Meeting)
@if (! empty($momCoSignerReceivedReturn))

These minutes were returned to you. Include your signature if you want it on the minutes, then sign and forward to the next co-signatory, or mark the chain complete. Uncheck to skip your signature for this submit.

@else

You are the active co-signatory. Include your signature if you want it on the minutes, then sign and forward to the next co-signatory, or mark the chain complete. Uncheck to skip your signature for this submit.

@endif @php $momCanBackdateSignature = filter_var($momCanBackdateSignature ?? false, FILTER_VALIDATE_BOOLEAN); $momSignatureDateDefault = (string) ($momSignatureDateDefault ?? now()->toDateString()); @endphp
@if ($momCanBackdateSignature) You may select today or any past date (backdating permitted). @else Automatically set to today’s date when you sign. @endif
@if ($mwsMomCoSigEffective !== '')
@else No signature on file yet — draw or upload below. @endif
Select any eligible co-signatory. You may forward to someone new or back to a co-signatory who previously returned the minutes.
@endif @if ($mwsMomShowSaveButton)
@endif
@endsection @push('scripts') @if (! empty($momShowAttendedParticipantsPicker) || ! empty($momShowCoSignerPicker) || ! empty($momShowCoSignerSignatureSection) || ! empty($momShowCoSignerForwardSection) || ! empty($momShowOtherParticipantsEditor)) @endif @if (! empty($momShowAttendedParticipantsPicker)) @endif @if (! empty($momShowOrganizerSignatureSection) || ! empty($momShowCoSignerSignatureSection)) @endif @if (! empty($momShowOrganizerSignatureSection)) @endif @if (! empty($momShowCoSignerSignatureSection) || ! empty($momShowCoSignerForwardSection)) @endif @if (! empty($momShowAttendedParticipantsPicker) || ! empty($momShowOtherParticipantsEditor)) @endif @endpush