@extends(backpack_view('blank')) @section('after_styles') @endSection @php $breadcrumbs = [ trans('backpack::crud.admin') => url(config('backpack.base.route_prefix'), 'dashboard'), trans('backpack::base.my_account') => false, ]; @endphp @section('header')

Services

@endsection @section('content') @php $services = json_decode($services, true); $selectedServices = []; $selectedServicesByName = []; if (!empty($services)) { $selectedServicesByName = collect($services) ->keyBy('name') ->toArray(); } $defaultOptions = [ // 'Flu vaccinations', // 'COVID vaccinations', // 'Blood pressure checks', // 'Medicine blister packs', // 'Smoking cessation', // 'Weight management', // 'Travel health advice', // 'Passport photos', // // 'Vaccinations', // // 'Health checks', // 'Blister packs', // 'Delivery services', // // 'Blood pressure monitors', ]; // $allOptions = collect($defaultOptions) // ->merge(array_keys($selectedServicesByName)) // ->unique() // ->values(); $selectedNames = array_keys($selectedServicesByName); // Selected services that are NOT in the default list $selectedCustom = collect($selectedNames) ->reject(fn ($option) => in_array($option, $defaultOptions)); // Selected services that ARE in the default list (keep default order) $selectedDefaults = collect($defaultOptions) ->filter(fn ($option) => in_array($option, $selectedNames)); // Remaining default services $remainingDefaults = collect($defaultOptions) ->reject(fn ($option) => in_array($option, $selectedNames)); $allOptions = $selectedCustom ->merge($selectedDefaults) ->merge($remainingDefaults) ->values(); @endphp
@csrf

@foreach($allOptions as $index => $serviceName) @php $selected = $selectedServicesByName[$serviceName] ?? null; @endphp
@endforeach
@endSection @push('after_scripts') @endpush @push('after_scripts') @endpush