<div class="table-responsive">
  <table id="example" class="table table-bordered align-middle" style="width:100%">
    <thead class="table-light">
      <tr>
        <th>Sl No</th>
        <th>Template Use For</th>
        <th>Template Id</th>
        <th>Sender Id</th>
        <th>Template Formate</th>
        <th>Company Name</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=> $row)
    <tr>
        <td>{{$data->firstItem() + $key}}</td>
        <td>{{$row->template_use_for}}</td>
        <td>{{$row->template_id}}</td>
        <td>{{$row->sender_id}}</td>
        <td style="white-space:pre-wrap; word-wrap:break-word">{{$row->template_format}}</td>
        <td>@if(isset($row->getComapnyName->name)){{$row->getComapnyName->name}}@endif</td>
        <td>
            <div class="form-check form-check-inline{{$row->id}}">
                <input class="form-check-input{{$row->id}} btn-lg changeStatus" type="checkbox" id="inlineCheckbox{{$row->id}}" data-url="{{route('smstemplate.changestatus')}}" data-id="{{$row->id}}" data-status="@if($row->status=='0'){{'1'}}@elseif($row->status=='1'){{'0'}}@endif" @if($row->status=='1'){{'checked'}}@elseif($row->status=='0'){{''}}@endif>
            </div>
        </td>

        @if(in_array('smstemplate-edit', $authRolePermissions))
        <td>
            <a href="{{route('smstemplate.edit',$row->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>
        </td>
        @endif
        
        
        @if(in_array('smstemplate-delete', $authRolePermissions))
        <td>
            <a href="#" data-url="{{route('smstemplate.destroy')}}" data-id="{{$row->id}}"  class="btn btn-danger deleteData" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Delete">
                <i class="bi bi-trash text-white"></i>
            </a>
        </td>
        @endif
        
    </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('smstemplate.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>