outlets.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. @extends('layouts.app')
  2. @section('page-title')| Outlets @endsection
  3. @section('css')
  4. <link href="{!! env('APP_ASSETS') !!}css/outlets.css" rel="stylesheet" type="text/css">
  5. @endsection
  6. @section('content')
  7. <style>
  8. @-webkit-keyframes special {
  9. from { background-color: rgba(255, 121, 77, 0.27); }
  10. to { background-color: inherit; }
  11. }
  12. @-moz-keyframes special {
  13. from { background-color: rgba(255, 121, 77, 0.27);; }
  14. to { background-color: inherit; }
  15. }
  16. @-o-keyframes special {
  17. from { background-color: rgba(255, 121, 77, 0.27);; }
  18. to { background-color: inherit; }
  19. }
  20. @keyframes special {
  21. from { background-color: rgba(255, 121, 77, 0.27);; }
  22. to { background-color: inherit; }
  23. }
  24. .special {
  25. -webkit-animation: special 1s infinite; /* Safari 4+ */
  26. -moz-animation: special 1s infinite; /* Fx 5+ */
  27. -o-animation: special 1s infinite; /* Opera 12+ */
  28. animation: special 1s infinite; /* IE 10+ */
  29. }
  30. .btn-toggle.btn-sm,.btn-toggle.btn-sm > .handle{
  31. border-radius: 16px;
  32. }
  33. .dataTables_wrapper.container-fluid.dt-bootstrap4.no-footer
  34. {
  35. padding: 0px;
  36. }
  37. .content{
  38. padding-right: 15px;
  39. }
  40. .w-max{
  41. width:max-content;
  42. }
  43. </style>
  44. <!-- Content Wrapper. Contains page content -->
  45. @php
  46. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  47. $lang = $resto->default_lang;
  48. app()->setLocale($lang);
  49. if(session('app_lang') !==null){
  50. $lang = session('app_lang');
  51. app()->setLocale($lang);
  52. }
  53. @endphp
  54. <div class="content-wrapper">
  55. <div class="container-full">
  56. <!-- Main content -->
  57. <section class="content">
  58. <div class="row ">
  59. <div class="col-md-6">
  60. <div class="m-15">
  61. <h3 class="title">{{__('label.outlets')}}</h3>
  62. <p>{{__('label.add_and_manage_your_outlets')}}</p>
  63. </div>
  64. </div>
  65. <div class="col-md-6">
  66. <a href="{!! env('APP_URL') !!}new/outlet" class="form-control btn btn-primary btn-md add-outlet text-center w-max">
  67. <i class="fa fa-plus mr-2"></i>
  68. <!-- <i class="mdi mdi-plus-circle"></i> --> {{__('label.add_outlet')}}
  69. </a>
  70. </div>
  71. </div>
  72. <div class="row mt-15">
  73. <div class="col-md-12 pt-5">
  74. <div class="d-flex justify-content-between align-items-center">
  75. <h4 class="orange_text p-5" style="margin-left: 10px">{!! $outlets->count() !!} {{__('label.outlets')}}</h4>
  76. <div class="form-group has-search">
  77. <span class="fa fa-search form-control-feedback"></span>
  78. <input type="text" class="form-control" placeholder="{{__('label.search_outlet')}}">
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="row">
  84. <div class="col-12 mt-4">
  85. <div class="table-responsive">
  86. <table class="table table-striped">
  87. <thead>
  88. <tr>
  89. <th scope="col">{{__('label.status')}}</th>
  90. <th scope="col">{{__('label.name')}}</th>
  91. <th scope="col">{{__('label.delivery')}}</th>
  92. <th scope="col">{{__('label.pickup')}}</th>
  93. <th></th>
  94. </tr>
  95. </thead>
  96. <tbody>
  97. @php
  98. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  99. @endphp
  100. @if(isset($outlets) && $outlets->count() > 0)
  101. @foreach($outlets as $outlet)
  102. <tr>
  103. <td>
  104. <button type="button" data-on-text="Open" data-off-text="Closed" class="btn btn-toggle btn-sm btn-success @if($outlet->active=="1") active @endif switch-me" data-id="{!! $outlet->id !!}" data-bs-toggle="button" aria-pressed="@if($outlet->active=="1") true @else false @endif" autocomplete="off">
  105. <div class="handle"></div>
  106. </button> {{__('label.active')}}
  107. </td>
  108. <td >
  109. <h5>{!! $outlet->name !!}</h5>
  110. <p class="text-cover">{!! $resto->name !!} | {!! $resto->address !!}</p>
  111. </td>
  112. <td>
  113. @if($outlet->is_delivery=="1")<span class="gdot"></span> {{__('label.on')}} @else <span class="rdot"></span> {{__('label.off')}} @endif
  114. </td>
  115. <td>
  116. @if($outlet->is_pickup=="1")<span class="gdot"></span> {{__('label.on')}} @else <span class="rdot"></span> {{__('label.off')}} @endif
  117. </td>
  118. <td>
  119. <a href="{!! env('APP_URL') !!}outlet/edit/{!! $outlet->unique_key !!}" type="button" class="waves-effect waves-circle btn btn-circle btn-primary btn-xs mb-5"><i class="mdi mdi-tooltip-edit"></i></a>
  120. <a type="button" data-id="{!! $outlet->unique_key !!}" class="waves-effect waves-circle btn btn-circle delete-outlet btn-danger btn-xs mb-5"><i class="mdi mdi-delete"></i></a>
  121. </td>
  122. </tr>
  123. @endforeach
  124. @endif
  125. </tbody>
  126. </table>
  127. </div>
  128. </div>
  129. </div>
  130. </section>
  131. <!-- /.content -->
  132. </div>
  133. </div>
  134. <!-- /.content-wrapper -->
  135. @endsection
  136. @section('js')
  137. <script>
  138. $(function () {
  139. $('.table').DataTable({
  140. paging: true,
  141. bLengthChange:false,
  142. searching: false,
  143. language: {
  144. @if($lang=='ar')
  145. url:`{{asset('public/assets/js/dataTablear.json')}}`,
  146. @endif
  147. },
  148. });
  149. $("body").on("click",".delete-outlet",function () {
  150. var id = $(this).data('id');
  151. var _this = $(this);
  152. swal({
  153. title: " Confirm?",
  154. text: "Do you want delete?",
  155. type: "error",
  156. showCancelButton: true,
  157. confirmButtonClass: "btn-danger",
  158. confirmButtonText: " Confirm, delete it!",
  159. cancelButtonText: "No, cancel please!",
  160. closeOnConfirm: true,
  161. closeOnCancel: true
  162. },
  163. function(isConfirm) {
  164. if (isConfirm) {
  165. $.ajax({
  166. url:'{!! env('APP_URL') !!}outlet/delete/'+id,
  167. success:function (response) {
  168. $.toast({
  169. heading: 'Outlet Status',
  170. text: 'Outlet is delete successfully.',
  171. position: 'top-right',
  172. loaderBg: '#ff6849',
  173. icon: 'success',
  174. hideAfter: 3000,
  175. stack: 1
  176. });
  177. _this.parents('tr').remove();
  178. }
  179. });
  180. }
  181. });
  182. });
  183. $("body").on("click",".switch-me",function () {
  184. var is_active = $(this).attr("aria-pressed");
  185. var id = $(this).data('id');
  186. is_active = $.trim(is_active);
  187. var status = 0;
  188. if(is_active=="false"){
  189. status = 0;
  190. }else{
  191. status = 1;
  192. }
  193. $.ajax({
  194. url:"{!! env('APP_URL') !!}outlet/update/status",
  195. type:"POST",
  196. data:{
  197. id:id,
  198. status:status,
  199. "_token":'{!! csrf_token() !!}'
  200. },
  201. success:function () {
  202. if(is_active=="false"){
  203. $.toast({
  204. heading: 'Outlet Status',
  205. text: 'Outlet is deactive',
  206. position: 'top-right',
  207. loaderBg: '#ff6849',
  208. icon: 'error',
  209. hideAfter: 3000,
  210. stack: 1
  211. });
  212. }else{
  213. $.toast({
  214. heading: 'Outlet Status',
  215. text: 'Outlet is deactive.',
  216. position: 'top-right',
  217. loaderBg: '#ff6849',
  218. icon: 'success',
  219. hideAfter: 3000,
  220. stack: 1
  221. });
  222. }
  223. }
  224. });
  225. });
  226. })
  227. </script>
  228. @endsection