@php
$sections = $sections ?? collect();
$certReview = $certIsComply = $sdReview = $sdIsComply = $authorizationLetterReview = $authorizationLetterIsComply = null;
$certificateSection = $sections->where('section', App\Models\EvaluatorSection::SECTION_CERTIFICATE)->first();
if ($certificateSection) {
$certReview = $certificateSection?->review->where('type', App\Models\EvaluatorReview::TYPE_CERTIFICATE)->first();
$certIsComply = $certReview?->is_comply;
$sdReview = $certificateSection?->review->where('type', App\Models\EvaluatorReview::TYPE_SUPPORTING_DOC)->first();
$sdIsComply = 1; // default to comply
foreach ($application->product_group?->supportingDoc as $supportingDoc) {
$supportingDocReview = $certificateSection?->review->where(
'type',
App\Models\EvaluatorReview::TYPE_SUPPORTING_DOC . "_$supportingDoc->id"
)->first();
if ($supportingDocReview?->is_comply === 0) {
$sdIsComply = 0;
break; // no need to check further
}
}
$authorizationLetterReview = $certificateSection?->review->where('type', App\Models\EvaluatorReview::TYPE_AUTHORIZATION)->first();
$authorizationLetterIsComply = $authorizationLetterReview?->is_comply;
} elseif ($application->stage == App\Models\Application::STAGE_SO) { // handle so evaluation
$sections = $evaluation?->section;
if (is_array($sections)) {
$certIsComply = $sdIsComply = $authorizationLetterIsComply = !in_array('5', $sections);
}
}
// only show certification tab if not comply
$showCertificationTab = ($sdIsComply !== null && $sdIsComply == 0) ||
($authorizationLetterIsComply !== null && $authorizationLetterIsComply == 0) ||
($certIsComply !== null && $certIsComply == 0);
@endphp
@include('pages.company.incomplete-application.partials.product.2a-certification-registration')
@include('pages.company.incomplete-application.partials.product.2b-main-certificate')
@include('pages.company.incomplete-application.partials.product.2c-product-ownership')
{{--
@include('pages.company.incomplete-application.partials.product.2c-product-ownership')
@include('pages.company.incomplete-application.partials.product.2d-compliance')
@include('pages.company.incomplete-application.partials.product.2e-general-requirement')
@include('pages.company.incomplete-application.partials.product.2f-environmental-claim')
--}}