123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
- <meta name="description" content="Meem" />
- <meta name="author" content="Meem" />
- <title>{!! env('APP_NAME') !!}</title>
- <!-- Favicon Icon -->
- <link rel="icon" type="image/png" href="{!! env('APP_ASSETS') !!}img/favicon.png">
- <!-- Feather Icon-->
- <link href="{!! env('APP_ASSETS') !!}css/vendors_css.css" rel="stylesheet" type="text/css">
- <!-- Fontawesome Icon-->
- <link href="{!! env('APP_ASSETS') !!}css/style.css" rel="stylesheet" type="text/css">
- <!-- Bootstrap Css -->
- <link href="{!! env('APP_ASSETS') !!}css/skin_color.css" rel="stylesheet"><!-- Custom Css -->
- @yield('css')
- <style>
- label.error{
- color:#FF0000;
- }
- .new-order {
- background: rgb(110 195 82 / 50%) !important;
- color: #000;
- }
- .alert{ display: none}
- #loader{
- background: #fff url({!! env('APP_ASSETS') !!}images/preloaders/1.gif) no-repeat center center;
- }
- </style>
- </head>
- <body class="hold-transition light-skin sidebar-mini theme-primary fixed sidebar-collapse">
- <div class="wrapper">
- <div id="loader"></div>
- @include('inc.header')
- @include('inc.sidebar_resto')
- @yield('content')
- @include('inc.sidebar_resto_right')
- </div>
- </body>
- <script src="{!! env('APP_ASSETS') !!}js/vendors.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/pages/chat-popup.js"></script>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/apexcharts-bundle/dist/apexcharts.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}icons/feather-icons/feather.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/progressbar.js-master/dist/progressbar.js"></script>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/OwlCarousel2/dist/owl.carousel.js"></script>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/datatable/datatables.min.js"></script>
- <!-- Riday Admin App -->
- <script src="{!! env('APP_ASSETS') !!}js/template.js"></script>
- <script type="text/javascript">
- var progress_img = '<img src="{!! env('APP_ASSETS') !!}images/preloader-1.svg" style="height: 25px;">';
- </script>
- <script>
- //screen.orientation.lock('');
- nosleep();
- function nosleep()
- {
- var noSleep = new NoSleep();
- noSleep.enable();
- }
- </script>
- <!-- AUDIO.JS -->
- <script type="text/javascript">
- const CACHE_NAME = "audioCache";
- const FILE_NAME = 'https://admin.meemapp.net/notif-order.mp3';
- (function main(){
- updateStatus();
- })();
- // Update the status field
- function updateStatus() {
- isCached().then(value => {
- });
- }
- function isCached() {
- return window.caches.open(CACHE_NAME)
- .then(cache => cache.match(FILE_NAME))
- .then(Boolean);
- }
- function addToCache() {
- window.caches.open(CACHE_NAME)
- .then(cache => cache.add(FILE_NAME))
- .then(() => console.log('cached audio file'))
- .catch(e => console.error('failed to cache file', e))
- .finally(updateStatus); // This only works in chrome/ff at the time of writing
- }
- function removeFromCache() {
- window.caches.open(CACHE_NAME)
- .then(cache => cache.delete(FILE_NAME))
- .then(() => console.log('removed cached file'))
- .catch(e => console.error('failed to remove cached file', e))
- .finally(updateStatus); // This only works in chrome/ff at the time of writing
- }
- </script>
- <script>
- if ('serviceWorker' in navigator) {
- var file = "{!! env('APP_ASSETS') !!}js/audio_cache_sw.js"
- navigator.serviceWorker.register(file)
- .then(function(reg) {
- console.log('Registration succeeded.');
- }).catch(function(error) {
- console.log('Registration failed with ' + error);
- });
- }
- </script>
- <!-- END AUDIO.JS -->
- <script>
- /*let src = "https://admin.meemapp.net/notif-order.mp3";
- let audio = new Audio(src);
- audio.loop = true;
- audio.play();
- */
- addToCache();
- var timeFormat = function(datetime){
- var time =datetime;
- var date = new Date(time);
- date = date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getMilliseconds();
- return date;
- };
- 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 !!}";
- var site_url = "{!! env('APP_URL') !!}";
- logged_user = parseInt(logged_user);
- $(function () {
- $('[data-toggle="tooltip"]').tooltip();
- // $('#dataTable').DataTable();
- $("body").on("click",".notifications",function () {
- $.ajax({
- url:"{!! env('APP_URL') !!}read/notifications",
- success:function (response) {
- $(".badge-counter").attr("data-count",0);
- $(".badge-counter").html("");
- }
- });
- });
- })
- </script>
- <script>
- let src = "{!! env('APP_URL') !!}notif-order.mp3";
- let audio = new Audio(src);
- audio.loop = true;
- @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
- @if(Route::currentRouteName()=="OrderListing" || $placed_order)
- @if((isset($is_pending_order) && !empty($is_pending_order)) || $placed_order)
- audio.play();
- @endif
- @endif
- @endif
- var pusher = new Pusher('{{env("PUSHER_APP_KEY")}}', {
- cluster: '{{env("PUSHER_APP_CLUSTER")}}',
- encrypted: true
- });
- var notification_counter = parseInt($(".badge-counter").data('count'));
- var new_order_count = parseInt($("#order-counter").html());
- if(new_order_count=="")
- new_order_count = 0;
- var channel = pusher.subscribe("{!! env('PUHER_APP_CHANNEL') !!}");
- channel.bind('App\\Events\\OrderNotification', function(data) {
- console.log(data);
- var order_resto_id = parseInt(data.order_resto_id);
- if(order_resto_id==logged_user && data.notification_for=="update-order-status"){
- $(".order-section").hide();
- $(".no-order").show();
- // location.reload();
- audio.pause();
- // $("#orders-list").html('');
- var after_pusher_status = $(".nav-link.active").data('status');
- if(after_pusher_status && after_pusher_status=="")
- after_pusher_status = "all";
- $("#all-orders").removeClass('no-order-found');
- $(".mlist_li[data-order-id="+data.order_id+"]").remove();
- /* $.ajax({
- url:"{!! env('APP_URL') !!}liveorders/"+after_pusher_status,
- success:function (response) {
- //response = $.parseJSON(response);
- if(response){
- $.each(response.orders,function (i,v) {
- var str='<li class="mlist_li" rel="detail" data-order-id="'+v.id+'">\n' +
- ' <div class="box '+v.box_bg+' rounded-0">\n' +
- ' <div class="media-list media-list-divided media-list-hover">\n' +
- ' <div class="media align-items-center">\n' +
- ' <div class="media-body">\n' +
- ' <p>#'+v.order_ref+'</p>\n' +
- ' <p> '+(v.campaign_type!=""?v.campaign_type:"Direct")+', '+v.created_at+'</p>\n' +
- ' </div>\n' +
- ' <div class="media-right gap-items">\n' +
- ' <div class="user-social-acount text-center">\n' +
- ' <p class="m-0 status">'+v.status+'</p>\n' +
- ' <div class="d-flex align-items-center float-end">\n' +
- ' <div class="circle-div '+v.bg+' text-center" data-min="'+v.remaining_min+'" data-color="'+v.bg_color+'">\n' +
- ' <p class="mb-5 min">'+v.remaining_min+'<br />\n'+
- ' Min</p>\n'+
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- '</li>';
- counter = counter+1;
- $("#orders-list").append(str);
- });
- $("span."+status).html(counter);
- }
- }
- });*/
- // $.ajax({
- // url: "{!! env('APP_URL') !!}order/counts",
- // success: function (response) {
- // // response = $.parseJSON(response);
- // var total_accepted = 0;
- // var total = 0;
- //
- // $.each(response,function (i,v) {
- // if(v.status=="Send_to_Kitchen" || v.status=="Accepted"){
- // total_accepted+=parseInt(v.status_count);
- // total+=parseInt(v.status_count);
- // $(".labelcenter.kitchen").text(total_accepted);
- // }
- //
- // if(v.status=="On_Road"){
- // $(".labelcenter.route").text(v.status_count);
- // total+=parseInt(v.status_count);
- // }
- //
- //
- // if(v.status=="Placed"){
- //
- // $(".labelcenter.new").html(v.status_count);
- // total+=parseInt(v.status_count);
- // if(parseInt(v.status_count) > 0){
- // $("#order-counter").html(v.status_count);
- // $("#order-counter").show();
- // }else{
- // audio.pause();
- // $("#order-counter").html(0);
- // $("#order-counter").hide();
- // }
- // }
- //
- // });
- // $(".labelcenter.all").text(total);
- // }
- // });
- count_order_status();
- $(".mlist_li[data-order-id="+data.order_id+"]").remove();
- }
- var resto_id = parseInt(data.resto_id);
- if(resto_id==logged_user){
- $("#all-orders").removeClass('no-order-found');
- audio.play();
- var new_order = (data.order_data);
- var v = new_order;
- var li = '<li class="mlist_li" rel="detail" data-order-id="'+v.id+'">\n' +
- ' <div class="box bg-danger rounded-0">\n' +
- ' <div class="media-list media-list-divided media-list-hover">\n' +
- ' <div class="media align-items-center">\n' +
- ' <div class="media-body">\n' +
- ' <p>#'+v.order_ref+'</p>\n' +
- ' <p> '+(v.campaign_type?v.campaign_type:"Direct")+', Just now</p>\n' +
- ' </div>\n' +
- ' <div class="media-right gap-items">\n' +
- ' <div class="user-social-acount text-center">\n' +
- ' <p class="m-0 status">New</p>\n' +
- ' <div class="d-flex align-items-center float-end">\n' +
- ' <div class="circle-div blu-bg text-center">\n' +
- ' <p class="mb-5 min">0<br />\n' +
- ' Min</p>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- ' </div>\n' +
- '</li>';
- /* var action_list = '<div class="btn-group">\n' +
- ' <a class="hover-primary dropdown-toggle no-caret" data-bs-toggle="dropdown"><i class="fa fa-ellipsis-h"></i></a>\n' +
- ' <div class="dropdown-menu">\n' +
- ' <a class="dropdown-item order-status" href="#!" data-id="'+new_order.id+'" data-status="Accepted">Accepted</a>\n' +
- ' <a class="dropdown-item order-status" href="#!" data-id="'+new_order.id+'" data-status="Rejected">Rejected</a>\n' +
- ' <a class="dropdown-item order-status" href="#!" data-id="'+new_order.id+'" data-status="Rejected_by_User">Rejected by User</a>\n' +
- ' \n' +
- ' </div>\n' +
- ' </div>';
- var row = '<tr class="special order-row" data-id="'+new_order.id+'">';
- row+='<td>'+new_order.order_ref+'</td>';
- row+='<td>'+timeFormat(new_order.created_at)+'</td>';
- row+='<td>'+new_order.customer_name+'</td>';
- row+='<td>'+ data.customer_mobile+ '</td>';
- row+='<td>'+data.customer_location+'</td>';
- row+='<td>'+new_order.order_type+'</td>';
- // row+='<td>'+new_order.campaign_name+'</td>';
- // row+='<td>'+new_order.campaign_date+'</td>';
- row+='<td>'+new_order.campaign_type+'</td>';
- row+='<td>'+data.total_price+'</td>';
- /!* row+='<td>'+(new_order.order_deliver_time?new_order.order_deliver_time:"(اقرب وقت)\t")+'</td>';*!/
- row+='<td><span class="badge badge-info-light">Placed</span></td>';
- row+='<td>'+action_list+'</td>';
- row+='</tr>';*/
- // $.ajax({
- // url: "{!! env('APP_URL') !!}order/counts",
- // success: function (response) {
- // // response = $.parseJSON(response);
- // var total_accepted = 0;
- // var total = 0;
- //
- // $.each(response,function (i,v) {
- // if(v.status=="Send_to_Kitchen" || v.status=="Accepted"){
- // total_accepted+=parseInt(v.status_count);
- // total+=parseInt(v.status_count);
- // $(".labelcenter.kitchen").text(total_accepted);
- // }
- //
- // if(v.status=="On_Road"){
- // $(".labelcenter.route").text(v.status_count);
- // total+=parseInt(v.status_count);
- // }
- //
- // if(v.status=="Placed"){
- // $(".labelcenter.new").text(v.status_count);
- // total+=parseInt(v.status_count);
- // if(parseInt(v.status_count) > 0){
- // $("#order-counter").html(v.status_count);
- // $("#order-counter").show();
- // }
- //
- // }
- //
- // });
- // $(".labelcenter.all").text(total);
- // }
- // });
- count_order_status();
- @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
- @if(Route::currentRouteName()=="OrderListing")
- $("#orders-list").prepend(li);
- @endif
- @endif
- // $("#new-order-tables tbody").prepend(row);
- // $("#new-orders-modal").modal();
- setTimeout(function () {
- $("#new-orders-modal").modal('hide');
- },30000);
- var notification = '<li>\n' +
- ' <a href="{!! env('APP_URL') !!}order/show/'+data.order_id+'">\n' +
- ' <i class="fa fa-users text-info"></i> '+data.message+'.\n' +
- ' </a>\n' +
- ' </li>';
- $("#notifications").prepend(notification);
- notification_counter += 1;
- new_order_count += 1;
- $(".badge-counter").attr('data-count',notification_counter);
- $(".badge-counter").html(notification_counter);
- $("#order-counter").html(new_order_count);
- $("#order-counter").show();
- }
- });
- $("body").on("click",".push-btn",function () {
- $(".main-sidebar").toggleClass('sidebar-active')
- });
- $("body").on("click",".change-lang",function () {
- var _lang = $(this).data('lang');
- $.ajax({
- url:"{!! env('APP_URL') !!}change/lang/"+_lang,
- success:function(){
- location.reload();
- }
- });
- });
- function count_order_status(){
- $.ajax({
- url: "{!! env('APP_URL') !!}order/counts",
- success: function (response) {
- // response = $.parseJSON(response);
- var total_accepted = 0;
- var total = 0;
- $.each(response,function (i,v) {
- if(v.status=="Send_to_Kitchen" || v.status=="Accepted"){
- total_accepted+=parseInt(v.status_count);
- total+=parseInt(v.status_count);
- $(".labelcenter.kitchen").text(total_accepted);
- }
- if(v.status=="On_Road"){
- $(".labelcenter.route").text(v.status_count);
- total+=parseInt(v.status_count);
- }
- if(v.status=="Placed"){
- $(".labelcenter.new").text(v.status_count);
- total+=parseInt(v.status_count);
- if(parseInt(v.status_count) > 0){
- $("#order-counter").html(v.status_count);
- $("#order-counter").show();
- }else{
- $("#order-counter").hide();
- }
- }
- });
- $(".labelcenter.all").text(total);
- }
- });
- }
- </script>
- </html>
- @yield('js')
|