в форму создания клиентов добавил разделение агентов по компаниям
This commit is contained in:
parent
184c0e20ea
commit
0262ac99db
@ -217,11 +217,20 @@ class="bi bi-plus-circle" viewBox="0 0 16 16">
|
||||
<select wire:model.live="agentId" class="form-select rounded-4 @error('agentId') is-invalid @enderror"
|
||||
id="agentId" name="agent" aria-label="Агент">
|
||||
<option selected></option>
|
||||
@foreach ($availableAgents as $agent)
|
||||
@php($currentCompanyId = false)
|
||||
@foreach ($availableAgents as $num=>$agent)
|
||||
@if($currentCompanyId !== $agent['company_id'])
|
||||
@if($num !== 0)
|
||||
</optgroup>
|
||||
@endif
|
||||
<optgroup label="{{ $agent['company']['name'] }}">
|
||||
@php( $currentCompanyId = $agent['company_id'])
|
||||
@endif
|
||||
<option value="{{ $agent['id'] }}">
|
||||
{{ $agent['user']['name'] }}
|
||||
</option>
|
||||
@endforeach
|
||||
</optgroup>
|
||||
</select>
|
||||
<label for="agentId">Агент</label>
|
||||
@error('agentId')
|
||||
|
||||
@ -59,6 +59,7 @@ function GetAvailableAgents($resultType = 'Collection')
|
||||
}
|
||||
$agents->with('company:id,name');
|
||||
$agents->with('user:id,name');
|
||||
$agents->orderBy('company_id');
|
||||
if ($resultType == 'Collection') {
|
||||
return $agents->get();
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user