menus.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. @extends('layouts.app')
  2. @section('page-title')| Menus @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\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.menus')}}</h3>
  62. <p>{{__('label.add_and_manage_your_menus')}}</p>
  63. </div>
  64. </div>
  65. <div class="col-md-6">
  66. <a href="{!! env('APP_URL') !!}new/menu" 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_menus')}}
  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">{!! $menus->count() !!} {{__('label.menu')}}</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_menu')}}">
  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.used_for')}}</th>
  92. <th></th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. @php
  97. $resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  98. @endphp
  99. @if(isset($menus) && $menus->count() > 0)
  100. @foreach($menus as $menu)
  101. <tr>
  102. <td>
  103. <button type="button" data-on-text="Open" data-off-text="Closed" class="btn btn-toggle btn-sm btn-success @if($menu->status=="active") active @endif switch-me" data-id="{!! $menu->id !!}" data-bs-toggle="button" aria-pressed="@if($menu->status=="active") true @else false @endif" autocomplete="off">
  104. <div class="handle"></div>
  105. </button> {{__('label.active')}}
  106. </td>
  107. <td >
  108. <h5>{!! $menu->title !!}</h5>
  109. <p class="text-cover">{!! $resto->name !!} | {!! $resto->address !!}</p>
  110. </td>
  111. <td>
  112. {!! $menu->used_for !!}
  113. </td>
  114. <td>
  115. <a href="{!! env('APP_URL') !!}menu/edit/{!! $menu->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>
  116. @if($menu->created_by!="system")
  117. <a type="button" data-id="{!! $menu->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>
  118. @endif
  119. </td>
  120. </tr>
  121. @endforeach
  122. @endif
  123. </tbody>
  124. </table>
  125. </div>
  126. </div>
  127. </div>
  128. </section>
  129. <!-- /.content -->
  130. </div>
  131. </div>
  132. <!-- /.content-wrapper -->
  133. @endsection
  134. @section('js')
  135. <script>
  136. $(function () {
  137. $('.table').DataTable({
  138. paging: true,
  139. bLengthChange:false,
  140. searching: false,
  141. language: {
  142. @if($lang=='ar')
  143. url:`{{asset('public/assets/js/dataTablear.json')}}`,
  144. @endif
  145. },
  146. });
  147. $("body").on("click",".delete-outlet",function () {
  148. var id = $(this).data('id');
  149. var _this = $(this);
  150. swal({
  151. title: " Confirm?",
  152. text: "Do you want delete?",
  153. type: "error",
  154. showCancelButton: true,
  155. confirmButtonClass: "btn-danger",
  156. confirmButtonText: " Confirm, delete it!",
  157. cancelButtonText: "No, cancel please!",
  158. closeOnConfirm: true,
  159. closeOnCancel: true
  160. },
  161. function(isConfirm) {
  162. if (isConfirm) {
  163. $.ajax({
  164. url:'{!! env('APP_URL') !!}outlet/delete/'+id,
  165. success:function (response) {
  166. $.toast({
  167. heading: 'Outlet Status',
  168. text: 'Outlet is delete successfully.',
  169. position: 'top-right',
  170. loaderBg: '#ff6849',
  171. icon: 'success',
  172. hideAfter: 3000,
  173. stack: 1
  174. });
  175. _this.parents('tr').remove();
  176. }
  177. });
  178. }
  179. });
  180. });
  181. $("body").on("click",".switch-me",function () {
  182. var is_active = $(this).attr("aria-pressed");
  183. var id = $(this).data('id');
  184. is_active = $.trim(is_active);
  185. var status = 0;
  186. if(is_active=="false"){
  187. status = 0;
  188. }else{
  189. status = 1;
  190. }
  191. $.ajax({
  192. url:"{!! env('APP_URL') !!}outlet/update/status",
  193. type:"POST",
  194. data:{
  195. id:id,
  196. status:status,
  197. "_token":'{!! csrf_token() !!}'
  198. },
  199. success:function () {
  200. if(is_active=="false"){
  201. $.toast({
  202. heading: 'Outlet Status',
  203. text: 'Outlet is deactive',
  204. position: 'top-right',
  205. loaderBg: '#ff6849',
  206. icon: 'error',
  207. hideAfter: 3000,
  208. stack: 1
  209. });
  210. }else{
  211. $.toast({
  212. heading: 'Outlet Status',
  213. text: 'Outlet is deactive.',
  214. position: 'top-right',
  215. loaderBg: '#ff6849',
  216. icon: 'success',
  217. hideAfter: 3000,
  218. stack: 1
  219. });
  220. }
  221. }
  222. });
  223. });
  224. })
  225. </script>
  226. @endsection