@extends('layouts.app') @section('title', 'Project Concept Note') @push('stylesheets') @include('partials.filter-card-styles') @include('partials.index-datatable-styles') @include('project-concept-notes.partials.show-modal-styles') @endpush @section('contents') @php $pcnShowReceivedDate = \App\Support\PcnWorkflowAction::currentUserHasAnyWorkflowPermission(); $pcnShowWorkingPaperColumn = can('working-papers', 'index') || can('working-papers', 'add'); $pcnWpPerms = $pcnWorkingPaperPermissions ?? ['show' => false, 'generate' => [], 'view' => []]; $pcnWpGeneratePerms = $pcnWpPerms['generate'] ?? []; $pcnWpViewPerms = $pcnWpPerms['view'] ?? []; $pcnCanGenerateAnyWorkingPaper = in_array(true, array_values($pcnWpGeneratePerms), true); $pcnIndexHeaders = []; $pcnSortColumns = []; $pcnIndexHeaders[] = 'ADP#'; $pcnSortColumns[] = null; $pcnIndexHeaders[] = 'Code'; $pcnSortColumns[] = null; $pcnIndexHeaders[] = 'Project'; $pcnSortColumns[] = null; if ($pcnShowWorkingPaperColumn) { $pcnIndexHeaders[] = 'Working Paper'; $pcnSortColumns[] = null; } $pcnIndexHeaders[] = 'Status'; $pcnSortColumns[] = 'project_concept_notes.workflow_stage'; if ($pcnShowReceivedDate ?? false) { $pcnIndexHeaders[] = 'Received Date'; $pcnSortColumns[] = 'project_concept_notes.created_at'; } $pcnIndexHeaders[] = 'Submission Date'; $pcnSortColumns[] = 'project_concept_notes.submitted_at'; @endphp
@include('project-concept-notes.partials.index-filter-form')
@forelse ($notes as $row) @php $isDraft = (string) ($row->state ?? '') === \App\Models\PC\Pcn\ProjectConceptNote::STATE_DRAFT; $editId = $row->id; $project = $row->project; $projectDisplayName = trim((string) ($project?->name ?? '')) !== '' ? (string) $project->name : (trim((string) ($row->project_name ?? '')) !== '' ? (string) $row->project_name : '—'); $state = $isDraft ? 'draft' : ($row->workflow_stage ?? $row->state ?? 'requested'); if ($isDraft) { $stateLabel = 'Draft'; } else { $stateLabel = app(\App\Services\PC\Pcn\PcnWorkflowService::class)->workflowStageDisplayLabel($row); } $badgeClass = match ($state) { 'cleared_cdwp', 'approved' => 'badge-success', 'declined', 'rejected' => 'badge-danger', 'draft' => 'badge-secondary', default => 'badge-info', }; $showPcnModifiedLabel = ! $isDraft && (bool) ($row->is_modified ?? false) && (bool) ($row->status ?? true); @endphp {{ $project?->adp_number ?? '—' }} {{ $project?->code ?? '—' }} @if ($showPcnModifiedLabel)
Modified
@endif
@if ($pcnShowWorkingPaperColumn) @php $pcnWpList = ! $isDraft ? ($row->submitted_working_papers ?? collect()) : collect(); $pcnWpViewUrls = []; foreach ($pcnWpList as $pcnWp) { $pcnWpType = (string) ($pcnWp['type'] ?? ''); if ($pcnWpType !== '' && ! empty($pcnWp['id'] ?? null) && ! empty($pcnWpViewPerms[$pcnWpType])) { $pcnWpViewUrls[$pcnWpType] = route('working-papers.edit', ['type' => $pcnWpType, 'id' => $pcnWp['id']]); } } $pcnHasViewableWp = $pcnWpViewUrls !== []; $pcnWpAllowsNewByType = is_array($row->working_paper_allows_new_by_type ?? null) ? $row->working_paper_allows_new_by_type : []; $pcnCanGenerateWpForRow = $pcnCanGenerateAnyWorkingPaper && ! $isDraft && ! empty($row->working_paper_generate_eligible); $pcnCanCreateNewWpForRow = $pcnCanGenerateWpForRow && ! empty($row->working_paper_allows_new); @endphp @if ($pcnHasViewableWp || ($pcnCanGenerateWpForRow && $pcnCanCreateNewWpForRow)) {{ $pcnHasViewableWp ? 'View' : 'Generate' }} @else @endif @endif {{ $stateLabel }} @if ($pcnShowReceivedDate ?? false) {{ $row->updated_at?->format('d M Y') ?? '—' }} @endif {{ $row->submitted_at?->format('d M Y') ?? ($isDraft ? '—' : ($row->created_at?->format('d M Y') ?? '—')) }} @empty No Project Concept Notes found. @endforelse
@include('project-concept-notes.partials.details-modal') @include('project-concept-notes.partials.forward-decline-modals') @include('project-concept-notes.partials.send-for-comments-modals') @endsection @push('scripts') @include('partials.collapsible-filter-scripts') @if (($pcnWorkingPaperPermissions['show'] ?? false)) @endif @include('partials.index-datatable-scripts') @include('project-concept-notes.partials.show-modal-scripts') @include('project-concept-notes.partials.pcn-reviewer-signature-scripts') @include('meeting-workspace.partials.mws-schedule-meeting-type-picker-script') @endpush