
<?php $__env->startSection('title'); ?> Business Type | SHOP <?php $__env->stopSection(); ?>
<?php $__env->startSection('business-type'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('business-type.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>Business Type 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('business-type.index')); ?>" class="text-primary  py-2 px-3 active">All
              (<?php echo e($allBusinessTypeCount); ?>)</a>
          </p>
        </div>
        <div class="d-none d-sm-block">
          <?php if(Auth::user()->can('business-type-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="#addBusinessType"><span class="">New Type</span></a>
          <?php endif; ?>
        </div>
      </div>

      <?php if(Auth::user()->can('business-type-create')): ?>
      <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none" data-bs-toggle="modal" data-bs-target="#addBusinessType">
        New Type</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 = $businessTypeData; $__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->type_name); ?>

              <div class="row-actions">
                  <?php if(Auth::user()->can('business-type-edit')): ?>
                  <span><a href="javascript:void(0)" class="edit_user_modal border-0 bg-transparent fw-bolder"
                      onclick="updateBusinessType(<?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('business-type-inactive', $item->id)); ?>">Inactive</a></span>
                  <?php else: ?>
                  <span> | <a class="text-success fw-bolder" href="<?php echo e(route('business-type-active', $item->id)); ?>">Active</a></span>
                  <?php endif; ?>

                  <?php endif; ?>

                  <?php if(Auth::user()->can('business-type-delete')): ?>
                  <span> | <a class="text-danger fw-bolder delete" href="<?php echo e(route('business-type-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="updateBusinessType<?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 Business Type</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('business-type.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="type_name" class="form-label mb-2">Type Name <span
                            class="text-danger">(required)</span></label>
                        <input type="text" class="form-control  form-control-solid" name="type_name" id="type_name"
                          placeholder="Type Name" value="<?php echo e($item->type_name); ?>" required>

                        <?php $__errorArgs = ['type_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($allBusinessTypeCount) && $allBusinessTypeCount > 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($businessTypeData->firstItem()); ?></span>
          <?php echo e(__('to')); ?>

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

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

        </p>
      </div>

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

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

  </div>

  
  <div class="modal fade" id="addBusinessType" 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 Business Type</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('business-type.store')); ?>" method="POST" onsubmit="return checkValidate()">
            <?php echo csrf_field(); ?>
            <div class="row px-4">
              <div class=" col-md-12 my-1">
                <label for="type_name" class="form-label mb-2">Type Name <span class="text-danger">(required)</span></label>
                <input type="text" class="form-control  form-control-solid" name="type_name" id="type_name" placeholder="Type Name"
                  required>

                <?php $__errorArgs = ['type_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 updateBusinessType(id) {
      $("#updateBusinessType"+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/businessType/index.blade.php ENDPATH**/ ?>