Select which sellers this manager can monitor and process orders for.
@php
$sellers = \App\Models\User::where('role', 'seller')
->with('managers')
->orderBy('name')
->get();
@endphp
@if($sellers->count() > 0)
@foreach($sellers as $seller)
@php
// Check if seller is assigned to another manager
$assignedToOther = $seller->managers()
->where('users.id', '!=', $user->id)
->first();
$isCurrentlyAssigned = $user->managedSellers->contains($seller->id);
$isDisabled = $assignedToOther ? true : false;
@endphp
@endforeach
@else
No sellers available. Create sellers first.
@endif
@error('seller_ids')
{{ $message }}
@enderror