app.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
  7. <meta name="description" content="Meem" />
  8. <meta name="author" content="Meem" />
  9. <title>{!! env('APP_NAME') !!}</title>
  10. <!-- Favicon Icon -->
  11. <link rel="icon" type="image/png" href="{!! env('APP_ASSETS') !!}img/favicon.png">
  12. <!-- Feather Icon-->
  13. <link href="{!! env('APP_ASSETS') !!}css/vendors_css.css" rel="stylesheet" type="text/css">
  14. <!-- Fontawesome Icon-->
  15. <link href="{!! env('APP_ASSETS') !!}css/style.css" rel="stylesheet" type="text/css">
  16. <!-- Bootstrap Css -->
  17. <link href="{!! env('APP_ASSETS') !!}css/skin_color.css" rel="stylesheet"><!-- Custom Css -->
  18. @yield('css')
  19. <style>
  20. label.error{
  21. color:#FF0000;
  22. }
  23. .new-order {
  24. background: rgb(110 195 82 / 50%) !important;
  25. color: #000;
  26. }
  27. .alert{ display: none}
  28. #loader{
  29. background: #fff url({!! env('APP_ASSETS') !!}images/preloaders/1.gif) no-repeat center center;
  30. }
  31. </style>
  32. </head>
  33. <body class="hold-transition light-skin sidebar-mini theme-primary fixed sidebar-collapse">
  34. <div class="wrapper">
  35. <div id="loader"></div>
  36. @include('inc.header')
  37. @include('inc.sidebar_resto')
  38. @yield('content')
  39. @include('inc.sidebar_resto_right')
  40. </div>
  41. </body>
  42. <script src="{!! env('APP_ASSETS') !!}js/vendors.min.js"></script>
  43. <script src="{!! env('APP_ASSETS') !!}js/pages/chat-popup.js"></script>
  44. <script src="{!! env('APP_ASSETS') !!}vendor_components/apexcharts-bundle/dist/apexcharts.min.js"></script>
  45. <script src="{!! env('APP_ASSETS') !!}icons/feather-icons/feather.min.js"></script>
  46. <script src="{!! env('APP_ASSETS') !!}vendor_components/progressbar.js-master/dist/progressbar.js"></script>
  47. <script src="{!! env('APP_ASSETS') !!}vendor_components/OwlCarousel2/dist/owl.carousel.js"></script>
  48. <script src="{!! env('APP_ASSETS') !!}vendor_components/datatable/datatables.min.js"></script>
  49. <!-- Riday Admin App -->
  50. <script src="{!! env('APP_ASSETS') !!}js/template.js"></script>
  51. <script type="text/javascript">
  52. var progress_img = '<img src="{!! env('APP_ASSETS') !!}images/preloader-1.svg" style="height: 25px;">';
  53. </script>
  54. <script>
  55. //screen.orientation.lock('');
  56. nosleep();
  57. function nosleep()
  58. {
  59. var noSleep = new NoSleep();
  60. noSleep.enable();
  61. }
  62. </script>
  63. <!-- AUDIO.JS -->
  64. <script type="text/javascript">
  65. const CACHE_NAME = "audioCache";
  66. const FILE_NAME = 'https://admin.meemapp.net/notif-order.mp3';
  67. (function main(){
  68. updateStatus();
  69. })();
  70. // Update the status field
  71. function updateStatus() {
  72. isCached().then(value => {
  73. });
  74. }
  75. function isCached() {
  76. return window.caches.open(CACHE_NAME)
  77. .then(cache => cache.match(FILE_NAME))
  78. .then(Boolean);
  79. }
  80. function addToCache() {
  81. window.caches.open(CACHE_NAME)
  82. .then(cache => cache.add(FILE_NAME))
  83. .then(() => console.log('cached audio file'))
  84. .catch(e => console.error('failed to cache file', e))
  85. .finally(updateStatus); // This only works in chrome/ff at the time of writing
  86. }
  87. function removeFromCache() {
  88. window.caches.open(CACHE_NAME)
  89. .then(cache => cache.delete(FILE_NAME))
  90. .then(() => console.log('removed cached file'))
  91. .catch(e => console.error('failed to remove cached file', e))
  92. .finally(updateStatus); // This only works in chrome/ff at the time of writing
  93. }
  94. </script>
  95. <script>
  96. if ('serviceWorker' in navigator) {
  97. var file = "{!! env('APP_ASSETS') !!}js/audio_cache_sw.js"
  98. navigator.serviceWorker.register(file)
  99. .then(function(reg) {
  100. console.log('Registration succeeded.');
  101. }).catch(function(error) {
  102. console.log('Registration failed with ' + error);
  103. });
  104. }
  105. </script>
  106. <!-- END AUDIO.JS -->
  107. <script>
  108. /*let src = "https://admin.meemapp.net/notif-order.mp3";
  109. let audio = new Audio(src);
  110. audio.loop = true;
  111. audio.play();
  112. */
  113. addToCache();
  114. var timeFormat = function(datetime){
  115. var time =datetime;
  116. var date = new Date(time);
  117. date = date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getMilliseconds();
  118. return date;
  119. };
  120. var logged_user = "{!! \Illuminate\Support\Facades\Auth::user()->role=="restaurant" && isset(\Illuminate\Support\Facades\Auth::user()->restaurants)?\Illuminate\Support\Facades\Auth::user()->restaurants->id:NULL !!}";
  121. var site_url = "{!! env('APP_URL') !!}";
  122. logged_user = parseInt(logged_user);
  123. $(function () {
  124. $('[data-toggle="tooltip"]').tooltip();
  125. // $('#dataTable').DataTable();
  126. $("body").on("click",".notifications",function () {
  127. $.ajax({
  128. url:"{!! env('APP_URL') !!}read/notifications",
  129. success:function (response) {
  130. $(".badge-counter").attr("data-count",0);
  131. $(".badge-counter").html("");
  132. }
  133. });
  134. });
  135. })
  136. </script>
  137. <script>
  138. let src = "{!! env('APP_URL') !!}notif-order.mp3";
  139. let audio = new Audio(src);
  140. audio.loop = true;
  141. @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
  142. @if(Route::currentRouteName()=="OrderListing" || $placed_order)
  143. @if((isset($is_pending_order) && !empty($is_pending_order)) || $placed_order)
  144. audio.play();
  145. @endif
  146. @endif
  147. @endif
  148. var pusher = new Pusher('{{env("PUSHER_APP_KEY")}}', {
  149. cluster: '{{env("PUSHER_APP_CLUSTER")}}',
  150. encrypted: true
  151. });
  152. var notification_counter = parseInt($(".badge-counter").data('count'));
  153. var new_order_count = parseInt($("#order-counter").html());
  154. if(new_order_count=="")
  155. new_order_count = 0;
  156. var channel = pusher.subscribe("{!! env('PUHER_APP_CHANNEL') !!}");
  157. channel.bind('App\\Events\\OrderNotification', function(data) {
  158. console.log(data);
  159. var order_resto_id = parseInt(data.order_resto_id);
  160. if(order_resto_id==logged_user && data.notification_for=="update-order-status"){
  161. $(".order-section").hide();
  162. $(".no-order").show();
  163. // location.reload();
  164. audio.pause();
  165. // $("#orders-list").html('');
  166. var after_pusher_status = $(".nav-link.active").data('status');
  167. if(after_pusher_status && after_pusher_status=="")
  168. after_pusher_status = "all";
  169. $("#all-orders").removeClass('no-order-found');
  170. $(".mlist_li[data-order-id="+data.order_id+"]").remove();
  171. /* $.ajax({
  172. url:"{!! env('APP_URL') !!}liveorders/"+after_pusher_status,
  173. success:function (response) {
  174. //response = $.parseJSON(response);
  175. if(response){
  176. $.each(response.orders,function (i,v) {
  177. var str='<li class="mlist_li" rel="detail" data-order-id="'+v.id+'">\n' +
  178. ' <div class="box '+v.box_bg+' rounded-0">\n' +
  179. ' <div class="media-list media-list-divided media-list-hover">\n' +
  180. ' <div class="media align-items-center">\n' +
  181. ' <div class="media-body">\n' +
  182. ' <p>#'+v.order_ref+'</p>\n' +
  183. ' <p> '+(v.campaign_type!=""?v.campaign_type:"Direct")+', '+v.created_at+'</p>\n' +
  184. ' </div>\n' +
  185. ' <div class="media-right gap-items">\n' +
  186. ' <div class="user-social-acount text-center">\n' +
  187. ' <p class="m-0 status">'+v.status+'</p>\n' +
  188. ' <div class="d-flex align-items-center float-end">\n' +
  189. ' <div class="circle-div '+v.bg+' text-center" data-min="'+v.remaining_min+'" data-color="'+v.bg_color+'">\n' +
  190. ' <p class="mb-5 min">'+v.remaining_min+'<br />\n'+
  191. ' Min</p>\n'+
  192. ' </div>\n' +
  193. ' </div>\n' +
  194. ' </div>\n' +
  195. ' </div>\n' +
  196. ' </div>\n' +
  197. ' </div>\n' +
  198. ' </div>\n' +
  199. '</li>';
  200. counter = counter+1;
  201. $("#orders-list").append(str);
  202. });
  203. $("span."+status).html(counter);
  204. }
  205. }
  206. });*/
  207. // $.ajax({
  208. // url: "{!! env('APP_URL') !!}order/counts",
  209. // success: function (response) {
  210. // // response = $.parseJSON(response);
  211. // var total_accepted = 0;
  212. // var total = 0;
  213. //
  214. // $.each(response,function (i,v) {
  215. // if(v.status=="Send_to_Kitchen" || v.status=="Accepted"){
  216. // total_accepted+=parseInt(v.status_count);
  217. // total+=parseInt(v.status_count);
  218. // $(".labelcenter.kitchen").text(total_accepted);
  219. // }
  220. //
  221. // if(v.status=="On_Road"){
  222. // $(".labelcenter.route").text(v.status_count);
  223. // total+=parseInt(v.status_count);
  224. // }
  225. //
  226. //
  227. // if(v.status=="Placed"){
  228. //
  229. // $(".labelcenter.new").html(v.status_count);
  230. // total+=parseInt(v.status_count);
  231. // if(parseInt(v.status_count) > 0){
  232. // $("#order-counter").html(v.status_count);
  233. // $("#order-counter").show();
  234. // }else{
  235. // audio.pause();
  236. // $("#order-counter").html(0);
  237. // $("#order-counter").hide();
  238. // }
  239. // }
  240. //
  241. // });
  242. // $(".labelcenter.all").text(total);
  243. // }
  244. // });
  245. count_order_status();
  246. $(".mlist_li[data-order-id="+data.order_id+"]").remove();
  247. }
  248. var resto_id = parseInt(data.resto_id);
  249. if(resto_id==logged_user){
  250. $("#all-orders").removeClass('no-order-found');
  251. audio.play();
  252. var new_order = (data.order_data);
  253. var v = new_order;
  254. var li = '<li class="mlist_li" rel="detail" data-order-id="'+v.id+'">\n' +
  255. ' <div class="box bg-danger rounded-0">\n' +
  256. ' <div class="media-list media-list-divided media-list-hover">\n' +
  257. ' <div class="media align-items-center">\n' +
  258. ' <div class="media-body">\n' +
  259. ' <p>#'+v.order_ref+'</p>\n' +
  260. ' <p> '+(v.campaign_type?v.campaign_type:"Direct")+', Just now</p>\n' +
  261. ' </div>\n' +
  262. ' <div class="media-right gap-items">\n' +
  263. ' <div class="user-social-acount text-center">\n' +
  264. ' <p class="m-0 status">New</p>\n' +
  265. ' <div class="d-flex align-items-center float-end">\n' +
  266. ' <div class="circle-div blu-bg text-center">\n' +
  267. ' <p class="mb-5 min">0<br />\n' +
  268. ' Min</p>\n' +
  269. ' </div>\n' +
  270. ' </div>\n' +
  271. ' </div>\n' +
  272. ' </div>\n' +
  273. ' </div>\n' +
  274. ' </div>\n' +
  275. ' </div>\n' +
  276. '</li>';
  277. /* var action_list = '<div class="btn-group">\n' +
  278. ' <a class="hover-primary dropdown-toggle no-caret" data-bs-toggle="dropdown"><i class="fa fa-ellipsis-h"></i></a>\n' +
  279. ' <div class="dropdown-menu">\n' +
  280. ' <a class="dropdown-item order-status" href="#!" data-id="'+new_order.id+'" data-status="Accepted">Accepted</a>\n' +
  281. ' <a class="dropdown-item order-status" href="#!" data-id="'+new_order.id+'" data-status="Rejected">Rejected</a>\n' +
  282. ' <a class="dropdown-item order-status" href="#!" data-id="'+new_order.id+'" data-status="Rejected_by_User">Rejected by User</a>\n' +
  283. ' \n' +
  284. ' </div>\n' +
  285. ' </div>';
  286. var row = '<tr class="special order-row" data-id="'+new_order.id+'">';
  287. row+='<td>'+new_order.order_ref+'</td>';
  288. row+='<td>'+timeFormat(new_order.created_at)+'</td>';
  289. row+='<td>'+new_order.customer_name+'</td>';
  290. row+='<td>'+ data.customer_mobile+ '</td>';
  291. row+='<td>'+data.customer_location+'</td>';
  292. row+='<td>'+new_order.order_type+'</td>';
  293. // row+='<td>'+new_order.campaign_name+'</td>';
  294. // row+='<td>'+new_order.campaign_date+'</td>';
  295. row+='<td>'+new_order.campaign_type+'</td>';
  296. row+='<td>'+data.total_price+'</td>';
  297. /!* row+='<td>'+(new_order.order_deliver_time?new_order.order_deliver_time:"(اقرب وقت)\t")+'</td>';*!/
  298. row+='<td><span class="badge badge-info-light">Placed</span></td>';
  299. row+='<td>'+action_list+'</td>';
  300. row+='</tr>';*/
  301. // $.ajax({
  302. // url: "{!! env('APP_URL') !!}order/counts",
  303. // success: function (response) {
  304. // // response = $.parseJSON(response);
  305. // var total_accepted = 0;
  306. // var total = 0;
  307. //
  308. // $.each(response,function (i,v) {
  309. // if(v.status=="Send_to_Kitchen" || v.status=="Accepted"){
  310. // total_accepted+=parseInt(v.status_count);
  311. // total+=parseInt(v.status_count);
  312. // $(".labelcenter.kitchen").text(total_accepted);
  313. // }
  314. //
  315. // if(v.status=="On_Road"){
  316. // $(".labelcenter.route").text(v.status_count);
  317. // total+=parseInt(v.status_count);
  318. // }
  319. //
  320. // if(v.status=="Placed"){
  321. // $(".labelcenter.new").text(v.status_count);
  322. // total+=parseInt(v.status_count);
  323. // if(parseInt(v.status_count) > 0){
  324. // $("#order-counter").html(v.status_count);
  325. // $("#order-counter").show();
  326. // }
  327. //
  328. // }
  329. //
  330. // });
  331. // $(".labelcenter.all").text(total);
  332. // }
  333. // });
  334. count_order_status();
  335. @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
  336. @if(Route::currentRouteName()=="OrderListing")
  337. $("#orders-list").prepend(li);
  338. @endif
  339. @endif
  340. // $("#new-order-tables tbody").prepend(row);
  341. // $("#new-orders-modal").modal();
  342. setTimeout(function () {
  343. $("#new-orders-modal").modal('hide');
  344. },30000);
  345. var notification = '<li>\n' +
  346. ' <a href="{!! env('APP_URL') !!}order/show/'+data.order_id+'">\n' +
  347. ' <i class="fa fa-users text-info"></i> '+data.message+'.\n' +
  348. ' </a>\n' +
  349. ' </li>';
  350. $("#notifications").prepend(notification);
  351. notification_counter += 1;
  352. new_order_count += 1;
  353. $(".badge-counter").attr('data-count',notification_counter);
  354. $(".badge-counter").html(notification_counter);
  355. $("#order-counter").html(new_order_count);
  356. $("#order-counter").show();
  357. }
  358. });
  359. $("body").on("click",".push-btn",function () {
  360. $(".main-sidebar").toggleClass('sidebar-active')
  361. });
  362. $("body").on("click",".change-lang",function () {
  363. var _lang = $(this).data('lang');
  364. $.ajax({
  365. url:"{!! env('APP_URL') !!}change/lang/"+_lang,
  366. success:function(){
  367. location.reload();
  368. }
  369. });
  370. });
  371. function count_order_status(){
  372. $.ajax({
  373. url: "{!! env('APP_URL') !!}order/counts",
  374. success: function (response) {
  375. // response = $.parseJSON(response);
  376. var total_accepted = 0;
  377. var total = 0;
  378. $.each(response,function (i,v) {
  379. if(v.status=="Send_to_Kitchen" || v.status=="Accepted"){
  380. total_accepted+=parseInt(v.status_count);
  381. total+=parseInt(v.status_count);
  382. $(".labelcenter.kitchen").text(total_accepted);
  383. }
  384. if(v.status=="On_Road"){
  385. $(".labelcenter.route").text(v.status_count);
  386. total+=parseInt(v.status_count);
  387. }
  388. if(v.status=="Placed"){
  389. $(".labelcenter.new").text(v.status_count);
  390. total+=parseInt(v.status_count);
  391. if(parseInt(v.status_count) > 0){
  392. $("#order-counter").html(v.status_count);
  393. $("#order-counter").show();
  394. }else{
  395. $("#order-counter").hide();
  396. }
  397. }
  398. });
  399. $(".labelcenter.all").text(total);
  400. }
  401. });
  402. }
  403. </script>
  404. </html>
  405. @yield('js')