 <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>Financial Year Start</th>
        <th>Financial Year End</th>
        <th>Financial Year Name</th>
        <th>Company Name</th>
        <th class="thbutton">Default</th>
        <th class="thbutton">Status</th>
        <th class="thbutton">Edit</th>
        <th class="thbutton">Delete</th>
    </tr>
</thead>
<tbody>
    @php $auth_format = \Session::get('company_data')['date_format'] ?? ''; @endphp
    @php $i=1;@endphp
    @if(count($data)>0)
    @foreach($data as $key=> $row)
    <tr>
        <td>{{$data->firstItem() + $key}}</td>
        <td>{{ date($auth_format, strtotime($row->financial_year_start_date)) }}</td>
        <td>{{ date($auth_format, strtotime($row->financial_year_end_date)) }}</td>
        <td>{{$row->financial_year_name}}</td>
        <td>@if(isset($row->getComapnyName->name)){{$row->getComapnyName->name}}@endif</td>
        <td>
            @if(in_array('financial-year-edit', $authRolePermissions))
                <div class="form-check form-check-inline{{$key}}">
                    <input class="form-check-input{{$key}} btn-lg changeStatusCustom" type="checkbox" id="inlineCheckbox{{$key}}" data-url="{{route('financialyear.changedefault')}}" data-id="{{$row->financialyearid}}" data-id="{{$row->id}}" data-status="{{$row->is_default=='0' ? '1' : '0'}}" {{ $row->is_default=='1' ? 'checked' : ''}}>
                </div>
           @endif
        </td>
        <td>
           @if(in_array('financial-year-edit', $authRolePermissions))
            <div class="form-check form-check-inline{{$row->financialyearid}}">
                <input class="form-check-input{{$row->financialyearid}} btn-lg changeStatusCustom" type="checkbox" id="inlineCheckbox{{$row->financialyearid}}" data-url="{{route('financialyear.changestatus')}}" data-id="{{$row->financialyearid}}" data-status="@if($row->status=='0'){{'1'}}@elseif($row->status=='1'){{'0'}}@endif" @if($row->status=='1'){{'checked'}}@elseif($row->status=='0'){{''}}@endif>
            </div>
           @endif
        </td>
        <td>
           @if(in_array('financial-year-edit', $authRolePermissions))
           <button data-id="{{ $row->financialyearid }}" class="btn btn-warning edit" data-bs-toggle="modal" data-bs-target="#commonModal" title="Edit">
            <i class="bi bi-pencil-square text-white"></i>
        </button>
        @endif
    </td>
    
    
    <td>
            @if(in_array('financial-year-delete', $authRolePermissions))
            <a data-url="{{route('financialyear.destroy')}}" data-id="{{$row->financialyearid}}" class="btn btn-danger deleteDataCustom" class="text-danger" class="text-danger" 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="float-start mt-2">
    <ul class="pagination">
        {!! $data->onEachSide(0)->render('financialyear.pagination') !!}
    </ul>
</nav>
</div>

