Viewing file: 25b10e04fd4ce04fd9f89cdff13f4aa9a313817e.php (26.71 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php if(auth()->user()->type =='admin'): ?> <?php $__env->startSection('title',trans('layout.customer')); ?> <?php else: ?> <?php $__env->startSection('title',trans('layout.staff')); ?> <?php endif; ?>
<?php $__env->startSection('css'); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('main-content'); ?> <div class="row page-titles mx-0"> <div class="col-sm-6 p-md-0"> <div class="welcome-text"> <?php if(auth()->user()->type =='admin'): ?> <h4><?php echo e(trans('layout.customer')); ?></h4> <?php else: ?> <h4><?php echo e(trans('layout.staff')); ?></h4> <?php endif; ?> <p class="mb-0"></p> </div> </div> <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex"> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>"><?php echo e(trans('layout.home')); ?></a></li> <?php if(auth()->user()->type =='admin'): ?> <li class="breadcrumb-item active"><a href="javascript:void(0)"><?php echo e(trans('layout.customer')); ?></a></li> <?php else: ?> <li class="breadcrumb-item active"><a href="javascript:void(0)"><?php echo e(trans('layout.staff')); ?></a></li> <?php endif; ?> </ol> </div> </div> <!-- row -->
<div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-header"> <h4 class="card-title"><?php echo e(trans('layout.list')); ?></h4> <div class="pull-right"> <button type="button" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#userCreateModal"> <?php echo e(trans('layout.create')); ?>
</button> </div> </div> <div class="card-body"> <div class="table-responsive"> <table class="table table-responsive-md"> <thead> <tr> <th><strong>#</strong></th> <th><strong><?php echo e(trans('layout.customer_details')); ?></strong></th> <?php if(auth()->user()->type =='restaurant_owner'): ?> <th><strong><?php echo e(trans('layout.role')); ?></strong></th> <th><strong><?php echo e(trans('layout.restaurant')); ?></strong></th> <?php endif; ?> <?php if(auth()->user()->type =='admin'): ?> <th><strong><?php echo e(trans('layout.plan_name')); ?></strong></th> <th><strong><?php echo e(trans('layout.expiry_date')); ?></strong></th> <th><strong><?php echo e(trans('layout.plan_status')); ?></strong></th> <th><strong><?php echo e(trans('layout.user_status')); ?></strong></th> <?php else: ?> <th></th> <th></th> <?php endif; ?> <th><strong><?php echo e(trans('layout.action')); ?></strong></th> </tr> </thead> <tbody> <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=> $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php $currentPlan=isset($customer->current_plans[0])?$customer->current_plans[0]:''; ?> <tr> <td><?php echo e(++$key); ?></td> <td> <?php echo e($customer->name); ?>
<?php if($customer->type == 'restaurant_owner'): ?> <div class="mb-1"> <span class="badge light badge-success"> <?php echo e($customer->restaurants->count()); ?> <?php if($customer->restaurants->count() == 1 || $customer->restaurants->count() == 0): ?> <?php echo e(trans('layout.branch')); ?>
<?php else: ?> <?php echo e(trans('layout.branches')); ?>
<?php endif; ?> </span> </div> <?php endif; ?> </td> <?php if(auth()->user()->type =='restaurant_owner'): ?> <td><?php echo e(ucfirst(str_replace('_', ' ', $customer->role))); ?></td> <td><?php echo e($customer->restaurant->name); ?></td> <?php endif; ?>
<?php if(auth()->user()->type=='admin'): ?> <?php if(isset($currentPlan->plan) && $currentPlan->plan->id == 1): ?> <td><?php echo e(trans('layout.choose_a_plan')); ?></td> <?php else: ?> <td><?php echo e($currentPlan?ucwords($currentPlan->plan->title):''); ?></td> <?php endif; ?> <td><?php echo e($currentPlan?$customer->current_plans[0]->expired_date:''); ?></td> <td> <?php if($currentPlan?ucwords($customer->current_plans[0]->status=='approved'):''): ?> <span class="badge light badge-success"><?php echo e(trans('layout.approved')); ?></span> <?php else: ?> <span class="badge light badge-warning"><?php echo e(trans('layout.pending')); ?></span> <?php endif; ?> </td> <td> <?php if($customer->status=='pending'): ?> <span class="badge light badge-info"><?php echo e(trans('layout.pending')); ?></span> <?php elseif($customer->status=='banned'): ?> <span class="badge light badge-warning"><?php echo e(trans('layout.banned')); ?></span> <?php else: ?> <span class="badge light badge-success"><?php echo e(trans('layout.approved')); ?></span> <?php endif; ?> </td> <?php else: ?> <td></td> <td></td> <?php endif; ?> <td> <div class="dropdown"> <button type="button" class="btn btn-success light sharp" data-toggle="dropdown"> <svg width="20px" height="20px" viewBox="0 0 24 24" version="1.1"> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect x="0" y="0" width="24" height="24"/> <circle fill="#000000" cx="5" cy="12" r="2"/> <circle fill="#000000" cx="12" cy="12" r="2"/> <circle fill="#000000" cx="19" cy="12" r="2"/> </g> </svg> </button> <div class="dropdown-menu"> <button class="dropdown-item edit_Customer" type="button" data-action="<?php echo e(route('customers.update', [$customer])); ?>" data-toggle="modal" data-target="#editCustomer" data-name="<?php echo e($customer->name); ?>" data-email="<?php echo e($customer->email); ?>" data-role="<?php echo e($customer->role ?? ''); ?>" data-restaurant="<?php echo e($customer->restaurant_id ?? ''); ?>" data-plan="<?php echo e($customer->current_plans[0]->plan_id ?? ''); ?>" data-id="<?php echo e($customer->id); ?>"> <?php echo e(trans('layout.edit')); ?>
</button> <button class="dropdown-item " type="button" data-message="<?php echo e(trans('layout.message.customer_delete_warning')); ?>" data-action='<?php echo e(route('customers.destroy',[$customer])); ?>' data-input={"_method":"delete"} data-toggle="modal" data-target="#modal-confirm"><?php echo e(trans('layout.delete')); ?></button> <?php if($customer->status == 'approved'): ?> <button class="dropdown-item" type="button" data-message="<?php echo e(trans('layout.message.customer_banned_warning')); ?>" data-action='<?php echo e(route('user.banned',[$customer])); ?>' data-input={"_method":"get","banned_id":"<?php echo e($customer->id); ?>"} data-toggle="modal" data-target="#modal-confirm"><?php echo e(trans('layout.banned')); ?></button> <?php elseif($customer->status == 'banned'): ?> <button class="dropdown-item" type="button" data-message="<?php echo e(trans('layout.message.customer_approved_warning')); ?>" data-action='<?php echo e(route('user.approved',[$customer])); ?>' data-input={"_method":"get","approved_id":"<?php echo e($customer->id); ?>"} data-toggle="modal" data-target="#modal-confirm"><?php echo e(trans('layout.approved')); ?></button> <?php else: ?> <button class="dropdown-item" type="button" data-message="<?php echo e(trans('layout.message.customer_banned_warning')); ?>" data-action='<?php echo e(route('user.banned',[$customer])); ?>' data-input={"_method":"get","banned_id":"<?php echo e($customer->id); ?>"} data-toggle="modal" data-target="#modal-confirm"><?php echo e(trans('layout.banned')); ?></button> <button class="dropdown-item" type="button" data-message="<?php echo e(trans('layout.message.customer_approved_warning')); ?>" data-action='<?php echo e(route('user.approved',[$customer])); ?>' data-input={"_method":"get","approved_id":"<?php echo e($customer->id); ?>"} data-toggle="modal" data-target="#modal-confirm"><?php echo e(trans('layout.approved')); ?></button> <?php endif; ?>
<?php if(auth()->user()->type=='admin'): ?> <?php if(!isset($customer->email_verified_at)): ?> <a class="dropdown-item" href="<?php echo e(route('verified.user', ['id'=>$customer->id])); ?>"><?php echo e(trans('layout.verify')); ?></a> <?php endif; ?> <button class="dropdown-item" type="button" data-message="<?php echo e(trans('layout.message.login_as_warning')); ?>" data-action='<?php echo e(route('restaurant.login.as',['id'=>$customer->id])); ?>' data-input={"_method":"get"} data-toggle="modal" data-target="#modal-confirm"><?php echo e(trans('layout.login_as')); ?></button> <?php endif; ?> </div> </div> </td> </tr> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </tbody> </table> </div> </div> </div> </div> </div> <!-- Modal Create --> <?php $__env->startSection('create-modal-id', 'userCreateModal'); ?> <?php $__env->startSection('create-modal-title', 'User Create'); ?> <?php $__env->startSection('create-modal-content-wapper'); ?> <form method="POST" action="<?php echo e(route('customers.store')); ?>"> <?php echo csrf_field(); ?> <div class="modal-body"> <div class="row"> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label"><?php echo e(trans('layout.name')); ?>*</label> <input type="text" name="name" class="form-control" placeholder="Ex: John Doe" required> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label"><?php echo e(trans('layout.email')); ?></label> <input readonly onfocus="this.removeAttribute('readonly');" type="email" class="form-control" placeholder="Ex: hello@example.com" name="email"> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label"><?php echo e(trans('layout.password')); ?></label> <input readonly onfocus="this.removeAttribute('readonly');" type="password" class="form-control" placeholder="<?php echo e(trans('layout.password')); ?>" name="password"> </div> </div> <?php if(auth()->user()->type=='admin'): ?> <div class="col-lg-6"> <div class="form-group"> <label class="mb-1"><?php echo e(trans('layout.choose_plan')); ?></label> <select name="plan_id" id="plan" class="form-control"> <?php $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option <?php echo e(isset($customer) && isset($customer->current_plans[0]) && $customer->current_plans[0]->plan_id==$plan->id?'selected':''); ?> value="<?php echo e($plan->id); ?>"><?php echo e($plan->title); ?>
(<?php echo e(formatNumberWithCurrSymbol($plan->cost)); ?>) </option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <?php endif; ?> <?php if(auth()->user()->type=='restaurant_owner'): ?> <div class="col-lg-6"> <div class="form-group"> <label class="mb-1"><?php echo e(trans('layout.role')); ?></label> <select name="role" class="form-control"> <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option <?php echo e(isset($customer->role) && $customer->role==$role->name?'selected':''); ?> value="<?php echo e($role->name); ?>"><?php echo e($role->name); ?>
</option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <div class="col-lg-12"> <div class="form-group"> <label class="mb-1"><?php echo e(trans('layout.restaurant')); ?></label> <select name="restaurant_id" class="form-control"> <?php $__currentLoopData = $restaurants; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $restaurant): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option <?php echo e(isset($customer->restaurant_id) && $customer->restaurant_id==$restaurant->id?'selected':''); ?> value="<?php echo e($restaurant->id); ?>"><?php echo e($restaurant->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <?php endif; ?> </div> </div> <div class="modal-footer"> <button type="button" aria-label="Close" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Submit</button> </div> </form> <?php $__env->stopSection(); ?> <!-- Modal Edit -->
<?php $__env->startSection('edit-modal-id', 'editCustomer'); ?> <?php $__env->startSection('edit-modal-title', 'Edit Customer'); ?> <?php $__env->startSection('edit-modal-content-wapper'); ?> <form id="editCustomerForm" method="POST"> <?php echo csrf_field(); ?> <?php echo method_field('PUT'); ?> <input type="hidden" value="" name="id" id="edit_id"> <div class="modal-body"> <div class="row"> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label"><?php echo e(trans('layout.name')); ?>*</label> <input type="text" id="edit_name" name="name" class="form-control" placeholder="Ex: John Doe" required> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label"><?php echo e(trans('layout.email')); ?></label> <input readonly onfocus="this.removeAttribute('readonly');" id="edit_email" type="email" class="form-control" placeholder="Ex: hello@example.com" name="email"> </div> </div> <div class="col-lg-6 mb-2"> <div class="form-group"> <label class="text-label"><?php echo e(trans('layout.password')); ?></label> <input readonly onfocus="this.removeAttribute('readonly');" id="edit_password" type="password" class="form-control" placeholder="<?php echo e(trans('layout.password')); ?>" name="password"> </div> </div> <?php if(auth()->user()->type == 'admin'): ?> <div class="col-lg-6"> <div class="form-group"> <label class="mb-1"><?php echo e(trans('layout.choose_plan')); ?></label> <select id="edit_plan" name="plan_id" class="form-control"> <?php $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($plan->id); ?>"><?php echo e($plan->title); ?> (<?php echo e(formatNumberWithCurrSymbol($plan->cost)); ?>)</option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <?php endif; ?> <?php if(auth()->user()->type == 'restaurant_owner'): ?> <div class="col-lg-6"> <div class="form-group"> <label class="mb-1"><?php echo e(trans('layout.role')); ?></label> <select id="edit_role" name="role" class="form-control"> <?php $__currentLoopData = $roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($role->name); ?>"><?php echo e($role->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <div class="col-lg-12"> <div class="form-group"> <label class="mb-1"><?php echo e(trans('layout.restaurant')); ?></label> <select id="edit_restaurant" name="restaurant_id" class="form-control"> <?php $__currentLoopData = $restaurants; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $restaurant): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($restaurant->id); ?>"><?php echo e($restaurant->name); ?></option> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </select> </div> </div> <?php endif; ?> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="submit" class="btn btn-primary">Submit</button> </div> </form> <?php $__env->stopSection(); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?> <script> $(document).on("click", ".edit_Customer", function(e) { e.preventDefault();
const id = $(this).data('id'); const name = $(this).data('name'); const email = $(this).data('email'); const role = $(this).data('role'); const restaurant = $(this).data('restaurant'); const plan = $(this).data('plan'); const actionUrl = $(this).data('action');
$('#edit_id').val(id); $('#edit_name').val(name); $('#edit_email').val(email); $('#edit_password').val(''); $('#edit_role').val(role).trigger('change'); $('#edit_restaurant').val(restaurant).trigger('change'); $('#edit_plan').val(plan).trigger('change');
$('#editCustomerForm').attr('action', actionUrl); $('#editCustomerForm').attr('action', $(this).attr('data-url')); $("#editCustomer").modal('show'); }); </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/picotech/domains/test.qr.picotech.app/public_html/resources/views/customer/index.blade.php ENDPATH**/ ?>
|