@php
$sections = $sections ?? collect();
$policyReview = $policyIsComply = $competencyReview = $competencyIsComply = $sopReview = $sopIsComply = null;
$certificateSection = $sections->where('section', App\Models\EvaluatorSection::SECTION_CERTIFICATE)->first();
if ($certificateSection) {
$policyReview = $certificateSection?->review->where('type', App\Models\EvaluatorReview::TYPE_POLICY)->first();
$policyIsComply = $policyReview?->is_comply;
$competencyReview = $certificateSection?->review->where('type', App\Models\EvaluatorReview::TYPE_CERTIFICATE_COMPETENCY)->first();
$competencyIsComply = 1; // default to comply
foreach ($application->product_group->competency ?? collect() as $competency) {
$competencyReview = $certificateSection?->review->where(
'type',
App\Models\EvaluatorReview::TYPE_CERTIFICATE_COMPETENCY . "_$competency->id"
)->first();
if ($competencyReview?->is_comply === 0) {
$competencyIsComply = 0;
break; // no need to check further
}
}
$sopReview = $certificateSection?->review->where('type', App\Models\EvaluatorReview::TYPE_CERTIFICATE_SOP)->first();
$sopIsComply = $sopReview?->is_comply;
} elseif ($application->stage == App\Models\Application::STAGE_SO) { // handle so evaluation
$sections = $evaluation?->section;
if (is_array($sections)) {
$policyIsComply = $competencyIsComply = $sopIsComply = !in_array('5', $sections);
}
}
@endphp
@include('pages.company.incomplete-application.partials.service.2a-sustainable-policy')
@include('pages.company.incomplete-application.partials.service.2b-service-competency')
@include('pages.company.incomplete-application.partials.service.2c-sop')
{{--
@include('pages.company.incomplete-application.partials.service.2d-general')
--}}