123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505 |
- @php
- $resto_rtl = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
- $lang = $resto_rtl->default_lang;
- if(!empty($resto_rtl->time_zone)){
- config(['app.timezone' => $resto_rtl->time_zone]);
- date_default_timezone_set($resto_rtl->time_zone);
- // dd(\Carbon\Carbon::now()->format('Y-m-d H:i:s'));
- }
- app()->setLocale($lang);
- if(session('app_lang') !==null){
- $lang = session('app_lang');
- app()->setLocale($lang);
- }
- if(\Illuminate\Support\Facades\Auth::user()->role=="administrator" || \Illuminate\Support\Facades\Auth::user()->role=="admin_user")
- $lang="en";
- @endphp
- <!DOCTYPE html>
- @if($lang=="ar")
- <!--<html lang="ar" dir="rtl">-->
- <html lang="ar" dir="rtl">
- @else
- <html lang="en">
- @endif
- <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" />
- <!--<title> {!! env('APP_NAME') !!} @yield('page-title')</title>-->
- <title> {!! env('APP_NAME') !!} </title>
- <meta property="og:type" content="website" />
- <!-- Favicon Icon -->
- <link rel="icon" type="image/png" href="{!! env('APP_ASSETS') !!}images/{!! env('FAV_ICON') !!}">
- <link rel="apple-touch-icon" href="{!! env('APP_ASSETS') !!}images/{!! env('FAV_ICON') !!}">
- <link rel="shortcut icon" href="{!! env('APP_ASSETS') !!}images/{!! env('FAV_ICON') !!}">
- <!-- 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">-->
- <link href="{!! env('APP_ASSETS') !!}css/style_new.css?v=1.5" rel="stylesheet" type="text/css">
- {{--
- <link href="{!! env('APP_ASSETS') !!}css/style_rtl.css" rel="stylesheet" type="text/css">--}}
- <!-- Bootstrap Css -->
- <link href="{!! env('APP_ASSETS') !!}css/skin_color.css" rel="stylesheet"><!-- Custom Css -->
- <link href="{!! env('APP_ASSETS') !!}css/sidebar-new.css?v=1.5" rel="stylesheet" type="text/css">
- <link href="{!! env('APP_ASSETS') !!}css/admin_ar.css" rel="stylesheet" type="text/css">
- <link href="{!! env('APP_ASSETS') !!}vendor_components/sweetalert/sweetalert.css" rel="stylesheet" type="text/css">
- <link href="{!! env('APP_ASSETS') !!}css/responsive.css" rel="stylesheet" type="text/css">
- <link href="{!! env('APP_ASSETS') !!}css/responsive_ar.css" rel="stylesheet" type="text/css">
- <link href="{!! env('APP_ASSETS') !!}vendor_components/jquery-toast-plugin-master/src/jquery.toast.css" rel="stylesheet" type="text/css">
- @yield('css')
- <style>
- @include('inc.dashboard_css')
- </style>
- </head>
- <body class="light-skin sidebar-mini theme-primary fixed">
- <div class="wrapper">
- <div id="loader"></div>
- @include('inc.header')
- @if(\Illuminate\Support\Facades\Auth::user()->role=="administrator")
- @include('inc.sidebar_admin')
- @elseif(\Illuminate\Support\Facades\Auth::user()->role=="resto_user")
- @include('inc.sidebar_resto_user')
- @elseif(\Illuminate\Support\Facades\Auth::user()->role=="admin_user")
- @include('inc.sidebar_admin_users')
- @else
- @include('inc.sidebar_resto')
- @endif
- @yield('content')
- @php
- if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant"){
- $placed_order = false;
- $recent_till = \Carbon\Carbon::now()->subDays(2)->format('Y-m-d');;
- $one_order = \Illuminate\Support\Facades\Auth::user()->restaurants->id;
- $order1 = \App\Models\Orders::where('status','Placed')->where('resto_id',$one_order)->where('created_at','>=',$recent_till)->first();
- if(isset($order1) && $order1->status=="Placed"){
- $placed_order = true;
- }
- //dump($order);
- }
- @endphp
- {{-- @include('inc.sidebar_resto_right')--}}
- {{--<footer class="main-footer" style="font-size: 10px">
- <video controls="controls" src="{!! env('APP_URL') !!}/1sec.avi" muted autoplay loop style="display:none">
- Your browser does not support the HTML5 Video element.
- </video>
- <img src="{!! env('APP_ASSETS') !!}images/favicon.png" height="18" /> meem powered by <img src="{!! env('APP_ASSETS') !!}images/taiftec.png" height="16" />
- </footer>--}}
- <input type="button" id="toggle" value="Wake Lock is disabled" style="display:none"/>
- </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') !!}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>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/jquery-toast-plugin-master/src/jquery.toast.js"></script>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/sweetalert/sweetalert.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/printThis.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/jquery.uploadPreview.js"></script>
- <script type="text/javascript" src="{!! env('APP_ASSETS') !!}js/moment.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/jquery.validate.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/jquery.form.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/NoSleep.min.js"></script>
- <!-- Riday Admin App -->
- <script src="//js.pusher.com/3.1/pusher.min.js"></script>
- <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');
- console.log(data);
- console.log('notification: '+data.notification_for);
- var order_resto_id = parseInt(data.order_resto_id);
- if(data.notification_for=="delivered-order-status")
- order_resto_id = parseInt(data.resto_id);
- if(order_resto_id==logged_user && (data.notification_for=="update-order-status" || data.notification_for=="delivered-order-status")){
- var order_id = data.order_id;
- if(data.notification_for=="delivered-order-status")
- order_id = parseInt(data.resto_id);
- console.log("update-roder-status : OrderID: "+data.order_id);
- $(".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();
- 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');
- if(data.notification_for!="delivered-order-status")
- 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")
- if(data.notification_for!="delivered-order-status")
- $("#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')
|