@foreach($providers as $key=> $row)

@php
    $disableDelete= ($row->disable_delete ?? null);
@endphp
<tr >
    <td scope="row">
        @if (!$disableDelete)
            <div class="form-check">
                <input class="form-check-input selectOne" type="checkbox" value="{{$row->code}}" name="id[]" id="check{{ $row->code }}">
                <label class="form-check-label" for="check{{ $row->code }}"> {{ $row->code }} </label>
            </div>
        @endif
    </td>
    <td>{{ $row->name }}</td>
    <td>{{ $row->email }}</td>
    <td>{{ validatePhone($row->phone) }}</td>
    <td>{{ $row->status_text ?? '' }}</td>
    <td>{{ $row->total_units ?? 0 }}</td>
    <td>{{ $row->total_clicks ?? 0 }}</td>
    <td>{{ $row->total_sold ?? 0 }}</td>
    <td>{!! $row->badges_text !!}</td>
        
    <td>{{ dateFormat($row->created_at, 'Y/m/d') }}</td>
    <td>
        <div class="dropdown">
            <button class="icon_dots dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-expanded="false">
                <i class="bi bi-three-dots-vertical"></i>
            </button>
            <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                @if($row->deleted_at)
                    <li><a href="{{ route ('providers.restore', $row->code) }}" data-method="put" class="dropdown-item rowAction" title="{{ __('dashboard.restore') }}"> <i class="bi bi-slash-circle ml-1"></i> {{ __('dashboard.restore') }} </a></li>
                    @if (!$disableDelete)
                        <li><a href="{{ route ('providers.destroy', $row->code) }}" data-method="delete" class="dropdown-item rowAction" title="{{ __('dashboard.delete') }}"> <i class="bi bi-trash ml-1"></i> {{ __('dashboard.delete') }} </a></li>
                    @endif
                @else
                
                    <li><a href="{{ route ('units.index', ['provider_id'=> $row->code]) }}" class="dropdown-item" title="{{ __('units.head') }}"><i class="bi bi-pen ml-1"></i> {{ __('units.head') }} </a></li>
                    
                    
                    <li><a href="{{ route ('providers.edit', $row->code) }}" class="dropdown-item" title="{{ __('dashboard.edit') }}"><i class="bi bi-pen ml-1"></i> {{ __('dashboard.edit') }} </a></li>

                    @if (!$disableDelete)
                        <li><a href="{{ route ('providers.destroy', $row->code) }}" data-method="delete" class="dropdown-item rowAction" title="{{ __('dashboard.trash') }}"> <i class="bi bi-slash-circle ml-1"></i> {{ __('dashboard.trash') }} </a></li>
                    @endif
                    
                    {{-- <li><a class="dropdown-item show_devices" data-user_name="{{ $row->name }}" data-user_id="{{ $row->code }}" title="{{ __('providers.devices') }}"> <i class="bi bi-phone ml-1"></i> {{ __('providers.devices') }} </a></li> --}}
                    
                @endif
                </ul>
            </div>
        </div>
    </td>
  </tr>
@endforeach

@if( count( $providers ) && $providers->hasPages() )
<tr> <td></td><td colspan="7"> {{ $providers->links() }} </td> <td></td></tr>
@endif
@php
    // dd(DB::getQueryLog());
@endphp