@lang('permissions.einvoices')
@if (auth('admin')->user()->hasPermissionTo('create officer_assign_setting', 'admin')) @lang('einvoice.addofficer') @endcan
@if (session('message'))
{{ session('message') }}
@endif @if ($errors->any()) @foreach ($errors->all() as $error)
{{ $error }}
@endforeach @endif @foreach ($data->groupBy('employee_id') as $employeeId => $settings) @php $firstSetting = $settings->first(); $uniqueBranches = $settings->pluck('pos.branches.name')->unique()->filter(); @endphp @endforeach
@lang('einvoice.employee_name') @lang('einvoice.branchname') @lang('einvoice.posname') @lang('einvoice.Actions')
{{ $employeeId }} {{ $firstSetting->employee->first_name ?? 'N/A' }} {{-- Show single branch name if all are the same, else join them --}} {{ $uniqueBranches->count() === 1 ? $uniqueBranches->first() : $uniqueBranches->join(' - ') }} {{-- Join all POS names --}} {{ $settings->pluck('pos.name')->filter()->join(' - ') ?? 'N/A' }} @if (auth('admin')->user()->hasPermissionTo('update officer_assign_setting', 'admin')) @lang('einvoice.update') @endif