outlets.blade.php 12 KB

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