aebbeb72775a9e05042321d0acc873e4394eb9de.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <?php $__env->startSection('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('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="" style="margin-left: 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>
  74. <?php if($user->is_virtual_user == 1): ?><span class='badge badge-inline badge-warning' style="margin-right: 4px; "><?php echo e(translate('Virtual')); ?></span><?php endif; ?>
  75. <?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>
  76. <td><?php echo e($user->email); ?></td>
  77. <td><?php echo e($user->phone); ?></td>
  78. <td>
  79. <?php if($user->customer_package != null): ?>
  80. <?php echo e($user->customer_package->getTranslation('name')); ?>
  81. <?php endif; ?>
  82. </td>
  83. <td><?php echo e(single_price($user->balance)); ?></td>
  84. <td class="text-right">
  85. <?php if(Auth::user()->user_type == 'admin'): ?>
  86. <a href="#" class="btn btn-soft-success btn-icon btn-circle btn-sm" style="display: inline-flex;width: auto" onclick="show_make_wallet_recharge_modal('<?php echo e($user->id); ?>');" title="<?php echo e(translate('Recharge')); ?>">
  87. <?php echo e(translate('Recharge')); ?>
  88. </a>
  89. <?php endif; ?>
  90. <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')); ?>">
  91. <i class="las la-edit"></i> </a>
  92. <?php if(Auth::user()->user_type == 'salesman'): ?>
  93. <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')); ?>">
  94. <i class="las la-edit"></i>
  95. </a>
  96. <?php endif; ?>
  97. <?php if($user->banned != 1): ?>
  98. <a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm" onclick="confirm_ban('<?php echo e(route('customers.ban', encrypt($user->id))); ?>');" title="<?php echo e(translate('Ban this Customer')); ?>">
  99. <i class="las la-user-slash"></i>
  100. </a>
  101. <?php else: ?>
  102. <a href="#" class="btn btn-soft-success btn-icon btn-circle btn-sm" onclick="confirm_unban('<?php echo e(route('customers.ban', encrypt($user->id))); ?>');" title="<?php echo e(translate('Unban this Customer')); ?>">
  103. <i class="las la-user-check"></i>
  104. </a>
  105. <?php endif; ?>
  106. <a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm confirm-delete" data-href="<?php echo e(route('customers.destroy', $user->id)); ?>" title="<?php echo e(translate('Delete')); ?>">
  107. <i class="las la-trash"></i>
  108. </a>
  109. </td>
  110. </tr>
  111. <?php endif; ?>
  112. <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
  113. </tbody>
  114. </table>
  115. <div class="aiz-pagination">
  116. <?php echo e($users->appends(request()->input())->links()); ?>
  117. </div>
  118. </div>
  119. </form>
  120. </div>
  121. <div class="modal fade" id="confirm-ban">
  122. <div class="modal-dialog">
  123. <div class="modal-content">
  124. <div class="modal-header">
  125. <h5 class="modal-title h6"><?php echo e(translate('Confirmation')); ?></h5>
  126. <button type="button" class="close" data-dismiss="modal"></button>
  127. </div>
  128. <div class="modal-body">
  129. <p><?php echo e(translate('Do you really want to ban this Customer?')); ?></p>
  130. </div>
  131. <div class="modal-footer">
  132. <button type="button" class="btn btn-light" data-dismiss="modal"><?php echo e(translate('Cancel')); ?></button>
  133. <a type="button" id="confirmation" class="btn btn-primary"><?php echo e(translate('Proceed!')); ?></a>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="modal fade" id="confirm-unban">
  139. <div class="modal-dialog">
  140. <div class="modal-content">
  141. <div class="modal-header">
  142. <h5 class="modal-title h6"><?php echo e(translate('Confirmation')); ?></h5>
  143. <button type="button" class="close" data-dismiss="modal"></button>
  144. </div>
  145. <div class="modal-body">
  146. <p><?php echo e(translate('Do you really want to unban this Customer?')); ?></p>
  147. </div>
  148. <div class="modal-footer">
  149. <button type="button" class="btn btn-light" data-dismiss="modal"><?php echo e(translate('Cancel')); ?></button>
  150. <a type="button" id="confirmationunban" class="btn btn-primary"><?php echo e(translate('Proceed!')); ?></a>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. <?php $__env->stopSection(); ?>
  156. <?php $__env->startSection('modal'); ?>
  157. <?php echo $__env->make('modals.delete_modal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  158. <div class="modal fade" id="virtual_user_form" data-backdrop="static">
  159. <div class="modal-dialog modal-lg">
  160. <div class="modal-content">
  161. <div class="modal-header">
  162. <h5 class="modal-title h6"><?php echo e(translate('Create Virtual Customers')); ?></h5>
  163. <button type="button" class="close" data-dismiss="modal"></button>
  164. </div>
  165. <div class="modal-body">
  166. <div style="margin-bottom: 16px; font-size: 14px; ">
  167. <i><?php echo e(translate('N:B: You can create virtual customers here, with a maximum of 100 people')); ?></i>
  168. </div>
  169. <form class="form-horizontal" action="<?php echo e(route('customers.create_virtual_user')); ?>" method="POST">
  170. <!--<div class="form-group row">
  171. <div class="col-lg-2"><?php echo e(translate('Name Prefix')); ?></div>
  172. <div class="col-lg-6">
  173. <input type="text" class="form-control" name="name_prefix" value="" placeholder="Prefix of Name" required>
  174. </div>
  175. <div class="col-lg-4"><span><?php echo e(translate('Optional')); ?></span></div>
  176. </div>-->
  177. <div class="form-group row" style="display:none;">
  178. <div class="col-lg-2"><?php echo e(translate('Referrel User')); ?></div>
  179. <div class="col-lg-6">
  180. <input type="number" class="form-control" name="referred_by" value="" placeholder="Referrel User" required>
  181. </div>
  182. </div>
  183. <div class="form-group row">
  184. <div class="col-lg-2"><?php echo e(translate('Quantity')); ?></div>
  185. <div class="col-lg-6">
  186. <input type="number" min="1" step="1" max="100" class="form-control" name="quantity" value="1" placeholder="Quantity of generate" required>
  187. </div>
  188. </div>
  189. <div class="form-group row">
  190. <div class="col-lg-2"><?php echo e(translate('Initial Balance')); ?></div>
  191. <div class="col-lg-6">
  192. <input type="number" min="0" class="form-control" name="balance" value="0.00" placeholder="Initial Balance of Accounts" required>
  193. </div>
  194. </div>
  195. <div class="form-group row">
  196. <div class="col-lg-2"></div>
  197. <div class="col-lg-6">
  198. <div style="display: flex; align-items: center;">
  199. <div class="aiz-checkbox-inline" style="display: inline-block;">
  200. <label class="aiz-checkbox">
  201. <input type="checkbox" class="check-one" name="disable_login" value="1">
  202. <span class="aiz-square-check"></span>
  203. </label>
  204. </div>
  205. <span style="margin-top: 14px;"><?php echo e(translate('Disable Log in')); ?></span>
  206. </div>
  207. </div>
  208. </div>
  209. </form>
  210. </div>
  211. <div class="modal-footer">
  212. <button type="button" class="btn btn-light" data-dismiss="modal"><?php echo e(translate('Cancel')); ?></button>
  213. <a type="button" id="submitVirtualCustomer" class="btn btn-primary"><?php echo e(translate('Submit')); ?></a>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <!-- offline payment Modal -->
  219. <div class="modal fade" id="offline_wallet_recharge_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  220. <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
  221. <div class="modal-content">
  222. <div class="modal-header">
  223. <h5 class="modal-title" id="exampleModalLabel"><?php echo e(translate('Recharge')); ?></h5>
  224. <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button>
  225. </div>
  226. <div id="offline_wallet_recharge_modal_body"></div>
  227. </div>
  228. </div>
  229. </div>
  230. <?php $__env->stopSection(); ?>
  231. <?php $__env->startSection('script'); ?>
  232. <script type="text/javascript">
  233. function show_make_wallet_recharge_modal(user_id){
  234. $.post('<?php echo e(route('admin.admin_wallet_recharge_modal')); ?>', {_token:'<?php echo e(csrf_token()); ?>', user_id: user_id}, function(data){
  235. $('#offline_wallet_recharge_modal_body').html(data);
  236. $('#offline_wallet_recharge_modal').modal('show');
  237. });
  238. }
  239. $( function ()
  240. {
  241. $( '#create_virtual_user' ).bind( 'click', function ()
  242. {
  243. $( '#virtual_user_form' ).modal( 'show' )
  244. } )
  245. $( '#submitVirtualCustomer' ).bind( 'click', function ()
  246. {
  247. let target = $( this )
  248. if ( target.hasClass( 'disabled' ) ) return false
  249. target.addClass( 'disabled' );
  250. let max = $( 'input[name=quantity]' ).val()
  251. let balance = $( 'input[name=balance]' ).val()
  252. let referred_by = $( 'input[name=referred_by]' ).val()
  253. fetch( '<?php echo e(route('customers.create_virtual_user')); ?>', {
  254. method: 'POST',
  255. headers: {
  256. 'Content-Type': 'application/json',
  257. 'X-Requested-With': 'fetch'
  258. },
  259. body: JSON.stringify( {
  260. _token: '<?php echo e(csrf_token()); ?>',
  261. max,
  262. balance,
  263. referred_by
  264. } )
  265. } )
  266. .then( resp => resp.text() )
  267. .then( res =>
  268. {
  269. if ( res == 1 ) {
  270. AIZ.plugins.notify( 'success', '<?php echo e(translate('Successfully created virtual customer')); ?>' )
  271. setTimeout( () =>
  272. {
  273. window.location.reload()
  274. }, 500 )
  275. }
  276. else {
  277. AIZ.plugins.notify( 'danger', '<?php echo e(translate('Executed failure Try again')); ?>' )
  278. target.removeClass( 'disabled' )
  279. }
  280. } )
  281. .catch( err => null ).finally( () =>
  282. {
  283. //target.removeClass('disabled')
  284. } )
  285. } )
  286. } )
  287. $( document ).on( "change", ".check-all", function ()
  288. {
  289. if ( this.checked ) {
  290. // Iterate each checkbox
  291. $( '.check-one:checkbox' ).each( function ()
  292. {
  293. this.checked = true;
  294. } );
  295. }
  296. else {
  297. $( '.check-one:checkbox' ).each( function ()
  298. {
  299. this.checked = false;
  300. } );
  301. }
  302. } );
  303. function sort_customers(el) {
  304. $( '#sort_customers' ).submit();
  305. }
  306. function confirm_ban(url) {
  307. $( '#confirm-ban' ).modal( 'show', { backdrop: 'static' } );
  308. document.getElementById( 'confirmation' ).setAttribute( 'href', url );
  309. }
  310. function confirm_unban(url) {
  311. $( '#confirm-unban' ).modal( 'show', { backdrop: 'static' } );
  312. document.getElementById( 'confirmationunban' ).setAttribute( 'href', url );
  313. }
  314. function bulk_delete() {
  315. var data = new FormData( $( '#sort_customers' )[0] );
  316. $.ajax( {
  317. headers: {
  318. 'X-CSRF-TOKEN': $( 'meta[name="csrf-token"]' ).attr( 'content' )
  319. },
  320. url: "<?php echo e(route('bulk-customer-delete')); ?>",
  321. type: 'POST',
  322. data: data,
  323. cache: false,
  324. contentType: false,
  325. processData: false,
  326. success: function (response)
  327. {
  328. if ( response == 1 ) {
  329. location.reload();
  330. }
  331. }
  332. } );
  333. }
  334. </script>
  335. <?php $__env->stopSection(); ?>
  336. <?php echo $__env->make('backend.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Users/shaoguo/Desktop/公司资料/小梦/商城/ebayShop/resources/views/backend/customer/customers/index.blade.php ENDPATH**/ ?>