<style type="text/css">
    .white-space-break-spaces {
        white-space: break-spaces
    }
</style>
<div class="table-responsive">
     <table id="example" class="table table-bordered align-middle" style="width:100%">
         <thead class="table-light">
             <tr>
                <th class="thbutton">Sl No</th>
                <th>Task Title</th>
                <th >Assign To</th>
                {{-- <th>Projects</th>
                <th>Task Type</th> --}}
                 <th style="width: 12%">Work Status</th>
                 <th style="width: 12%">Task Priority</th>
                 {{-- <th class="thbutton">Add <i style="font-size: 15px; color: #007bff;" class="bi bi-chat-quote-fill"></i></i></th> --}}
                 {{-- <th width="10%">Is Default</th> --}}
                 <th>Status</th>
                 @if(in_array('task-edit', $authRolePermissions))
                 <th class="thbutton">Edit</th>
                 @endif
                 @if(in_array('task-delete', $authRolePermissions))
                 <th class="thbutton">Delete</th>
                 @endif
             </tr>
         </thead>
         <tbody>
             @php
             $i=1;
             $sortedtask_groups = $data ->sortByDesc('id');@endphp
             @if (count(  $sortedtask_groups) > 0)
                 @foreach (  $sortedtask_groups as  $list)
                     <tr>
                         <td class="text-center">{{ $i++}}</td>
                         <td style="white-space: initial;">
                             <strong>
                                 <a href="{{ route('task.show', $list->id) }}"> {{ ucfirst($list->title) }}</a>
                             </strong>
                             <br>{{ $list->details }}
                             <br>Client: <a href="{{ !empty($list->account_id) ? route('task-manager.client-tasks', $list->account_id) : '' }}">{!! $list->getAccount->name ?? '' !!}</a>
                             <br><span class="badge badge-secondary">{{ $list->task_group }}</span> <span class="badge badge-secondary">@if($list->amount >= 1) Chargeable @else Free @endif</span> <span class="badge badge-secondary">{{ $list->task_type }}</span> | Project {!! ucfirst($list->project) !!}
                             <br>{{ formatedDate($list->date) }} | By: {!! ucfirst($list->created_by) !!} {{ !empty($list->deadline) ? '| Deadline: '.formatedDate($list->deadline) : '' }}
                         </td>

                         <td>{{$list->member_name}}</td>
                        <td>
                            <select class="form-control taskWorkStatusDropdown" data-task-id="{{ $list->id }}">
                                <option value="">-- Select --</option>
                                @foreach ($taskStatus as $option)
                                    <option value="{{ $option->id }}" {{ $list->task_status_id == $option->id ? 'selected' : '' }}>
                                        {{ ucfirst($option->name) }}
                                    </option>
                                @endforeach
                            </select>
                        </td>
                         <td>
                             <select class="form-control taskPriorityDropdown" data-task-id="{{ $list->id }}">
                                <option value="">-- Select --</option>
                                @foreach ($taskPriority as $option)
                                    <option value="{{ $option->id }}" {{ $list->task_priority_id == $option->id ? 'selected' : '' }}>
                                        {{ ucfirst($option->name) }}
                                    </option>
                                @endforeach
                             </select>
                         </td>
                         <td>
                             <select class="form-control taskStatusDropdown" data-task-id="{{ $list->id }}">
                                <option value="">-- Select --</option>
                                @foreach (taskStatus() as $key => $option)
                                    <option value="{{ $key }}" {{ $list->status == $key ? 'selected' : '' }}>
                                        {{ $option }}
                                    </option>
                                @endforeach
                             </select>
                         </td>
                         @if(in_array('task-edit', $authRolePermissions))
                         <td class="text-center">
                             <button type="button" class="btn btn-warning edit" data-id="{!! $list->id !!}"
                                 id="edit" data-bs-toggle="modal" data-bs-target="#commonModal"><i
                                     class="bi bi-pencil-square text-white"></i></button>
                         </td>
                         @endif
                         @if(in_array('task-delete', $authRolePermissions))
                         <td class="text-center">
                             <a data-url="{!! route('task-manager.destroy') !!}" data-id="{!! $list->id !!}"
                                 class="btn btn-danger deleteDataCustom" class="text-danger"
                                 data-bs-toggle="tooltip" data-bs-placement="bottom">
                                 <i class="bi bi-trash text-white"></i>
                             </a>
                         </td>
                         @endif
                     </tr>

                 @endforeach
             @else
                 <tr>
                     <td colspan="13">No Data Found</td>
                 </tr>
             @endif
         </tbody>
     </table>
 </div>
<nav class="mt-2 row d-flex align-items-center">
    <div class="col-lg-10 col-md-10 col-10 d-flex align-items-center">
        <div class="btn-group mb-0 me-2">
            {!! $data->onEachSide(0)->render('task-manager.tasks.pagination') !!}
        </div>
    </div>
    <div class="col-lg-2 col-md-2 col-2 d-flex justify-content-end align-items-center" id="example_length">
        <select class="form-select sorting sorting-box" id="" name="example_length" aria-controls="example">
            <option value="10" {!! matchSelected($sort_by, 10) !!}>Show: 10</option>
            <option value="30" {!! matchSelected($sort_by, 30) !!}>Show: 30</option>
            <option value="50" {!! matchSelected($sort_by, 50) !!}>Show: 50</option>
        </select>
    </div>
</nav>

 </div>
 <script>
 </script>
