
<?php $__env->startSection('title'); ?> Floor | SHOP <?php $__env->stopSection(); ?>
<?php $__env->startSection('floor'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('floor.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>Floor List</span></h3>
  </div>
</div>


<div class="table_wrapper py-1 card">
  <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">
          <p class="mb-0"><a href="<?php echo e(route('floor.index')); ?>" class="text-primary  py-2 px-3 active">All
              (<?php echo e($allFloorCount); ?>)</a>
          </p>
        </div>
        <div class="d-none d-sm-block">
          <?php if(Auth::user()->can('floor-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="#addFloor"><span class="">New Floor</span></a>
          <?php endif; ?>
        </div>
      </div>

      <?php if(Auth::user()->can('floor-create')): ?>
      <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none" data-bs-toggle="modal" data-bs-target="#addFloor">
        New Floor</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>Name</span></th>
            <th class="text-center" scope="col"><span>Status</span></th>
            <th class="text-center w-25" scope="col"><span>Created</span></th>

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

          <?php $__currentLoopData = $floorData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
          <?php if(isset($item) && $item != null): ?>
          <tr class="">
            <td>
              <?php echo e($item->floor_name); ?>

              <div class="row-actions">
                  <?php if(Auth::user()->can('floor-edit')): ?>
                  <span><a href="javascript:void(0)" class="edit_user_modal border-0 bg-transparent fw-bolder"
                      onclick="updateFloor(<?php echo e($item->id); ?>)"> <span class="text-primary">Edit</span></a></span>
                  

                  <?php if($item->status == true): ?>
                  <span> | <a class="text-warning fw-bolder"
                      href="<?php echo e(route('floor-inactive', $item->id)); ?>">Inactive</a></span>
                  <?php else: ?>
                  <span> | <a class="text-success fw-bolder" href="<?php echo e(route('floor-active', $item->id)); ?>">Active</a></span>
                  <?php endif; ?>

                  <?php endif; ?>

                  <?php if(Auth::user()->can('floor-delete')): ?>
                  <span> | <a class="text-danger fw-bolder delete" href="<?php echo e(route('floor-delete', $item->id)); ?>">Delete</a></span>
                  <?php endif; ?>
              </div>
            </td>

            <td>
              <?php if($item->status == true): ?>
              <span class="badge bg-success">Active</span>
              <?php else: ?>
              <span class="badge bg-warning">Inactive</span>
              <?php endif; ?>
            </td>

            <td class="text-start w-25">
              <b>Date: </b><?php echo e(Carbon\Carbon::parse($item->created_at->toDateString())->format('d-m-Y')); ?> <br>
              <b>Time: </b><?php echo e(Carbon\Carbon::create($item->created_at->toTimeString())->format('h:i')); ?>

            </td>

          </tr>

          
          <div class="modal fade" id="updateFloor<?php echo e($item->id); ?>" tabindex="-1" aria-labelledby="oneInputModalLabel"
            aria-hidden="true" data-bs-backdrop="static">
            <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">Update Floor</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('floor.update', $item->id)); ?>" method="post" enctype="multipart/form-data"
                    onsubmit="return checkValidateForUpdate(<?php echo e($item->id); ?>)">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('put'); ?>
                    <div class="row px-4">
                      <div class=" col-md-12 my-1">
                        <label for="floor_name" class="form-label mb-2">Name <span
                            class="text-danger">(required)</span></label>
                        <input type="text" class="form-control  form-control-solid" name="floor_name" id="floor_name"
                          placeholder="Name" value="<?php echo e($item->floor_name); ?>" required>

                        <?php $__errorArgs = ['floor_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <span class=text-danger><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                      </div>
                      
                    </div>
                    <div class="modal-footer">
                      <div class="">
                        <button type="submit" class="btn btn-success">Update</button>
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
                      </div>
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
          <?php endif; ?>
          <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


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

    <?php if(isset($allFloorCount) && $allFloorCount > 10): ?>
    <div class="clearfix d-flex pb-2">
      <div class="float-left">
        <p class="text-muted">
          <?php echo e(__('Showing')); ?>

          <span class="font-weight-bold"><?php echo e($floorData->firstItem()); ?></span>
          <?php echo e(__('to')); ?>

          <span class="font-weight-bold"><?php echo e($floorData->lastItem()); ?></span>
          <?php echo e(__('of')); ?>

          <span class="font-weight-bold"><?php echo e($floorData->total()); ?></span>
          <?php echo e(__('results')); ?>

        </p>
      </div>

      <div class="float-right custom-table-pagination">
        <?php echo $floorData->links('pagination::bootstrap-4'); ?>

      </div>
    </div>
    <?php endif; ?>

  </div>

  
  <div class="modal fade" id="addFloor" tabindex="-1" aria-labelledby="oneInputModalLabel" aria-hidden="true"
    data-bs-backdrop="static">
    <div class="modal-dialog modal-dialog-centered max-width-900px">
      <div class="modal-content">
        <div class="modal-header">
          <h1 class="modal-title fs-5" id="oneInputModalLabel">New Floor</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('floor.store')); ?>" method="POST" onsubmit="return checkValidate()">
            <?php echo csrf_field(); ?>
            <div class="row px-4">
              <div class=" col-md-12 my-1">
                <label for="floor_name" class="form-label mb-2">Name <span class="text-danger">(required)</span></label>
                <input type="text" class="form-control  form-control-solid" name="floor_name" id="floor_name" placeholder="Name"
                  required>

                <?php $__errorArgs = ['floor_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                <span class=text-danger><?php echo e($message); ?></span>
                <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
              </div>
            </div>
            <div class="modal-footer">
              <div class="">
                <button type="submit" class="btn btn-success">Save</button>
                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>

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


<?php $__env->startSection('scripts'); ?>
<script>
    function checkValidate() {
        return true;
    }
    
    //For update...
    function checkValidateForUpdate(id) {
        return true;
    }
    
    //To show update modal...
    function updateFloor(id) {
      $("#updateFloor"+id).modal('show');
    }
</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\Next-Web-Service\muktijoddhe-somobai-somity\resources\views/admin/others/floor/index.blade.php ENDPATH**/ ?>