@php use App\Support\MecReportType; /** @var \App\Models\MecReport $report */ /** @var \App\Models\PC\Plan|null $plan */ /** @var \App\Models\Core\Project|null $project */ /** @var string|null $mecReportWorkflowUiMode */ $mecReportWorkflowUiMode = $mecReportWorkflowUiMode ?? mec_report_workflow_ui_mode($report); $submitted = $report->submitted_at ?? $report->created_at; $submittedLabel = $submitted instanceof \Illuminate\Support\Carbon ? $submitted->timezone(config('app.timezone'))->format('d M Y, H:i') : (string) $submitted; $periodLabel = $plan !== null ? \Carbon\Carbon::create()->month((int) $plan->month)->format('F').' '.$plan->year : '—'; $planMetaRegion = $plan !== null ? plan_region_label_for_plan($plan) : '—'; $reportTypeLabel = match (MecReportType::normalize((string) $report->report_type)) { MecReportType::RMR, MecReportType::CMR => __('Monitoring Report'), MecReportType::SAR => __('Short Assessment Report (SAR)'), MecReportType::DRR => __('Desk Review Report (DRR)'), MecReportType::SER => __('Summative Evaluation Report (SER)'), MecReportType::IER => __('Impact Evaluation Report (IER)'), MecReportType::TPR => __('Third Party Validation Report (TPR)'), MecReportType::PPR, MecReportType::PMR => __('Project Monitoring Report (PMR)'), default => (string) $report->report_type, }; $isProcessing = $report->status === \App\Models\MecReport::STATUS_PROCESSING; $isApproved = $report->status === \App\Models\MecReport::STATUS_APPROVED; $isDeclined = $report->status === \App\Models\MecReport::STATUS_DECLINED; $declineRemarks = $isDeclined ? mec_report_last_workflow_remarks($report, 'declined') : ''; $wf = (string) ($report->workflow_status ?? ''); $viewerId = (int) auth()->id(); $canResumeInitiatorReturned = user_can_resume_initiator_returned_mec_report($report, $viewerId); $canOpenReview = $isProcessing && ! $canResumeInitiatorReturned && user_can_act_on_mec_report_in_review_approval_list($report, $viewerId); $canResumeDeclined = user_can_resume_declined_mec_report($report, $viewerId) && user_can_act_on_mec_report_in_processing_list($report, $viewerId); $reviewLinkLabel = $canOpenReview ? __('Open report wizard') : ''; $evaluationReportNoPreview = MecReportType::isSerIerTpr((string) $report->report_type); $erpLatestDownloadUrl = $evaluationReportNoPreview ? mec_report_erp_latest_document_download_url($report) : ''; $erpLatestFileName = trim((string) data_get(is_array($report->payload) ? $report->payload : [], 'erp_profile.attachment_word_original_name', '')); @endphp
@if ($canOpenReview && $mecReportWorkflowUiMode === 'rd') {{ __('Click a row in the list to open the report wizard directly, or use Open report wizard above. Review every part of the report, add your RD comments in Part E, then use Forward to SDM or Decline on the last step (decline requires a reason). Forward and decline are only available from the wizard.') }} @elseif ($canOpenReview && $mecReportWorkflowUiMode === 'sdm') @if (\App\Support\MecReportType::finalizesAtSdm((string) $report->report_type)) {{ __('Open the report wizard, review every part of the report, add SDM input in Part E, then Approve or Decline (return to RD, reason required) on the last step. Approve and decline are only available from the wizard.') }} @else {{ __('Open the report wizard, review every part of the report, add SDM input in Part E, then Forward to DG or Decline (return to RD, reason required) on the last step. Forward and decline are only available from the wizard.') }} @endif @elseif ($canOpenReview && $mecReportWorkflowUiMode === 'dg') {{ __('Review opens the report wizard in read-only mode. Use Approve on the last step to publish the report; you will be returned to Published reports.') }} @elseif ($isApproved) @if (\App\Support\MecReportType::usesPublishLetter((string) $report->report_type)) {{ __('This report is approved and awaiting publication. Use Preview report or Publish letter above.') }} @else {{ __('This report is approved and awaiting publication. Open Publish report to review the full report and publish it.') }} @endif @elseif ($evaluationReportNoPreview && $erpLatestDownloadUrl !== '') {{ __('Download retrieves the latest Word evaluation report file attached to this submission.') }} @else {{ __('Preview opens the printable report in a new tab.') }} @endif