@foreach ($customers as $key => $customer)
@php($customerEmail = $customer->getRawOriginal('email') ?: $customer->email)
@php($customerPhone = $customer->getRawOriginal('phone') ?: $customer->phone)
<tr class="">
    <td class="">
        {{ $key + 1 }}
    </td>
    <td class="table-column-pl-0">
        <a href="{{ route('admin.users.customer.view', [$customer['id']]) }}" class="text--hover">
            {{ $customer['f_name'] . ' ' . $customer['l_name'] }}
        </a>
    </td>
    <td>
        <div>
            {{ $customerEmail }}
        </div>
        <div>
            {{ $customerPhone }}
        </div>
    </td>
    <td>
        <label class="badge">
            {{ $customer->order_count }}
        </label>
    </td>
    <td>
        <label class="toggle-switch toggle-switch-sm ml-xl-4" for="stocksCheckbox{{ $customer->id }}">
            <input type="checkbox" data-url="{{ route('admin.users.customer.status', [$customer->id, $customer->status ? 0 : 1]) }}" data-message="{{ $customer->status? translate('messages.you_want_to_block_this_customer'): translate('messages.you_want_to_unblock_this_customer') }}"
                   class="toggle-switch-input status_change_alert" id="stocksCheckbox{{ $customer->id }}"
                {{ $customer->status ? 'checked' : '' }}>
            <span class="toggle-switch-label">
                                                <span class="toggle-switch-indicator"></span>
                                            </span>
        </label>
    </td>
    <td>
        <a class="btn action-btn btn--warning btn-outline-warning"
            href="{{ route('admin.users.customer.view', [$customer['id']]) }}"
            title="{{ translate('messages.view_customer') }}"><i
                class="tio-visible-outlined"></i>
        </a>
        <a class="btn action-btn btn--danger btn-outline-danger form-alert"
            href="javascript:"
            data-id="customer-{{$customer['id']}}"
            data-message="Want to delete this customer?"
            title="{{ translate('messages.delete') }}"><i class="tio-delete-outlined"></i>
        </a>
        <form action="{{ route('admin.users.customer.delete', [$customer['id']]) }}"
              method="post" id="customer-{{$customer['id']}}">
            @csrf
            @method('delete')
        </form>
    </td>
</tr>
@endforeach
