@php
$is_non_solar = \App\ApplicationCategory::isNonSolarCategory($merchant_data->category_id ?: ($category_id ?? null));
/*
* "Asset Insurance Premium" on the merchant (merchant.insurance_premium)
* is the master switch. With it off the merchant has not opted in to
* insuring its customers, so this application cannot opt in either and
* the selection is locked. ConsumerApplicationController::saveInsuranceSummary()
* applies the same rule, so a direct post cannot get round it.
*/
$merchant_insurance_enabled = !empty($merchant_data->insurance_premium);
$insurance_locked = $is_non_solar || !$merchant_insurance_enabled;
$insurance_locked_reason = $is_non_solar ? 'Insurance not applicable for non-solar' : 'Asset Insurance Premium is not enabled for this merchant';
$is_insured = !$insurance_locked && ((!empty($proFormaInvoice) && !empty($proFormaInvoice->insurance_premium_applicable)) || (empty($proFormaInvoice) && !empty($merchant_data->insurance_premium)));
@endphp