outlets-pause-orders.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. @extends('layouts.app')
  2. @section('page-title')| {{__('label.outlet_pause_orders')}} @endsection
  3. @section('css')
  4. <link href="{!! env('APP_ASSETS') !!}css/outlets.css?v=1.3" rel="stylesheet" type="text/css">
  5. @endsection
  6. <link href="{!! env('APP_ASSETS') !!}vendor_components/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
  7. @section('content')
  8. <style>
  9. .p-10{
  10. padding: 10px;
  11. }
  12. .ml-0{
  13. margin-left: 0 !important;
  14. }
  15. .flex-items{
  16. display: flex;
  17. align-items: center;
  18. gap: 7px;
  19. }
  20. @-webkit-keyframes special {
  21. from { background-color: rgba(255, 121, 77, 0.27); }
  22. to { background-color: inherit; }
  23. }
  24. @-moz-keyframes special {
  25. from { background-color: rgba(255, 121, 77, 0.27);; }
  26. to { background-color: inherit; }
  27. }
  28. @-o-keyframes special {
  29. from { background-color: rgba(255, 121, 77, 0.27);; }
  30. to { background-color: inherit; }
  31. }
  32. @keyframes special {
  33. from { background-color: rgba(255, 121, 77, 0.27);; }
  34. to { background-color: inherit; }
  35. }
  36. .special {
  37. -webkit-animation: special 1s infinite; /* Safari 4+ */
  38. -moz-animation: special 1s infinite; /* Fx 5+ */
  39. -o-animation: special 1s infinite; /* Opera 12+ */
  40. animation: special 1s infinite; /* IE 10+ */
  41. }
  42. .btn-toggle.btn-sm,.btn-toggle.btn-sm > .handle{
  43. border-radius: 16px;
  44. }
  45. table.dataTable {
  46. clear: both;
  47. margin-top: 6px !important;
  48. margin-bottom: 6px !important;
  49. max-width: none !important;
  50. border-collapse: collapse !important;
  51. font-family: 'Open Sans';
  52. }
  53. .theme-primary .paging_simple_numbers .pagination .paginate_button.active a,.theme-primary .pagination li a:hover,.theme-primary .paging_simple_numbers .pagination .paginate_button:hover a{
  54. color: white !important;
  55. background: #ffa505 !important;
  56. }
  57. .search-outlet{
  58. width: 400px;
  59. background-color: white;
  60. }
  61. .search-buttom{
  62. top: 8px;
  63. right: 15px;
  64. font-size: 20px;
  65. color: #e1e1e1;
  66. }
  67. .btn-toggle.btn-sm:focus, .btn-toggle.btn-sm.focus, .btn-toggle.btn-sm:focus.active, .btn-toggle.btn-sm.focus.active{
  68. box-shadow: none;
  69. }
  70. .btn-outlet{
  71. }
  72. .btn-toggle.active{
  73. color: white !important;
  74. background: green;
  75. }
  76. .rdot {
  77. height: 10px;
  78. width: 10px;
  79. background-color: red;
  80. border-radius: 0%;
  81. display: inline-block;
  82. }
  83. .gdot {
  84. height: 10px;
  85. width: 10px;
  86. background-color: green;
  87. border-radius: 0%;
  88. display: inline-block;
  89. margin-right: 5px;
  90. }
  91. .pause-order{
  92. padding: 40px; background-color: #fff8ec; margin-bottom: 30px;
  93. }
  94. .ar-m-adjust
  95. {
  96. margin-left: 0 !important;
  97. }
  98. html[dir="rtl"] .ar-m-adjust
  99. {
  100. margin-right: 0 !important;
  101. margin-left:5px !important;
  102. }
  103. @media (max-width:641px) {
  104. .list-inline li{
  105. margin-right: 5px;
  106. }
  107. }
  108. @media(max-width:767px)
  109. {
  110. .order_status_div
  111. {
  112. text-align:left !important;
  113. margin-top:14px;
  114. }
  115. .sm-mt-0
  116. {
  117. margin-top: 0px !important;
  118. }
  119. button.switch-me
  120. {
  121. margin-left: 3px !important;
  122. }
  123. }
  124. </style>
  125. @php
  126. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  127. $lang = $resto->default_lang;
  128. app()->setLocale($lang);
  129. if(session('app_lang') !==null){
  130. $lang = session('app_lang');
  131. app()->setLocale($lang);
  132. }
  133. @endphp
  134. @php
  135. //$resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  136. $restuarant1 = $resto;
  137. $resto_metas = \App\Helpers\CommonMethods::getRestoMetas($restuarant1);
  138. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  139. $business_type = isset($resto_metas['BUSSINESS_TYPE'])?trim($resto_metas['BUSSINESS_TYPE']):"Restaurants";
  140. @endphp
  141. <!-- Content Wrapper. Contains page content -->
  142. <div class="content-wrapper">
  143. <div class="container-full">
  144. <!-- Main content -->
  145. <section class="content">
  146. <div class="row ">
  147. <div class="col-md-6">
  148. <div class="page-top-title">
  149. <h3 class="title m-0">{{__('label.pause_orders')}}</h3>
  150. </div>
  151. </div>
  152. </div>
  153. @php
  154. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  155. @endphp
  156. <div class="row m-0 p-10">
  157. @if(isset($outlets) && $outlets->count() > 0)
  158. @foreach($outlets as $outlet)
  159. @php
  160. $outlet_pickup_off_date = ($outlet->outlet_pickup_off_date);
  161. $outlet_delivery_off_date = ($outlet->outlet_delivery_off_date);
  162. if(!empty($outlet_pickup_off_date) || !empty($outlet_delivery_off_date)){
  163. $outlet1 = \App\Models\Outlets::find($outlet->id);
  164. $delivery_date = \Carbon\Carbon::createFromDate($outlet_delivery_off_date)->addDays(1);
  165. $pickup_date = \Carbon\Carbon::createFromDate($outlet_pickup_off_date)->addDays(1);
  166. $today = \Carbon\Carbon::now();
  167. if(!empty($delivery_date) || !empty($pickup_date)){
  168. $result = $today->gt($delivery_date);
  169. if($result){
  170. $outlet1->outlet_delivery_off_date = null;
  171. $outlet1->is_delivery = 1;
  172. }
  173. $result = $today->gt($pickup_date);
  174. if($result){
  175. $outlet1->outlet_pickup_off_date = null;
  176. $outlet1->is_pickup = 1;
  177. }
  178. $outlet1->save();
  179. $outlet = $outlet1;
  180. $outlet_pickup_off_date = $outlet1->outlet_pickup_off_date;
  181. $outlet_delivery_off_date = $outlet1->outlet_delivery_off_date;
  182. }
  183. }
  184. @endphp
  185. <div class="pause-order">
  186. <div class="row">
  187. <div class="col-md-6"><p class="fw-normal m-0 ar-sm-mr-5">{!! $resto->name !!}</p>
  188. <h5 class="m-0 fw-bold ar-sm-mr-5">{!! $outlet->name !!}</h5>
  189. </div>
  190. <div class="col-md-6 text-{{($lang=='ar')?'start':'end'}} order_status_div">
  191. <ul class="list-inline">
  192. <li> @if($outlet->is_delivery=="1") <span class="gdot"></span>{{__('label.delivery')}} @else<span class="rdot"></span> {{__('label.delivery_pause')}} @endif
  193. </li>
  194. <li> @if($outlet->is_pickup=="1") <span class="gdot"></span> {{__('label.pickup')}} @else <span class="rdot"></span>{{__('label.pickup_pause')}} @endif</li>
  195. @if($business_type=="Restaurants")
  196. <li> @if($outlet->is_contactless_dining=="1") <span class="gdot"></span> {{__('label.dine_in')}} @else <span class="rdot"></span> {{__('label.dine_in_pause')}} @endif</li>
  197. @endif
  198. </ul>
  199. </div>
  200. </div>
  201. <div class="row mt-30 sm-mt-0">
  202. <div class="col-md-12 col-lg-4 mb-2">
  203. <div class="flex-items">
  204. <button type="button" data-on-text="Open" data-type="delivery" data-off-text="Closed" class="ar-m-adjust switch-me btn-toggle btn-sm btn-outlet @if($outlet->is_delivery=="1") active @endif switch-me" data-id="{!! $outlet->id !!}" data-bs-toggle="button" aria-pressed="@if($outlet->is_delivery=="1") true @else false @endif" autocomplete="off">
  205. <div class="handle"></div>
  206. </button> {{__('label.accepting_delivery_orders')}}
  207. @if(isset($outlet_delivery_off_date) && !empty($outlet_delivery_off_date)) <br /> <small class="text-danger">{{__('label.paused_till_to')}} {!! \Carbon\Carbon::parse($outlet_delivery_off_date)->format('d/m/Y') !!}</small> @endif
  208. </div>
  209. </div>
  210. <div class="col-md-12 col-lg-4">
  211. <div class="flex-items">
  212. <button type="button" data-type="pickup" data-on-text="Open" data-off-text="Closed" class="switch-me ar-mrl-adjust btn-toggle btn-sm btn-outlet @if($outlet->is_pickup=="1") active @endif switch-me" data-id="{!! $outlet->id !!}" data-bs-toggle="button" aria-pressed="@if($outlet->is_pickup=="1") true @else false @endif" autocomplete="off">
  213. <div class="handle"></div>
  214. </button> {{__('label.accepting_pickup_orders')}}
  215. @if(isset($outlet_pickup_off_date) && !empty($outlet_pickup_off_date)) <br /> <small class="text-danger">{{__('label.paused_till_to')}} {!! \Carbon\Carbon::parse($outlet_pickup_off_date)->format('d/m/Y') !!}</small> @endif
  216. </div>
  217. </div>
  218. @if($business_type=="Restaurants")
  219. <div class="col-md-12 col-lg-4">
  220. <div class="flex-items">
  221. <button type="button" data-type="dine-in" data-on-text="Open" data-off-text="Closed" class="ar-m-adjust switch-me btn-toggle btn-sm btn-outlet @if($outlet->is_contactless_dining=="1") active @endif switch-me" data-id="{!! $outlet->id !!}" data-bs-toggle="button" aria-pressed="@if($outlet->is_contactless_dining=="1") true @else false @endif" autocomplete="off">
  222. <div class="handle"></div>
  223. </button>{{__('label.accepting_dine_in')}}
  224. </div>
  225. </div>
  226. @endif
  227. </div>
  228. </div>
  229. @endforeach
  230. @endif
  231. </div>
  232. </section>
  233. <!-- /.content -->
  234. </div>
  235. </div>
  236. <!-- /.content-wrapper -->
  237. <div class="modal" tabindex="-1" id="date-model">
  238. <div class="modal-dialog">
  239. <div class="modal-content">
  240. <div class="modal-header">
  241. <h5 class="modal-title" id="report-tile"></h5>
  242. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  243. </div>
  244. <div class="modal-body">
  245. <p>You 'll set date when you want to swithc on automatically.</p>
  246. <form id="get-report-data" method="POST" action="{!! env('APP_URL') !!}download/report/data" enctype="multipart/form-data">
  247. @csrf
  248. <input type="hidden" name="report_type" />
  249. <div class="form-group">
  250. <label>Date frame</label>
  251. <input type="text" id="rangedate" class="form-control">
  252. </div>
  253. </form>
  254. </div>
  255. <div class="modal-footer">
  256. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
  257. <button type="button" class="btn btn-primary set-date">Set Date</button>
  258. </div>
  259. </div>
  260. </div>
  261. </div>
  262. @endsection
  263. @section('js')
  264. <script type="text/javascript" src="{!! env('APP_ASSETS') !!}vendor_components/bootstrap-daterangepicker/daterangepicker.min.js"></script>
  265. <script>
  266. var _outletType = "";
  267. var _selectedOutletID = 0;
  268. $(function () {
  269. $("body").on("click",".set-date",function(){
  270. var start_date = $('#rangedate').data('daterangepicker').startDate;
  271. var s_date = moment(start_date).format("YYYY-MM-DD");
  272. $.ajax({
  273. url:"{!! env('APP_URL') !!}outlet/feature/update/status",
  274. type:"POST",
  275. data:{
  276. id:_selectedOutletID,
  277. status:0,
  278. offDate:s_date,
  279. type:_outletType,
  280. "_token":'{!! csrf_token() !!}'
  281. },
  282. success:function () {
  283. $("#date-model").modal('hide');
  284. }
  285. });
  286. });
  287. $('#rangedate').daterangepicker({
  288. singleDatePicker: true,
  289. showDropdowns: true,
  290. minDate: new Date(),
  291. }, function(start, end, label) {
  292. });
  293. $("body").on("click",".switch-me",function () {
  294. var is_active = $(this).attr("aria-pressed");
  295. var id = $(this).data('id');
  296. _selectedOutletID = id;
  297. var type = $(this).data('type');
  298. is_active = $.trim(is_active);
  299. var _this = $(this);
  300. var status = 0;
  301. _outletType = type;
  302. if(is_active=="false"){
  303. status = 0;
  304. _this.parents('tr').addClass('inactive');
  305. $("#date-model").modal('show');
  306. }else{
  307. status = 1;
  308. _this.parents('tr').removeClass('inactive');
  309. $.ajax({
  310. url:"{!! env('APP_URL') !!}outlet/feature/update/status",
  311. type:"POST",
  312. data:{
  313. id:id,
  314. status:status,
  315. type:type,
  316. "_token":'{!! csrf_token() !!}'
  317. },
  318. success:function () {
  319. if(is_active=="false"){
  320. $.toast({
  321. heading: 'Outlet '+type+' Status',
  322. text: 'Outlet '+type+' is deactive',
  323. position: 'top-right',
  324. loaderBg: '#ff6849',
  325. icon: 'error',
  326. hideAfter: 3000,
  327. stack: 1
  328. });
  329. }else{
  330. $.toast({
  331. heading: 'Outlet '+type+' Status',
  332. text: 'Outlet '+type+' is active.',
  333. position: 'top-right',
  334. loaderBg: '#ff6849',
  335. icon: 'success',
  336. hideAfter: 3000,
  337. stack: 1
  338. });
  339. }
  340. }
  341. });
  342. }
  343. });
  344. })
  345. </script>
  346. @endsection