@php
$manualCouriers = $manualCouriers ?? \App\Models\CourierApi::activeManualCouriers();
$steadfastOn = $steadfastOn ?? false;
$pathaoOn = $pathaoOn ?? false;
$redxOn = $redxOn ?? false;
$carrybeeOn = $carrybeeOn ?? false;
$selectedCourier = $selectedCourier ?? ($selected ?? '');
$matchCourier = function ($value) use ($selectedCourier) {
return $selectedCourier !== '' && strcasecmp((string) $selectedCourier, (string) $value) === 0;
};
$hasMatch = false;
@endphp
@if($steadfastOn)
@php if ($matchCourier('steadfast')) { $hasMatch = true; } @endphp
@endif
@if($redxOn ?? false)
@php if ($matchCourier('redx')) { $hasMatch = true; } @endphp
@endif
@if($carrybeeOn ?? false)
@php if ($matchCourier('carrybee')) { $hasMatch = true; } @endphp
@endif
@if($pathaoOn)
@php if ($matchCourier('pathao')) { $hasMatch = true; } @endphp
@endif
@foreach($manualCouriers as $mc)
@php if ($matchCourier($mc->name) || $matchCourier($mc->type)) { $hasMatch = true; } @endphp
@endforeach
@if($selectedCourier && !$hasMatch)
@endif