b6dd8a810e9ce45a2afddce14a12f8af857f16ec.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <?php $__env->startSection('panel_content'); ?>
  2. <div class="aiz-titlebar text-left mt-2 mb-3 row align-items-center">
  3. <div class="align-items-center">
  4. <h1 class="h3"><?php echo e(translate('All Customers')); ?></h1>
  5. </div>
  6. <!--<div class="col text-right">
  7. <a href="<?php echo e(route('salesman.customers.create')); ?>" class="btn btn-circle btn-info">
  8. <span><?php echo e(translate('Add Virtual Account')); ?></span>
  9. </a>
  10. </div> -->
  11. <div class="ml-auto" style="margin-right: 6px;">
  12. <button id="create_virtual_user" type="button" class="btn btn-outline-primary btn-block" onclick=""><?php echo e(translate('Create Virtual Customers')); ?></button>
  13. </div>
  14. </div>
  15. <div class="card">
  16. <form class="" id="sort_customers" action="" method="GET">
  17. <div class="card-header row gutters-5">
  18. <div class="col">
  19. <h5 class="mb-0 h6"><?php echo e(translate('Customers')); ?></h5>
  20. </div>
  21. <div class="dropdown mb-2 mb-md-0">
  22. <button class="btn border dropdown-toggle" type="button" data-toggle="dropdown">
  23. <?php echo e(translate('Bulk Action')); ?>
  24. </button>
  25. <div class="dropdown-menu dropdown-menu-right">
  26. <a class="dropdown-item" href="#" onclick="bulk_delete()"><?php echo e(translate('Delete selection')); ?></a>
  27. </div>
  28. </div>
  29. <div class="col-md-3">
  30. <div class="form-group mb-0">
  31. <input type="text" class="form-control" id="search" name="search"<?php if(isset($sort_search)): ?> value="<?php echo e($sort_search); ?>" <?php endif; ?> placeholder="<?php echo e(translate('Type email or name & Enter')); ?>">
  32. </div>
  33. </div>
  34. </div>
  35. <div class="card-body">
  36. <table class="table aiz-table mb-0">
  37. <thead>
  38. <tr>
  39. <!--<th data-breakpoints="lg">#</th>-->
  40. <th>
  41. <div class="form-group">
  42. <div class="aiz-checkbox-inline">
  43. <label class="aiz-checkbox">
  44. <input type="checkbox" class="check-all">
  45. <span class="aiz-square-check"></span>
  46. </label>
  47. </div>
  48. </div>
  49. </th>
  50. <th><?php echo e(translate('Name')); ?></th>
  51. <th data-breakpoints="lg"><?php echo e(translate('Email Address')); ?></th>
  52. <th data-breakpoints="lg"><?php echo e(translate('Phone')); ?></th>
  53. <th data-breakpoints="lg"><?php echo e(translate('Package')); ?></th>
  54. <th data-breakpoints="lg"><?php echo e(translate('Wallet Balance')); ?></th>
  55. <th><?php echo e(translate('Options')); ?></th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
  60. <?php if($user != null): ?>
  61. <tr>
  62. <!--<td><?php echo e(($key+1) + ($users->currentPage() - 1)*$users->perPage()); ?></td>-->
  63. <td>
  64. <div class="form-group">
  65. <div class="aiz-checkbox-inline">
  66. <label class="aiz-checkbox">
  67. <input type="checkbox" class="check-one" name="id[]" value="<?php echo e($user->id); ?>">
  68. <span class="aiz-square-check"></span>
  69. </label>
  70. </div>
  71. </div>
  72. </td>
  73. <td><?php if($user->banned == 1): ?> <i class="fa fa-ban text-danger" aria-hidden="true"></i> <?php endif; ?> <?php echo e($user->name); ?> <?php if($user->is_virtual_user == 1): ?> (<font color="red"><?php echo e(translate('Virtual')); ?></font>) <?php endif; ?></td>
  74. <td><?php echo e($user->email); ?></td>
  75. <td><?php echo e($user->phone); ?></td>
  76. <td>
  77. <?php if($user->customer_package != null): ?>
  78. <?php echo e($user->customer_package->getTranslation('name')); ?>
  79. <?php endif; ?>
  80. </td>
  81. <td><?php echo e(single_price($user->balance)); ?></td>
  82. <td class="text-right">
  83. <a href="<?php echo e(route('customers.login', encrypt($user->id))); ?>" class="btn btn-soft-primary btn-icon btn-circle btn-sm" title="<?php echo e(translate('Log in as this Customer')); ?>">
  84. <i class="las la-edit"></i>
  85. </a>
  86. <?php if(Auth::user()->user_type == 'salesman' && false): ?>
  87. <a href="<?php echo e(route('customers.login', encrypt($user->id))); ?>" class="btn btn-soft-primary btn-icon btn-circle btn-sm" title="<?php echo e(translate('Log in as this Customer')); ?>">
  88. <i class="las la-edit"></i>
  89. </a>
  90. <?php endif; ?>
  91. <?php if($user->banned != 1): ?>
  92. <a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm" onclick="confirm_ban('<?php echo e(route('salesman.customers.ban', encrypt($user->id))); ?>');" title="<?php echo e(translate('Ban this Customer')); ?>">
  93. <i class="las la-user-slash"></i>
  94. </a>
  95. <?php else: ?>
  96. <a href="#" class="btn btn-soft-success btn-icon btn-circle btn-sm" onclick="confirm_unban('<?php echo e(route('salesman.customers.ban', encrypt($user->id))); ?>');" title="<?php echo e(translate('Unban this Customer')); ?>">
  97. <i class="las la-user-check"></i>
  98. </a>
  99. <?php endif; ?>
  100. <a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm confirm-delete" data-href="<?php echo e(route('salesman.customers.destroy', $user->id)); ?>" title="<?php echo e(translate('Delete')); ?>">
  101. <i class="las la-trash"></i>
  102. </a>
  103. </td>
  104. </tr>
  105. <?php endif; ?>
  106. <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
  107. </tbody>
  108. </table>
  109. <div class="aiz-pagination">
  110. <?php echo e($users->appends(request()->input())->links()); ?>
  111. </div>
  112. </div>
  113. </form>
  114. </div>
  115. <div class="modal fade" id="confirm-ban">
  116. <div class="modal-dialog">
  117. <div class="modal-content">
  118. <div class="modal-header">
  119. <h5 class="modal-title h6"><?php echo e(translate('Confirmation')); ?></h5>
  120. <button type="button" class="close" data-dismiss="modal"></button>
  121. </div>
  122. <div class="modal-body">
  123. <p><?php echo e(translate('Do you really want to ban this Customer?')); ?></p>
  124. </div>
  125. <div class="modal-footer">
  126. <button type="button" class="btn btn-light" data-dismiss="modal"><?php echo e(translate('Cancel')); ?></button>
  127. <a type="button" id="confirmation" class="btn btn-primary"><?php echo e(translate('Proceed!')); ?></a>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <div class="modal fade" id="confirm-unban">
  133. <div class="modal-dialog">
  134. <div class="modal-content">
  135. <div class="modal-header">
  136. <h5 class="modal-title h6"><?php echo e(translate('Confirmation')); ?></h5>
  137. <button type="button" class="close" data-dismiss="modal"></button>
  138. </div>
  139. <div class="modal-body">
  140. <p><?php echo e(translate('Do you really want to unban this Customer?')); ?></p>
  141. </div>
  142. <div class="modal-footer">
  143. <button type="button" class="btn btn-light" data-dismiss="modal"><?php echo e(translate('Cancel')); ?></button>
  144. <a type="button" id="confirmationunban" class="btn btn-primary"><?php echo e(translate('Proceed!')); ?></a>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <?php $__env->stopSection(); ?>
  150. <?php $__env->startSection('modal'); ?>
  151. <?php echo $__env->make('modals.delete_modal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  152. <div class="modal fade" id="virtual_user_form" data-backdrop="static">
  153. <div class="modal-dialog modal-lg">
  154. <div class="modal-content">
  155. <div class="modal-header">
  156. <h5 class="modal-title h6"><?php echo e(translate('Create Virtual Customers')); ?></h5>
  157. <button type="button" class="close" data-dismiss="modal"></button>
  158. </div>
  159. <div class="modal-body">
  160. <div style="margin-bottom: 16px; font-size: 14px; ">
  161. <i><?php echo e(translate('N:B: You can create virtual customers here, with a maximum of 100 people')); ?></i>
  162. </div>
  163. <form class="form-horizontal" action="<?php echo e(route('customers.create_virtual_user')); ?>" method="POST">
  164. <!--<div class="form-group row">
  165. <div class="col-lg-2"><?php echo e(translate('Name Prefix')); ?></div>
  166. <div class="col-lg-6">
  167. <input type="text" class="form-control" name="name_prefix" value="" placeholder="Prefix of Name" required>
  168. </div>
  169. <div class="col-lg-4"><span><?php echo e(translate('Optional')); ?></span></div>
  170. </div>-->
  171. <div class="form-group row" style="display:none;">
  172. <div class="col-lg-2"><?php echo e(translate('Referrel User')); ?></div>
  173. <div class="col-lg-6">
  174. <input type="number" class="form-control" name="referred_by" value="<?php echo Auth::user()->id;?>" placeholder="Referrel User" required>
  175. </div>
  176. </div>
  177. <div class="form-group row">
  178. <div class="col-lg-2"><?php echo e(translate('Quantity')); ?></div>
  179. <div class="col-lg-6">
  180. <input type="number" min="1" step="1" max="100" class="form-control" name="quantity" value="1" placeholder="Quantity of generate" required>
  181. </div>
  182. </div>
  183. <div class="form-group row">
  184. <div class="col-lg-2"><?php echo e(translate('Initial Balance')); ?></div>
  185. <div class="col-lg-6">
  186. <input type="number" min="0" class="form-control" name="balance" value="0.00" placeholder="Initial Balance of Accounts" required>
  187. </div>
  188. </div>
  189. <div class="form-group row">
  190. <div class="col-lg-2"></div>
  191. <div class="col-lg-6">
  192. <div style="display: flex; align-items: center;">
  193. <div class="aiz-checkbox-inline" style="display: inline-block;">
  194. <label class="aiz-checkbox">
  195. <input type="checkbox" class="check-one" name="disable_login" value="1">
  196. <span class="aiz-square-check"></span>
  197. </label>
  198. </div>
  199. <span style="margin-top: 14px;"><?php echo e(translate('Disable Log in')); ?></span>
  200. </div>
  201. </div>
  202. </div>
  203. </form>
  204. </div>
  205. <div class="modal-footer">
  206. <button type="button" class="btn btn-light" data-dismiss="modal"><?php echo e(translate('Cancel')); ?></button>
  207. <a type="button" id="submitVirtualCustomer" class="btn btn-primary"><?php echo e(translate('Submit')); ?></a>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. <?php $__env->stopSection(); ?>
  213. <?php $__env->startSection('script'); ?>
  214. <script type="text/javascript">
  215. $(function() {
  216. $('#create_virtual_user').bind('click', function() {
  217. $('#virtual_user_form').modal('show')
  218. })
  219. $('#submitVirtualCustomer').bind('click', function() {
  220. let target = $(this)
  221. if (target.hasClass('disabled')) return false
  222. target.addClass('disabled');
  223. let max = $('input[name=quantity]').val()
  224. let balance = $('input[name=balance]').val()
  225. let referred_by = $('input[name=referred_by]').val()
  226. fetch('<?php echo e(route('customers.create_virtual_user')); ?>', {
  227. method: 'POST',
  228. headers: {
  229. 'Content-Type': 'application/json',
  230. 'X-Requested-With': 'fetch'
  231. },
  232. body: JSON.stringify({
  233. _token: '<?php echo e(csrf_token()); ?>',
  234. max,
  235. balance,
  236. referred_by,
  237. })
  238. })
  239. .then(resp => resp.text())
  240. .then(res => {
  241. if (res == 1) {
  242. AIZ.plugins.notify('success', '<?php echo e(translate('Successfully created virtual customer')); ?>')
  243. setTimeout(() => {
  244. window.location.reload()
  245. }, 500)
  246. } else {
  247. AIZ.plugins.notify('danger', '<?php echo e(translate('Executed failure Try again')); ?>')
  248. target.removeClass('disabled')
  249. }
  250. })
  251. .catch(err => null).finally(() => {
  252. //target.removeClass('disabled')
  253. })
  254. })
  255. })
  256. $(document).on("change", ".check-all", function() {
  257. if(this.checked) {
  258. // Iterate each checkbox
  259. $('.check-one:checkbox').each(function() {
  260. this.checked = true;
  261. });
  262. } else {
  263. $('.check-one:checkbox').each(function() {
  264. this.checked = false;
  265. });
  266. }
  267. });
  268. function sort_customers(el){
  269. $('#sort_customers').submit();
  270. }
  271. function confirm_ban(url)
  272. {
  273. $('#confirm-ban').modal('show', {backdrop: 'static'});
  274. document.getElementById('confirmation').setAttribute('href' , url);
  275. }
  276. function confirm_unban(url)
  277. {
  278. $('#confirm-unban').modal('show', {backdrop: 'static'});
  279. document.getElementById('confirmationunban').setAttribute('href' , url);
  280. }
  281. function bulk_delete() {
  282. var data = new FormData($('#sort_customers')[0]);
  283. $.ajax({
  284. headers: {
  285. 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  286. },
  287. url: "<?php echo e(route('bulk-customer-delete')); ?>",
  288. type: 'POST',
  289. data: data,
  290. cache: false,
  291. contentType: false,
  292. processData: false,
  293. success: function (response) {
  294. if(response == 1) {
  295. location.reload();
  296. }
  297. }
  298. });
  299. }
  300. </script>
  301. <?php $__env->stopSection(); ?>
  302. <?php echo $__env->make('salesman.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /www/wwwroot/www.easybuyjp.shop/resources/views/salesman/customers/index.blade.php ENDPATH**/ ?>