 <div class="table-responsive">
  <table class="table table-bordered align-middle" style="width:100%">
      <thead class="table-light">
          <tr>
              <th>Sl No</th>
              <th>Company Name</th>
              <th>Address</th>
              <th>Email</th>
              <th>Mobile Number</th>
              <th class="thbutton">Is Default</th>
              <th class="thbutton">Status</th>
              <th class="thbutton">Edit</th>
              <th class="thbutton">Delete</th>
          </tr>
      </thead>
      <tbody>
        @php $i=1;@endphp
        @if(count($data)>0)
        @foreach($data as $key => $list)
        <tr>
            <td>{{$data->firstItem() + $key}}</td>
            <td><a href="{{  route('companies.show',$list->id)}}" >{{$list->name}}</a>
                <br>
                @if($list->office_type=='head_office'){{'Head Office'}}@else{{$list->office_type}}@endif
            </td>
            <td style="white-space:pre-wrap; word-wrap:break-word">@if(isset($list->getCompanyName->address_1)){{$list->getCompanyName->address_1}}@endif</td>
            <td>{{$list->email}}</td>
            <td>{{$list->mobile_number}}
                <br>
                @if($list->phone_number)
                {{$list->phone_number}}
                @endif
                <br>
                @if($list->whatsapp_no)
                {{$list->whatsapp_no}}
                @endif
            </td>
            <td>
                <div class="form-check form-check-inline{{$i}}">
                    <input class="form-check-input{{$i}} btn-lg changeCompanyStatus" type="checkbox" id="inlineCheckbox{{$i}}" data-url="{{route('companies.changedefault')}}" data-id="{{$list->id}}" data-status="{{$list->is_default=='0' ? '1' : '0'}}" {{ $list->is_default=='1' ? 'checked' : ''}}>
                </div>
            </td>
            <td align="center">
                @if(in_array('company-edit', $authRolePermissions))
                <div class="form-check form-check-inline{{$i}}">
                    <input class="form-check-input{{$i}} btn-lg changeCompanyStatus" type="checkbox" id="inlineCheckbox{{$i}}" data-url="{{route('companies.changestatus')}}" data-id="{{$list->id}}" data-status="@if($list->status=='0'){{'1'}}@elseif($list->status=='1'){{'0'}}@endif" @if($list->status=='1'){{'checked'}}@elseif($list->status=='0'){{''}}@endif>
                </div>
                @endif
            </td>
            <td align="center">
                @if(in_array('company-edit', $authRolePermissions))
                <a href="{{ route('companies.edit',$list->id)}}" class="btn btn-warning" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Edit">
                    <i class="bi bi-pencil-square text-white"></i>
                </a>
                @endif
            </td>
            
            
            <td align="center">
                @if(in_array('company-delete', $authRolePermissions))
                <a href="#"  data-url="{{route('companies.destroy')}}" data-id="{{$list->id}}" class="btn btn-danger deleteCompanyData" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Delete">
                    <i class="bi bi-trash text-white"></i>
                </a>
                @endif
            </td>
            
        </tr>
        @php $i++; @endphp
        @endforeach
        @else
        <tr>
            <td colspan="8">No Data Found</td>
        </tr>
        @endif
    </tbody>
</table>
</div>

<nav class="row align-items-center mt-2">
    <div class="col-md-10">
        {!! $data->onEachSide(0)->render('company.pagination') !!}
    </div>
    <div class="col-lg-2 col-md-2 col-2 dataTables_length" id="example_length" style="text-align: right;">
        <i class="bi bi-funnel" style=" top: 11px;left: 20px;"></i>
        <select class="form-select sorting sorting-box" id="" name="example_length" aria-controls="example" style="padding-left: 30px;">
            <option value="10">Show: 10</option>
            <option value="30">Show: 30</option>
            <option value="50">Show: 50</option>
        </select>
    </div>
</nav>
</div>

