<div class="table-responsive">
    <div class="d-flex justify-content-between">
        <h5 class="mb-0">Project Attachments</h5>
        @if(auth()->user()->can('project-attachment-create'))
        <button type="button" class="btn btn-primary" id="createProjectAttachments"  data-bs-toggle="modal" data-bs-target="#commonModal"><i class="bx bx-plus"></i> Add New</button>
        @endif
    </div>
    <hr class="mb-2">
    <table id="example" class="table table-bordered align-middle" style="width:100%">
        <thead class="table-light">
            <tr>
                <th class="thbutton">Sl No</th>
                <th>Title </th>
                <th>File Url</th>
                <th width="10%">Status</th>
                @if(in_array('project-attachment-edit', $authRolePermissions))
                <th class="thbutton">Edit</th>
                @endif
                @if(in_array('project-attachment-delete', $authRolePermissions))
                <th class="thbutton">Delete</th>
                @endif
            </tr>
        </thead>
        <tbody>
            @php $i=1;@endphp
            @if(count($ProjectAttachments)>0)
                @foreach($ProjectAttachments as $key=> $list)
                <tr>
                    <td class="text-center">{{ $key + 1}}</td>
                    <td>{{ucfirst($list->title)}}</td>
                    <td>
                        <a href="{{ asset($list->file_url) }}" download>
                            <i class="bi bi-download" style="font-size: 20px;"></i>
                        </a>
                    </td>
                    <td>
                        <div class="form-check form-check-inline{{$i}}">
                            <input class="form-check-input{{$i}} btn-lg changeStatusCustom" type="checkbox" id="inlineCheckbox{{$i}}" data-url="{{route('project-attachments.changestatus')}}" data-id="{{$list->id}}" data-status="{{$list->status=='0' ? '1' : '0'}}" {{ $list->status=='1' ? 'checked' : ''}}>
                        </div>
                    </td>
                    @if(in_array('project-attachment-edit', $authRolePermissions))
                    <td style="font-size: 5px;">
                        <button type="button" class="btn btn-outline-secondary" data-id="{!! $list->id !!}" id="project_attachments_edit"  data-bs-toggle="modal" data-bs-target="#commonModal"><i class="bi bi-pencil-square"></i></i></button>
                    </td>
                    @endif
                    @if(in_array('project-attachment-delete', $authRolePermissions))
                    <td class="text-center">
                        <a data-url="{{route('project-attachments.destroy')}}" data-id="{{$list->id}}" class="btn btn-danger deleteAccountData project_attachments" href="#" class="text-danger" 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="12">No Data Found</td>
            </tr>
            @endif
        </tbody>
    </table>
</div>
</div>

