@if($customer->UnitID && $customer->unit && $customer->unit->property)
@php
$propertyId = $customer->unit->property->PropID;
$services = \App\Models\PropService::where('PropID', $propertyId)
->where('CompanyID', $customer->CompanyID)
->orderBy('ServiceName')
->get();
$customerServices = $customer->propServices->keyBy('IDService');
@endphp
@forelse($services as $service)
@php
$isChecked = $customerServices->has($service->IDService);
$pivot = $customerServices->get($service->IDService);
$price = $isChecked ? $pivot->pivot->Price : $service->Price;
$quantity = $isChecked ? $pivot->pivot->Quantity : 1;
$startDate = $isChecked ? $pivot->pivot->StartDate : now()->format('Y-m-d');
@endphp
@empty
No services available for this property.
@endforelse
@else
Please select a unit to view available services.
@endif