
<?php $__env->startSection('title'); ?> ইউজার  | TESTPAPER <?php $__env->stopSection(); ?>
<?php $__env->startSection('class'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('class.index'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>

<!-- BEGIN: Content-->
<?php $__env->startSection('main_content_section'); ?>
<div class="row py-3 ps-2">
  <div class="heading d-flex justify-content-start heading-margin-bottom-minus">
    <h3 class="mb-0"><span>ইউজারের তালিকা</span></h3>
  </div>
</div>


<div class="table_wrapper py-1 card min-vh-100">
  <div class="row my-2 aggregate-section-div">
    <div class="px-3 ">
      <div class=" d-flex justify-content-between align-items-center aggregate-section border">
        <div class="d-flex align-items-center py-1">
          
        </div>
        <div class="d-none d-sm-block">
          <?php if(Auth::user()->can('user-create')): ?> 
            <a href="javascript:void(0)" class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0"
              data-bs-toggle="modal" data-bs-target="#oneInputModalCenterForLarge"><span class="">নতুন ইউজার</span></a>
          <?php endif; ?>
        </div>
      </div>

     <?php if(Auth::user()->can('user-create')): ?> 
       <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none" data-bs-toggle="modal"
         data-bs-target="#oneInputModalCenterForLarge">নতুন ইউজার</div>
     <?php endif; ?>
    </div>
  </div>



  <div class="row px-3">
    <div class="table-container table-responsive">
      <table id="" class="table table-bordered">
        <thead class="text-uppercase">
          <tr class="me-3">

            <th class="text-center" scope="col"><span>ইউজারের নাম</span></th>
            <th class="text-center" scope="col"><span> ইমেইল </span></th>
            <th class="text-center" scope="col"><span> মোবাইল </span></th> 
            <th class="text-center" scope="col"><span> রোল </span></th> 
            <th class="text-center" scope="col"><span> আইডি </span></th>


          </tr>
        </thead>
        <tbody class="text-center">

          <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <?php if(isset($item) && $item != null): ?>
          <?php if(Auth::user()->can('user-list')): ?> 
            <tr class="">
              <td> 
                  <?php echo e($item->name); ?>

                  <div class="row-actions">
                      <?php if(Auth::user()->can('user-edit')): ?> 
                        <span><button href="javascript:void(0)" class="edit_user_modal border-0 bg-transparent"
                            value="<?php echo e($item->id); ?>"> <span class="text-primary">সম্পাদন</span>  | </button></span>
                      <?php endif; ?>
                      
                      <?php if(Auth::user()->can('user-delete')): ?> 
                        <span><a href="<?php echo e(route('user.delete', ['id'=>$item->id])); ?>" class="row-delete"><span
                          class="trash text-danger">ডিলিট</span> </a></span>
                      <?php endif; ?>
                  </div>
              </td>
              <td> <?php echo e($item->email); ?></td>
              <td> <?php echo e($item->mobile); ?></td>
              <td> <?php echo e($item->role); ?></td>
              <td>
                <div class="row_title">
                  <strong><a href="#"><?php echo e($item->id); ?></a></strong>
                </div>
              </td>
            </tr>
          <?php endif; ?>
          <?php endif; ?>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


        </tbody>
      </table>
    </div>

    
  </div>


</div>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('modal_section'); ?>

<div class="modal fade" id="oneInputModalCenterForLarge" tabindex="-1" aria-labelledby="oneInputModalLabel"
  aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered max-width-1000px">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="oneInputModalLabel">নতুন ইউজার</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body p-0">
        <form action="<?php echo e(route('users.store')); ?>" method="POST">
          <?php echo csrf_field(); ?>
          <div class="row">
            <div class=" col-md-6 px-4 my-1">
                <label for="name" class="form-label mb-2">ইউজার নাম <span class="text-danger">*</span></label>
                <input type="text" class="form-control  form-control-solid" name="name" id="name"
                  placeholder="Rabbi Hossain" required>
            </div>

            <div class="col-md-6 px-4 my-1">
                <label for="email" class="form-label mb-2">ইমেইল <span class="text-danger">*</span></label>
                <input type="text" class="form-control  form-control-solid" name="email" id="email"
                  placeholder="rabbi@gmail.com" required>
            </div> 
            <div class="col-md-6 px-4 my-1">
                <label for="mobile" class="form-label mb-2">মোবাইল <span class="text-danger">*</span></label>
                <input type="number" class="form-control  form-control-solid number-control-hide" name="mobile" id="mobile"
                  placeholder="01785-700000" required>
            </div>  

            <div class="col-md-6 px-4 my-1">
                <label for="password" class="form-label mb-2">পাসওয়ার্ড <span class="text-danger">*</span></label>
                <input type="password" class="form-control  form-control-solid" name="password" id="password"
                  placeholder="password" required>
            </div>  

            <div class="col-md-6 px-4 my-1">
                <label for="password_confirmation" class="form-label mb-2">নিশ্চিত পাসওয়ার্ড <span class="text-danger">*</span></label>
                <input type="password" class="form-control  form-control-solid" name="password_confirmation" id="password_confirmation"
                  placeholder="confirm password" required>
            </div>  

            <div class="col-md-6 px-4 my-1">
              <div class="form-group custom-select2-form setting-custom-select2-form">
                <label for="roles">রোল <span class=" text-danger">*</span>
                </label>
                <select name="roles" id="roles" class="form-select select2" 
                  onchange="classWiseDeptForCreate()" required>
                  <option value="" selected disabled> রোল সিলেক্ট করুন </option>
                  <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <option value="<?php echo e($role->id); ?>"><?php echo e(Str::title($role->name)); ?></option>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select> 
              </div>
            </div>  
          </div>
          <div class="modal-footer">
            <div class="">
              <button type="submit" class="btn btn-success">সংরক্ষন</button>
              <button type="button" class="btn btn-danger" data-bs-dismiss="modal">বাতিল</button>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>




<div class="modal fade" id="editoneInputModalCenter" tabindex="-1" aria-labelledby="oneInputModalLabel"
  aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered max-width-1000px">
    <div class="modal-content">
      <div class="modal-header">
        <h1 class="modal-title fs-5" id="oneInputModalLabel">সম্পাদন  ইউজার</h1>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body p-0">
        <form action="<?php echo e(route('users-update')); ?>" method="GET">
          <div class="row">
            <input type="hidden" id="edit_id" name="edit_id">
            <div class=" col-md-6 px-4 my-1">
                <label for="name" class="form-label mb-2">ইউজার নাম <span class="text-danger">*</span></label>
                <input type="text" class="form-control  form-control-solid" name="name" id="edit_name"
                  placeholder="Rabbi Hossain" required>
            </div>

            <div class="col-md-6 px-4 my-1">
                <label for="email" class="form-label mb-2">ইমেইল <span class="text-danger">*</span></label>
                <input type="text" class="form-control  form-control-solid" name="email" id="edit_email"
                  placeholder="rabbi@gmail.com" required>
            </div> 
            <div class="col-md-6 px-4 my-1">
                <label for="mobile" class="form-label mb-2">মোবাইল <span class="text-danger">*</span></label>
                <input type="number" class="form-control  form-control-solid number-control-hide" name="mobile" id="edit_mobile"
                  placeholder="01785-700000" required>
            </div>

            <div class="col-md-6 px-4 my-1">
              <div class="form-group custom-select2-form setting-custom-select2-form">
                <label for="roles">রোল <span class=" text-danger">*</span>
                </label>
                <select name="roles" id="edit_roles" class="form-select select2 mt-2" 
                  onchange="classWiseDeptForCreate()" required>
                  <option value="" selected disabled> রোল সিলেক্ট করুন </option>
                  <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                  <option value="<?php echo e($role->id); ?>"><?php echo e(Str::title($role->name)); ?></option>
                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select> 
              </div>
            </div>  
          </div>
          <div class="modal-footer">
            <div class="">
              <button type="submit" class="btn btn-success">সম্পাদন</button>
              <button type="button" class="btn btn-danger" data-bs-dismiss="modal">বাতিল</button>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</div>


<?php $__env->stopSection(); ?>
<!-- END: Content-->

<?php $__env->startSection('scripts'); ?>


<script>
  $(document).ready(function(){
          $(document).on('click', '.edit_user_modal', function(){
              $rowId = $(this).val();
              $('#editoneInputModalCenter').modal('show');
              $.ajax({
                  type:'GET',
                  url:'users-edit/'+$rowId,
                  success:function(response){
                      $rowId = response.id;
                      $name = response.name;
                      $email = response.email;
                      $mobile = response.mobile;
                      $('#edit_id').val($rowId);
                      $('#edit_name').val($name);
                    $('#edit_email').val($email);
                    $('#edit_mobile').val($mobile);
                  }
                  
                });
            });
        });

</script>

<script>

  // $('#edit_roles').select2({
  //   dropdownParent: $('#editoneInputModalCenter');
  // });

  $("#roles").select2({
      dropdownParent: $('#oneInputModalCenterForLarge')
    })

  $("#edit_roles").select2({
      dropdownParent: $('#editoneInputModalCenter')
    })

</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Project\Personal-Project\Office-Project\update\test-paper-final\resources\views/admin/userRole/users/index.blade.php ENDPATH**/ ?>