Customer Details

@if (isset($customer->id))
@method('PUT') @else @endif @csrf {{-- @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif --}} @if (request('lead_id')) @endif @php $leadType = $lead->lead_type ?? null; // null when not converting from a lead $isEditing = isset($customer) && isset($customer->id); // What should be selected $selectedType = old('customer_type', $customer->customer_type ?? ($leadType ?? 'individual')); // UI rules // - Converting from a lead: disable ONLY the other option // - Editing an existing customer: lock it completely (disable both) + submit hidden value $disableIndividual = ($leadType === 'business') || ($isEditing && $selectedType !== 'individual'); $disableBusiness = ($leadType === 'individual') || ($isEditing && $selectedType !== 'business'); $lockAll = $isEditing; // fully lock on edit @endphp
@if(!$isEditing)
@endif
{{-- If fully locked (editing), submit value via hidden input because disabled inputs don't submit --}} @if ($lockAll) @endif
@if ($leadType)
Customer type is fixed by the lead ({{ ucfirst($leadType) }}).
@elseif($isEditing)
Customer type is locked ({{ ucfirst($selectedType) }}).
@endif