@extends('layouts.admin')
{{-- @section('title', __('Users Account Delete Requests'))
@section('breadcum')
  <div class="breadcrumbbar">
      <h4 class="page-title">{{ __('Delete Requests') }}</h4>
      <div class="breadcrumb-list">
          <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{{url('/admin')}}" title="{{ __('Dashboard') }}">{{ __('Dashboard') }}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{{ __('Delete Requests') }}</li>
          </ol>
      </div>  
    </div>
@endsection --}}
@section('content')
    <div class="contentbar">
        <div class="row">
            @if ($errors->any())
                <div class="alert alert-danger" role="alert">
                    @foreach ($errors->all() as $error)
                        <p>{{ $error }}<button type="button" class="close" data-dismiss="alert" aria-label="Close"
                                title="{{ __('Close') }}">
                                <span aria-hidden="true" style="color:red;">&times;</span></button></p>
                    @endforeach
                </div>
            @endif
            <!-- row started -->
            <div class="col-lg-12">
                <div class="card dashboard-card m-b-30">                    
                    <div class="card-header">
                        {{-- <button type="button" class="float-right btn btn-danger-rgba mr-2 float-right" data-toggle="modal"
                            data-target="#bulk_delete" title="{{ __('Delete Selected') }}"><i
                                class="feather icon-trash mr-2"></i> {{ __('Delete Selected') }}</button> --}}
                        <h3 class="card-box">{{ __('All Delete Requests List') }}</h3 >
                    </div>
                    <!-- card body started -->
                    <div class="content-block box">
                        <div class="box-body table-responsive">
                          <table id="example1" class="table table-striped">
                                <thead>
                                    <th>
                                        <input id="checkboxAll" type="checkbox" class="filled-in" name="checked[]"
                                            value="all" />
                                        <label for="checkboxAll" class="material-checkbox"></label> #
                                    </th>
                                    <th>{{ __('User') }}</th>
                                    <th>{{ __('Reason') }}</th>
                                    <th>{{ __('Action') }}</th>
                                </thead>
                                <tbody>
                                    @foreach ($users as $key => $test)
                                        @if (isset($test))
                                            <tr>
                                                <td>
                                                    <input type='checkbox' form='bulk_delete_form'
                                                        class='check filled-in material-checkbox-input' name='checked[]'
                                                        value="{{ $test->id }}" id='checkbox{{ $test->id }}'>
                                                    <label for='checkbox{{ $test->id }}'
                                                        class='material-checkbox'></label>
                                                    <?php echo $key + 1; ?>
                                                    <div id="bulk_delete" class="delete-modal modal fade" role="dialog">
                                                        <div class="modal-dialog modal-sm">
                                                            <!-- Modal content-->
                                                            <div class="modal-content">
                                                                <div class="modal-header">
                                                                    <button type="button" class="close"
                                                                        data-dismiss="modal"
                                                                        title="{{ __('Close') }}">&times;</button>
                                                                    <div class="delete-icon"></div>
                                                                </div>
                                                                <div class="modal-body text-center">
                                                                    <h4 class="modal-heading">{{ __('Are You Sure') }} ?
                                                                    </h4>
                                                                    <p>{{ __('Do you really want to delete selected item ? This process
                                                                                                                        cannot be undone') }}.
                                                                    </p>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <form id="bulk_delete_form" method="post"
                                                                        action="{{ route('users-bulk-delete') }}">
                                                                        @csrf
                                                                        @method('POST')
                                                                        <button type="reset"
                                                                            class="btn btn-gray translate-y-3"
                                                                            data-dismiss="modal">{{ __('No') }}</button>
                                                                        <button type="submit"
                                                                            class="btn btn-danger">{{ __('Yes') }}</button>
                                                                    </form>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </td>
                                                <td>
                                                    {{ $test->name }}
                                                </td>
                                                <td>
                                                    {{ $test->delete_reason }}
                                                </td>
                                                <td>
                                                    <div class="dropdown">
                                                        {{-- <button class="btn btn-round btn-outline-primary" type="button"
                                                            id="CustomdropdownMenuButton1" data-toggle="dropdown"
                                                            aria-haspopup="true" aria-expanded="false"
                                                            title="{{ __('Settings') }}"><i
                                                                class="feather icon-more-vertical-"></i></button> --}}
                                                        {{-- <div class="dropdown-menu"
                                                            aria-labelledby="CustomdropdownMenuButton1"> --}}
                                                            <a class="dropdown-item btn" data-toggle="modal"
                                                                data-target="#delete{{ $test->id }}"
                                                                title="{{ __('Delete') }}">
                                                                <i
                                                                    class="feather icon-delete mr-2"></i>{{ __('Delete') }}</a>
                                                            </a>
                                                        {{-- </div> --}}
                                                    </div>
                                                    
                                                    <!-- delete Modal start -->
                                                    <div class="modal fade bd-example-modal-sm"
                                                        id="delete{{ $test->id }}" tabindex="-1" role="dialog"
                                                        aria-hidden="true">
                                                        <div class="modal-dialog modal-sm">
                                                            <div class="modal-content">
                                                                <div class="modal-header">
                                                                    <h5 class="modal-title" id="exampleSmallModalLabel">
                                                                        {{ __('Delete') }}</h5>
                                                                    <button type="button" class="close"
                                                                        data-dismiss="modal" aria-label="Close"
                                                                        title="{{ __('Close') }}">
                                                                        <span aria-hidden="true">&times;</span>
                                                                    </button>
                                                                </div>
                                                                <div class="modal-body">
                                                                    <h4>{{ __('Are You Sure ?') }}</h4>
                                                                    <p>{{ __('Do you really want to delete') }}
                                                                        <b>{{ $test->title }}</b>
                                                                        ? {{ __('This process cannot be undone.') }}</p>
                                                                </div>
                                                                <div class="modal-footer">
                                                                    <form method="post"
                                                                        action="{{ url('admin/user-delete/' . $test->id) }}"
                                                                        class="pull-right">
                                                                        {{ csrf_field() }}
                                                                        {{ method_field('DELETE') }}
                                                                        <button type="reset" class="btn btn-secondary"
                                                                            data-dismiss="modal">{{ __('No') }}</button>
                                                                        <button type="submit"
                                                                            class="btn btn-primary">{{ __('Yes') }}</button>
                                                                    </form>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <!-- delete Model ended -->
                                                    
                                                </td>

                                            </tr>
                                        @endif
                                    @endforeach
                                </tbody>
                            </table>
                            <!-- table to display faq data end -->
                        </div><!-- table-responsive div end -->
                    </div><!-- card body end -->

                </div><!-- col end -->
            </div>
        </div>
    </div>
    <!-- row end -->
    <br><br>
@endsection
<!-- main content section ended -->
@section('script')
    <script src="{{ url('admin_assets/assets/js/lightbox-plus-jquery.min.js') }}"></script>
    <script>
        $("#checkboxAll").on('click', function() {
            $('input.check').not(this).prop('checked', this.checked);
        });
    </script>
@endsection
