@php use App\Services\Leads\LeadModule; use App\Services\Leads\RemarkRule; $name = trim((string) $lead->user_name) ?: 'Unnamed lead'; $fields = collect($sections)->collapse(); // Initial values for client-side toggles (validation errors keep the submitted value). $initial = $fields->map(fn ($f, $col) => (string) old($col, $f['type'] === 'date' ? LeadModule::inputDate($lead->getAttribute($col)) : $lead->getAttribute($col)))->all(); $outcomes = collect($module->options('final_remark', $lead->final_remark))->keys() ->mapWithKeys(fn ($r) => [$r => RemarkRule::outcome($r)])->filter()->all(); $showIf = function (array $f): ?string { $cond = $f['show_if'] ?? null; if ($cond === 'live') { return "outcome === 'LIVE'"; } if (is_array($cond)) { return collect($cond)->map(fn ($v, $k) => 'v['.json_encode($k).'] === '.json_encode($v))->implode(' && '); } return null; }; $toggles = $fields->filter(fn ($f) => is_array($f['show_if'] ?? null))->flatMap(fn ($f) => array_keys($f['show_if']))->unique()->push('final_remark')->all(); @endphp
@csrf @method('PUT')
@foreach ($sections as $section => $sectionFields) @if ($section === 'Joining & KYC') Admin only

Set Joined to “Yes” to record KYC and bank details.

@endif
@foreach ($sectionFields as $col => $f) @php $cond = $showIf($f); $value = $initial[$col] ?? ''; $model = in_array($col, $toggles, true) ? 'v.'.$col : null; $label = $module->columnLabel($col); @endphp
($f['span'] ?? null) === 'full']) @if ($cond) x-show="{{ $cond }}" x-cloak @endif> @switch($f['type']) @case('remark')

Status after saving: Live Lost New

@break @case('select') @break @case('date') @break @case('textarea') @break @case('number') @break @case('phone') @break @default @endswitch
@endforeach
@endforeach
Current status
@include('leads.partials.status', ['value' => $lead->live_data])
Captured
{{ $lead->date ?: '—' }}
IP address
{{ $lead->user_ip_address ?: '—' }}
The final remark sets the status: “interested” remarks make the lead Live and need a due date; “not interested” remarks mark it Lost.
Cancel