orders-history.blade.php 82 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561
  1. @extends('layouts.app')
  2. @section('page-title')| Order History @endsection
  3. @section('content')
  4. <link href="{!! env('APP_ASSETS') !!}css/order-history.css" rel="stylesheet" type="text/css">
  5. <link href="{!! env('APP_ASSETS') !!}vendor_components/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
  6. <style>
  7. #discount-info{
  8. position: absolute;
  9. height: auto;
  10. width: 400px;
  11. border: 1px solid;
  12. bottom: 15%;
  13. background: #fff;
  14. left: 22%;
  15. border-radius: 5px;
  16. padding: 15px;
  17. display: none;
  18. z-index: 1;
  19. box-shadow: 0px 2px 3px #091E4240, 0px 0px 1px #091E424F;
  20. }
  21. span.info,.close-popup{
  22. cursor: pointer;
  23. position: relative;
  24. top: -2px;
  25. }
  26. #discount-info.active{
  27. display: block;
  28. }
  29. .item-list .list-group-item{
  30. background-color: transparent !important;
  31. }
  32. #only-loyalty-points{
  33. display:none;
  34. }
  35. #only-loyalty-points.active{
  36. display:block;
  37. }
  38. .item-list .list-group{
  39. margin-left: 18px !important;
  40. }
  41. .content{
  42. padding-left:10px;
  43. }
  44. @-webkit-keyframes special {
  45. from { background-color: rgba(255, 121, 77, 0.27); }
  46. to { background-color: inherit; }
  47. }
  48. @-moz-keyframes special {
  49. from { background-color: rgba(255, 121, 77, 0.27);; }
  50. to { background-color: inherit; }
  51. }
  52. @-o-keyframes special {
  53. from { background-color: rgba(255, 121, 77, 0.27);; }
  54. to { background-color: inherit; }
  55. }
  56. @keyframes special {
  57. from { background-color: rgba(255, 121, 77, 0.27);; }
  58. to { background-color: inherit; }
  59. }
  60. .special {
  61. -webkit-animation: special 1s infinite; /* Safari 4+ */
  62. -moz-animation: special 1s infinite; /* Fx 5+ */
  63. -o-animation: special 1s infinite; /* Opera 12+ */
  64. animation: special 1s infinite; /* IE 10+ */
  65. }
  66. .page-link{
  67. padding: .5em 1em !important;
  68. border-radius: 2px;
  69. border: 0;
  70. margin: 0;
  71. min-width: 50px !important;
  72. text-align: center;
  73. }
  74. .page-item.active .page-link{
  75. background-color: #4c95dd;
  76. }
  77. table.dataTable {
  78. clear: both;
  79. margin-top: 6px !important;
  80. margin-bottom: 6px !important;
  81. max-width: none !important;
  82. border-collapse: collapse !important;
  83. font-family: 'Open Sans';
  84. }
  85. /*table.dataTable td{
  86. border-width: 1px;
  87. }*/
  88. .theme-primary .pagination li a:hover {
  89. background-color: #000 !important;
  90. }
  91. .table > :not(:last-child) > :last-child > * {
  92. border-bottom-color: transparent;
  93. }
  94. table.dataTable th{font-weight: 700 !important;}
  95. .dataTables_paginate {
  96. width: 100%;
  97. text-align: center;
  98. }
  99. div.dataTables_wrapper div.dataTables_paginate ul.pagination{
  100. justify-content: center !important;
  101. }
  102. .right-panel-footer {
  103. background-color: #fff7e8;
  104. }
  105. .actions{
  106. position:absolute; top: 25px; right: 0
  107. }
  108. .content-wrapper {
  109. width: calc(100% - 290px);
  110. background-color: #fff !important;
  111. }
  112. .actions li{ margin:0 !important; padding:0}
  113. @media(max-width:767px)
  114. {
  115. .sm-w-50{
  116. width:50%;
  117. }
  118. }
  119. .pl-10{
  120. padding-left: 10px;
  121. }
  122. .pr-10{
  123. padding-right: 10px;
  124. }
  125. .page-top-title{
  126. padding-left: 0;
  127. }
  128. html[dir="rtl"] .row.pt-15.pl-10.pr-10{
  129. margin: 0 !important;
  130. }
  131. #print-recipt{
  132. display: none; }
  133. </style>
  134. @php
  135. $resto = \App\Models\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  136. $lang = $resto->default_lang;
  137. app()->setLocale($lang);
  138. if(session('app_lang') !==null){
  139. $lang = session('app_lang');
  140. app()->setLocale($lang);
  141. }
  142. $restuarant1 = $resto ;
  143. $resto_metas = \App\Helpers\CommonMethods::getRestoMetas($restuarant1);
  144. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  145. $is_tax_info = isset($resto_metas['DISPLAY_TAX_INFO'])?$resto_metas['DISPLAY_TAX_INFO']:"";
  146. $business_type = isset($resto_metas['BUSSINESS_TYPE'])?$resto_metas['BUSSINESS_TYPE']:"Restaurants";
  147. $translations = \App\Models\Translations::whereIn('item_key',['delivery','delivered','rejected','cancelled','close'])->get();
  148. $tr_ar = [];
  149. $tr_en = [];
  150. foreach($translations as $tr){
  151. if($tr->lang_id=="en")
  152. $tr_en[ucwords($tr->item_key)]= $tr->item_val;
  153. else
  154. $tr_ar[ucwords($tr->item_key)]= $tr->item_val;
  155. }
  156. @endphp
  157. @if($lang=="ar")
  158. <style>
  159. #show-order-detail .modal-header{
  160. display: block !important;
  161. }
  162. .btn-close{
  163. float: left;
  164. position: relative;
  165. top: -21px;
  166. }
  167. </style>
  168. @endif
  169. <div class="content-wrapper">
  170. <div class="container-full">
  171. <section class="content">
  172. <div class="row ">
  173. <div class="col-md-10">
  174. <div class="page-top-title">
  175. <h3 class="title m-0">{{__('label.order_history')}}</h3>
  176. </div>
  177. </div>
  178. </div>
  179. <div class="row pt-15 pl-10 pr-10">
  180. <div class="card cust_card p-15 rounded-1">
  181. <form class="row g-3 ordhistory" action="{!! env('APP_URL') !!}order/history">
  182. <div class="col-md-4 sm-pl-0">
  183. <input type="text" class="form-control" name="order_ref" value="{!! isset($_GET['order_ref'])?$_GET['order_ref']:"" !!}" placeholder="{{__('label.id')}}" id="inputID">
  184. </div>
  185. <div class="col-md-8 sm-pl-0">
  186. <input type="text" class="form-control" name="phone_number" value="{!! isset($_GET['phone_number'])?$_GET['phone_number']:"" !!}" placeholder="{{__('label.phone_number')}}" id="inputPassword4">
  187. </div>
  188. <div class="col-12 sm-pl-0">
  189. <select class="form-control form-select " name="outlet_id" title="{{__('label.outlets')}}" data-live-search="true">
  190. <option value="">Choose Outlet</option>
  191. @php
  192. $outlets = \App\Models\Outlets::whereNull('deleted_at')->where('resto_id',\App\Helpers\CommonMethods::getRestuarantID())->where('active',1)->get();
  193. @endphp
  194. @if(isset($outlets))
  195. @foreach($outlets as $outlet)
  196. <option @if(isset($_GET['outlet_id']) && !empty($_GET['outlet_id']) && $_GET['outlet_id']==$outlet->id) selected @endif value="{!! $outlet->id !!}">{!! $outlet->name !!}</option>
  197. @endforeach
  198. @endif
  199. </select>
  200. </div>
  201. <div class="col-12 sm-pl-0">
  202. <input type="text" class="form-control" id="date_range" value="{!! isset($_GET['date_range'])?$_GET['date_range']:"" !!}" name="date_range" placeholder="{{__('label.date_range')}}">
  203. </div>
  204. <div class="col-12 sm-pl-0">
  205. <select class="form-control form-select" name="order_status" data-live-search="true" title="{{__('label.order_status')}}">
  206. <option value="">Choose Order Status</option>
  207. <option value="Placed" @if(isset($_GET['order_status']) && $_GET['order_status']=="Placed") selected @endif>{{__('label.placed')}}</option>
  208. <option value="Accepted" @if(isset($_GET['order_status']) && $_GET['order_status']=="Accepted") selected @endif>{{__('label.in_preparation')}}</option>
  209. <option value="On_Road" @if(isset($_GET['order_status']) && $_GET['order_status']=="On_Road") selected @endif>{{__('label.in_routeready')}}</option>
  210. <option value="Has_Delivered" @if(isset($_GET['order_status']) && $_GET['order_status']=="Has_Delivered") selected @endif>{{__('label.delivered')}}</option>
  211. <option value="Cancelled" @if(isset($_GET['order_status']) && $_GET['order_status']=="Cancelled") selected @endif>{{__('label.cancelled')}}</option>
  212. <option value="Rejected" @if(isset($_GET['order_status']) && $_GET['order_status']=="Rejected") selected @endif>{{__('label.rejected')}}</option>
  213. <option value="Close" @if(isset($_GET['order_status']) && $_GET['order_status']=="Close") selected @endif>{{__('label.rejected_by_user')}}</option>
  214. <option value="Close" @if(isset($_GET['order_status']) && $_GET['order_status']=="Fail") selected @endif>{{__('label.order_status_fail')}}</option>
  215. </select>
  216. </div>
  217. <div class="col-12 sm-pl-0">
  218. <select class="form-control form-select selectpicker">
  219. <option>{{__('label.select_option')}}</option>
  220. </select>
  221. </div>
  222. <div class="col-12 sm-pl-0">
  223. <select class="form-control form-select selectpicker">
  224. <option>{{__('label.select_option')}}</option>
  225. </select>
  226. </div>
  227. <div class="col-6 sm-pl-0">
  228. <button type="submit" class="btn btn-outline-primary btn-md rounded-0 sm-w-50">{{__('label.search')}}</button>
  229. </div>
  230. </form>
  231. </div>
  232. <div class="card p-15 rounded-1 sm-pl-0">
  233. <div class="jumbotron p-0">
  234. <div class="row">
  235. <div class="col-md-12 sm-pl-3">
  236. <div class="table-responsive order-his-tbl">
  237. <table id="example" class="table table-striped" >
  238. <thead>
  239. <tr>
  240. <th>{{__('label.id')}}</th>
  241. <th>{{__('label.status')}}</th>
  242. <th>{{__('label.customer')}}</th>
  243. <th>{{__('label.mobile_no')}}</th>
  244. <th>{{__('label.type')}}</th>
  245. <th>{{__('label.payment_mode')}}</th>
  246. <th>{{__('label.total')}}</th>
  247. <th>{{__('label.channel')}}</th>
  248. <th>{{__('label.order_at')}}</th>
  249. <th>{{__('label.deliver_at')}}</th>
  250. </tr>
  251. </thead>
  252. <tbody>
  253. @if(isset($orders) && $orders->count() > 0)
  254. @php
  255. $country_code = "";
  256. if(isset($restuarant1->countries))
  257. $country_code = $restuarant1->countries->country_code;
  258. @endphp
  259. @php
  260. $custom_status['Placed'] = ['Accepted'=>'Accepted','Rejected'=>'Rejected', 'Rejected_by_User'=>'Rejected by User'];
  261. $custom_status['Send_to_Kitchen'] = [' <a href="#!" class="print1">On_Road'=>'On the Way','Rejected'=>'Rejected', 'Rejected_by_User'=>'Rejected by User'];
  262. $custom_status['On_Road'] = ['Has_Delivered'=>'Delivered','Rejected'=>'Rejected', 'Rejected_by_User'=>'Rejected by User'];
  263. $custom_statuses = ['Rejected_by_User'=>'Rejected by User','Accepted'=>'Accepted','Rejected'=>'Rejected','Placed'=>'Placed','Send_to_Kitchen'=>'Send to Kitchen','On_Road'=>'On the Way', 'Has_Delivered'=>'Delivered','Served'=>"Served",
  264. "Cancelled_by_Customer"=>"Cancelled","Close"=>"Close","Fail"=>"Fail"];
  265. $custom_status['Accepted'] = ['On_Road'=>'On the Way','Rejected'=>'Rejected', 'Rejected_by_User'=>'Rejected by User'];
  266. @endphp
  267. @foreach($orders as $order)
  268. <tr class="order-detail" data-id="{!! $order->id !!}">
  269. <td> {!! $order->order_ref !!}</td>
  270. @if(app()->getLocale()=="en")
  271. <td>{!! isset($custom_statuses[$order->status])?$custom_statuses[$order->status]:"" !!}</td>
  272. @else
  273. <td>{!! $tr_ar[isset($custom_statuses[$order->status])?$custom_statuses[$order->status]:""] !!}</td>
  274. @endif
  275. @php
  276. $customer_name = $order->customer_name;
  277. if(empty($customer_name)){
  278. $customer_name = $order->customers->name;
  279. }
  280. @endphp
  281. <td>{!! $customer_name !!}</td>
  282. @php
  283. $new_phone = "";
  284. if(isset($order->customers) && isset($order->customers->users)){
  285. $pos = strpos($order->customers->users->email,$country_code);
  286. if ($pos !== false) {
  287. $new_phone = substr_replace($order->customers->users->email, '', $pos, strlen($country_code));
  288. }else{
  289. $new_phone = $order->customers->users->email;
  290. }
  291. }
  292. @endphp
  293. <td>{!! $new_phone !!}</td>
  294. <td>{!! app()->getLocale()=="en"?$order->order_type:$tr_ar[ucwords($order->order_type)] !!}</td>
  295. <td>{!! $order->payment_mode=="COD"?__('label.cash'):__('label.card') !!} </td>
  296. <td>{!! $currency !!} {!! $order->getActualPriceAttribute() !!}</td>
  297. <td>{!! $order->campaign_type!!}</td>
  298. <td>{!! \App\Helpers\CommonMethods::formatDateTime($order->created_at) !!}</td>
  299. <td>{!! \App\Helpers\CommonMethods::formatDateTime($order->updated_at) !!}</td>
  300. </tr>
  301. @endforeach
  302. @endif
  303. </tbody>
  304. </table>
  305. </div>
  306. </div>
  307. </div>
  308. </div>
  309. </div>
  310. </div>
  311. </section>
  312. <!-- /.content -->
  313. </div>
  314. </div>
  315. <!-- /.content-wrapper -->
  316. <div class="modal fade" id="show-order-detail" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  317. <div class="modal-dialog modal-lg">
  318. <div class="modal-content">
  319. <div class="modal-header">
  320. <h5 class="modal-title" id="staticBackdropLabel">{{__('label.order_detail')}}</h5>
  321. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  322. </div>
  323. <div class="modal-body">
  324. <div class="order-section" style="max-height: 500px; overflow-x: auto;">
  325. <div class="row">
  326. <div class="col-sm-12">
  327. <div class="boxs">
  328. <div class="box-header with-border">
  329. <div class="d-flex justify-content-between align-items-center">
  330. <p class="fw-bold" rel="order_ref"></p>
  331. <p rel="order_placed"></p>
  332. <p class="p-2 inkitchen-btn" id="toggle"></p>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. <div class="row">
  338. <div class="col-sm-12 mt-1 text-end">
  339. <a href="#!" class="print">
  340. <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" class="bi bi-printer-fill" viewBox="0 0 16 16">
  341. <path d="M5 1a2 2 0 0 0-2 2v1h10V3a2 2 0 0 0-2-2H5zm6 8H5a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1z"/>
  342. <path d="M0 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-1v-2a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2H2a2 2 0 0 1-2-2V7zm2.5 1a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1z"/>
  343. </svg>
  344. </a>
  345. </div>
  346. </div>
  347. <div class="row right-panel-box">
  348. <div class="col-md-6">
  349. <div class="boxs">
  350. <div class="box-body">
  351. <div class="d-flex align-items-start">
  352. <div>
  353. <p class="text-fade mb-0">{{__('label.brand')}}</p>
  354. <p rel="brand_name"></p>
  355. </div>
  356. </div>
  357. </div>
  358. </div>
  359. </div>
  360. <div class="col-md-6">
  361. <div class="boxs">
  362. <div class="box-body">
  363. <div class="d-flex align-items-start">
  364. <div>
  365. <p class="text-fade mb-0">{{__('label.outlets')}}</p>
  366. <p rel="outlet_name"></p>
  367. </div>
  368. </div>
  369. </div>
  370. </div>
  371. </div>
  372. </div>
  373. <div class="row right-panel-box">
  374. <div class="col-md-6">
  375. <div class="boxs">
  376. <div class="box-body">
  377. <div class="d-flex align-items-start">
  378. <div>
  379. <p class="text-fade mb-0">{{__('label.order_type')}}</p>
  380. <p>
  381. <i class="icon-Dinner"><span class="path1"></span><span class="path2"></span><span class="path3"></span><span class="path4"></span><span class="path5"></span></i>
  382. <span rel="order_type"></span>
  383. </p>
  384. </div>
  385. </div>
  386. </div>
  387. </div>
  388. </div>
  389. <div class="col-md-6 for-delivery">
  390. <div class="boxs">
  391. <div class="box-body">
  392. <div class="d-flex align-items-start">
  393. <div class="">
  394. <p class="text-fade mb-0">{{__('label.delivery_at')}}</p>
  395. <p rel="delivery_at"></p>
  396. </div>
  397. </div>
  398. </div>
  399. </div>
  400. </div>
  401. <div class="col-md-6 for-pickup" style="display:none">
  402. <div class="boxs">
  403. <div class="box-body">
  404. <div class="d-flex align-items-start">
  405. <div class="">
  406. <p class="text-fade mb-0">{{__('label.pickup_at')}}</p>
  407. <p rel="delivery_at"></p>
  408. </div>
  409. </div>
  410. </div>
  411. </div>
  412. </div>
  413. </div>
  414. <div class="row right-panel-box">
  415. <div class="col-md-6">
  416. <div class="boxs">
  417. <div class="box-body">
  418. <div class="d-flex align-items-start">
  419. <div class="">
  420. <p class="text-fade mb-0">{{__('label.customers')}}</p>
  421. <p rel="customer"> <br>
  422. <i class="mdi mdi-crown org-color"></i>
  423. <small class="org-color">Ordered 5 times </small>
  424. </p>
  425. </div>
  426. </div>
  427. </div>
  428. </div>
  429. </div>
  430. <div class="col-md-6">
  431. <div class="boxs">
  432. <div class="box-body">
  433. <div class="d-flex align-items-start">
  434. <div class="">
  435. <p class="text-fade mb-0">{{__('label.phone_number')}}</p>
  436. <p rel="phone"></p>
  437. </div>
  438. </div>
  439. </div>
  440. </div>
  441. </div>
  442. </div>
  443. <div class="row right-panel-box">
  444. <div class="col-md-6">
  445. <div class="boxs">
  446. <div class="box-body">
  447. <div class="d-flex align-items-start">
  448. <div class="">
  449. <p class="text-fade mb-0">{{__('label.payment_mode')}}</p>
  450. <p rel="payment"></p>
  451. </div>
  452. </div>
  453. </div>
  454. </div>
  455. </div>
  456. <div class="col-md-6">
  457. <div class="boxs">
  458. <div class="box-body">
  459. <div class="d-flex align-items-start">
  460. <div class="">
  461. <p class="text-fade mb-0">{{__('label.channel')}}</p>
  462. <p rel="channel"></p>
  463. </div>
  464. </div>
  465. </div>
  466. </div>
  467. </div>
  468. </div>
  469. <div class="row right-panel-box">
  470. <div class="col-md-6">
  471. <div class="boxs">
  472. <div class="box-body">
  473. <div class="d-flex align-items-start">
  474. <div class="">
  475. <p class="text-fade mb-0">{{__('label.address')}}</p>
  476. <p rel="address"></p>
  477. </div>
  478. </div>
  479. </div>
  480. </div>
  481. </div>
  482. <div class="col-md-6">
  483. <div class="boxs">
  484. <div class="box-body">
  485. <div class="d-flex align-items-start">
  486. <div class="">
  487. <p class="text-fade mb-0">{{__('label.delivery_notes')}}</p>
  488. <p rel="delivery_notes"></p>
  489. </div>
  490. </div>
  491. </div>
  492. </div>
  493. </div>
  494. </div>
  495. <!--<div class="row right-panel-box for-delivery" id="google-map-link">
  496. <div class="col-md-6">
  497. <div class="boxs">
  498. <div class="box-body">
  499. <div class="d-flex align-items-start">
  500. <div class="">
  501. <p class="text-fade mb-0">Formatted Address</p>
  502. <p rel="formatted_address"></p>
  503. </div>
  504. </div>
  505. </div>
  506. </div>
  507. </div>
  508. <div class="col-md-6">
  509. <div class="boxs">
  510. <div class="box-body">
  511. <div class="d-flex align-items-start">
  512. <div class="">
  513. <p class="text-fade mb-0">Share Google map link</p>
  514. <p rel="google-map-link"></p>
  515. </div>
  516. </div>
  517. </div>
  518. </div>
  519. </div>
  520. </div>-->
  521. <div class="row right-panel-box">
  522. <div class="col-md-12">
  523. <div class="boxs" style="position: relative">
  524. <div class="box-body">
  525. <div class="d-flex align-items-start">
  526. <div class="">
  527. <p class="text-fade mb-0">{{__('label.address')}}</p>
  528. <p rel="address"></p>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="actions">
  533. <ul class="list-inline">
  534. <li class="list-inline-item"><a href="#!" class="address-actions" data-action="copy-clipboard"><svg data-v-10e82b3e="" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" class="" style="color: var(--color-midnight); width: 20px; height: 20px;"><path fill-rule="evenodd" d="M16 5.5H6a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h10a.5.5 0 00.5-.5V6a.5.5 0 00-.5-.5zM6 4a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2H6z" clip-rule="evenodd"></path><path fill-rule="evenodd" d="M1.25 4A2.75 2.75 0 014 1.25h6a.75.75 0 010 1.5H4c-.69 0-1.25.56-1.25 1.25v6a.75.75 0 01-1.5 0V4z" clip-rule="evenodd"></path></svg></a></li>
  535. <li class="list-inline-item"><a href="#!" class="address-actions" data-action="google-map"><svg data-v-2740a47f="" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg" class="" style="width: 20px; height: 20px;"><path d="M16.45 7.7c0 3.152-2.19 4.965-3.831 6.72-.983 1.051-1.769 4.48-1.769 4.48s-.784-3.426-1.764-4.475C7.443 12.671 5.25 10.855 5.25 7.7a5.6 5.6 0 1111.2 0v0z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.61 7.7a2.24 2.24 0 104.48 0 2.24 2.24 0 00-4.48 0z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></a></li>
  536. <li class="list-inline-item">
  537. <a href="#!" class="address-actions" data-action="whatsapp">
  538. <svg data-v-2740a47f="" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg" class="" style="width: 20px; height: 20px;"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.071 4.013a9.192 9.192 0 016.502-2.663 9.192 9.192 0 019.207 9.143v.01A9.222 9.222 0 015.803 18.33l-2.92.925a.75.75 0 01-.937-.954l.932-2.763a9.027 9.027 0 01-1.528-5.042v-.003a9.192 9.192 0 012.721-6.48zM10.572 2.1l-.002.75a7.692 7.692 0 00-7.72 7.65 7.527 7.527 0 001.464 4.473.75.75 0 01.107.685l-.58 1.72 1.84-.583a.75.75 0 01.638.088 7.722 7.722 0 0011.96-6.387 7.692 7.692 0 00-7.705-7.646l-.002-.75zM8.548 5.878c.223.115.47.313.606.628.055.126.132.314.212.51l.177.43c.07.167.134.316.186.428.026.056.045.096.058.12v.002a1.149 1.149 0 01.058 1.17 1.27 1.27 0 01-.282.38 5.126 5.126 0 01-.07.063l-.048.045a6.172 6.172 0 002.386 2.02c.085-.116.18-.253.252-.367.156-.246.41-.47.777-.513.277-.032.52.062.614.098l.009.004c.2.076 1.063.497 1.425.673l.136.066c.019.009.04.02.064.03.077.037.173.082.246.123.085.047.297.166.434.4.04.068.067.14.083.213a1.81 1.81 0 01-.216 1.572c-.796 1.379-2.173 1.81-3.55 1.667-1.356-.14-2.785-.827-3.962-1.76-1.178-.934-2.19-2.183-2.63-3.538-.452-1.393-.293-2.904.899-4.163.401-.436 1-.53 1.429-.496.233.018.482.078.707.195zm5.91 7.139l-.066-.031-.175-.085a155.61 155.61 0 00-1.056-.508 6 6 0 01-.39.508c-.133.15-.35.327-.67.366a1.22 1.22 0 01-.686-.133 7.672 7.672 0 01-3.436-2.979l-.01-.016a1.033 1.033 0 01-.085-.922c.086-.216.248-.379.276-.408a8.417 8.417 0 01.24-.234 15.217 15.217 0 01-.242-.552l-.19-.463a46.22 46.22 0 00-.15-.365.524.524 0 00-.313.012c-.76.8-.875 1.717-.565 2.672.323.995 1.113 2.016 2.135 2.826 1.021.81 2.188 1.34 3.184 1.443.963.1 1.683-.193 2.108-.943a.728.728 0 01.038-.061.312.312 0 00.052-.127zM7.515 7.194l-.002.003.002-.003zm.346.018H7.86h.002zm4.226 4.58zm-2.29-3.779z" fill="currentColor"></path></svg>
  539. </a>
  540. </li>
  541. </ul>
  542. </div>
  543. </div>
  544. </div>
  545. </div>
  546. @if( $business_type=="Florist")
  547. <div class="row right-panel-box" >
  548. <div class="col-md-6">
  549. <div class="boxs">
  550. <div class="box-body">
  551. <div class="d-flex align-items-start">
  552. <div class="">
  553. <p class="text-fade mb-0">{{__('label.receiver_name')}}</p>
  554. <p rel="recipient_name"></p>
  555. </div>
  556. </div>
  557. </div>
  558. </div>
  559. </div>
  560. <div class="col-md-6">
  561. <div class="boxs">
  562. <div class="box-body">
  563. <div class="d-flex align-items-start">
  564. <div class="">
  565. <p class="text-fade mb-0">{{__('label.receiver_phone')}}</p>
  566. <p rel="recipient_phone"></p>
  567. </div>
  568. </div>
  569. </div>
  570. </div>
  571. </div>
  572. </div>
  573. <div class="row right-panel-box" >
  574. <div class="col-md-12">
  575. <div class="boxs">
  576. <div class="box-body">
  577. <div class="d-flex align-items-start">
  578. <div class="">
  579. <p class="text-fade mb-0">{{__('label.greeting_message')}}</p>
  580. <p rel="greeting_message"></p>
  581. </div>
  582. </div>
  583. </div>
  584. </div>
  585. </div>
  586. </div>
  587. @endif
  588. </div>
  589. <div class="row mt-0 right-panel-footer position-relative">
  590. <div id="discount-info">
  591. <ul class="list-group list-group-flush">
  592. <li class="list-group-item">Discount Code : <strong><span id="discount-code"></span></strong></li>
  593. <li class="list-group-item">Discount Name : <strong><span id="discount-name"></span></strong></li>
  594. <li class="list-group-item">Discount Amount : <strong><span id="discount-amount"></span></strong></li>
  595. <li class="list-group-item">Start DateTime : <strong><span id="discount-start-datetime"></span></strong></li>
  596. <li class="list-group-item">End DateTime : <strong><span id="discount-end-datetime"></span></strong></li>
  597. <li class="list-group-item text-end">
  598. <span class="close-popup">
  599. <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24">
  600. <path fill="currentColor" d="m12 13.4l-4.9 4.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.9-4.9l-4.9-4.9q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l4.9 4.9l4.9-4.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7L13.4 12l4.9 4.9q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L12 13.4Z"/></svg>
  601. </span>
  602. </li>
  603. </ul>
  604. </div>
  605. <div class="col-12" id="show-recipes">
  606. </div>
  607. <div class="col-12 calc_div">
  608. <div class="box-header border-0 p-15 mt-0 pb-0">
  609. <div class="d-flex justify-content-between align-items-center m-0">
  610. <p>{{__('label.sub_total')}}:</p>
  611. <p class="sub_total"></p>
  612. </div>
  613. <div class="discount_with text-success d-flex justify-content-between align-items-center m-0">
  614. <p>{{__('label.discounts')}} ( <span rel="discount_code"></span> ) ( <span rel="discount_amount"></span> ): <span class="info">
  615. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 32 32"><path fill="currentColor" d="M17 22v-8h-4v2h2v6h-3v2h8v-2h-3zM16 8a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 16 8z"/>
  616. <path fill="currentColor" d="M16 30a14 14 0 1 1 14-14a14 14 0 0 1-14 14Zm0-26a12 12 0 1 0 12 12A12 12 0 0 0 16 4Z"/></svg>
  617. </span> </p>
  618. <p class="discount_total">AED 0</p>
  619. </div>
  620. <div id="only-delivery">
  621. <div class="d-flex justify-content-between align-items-center m-0">
  622. <p>{{__('label.delivery_fee')}}:</p>
  623. <p class="delivery_fee"></p>
  624. </div>
  625. <div class="delivery_discount_with text-success d-flex justify-content-between align-items-center m-0">
  626. <p>{{__('label.delivery_discounts')}}:</p>
  627. <p class="delivery_discount_total">AED 0</p>
  628. </div>
  629. </div>
  630. <div id="only-loyalty-points" class="text-success">
  631. <div class="d-flex justify-content-between align-items-center m-0">
  632. <p>{{__('label.loyalty_points')}}:</p>
  633. <p class="loyalty_amount"></p>
  634. </div>
  635. </div>
  636. @if(!empty($is_tax_info))
  637. <div class="d-flex fw-bold justify-content-between align-items-center m-0">
  638. <p>{{__('label.tax_info')}}:</p>
  639. <p class="tax_info"></p>
  640. </div>
  641. @endif
  642. <div class="d-flex fw-bold justify-content-between align-items-center m-0">
  643. <p class="">{{__('label.total')}}:</p>
  644. <p class="total_txt"></p>
  645. </div>
  646. </div>
  647. </div>
  648. </div>
  649. </div>
  650. </div>
  651. <div class="modal-footer">
  652. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{__('label.close')}}</button>
  653. </div>
  654. </div>
  655. </div>
  656. </div>
  657. <div id="print-recipt"> </div>
  658. @endsection
  659. @section('js')
  660. {{-- <script src="{!! env('APP_ASSETS') !!}vendor_components/bootstrap-select/dist/js/bootstrap-select.js"></script>--}}
  661. <script type="text/javascript" src="{!! env('APP_ASSETS') !!}vendor_components/bootstrap-daterangepicker/daterangepicker.min.js"></script>
  662. <script>
  663. var resto_id = 0;
  664. var order_object = null;
  665. var order_id = 0;
  666. var lang = "{!! $lang !!}";
  667. $(function () {
  668. $("body").on("click",".info,.close-popup",function (){
  669. $("#discount-info").toggleClass('active')
  670. });
  671. $("body").on("click",".address-actions",function(){
  672. var _actions = $(this).data("action");
  673. if(_actions=="google-map"){
  674. var map = "https://maps.google.com/?q="+order_object.geo_location;
  675. window.open(map,"_blank");
  676. return false;
  677. }
  678. if(_actions=="whatsapp"){
  679. var template = order_text_template(order_object,"whatsapp");
  680. //console.log(encodeURIComponent(template));
  681. window.open("https://api.whatsapp.com/send?text="+(template),"_blank");
  682. }
  683. if(_actions=="copy-clipboard"){
  684. var template = order_text_template(order_object,"copy-clipboard");
  685. //console.log(encodeURIComponent(template));
  686. navigator.clipboard.writeText(template);
  687. }
  688. });
  689. $("body").on("click",".print",function () {
  690. $.ajax({
  691. url:"{!! env('APP_URL') !!}show/order/detail/"+order_id+"?action=print",
  692. success:function (response) {
  693. $('#print-recipt').html(response);
  694. $('#print-recipt').printThis();
  695. }
  696. });
  697. });
  698. var _already_clicked = false;
  699. $("body").on("click",".order-detail",function(){
  700. if(!_already_clicked){
  701. //_already_clicked = true;
  702. var id = $(this).data("id");
  703. order_id = id;
  704. // $(".mlist_li.selected").removeClass('selected');
  705. $("#show-recipes").html('');
  706. //$(this).addClass('selected');
  707. $(".discount_with").removeClass('active');
  708. $(".delivery_discount_with").removeClass('active');
  709. $("p[rel]").each(function(){
  710. $(this).html(progress_img);
  711. });
  712. $("#show-recipes").html(progress_img);
  713. $(".sub_total, .delivery_fee, .delivery_discount_total, .total_txt, .tax_info").html(progress_img);
  714. $.ajax({
  715. url:"{!! env('APP_URL') !!}show/order/detail/"+id,
  716. success:function (response) {
  717. $("p[rel]").each(function(){
  718. $(this).html('');
  719. });
  720. $("#show-recipes").html('');
  721. $("#show-order-detail").modal('show');
  722. $(".sub_total, .delivery_fee, .delivery_discount_total, .total_txt,.tax_info").html('');
  723. order_object = {
  724. geo_location:response.customer.geo_points!=""?response.customer.geo_points:response.customer.geo_location,
  725. order_ref:response.order_info.order_ref,
  726. brand_name:response.business_info.business_name,
  727. outlet_name:response.business_info.outlet_name,
  728. customer:response.customer.customer_name,
  729. phone:response.customer.customer_phone,
  730. payment:response.order_info.payment,
  731. delivery_at:response.order_info.delivery_at,
  732. address:response.customer.deliveryAddress,
  733. sub_total_price:response.basket.sub_total.formatted_price,
  734. delivery_fee:response.basket.delivery_fee.formatted_price,
  735. is_discount:response.basket.is_discount,
  736. discounted_amount:response.basket.discounted_amount.formatted_price,
  737. is_delivery_discount:response.basket.is_delivery_discount,
  738. delivery_discount_fee:response.basket.delivery_discounted_amount.formatted_price,
  739. total_price:response.basket.is_discount?response.basket.discounted_total_price.formatted_price:response.basket.grand_total.formatted_price,
  740. delivery_update_status_url:response.delivery_boy.delivery_update_status_url,
  741. link_expire_time:response.delivery_boy.link_expire_time
  742. };
  743. $("#accept-modal input[name=preparation_time]").val(response.order_info.estimated_time.preparation_time);
  744. $("#accept-modal input[name=preperation_delivery]").val(response.order_info.estimated_time.preparation_delivery_time);
  745. $("#accept-modal select[name=preparation_type]").val(response.order_info.estimated_time.time_type);
  746. $(".change-status").attr('data-id',id);
  747. $(".change-status-reject").attr('data-id',id);
  748. var o_t = response.order_info.order_type.toLowerCase();
  749. $(".for-delivery").hide();
  750. $(".for-pickup").hide();
  751. $(".for-"+o_t).show();
  752. if(o_t=="pickup"){
  753. $("#only-delivery").hide();
  754. }
  755. $("p[rel=order_placed]").html(response.order_info.order_placed);
  756. $("p[rel=order_ref]").html(response.order_info.order_ref);
  757. $("p[rel=brand_name]").html(response.business_info.business_name);
  758. $("p[rel=outlet_name]").html(response.business_info.outlet_name);
  759. $(".inkitchen-btn").removeClass('org-bg');
  760. $(".inkitchen-btn").removeClass('bg-danger');
  761. $(".inkitchen-btn").removeClass('green-bg');
  762. $(".inkitchen-btn").addClass(response.order_info.bg);
  763. $(".inkitchen-btn").html(response.order_info.status);
  764. $("p[rel=order_type]").html(response.order_info.order_type);
  765. if(response.order_info.status=="New"){
  766. $(".reject").show();
  767. $(".accept").hide();
  768. }else{
  769. $(".accept").show();
  770. $(".reject").hide();
  771. }
  772. if(response.order_info.order_type=="Dine in"){
  773. $("#address").hide();
  774. $("#table").show();
  775. $("#google-map-link").hide();
  776. }else{
  777. $("#address").show();
  778. $("#table").hide();
  779. if(response.order_info.order_type=="Delivery")
  780. $("#google-map-link").show();
  781. else
  782. $("#google-map-link").hide();
  783. }
  784. $(".change-status").html(response.order_info.next_status_label);
  785. $(".change-status").attr('data-status',response.order_info.next_status);
  786. $("p[rel=delivery_at]").html(response.order_info.delivery_at);
  787. $("p[rel=payment]").html(response.order_info.payment);
  788. $("p[rel=channel]").html(response.order_info.channel);
  789. $("p[rel=order_instructions]").html(response.order_info.order_instructions);
  790. $("p[rel=customer]").html(response.customer.customer_name);
  791. $("p[rel=phone]").html(response.customer.customer_phone);
  792. $("p[rel=delivery_notes]").html(response.customer.delivery_instructions);
  793. $("p[rel=address]").html(response.customer.deliveryAddress);
  794. //BASKET INFORMATION
  795. var items = response.basket.items?response.basket.items:null;
  796. if(items){
  797. $(items).each(function(index, item){
  798. $("#show-recipes").append(show_item(item));
  799. });
  800. }
  801. var is_discount = response.basket.is_discount;
  802. var is_loyalty = response.basket.is_loyalty;
  803. if(is_discount){
  804. $(".discount_with").addClass('active');
  805. $(".discount_total").html(response.basket.discounted_amount.formatted_price);
  806. }else{
  807. $(".discount_with").removeClass('active');
  808. $(".discount_total").html(0);
  809. }
  810. if(is_loyalty){
  811. $("#only-loyalty-points").addClass('active');
  812. $(".loyalty_amount").html(response.basket.loyalty_amount.formatted_price);
  813. }else{
  814. $("#only-loyalty-points").removeClass('active');
  815. $(".loyalty_amount").html(0);
  816. }
  817. var is_delivery_discount = response.basket.is_delivery_discount;
  818. if(is_delivery_discount){
  819. $(".delivery_discount_with ").addClass('active');
  820. $(".delivery_discount_total ").html(response.basket.delivery_discounted_amount.formatted_price);
  821. $("span[rel=discount_code]").html(response.basket.discount_info.discount_code);
  822. $("#discount-code").html(response.basket.discount_info.discount_code);
  823. $("#discount-name").html(response.basket.discount_info.discount_name);
  824. $("#discount-amount, span[rel=discount_amount]").html(response.basket.discount_info.discount_amount);
  825. $("#discount-start-datetime").html(response.basket.discount_info.start_date);
  826. $("#discount-end-datetime").html(response.basket.discount_info.end_date);
  827. }else{
  828. $(".delivery_discount_with").removeClass('active');
  829. $(".delivery_discount_total").html(0);
  830. $("span[rel=discount_code]").html('');
  831. $("#discount-code").html('');
  832. $("#discount-name").html('');
  833. $("#discount-amount, span[rel=discount_amount]").html('');
  834. $("#discount-start-datetime").html('');
  835. $("#discount-end-datetime").html('');
  836. }
  837. $(".sub_total").html(response.basket.sub_total.formatted_price);
  838. $(".delivery_fee").html(response.basket.delivery_fee.formatted_price);
  839. $(".tax_info").html(response.order_info.tax_info);
  840. if(is_discount)
  841. $(".total_txt").html(response.basket.discounted_total_price.formatted_price);
  842. else
  843. $(".total_txt").html(response.basket.grand_total.formatted_price);
  844. },
  845. cache: false
  846. });
  847. $(".no-order").hide();
  848. $(".order-section").show();
  849. }
  850. });
  851. $("body").on("click",".order-detail1",function(){
  852. $("#show-recipes").html('');
  853. var id = $(this).data('id');
  854. order_id = id;
  855. $.ajax({
  856. url:"{!! env('APP_URL') !!}get/order/detail/"+id,
  857. success:function (response) {
  858. response = $.parseJSON(response);
  859. var discount_with_order = response.discount_with_order?response.discount_with_order:null;
  860. order_object = response;
  861. $("#show-recipes").html('');
  862. $("#show-order-detail").modal('show');
  863. var price = 0;
  864. var delivery_fee = 0;
  865. $(".change-status").attr('data-id',id);
  866. $(".change-status-reject").attr('data-id',id);
  867. var o_t = response.order_type.toLowerCase();
  868. $(".for-delivery").hide();
  869. $(".for-pickup").hide();
  870. $(".for-"+o_t).show();
  871. $.each(response,function (i,v) {
  872. $("p[rel="+i+"]").text(v);
  873. $("span[rel="+i+"]").text(v);
  874. if(i=="delivery_fee"){
  875. delivery_fee = v;
  876. $(".delivery_fee").html("{{ $currency }} "+v);
  877. }
  878. if(i=="geo_location"){
  879. $("p[rel=google-map-link]").html('<a target="_blank" href="https://maps.google.com/?q='+v+'">Share</a>');
  880. //$("p[rel=google-map-link]").html('<a target="_blank" href="https://maps.googleapis.com/maps/api/staticmap?zoom=15&size=900x500&markers=color:yellow|label:D|'+v+'&key=AIzaSyBFh6fzq8G7dgWLfz8kccvTlmPCSI_uWXQ">Share</a>');
  881. }
  882. if(i=="order_type"){
  883. if(v=="Delivery")
  884. $("#google-map-link").show();
  885. else
  886. $("#google-map-link").hide();
  887. }
  888. if(i=="status"){
  889. $(".inkitchen-btn").html(v);
  890. $(".inkitchen-btn").addClass();
  891. if(v=="New"){
  892. $(".reject").show();
  893. $(".accept").hide();
  894. }else{
  895. $(".accept").show();
  896. $(".reject").hide();
  897. }
  898. }
  899. if(i=="bg"){
  900. $(".inkitchen-btn").removeClass('org-bg');
  901. $(".inkitchen-btn").removeClass('bg-danger');
  902. $(".inkitchen-btn").removeClass('green-bg');
  903. $(".inkitchen-btn").addClass(v);
  904. }
  905. if(i=="next_action"){
  906. if(v=="Accepted")
  907. $(".change-status").html('Accept');
  908. else
  909. $(".change-status").html(v);
  910. }
  911. if(i=="next_status"){
  912. $(".change-status").attr('data-status',v);
  913. }
  914. if(i=="recipes"){
  915. var recipes = v;
  916. /* if(recipes){
  917. $.each(recipes,function(m,n){
  918. console.log(n);
  919. $("#show-recipes").append(show_recipe(n));
  920. price+=parseFloat(n.total_price);
  921. if(n.extra_options){
  922. $.each(n.extra_options,function(c,d){
  923. price+=(parseInt(n.quantity) * parseFloat(d.price));
  924. });
  925. }
  926. });
  927. $(".sub_total").html('{{ $currency }} '+price);
  928. }*/
  929. if(recipes){
  930. console.log(recipes);
  931. /*$.each(recipes,function(m,n){
  932. console.log(n);
  933. $("#show-recipes").append(show_recipe(n));
  934. price+=parseFloat(n.total_price);
  935. console.log("price: "+price);
  936. @if($business_type!="ClothsStore")
  937. if(n.extra_options){
  938. $.each(n.extra_options,function(c,d){
  939. price+=(parseInt(n.quantity) * parseFloat(d.price));
  940. });
  941. }
  942. @endif
  943. });*/
  944. if(discount_with_order){
  945. $.each(recipes,function(m,n){
  946. $("#show-recipes").append(show_recipe_with_discount(n,discount_with_order));
  947. // price+=parseFloat(n.total_price);
  948. var discount_amount = discount_with_order.discount_value!=""?parseFloat(discount_with_order.discount_value):0;
  949. var discount_type = discount_with_order.discount_type!=""?discount_with_order.discount_type:"";
  950. if(n.extra_options){
  951. $.each(n.extra_options,function(c,d){
  952. //console.log("extra-option: ",d.price);
  953. if(discount_amount > 0 && discount_type!=""){
  954. if(discount_type=="percentage"){
  955. var d_price = parseFloat(d.price) - (parseFloat(d.price) * (discount_amount/100));
  956. console.log(d_price);
  957. price+=d_price;
  958. }else{
  959. var d_price = parseFloat(d.price) - discount_amount/100;
  960. price+=d_price;
  961. }
  962. }else{
  963. console.log(n);
  964. price+=parseFloat(d.price);
  965. }
  966. });
  967. }
  968. price+=parseFloat(n.total_price);
  969. });
  970. }
  971. else{
  972. $.each(recipes,function(m,n){
  973. $("#show-recipes").append(show_recipe(n));
  974. var discount_amount = n.discount_amount!=""?parseFloat(n.discount_amount):0;
  975. var discount_type = n.discount_type!=""?n.discount_type:"";
  976. if(discount_amount > 0 && discount_type!=""){
  977. if(discount_type=="%"){
  978. var d_price = parseFloat(n.total_price) - (parseFloat(n.total_price) * (discount_amount/100));
  979. price+=d_price;
  980. }else{
  981. var d_price = parseFloat(n.total_price) - discount_amount/100;
  982. price+=d_price;
  983. }
  984. }else{
  985. price+=parseFloat(n.total_price);
  986. }
  987. @if($business_type!="ClothsStore")
  988. if(n.extra_options){
  989. $.each(n.extra_options,function(c,d){
  990. if(d.price && d.price!=""){
  991. if(discount_amount > 0 && discount_type!=""){
  992. if(discount_type=="%"){
  993. var d_price = parseFloat(d.price) - (parseFloat(d.price) * (discount_amount/100));
  994. console.log(d_price);
  995. price+=d_price;
  996. }else{
  997. var d_price = parseFloat(d.price) - discount_amount/100;
  998. price+=d_price;
  999. }
  1000. }else{
  1001. price+=(parseInt(n.quantity) * parseFloat(d.price));
  1002. }
  1003. }
  1004. });
  1005. }
  1006. @endif
  1007. });
  1008. }
  1009. if(price==0)
  1010. price=response.total_price;
  1011. $(".sub_total").html('{{ $currency }} '+(price?price:0));
  1012. } }
  1013. $(".total_txt").html("{{ $currency }} "+(price+delivery_fee));
  1014. });
  1015. }
  1016. });
  1017. });
  1018. $("body").on("click",".order-row",function () {
  1019. var id = $(this).data('id');
  1020. window.location = "{!! env('APP_URL') !!}order/show/"+id;
  1021. });
  1022. $("body").on("click",'.order-status',function (e) {
  1023. // alert();
  1024. var status = $(this).data('status');
  1025. var order_id = $(this).data('id');
  1026. $.ajax({
  1027. url:"{!! env('APP_URL') !!}update/order/status",
  1028. type:"POST",
  1029. data:{
  1030. id:order_id,
  1031. status:status,
  1032. "_token":"{!! csrf_token() !!}"
  1033. },
  1034. success:function () {
  1035. location.reload();
  1036. }
  1037. });
  1038. e.preventDefault();
  1039. e.stopPropagation();
  1040. });
  1041. $('#example').DataTable({
  1042. "bSort": true,
  1043. "searching": false,
  1044. "paging": true,
  1045. "info": false,
  1046. "bLengthChange": false,
  1047. "aaSorting": [[0,'desc']],
  1048. language: {
  1049. paginate: {
  1050. next: '<img src="{!! env("APP_ASSETS") !!}images/icons/next.png">', // or '→'
  1051. previous: '<img src="{!! env("APP_ASSETS") !!}images/icons/preivew.png">' // or '←'
  1052. }
  1053. },
  1054. });
  1055. $("td nav").addClass('d-flex justify-content-center');
  1056. // $('#example_wrapper .row:last').find('.col-md-5').first().remove()
  1057. var start = moment().subtract(6, 'days');
  1058. var end = moment();
  1059. $('#date_range').daterangepicker({
  1060. @if(!isset($_GET['date_range']))
  1061. startDate: start,
  1062. endDate: end,
  1063. @endif
  1064. ranges: {
  1065. 'Today': [moment(), moment()],
  1066. 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
  1067. 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
  1068. 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
  1069. 'This Month': [moment().startOf('month'), moment().endOf('month')],
  1070. 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
  1071. }
  1072. }, cb);
  1073. cb(start, end);
  1074. })
  1075. /*function show_recipe(recipe){
  1076. console.log(recipe);
  1077. var str='<div class="box-header border-1 ">\n' +
  1078. ' <div class="ml-5">\n' +
  1079. ' <div class="d-flex justify-content-between align-items-center">\n' +
  1080. ' <p>'+recipe.quantity+'x '+recipe.recipe_name+'</p>\n' ;
  1081. if(recipe.total_price > 0)
  1082. str+= ' <p>{{ $currency }} '+recipe.total_price+'</p>\n';
  1083. if(recipe.extra_options){
  1084. str+='<dl>';
  1085. if(recipe.extra_options){
  1086. $.each(recipe.extra_options,function(c,d){
  1087. str+="<dt>"+d.name+" : {{ $currency }} "+d.price;
  1088. if(d.sub_items){
  1089. //str+="<ul>";
  1090. $.each(d.sub_items,function(m,n){
  1091. console.log("Sub Items");
  1092. str+="<dd>"+n.name+"</dd>";
  1093. });
  1094. //str+="</dt>";
  1095. }
  1096. str+="</li>"
  1097. });
  1098. }
  1099. str+='<dl>';
  1100. }
  1101. str+=
  1102. ' </div>\n' +
  1103. ' </div>\n' +
  1104. ' </div>';
  1105. return str;
  1106. }*/
  1107. function show_recipe_with_discount(recipe,with_discount){
  1108. var discount_amount = 0;
  1109. if(with_discount.discount_type=="percentage")
  1110. discount_amount = parseFloat(with_discount.discount_value)/100;
  1111. else
  1112. discount_amount = parseFloat(with_discount.discounted_amount);
  1113. var str='<div class="box-header border-1 ">\n' +
  1114. ' <div class="ml-5">\n' +
  1115. ' <div class="d-flex justify-content-between align-items-center">\n' +
  1116. ' <p><span class="badge rounded-pill bg-secondary mx-2">'+recipe.quantity+' </span><img src="'+recipe.recipe_image+'" style="border-radius:10px; margin:0 3px" height="40px" width="40px" /> '+recipe.recipe_name+'</p>\n' ;
  1117. if(recipe.total_price > 0){
  1118. var price = parseFloat(recipe.total_price);
  1119. var discounted_price = 0;
  1120. if(with_discount.discount_type=="percentage"){
  1121. discounted_price = parseFloat(price) - (parseFloat(price) * (parseFloat(with_discount.discount_value)/100));
  1122. console.log(discounted_price);
  1123. }
  1124. //price = price - (price * (discount_amount/100));
  1125. if(discounted_price > 0)
  1126. price = "<span>"+discounted_price+"</span>" +"<span style='margin-left:10px; color:red'><del>"+price+"</del></span>"+ "</span>";
  1127. else
  1128. price = "<span>"+discounted_price+"</span>" + "</span>";
  1129. str+= ' <p>{{ $currency }} '+price+'</p>\n';
  1130. }
  1131. if(recipe.extra_options){
  1132. str+='<dl>';
  1133. if(recipe.extra_options){
  1134. console.log(recipe.extra_options);
  1135. $.each(recipe.extra_options,function(c,d){
  1136. @if($business_type=="ClothsStore")
  1137. if(c=="color")
  1138. str+='<div style="width: 20px; height: 20px; background-color: '+d+'; border-radius: 20px; float:left"></div>';
  1139. if(c=="size")
  1140. str+='<div style="float:right;font-size: 14px;margin-left: 8px;font-weight: 700;"> '+d+'</div>';
  1141. @else
  1142. if(d.price && d.price!=""){
  1143. console.log('In d.price: '+d.price);
  1144. var price = parseFloat(d.price);
  1145. if(discount_amount > 0){
  1146. var _pric = parseFloat(price) - (parseFloat(price) * (parseFloat(with_discount.discount_value)/100));
  1147. price += _pric;
  1148. price = "<span>"+_pric+"</span>" + "<span style='margin-left:10px; color:red'><del>"+d.price+"</del></span>";
  1149. }
  1150. str+="<dt>"+d.name+" : {{ $currency }} "+price;
  1151. if(d.sub_items){
  1152. //str+="<ul>";
  1153. $.each(d.sub_items,function(m,n){
  1154. console.log("Sub Items");
  1155. str+="<dd>"+n.name+"</dd>";
  1156. });
  1157. //str+="</dt>";
  1158. }
  1159. str+="</li>"
  1160. }else{
  1161. str+="<dt>"+d.name+"</dt>";
  1162. }
  1163. @endif
  1164. });
  1165. }
  1166. str+='<dl>';
  1167. }
  1168. str+=
  1169. ' </div>\n' +
  1170. ' </div>\n' +
  1171. ' </div>';
  1172. return str;
  1173. }
  1174. function show_recipe(recipe){
  1175. var discount_amount = parseFloat(recipe.discount_amount);
  1176. var str='<div class="box-header border-1 ">\n' +
  1177. ' <div class="ml-5">\n' +
  1178. ' <div class="d-flex justify-content-between align-items-center">\n' +
  1179. ' <p><span class="badge rounded-pill bg-secondary mx-2">'+recipe.quantity+' </span><img src="'+recipe.recipe_image+'" style="border-radius:10px; margin:0 3px" height="40px" width="40px" /> '+recipe.recipe_name+'</p>\n' ;
  1180. if(recipe.total_price > 0){
  1181. var price = parseFloat(recipe.total_price);
  1182. if(discount_amount > 0){
  1183. if(recipe.discount_type=="%"){
  1184. price = price - (price * (discount_amount/100));
  1185. price = "<span>"+price+"</span>" + "<span style='margin-left:10px; color:red'><del>"+recipe.total_price+"</del></span>";
  1186. }
  1187. }
  1188. str+= ' <p>{{ $currency }} '+price+'</p>\n';
  1189. }
  1190. if(recipe.extra_options){
  1191. str+='<dl>';
  1192. if(recipe.extra_options){
  1193. $.each(recipe.extra_options,function(c,d){
  1194. @if($business_type=="ClothsStore")
  1195. if(c=="color")
  1196. str+='<div style="width: 20px; height: 20px; background-color: '+d+'; border-radius: 20px; float:left"></div>';
  1197. if(c=="size")
  1198. str+='<div style="float:right;font-size: 14px;margin-left: 8px;font-weight: 700;"> '+d+'</div>';
  1199. @else
  1200. if(d.price && d.price!=""){
  1201. var price = parseFloat(d.price);
  1202. console.log("p: "+d.price);
  1203. if(discount_amount > 0){
  1204. if(recipe.discount_type=="%"){
  1205. price = price - (price * (discount_amount/100));
  1206. price = "<span>"+price+"</span>" + "<span style='margin-left:10px; color:red'><del>"+d.price+"</del></span>";
  1207. }
  1208. }
  1209. var extItemName = d.name;
  1210. @if($lang=='ar')
  1211. extItemName = d.name_ar;
  1212. @endif
  1213. str+="<dt>"+
  1214. extItemName
  1215. +" : {{ $currency }} "+price;
  1216. if(d.sub_items){
  1217. //str+="<ul>";
  1218. $.each(d.sub_items,function(m,n){
  1219. console.log("Sub Items");
  1220. str+="<dd>"+n.name+"</dd>";
  1221. });
  1222. //str+="</dt>";
  1223. }
  1224. str+="</li>";
  1225. }else{
  1226. var extItemName = d.name;
  1227. @if($lang=='ar')
  1228. extItemName = d.name_ar;
  1229. @endif
  1230. str+="<dt>"+
  1231. extItemName;
  1232. if(d.sub_items){
  1233. //str+="<ul>";
  1234. $.each(d.sub_items,function(m,n){
  1235. console.log("Sub Items");
  1236. str+="<dd>"+n.name+"</dd>";
  1237. });
  1238. //str+="</dt>";
  1239. }
  1240. str+="</li>";
  1241. }
  1242. @endif
  1243. });
  1244. }
  1245. str+='<dl>';
  1246. }
  1247. str+=
  1248. ' </div>\n' +
  1249. ' </div>\n' +
  1250. ' </div>';
  1251. return str;
  1252. }
  1253. function order_text_template(object,action){
  1254. console.log(object);
  1255. var sep = "%0A";
  1256. if(action=="copy-clipboard")
  1257. sep = "\n";
  1258. var map = "https://maps.google.com/?q="+object.geo_location;
  1259. var str = "I would like to share an order with you:"+sep+sep;
  1260. str += "*OrderID:* "+object.order_ref+' '+sep;
  1261. str += " *Business:* "+object.brand_name.replaceAll('&','%26')+' '+sep;
  1262. str += " *Outlet:* "+object.outlet_name.replaceAll('&','%26')+' '+sep;
  1263. str += " *Customer Name:* "+object.customer+' '+sep;
  1264. str += " *Customer Phone No:* "+object.phone+' '+sep;
  1265. str += " *Payment Method:* "+object.payment+' '+sep;
  1266. str += " *Delivery Date:* "+object.delivery_at+' '+sep;
  1267. str += " *Delivery Address:* "+object.address+' '+sep;
  1268. if(action=="copy-clipboard")
  1269. str += ' *Map:* '+(map)+' '+sep;
  1270. else
  1271. str += ' *Map:* '+encodeURIComponent(map)+' '+sep;
  1272. str += ' *Sub Total:* '+object.sub_total_price+sep;
  1273. if(object.is_discount){
  1274. str += ' *Discount:* '+object.discounted_amount+sep;
  1275. }
  1276. str += ' *Delivery Fee:* '+object.delivery_fee+sep;
  1277. if(object.is_delivery_discount){
  1278. str += ' *Delivery Discount:* '+object.delivery_discount_fee+sep;
  1279. }
  1280. str += ' *Total:* '+(parseFloat(object.total_price))+sep;
  1281. str += ' *Mark as delivered:* '+(object.delivery_update_status_url)+' (Link will expire at '+ object.link_expire_time +')'+sep;
  1282. return str;
  1283. }
  1284. function cb(start, end) {
  1285. $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
  1286. // alert(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
  1287. }
  1288. function show_item(item){
  1289. var show_item= '<div class="item-list p-3"><div class="d-flex justify-content-between align-items-center">'+
  1290. '<p><span class="badge rounded-pill bg-secondary mx-2">'+item.quantity+'</span>'+
  1291. '<img src="'+item.item_image+'" style="border-radius:10px; margin:0 3px" height="40px" width="40px"> '+item.item_name+'</p>';
  1292. if(item.item_price.normal_price > 0)
  1293. show_item+=' <p> <span>'+item.item_price.formatted_price+'</span></p>';
  1294. show_item+=' </div>' +
  1295. sub_items(item.sub_items)
  1296. '</div>';
  1297. return show_item;
  1298. }
  1299. function sub_items(sub_items){
  1300. // console.log(sub_items.length);
  1301. var _list = "";
  1302. if(sub_items && sub_items.length > 0){
  1303. _list = '<ul class="list-group col-sm-6 list-group-flush">';
  1304. $(sub_items).each(function(index,item){
  1305. var _pull_class = (lang=="en"?"pull-right":"pull-left");
  1306. //_list+='<li class="list-group-item"><span class="badge rounded-pill bg-secondary mx-2">'+item.quantity+'</span> '+item.name+'</li>';
  1307. _list+='<li class="list-group-item"><span class="badge rounded-pill bg-secondary mx-2">'+item.quantity+'</span> '+item.name+' '+(typeof item.price !=="undefined" && item.price.formatted_price ?'<span class="fw-bold text-end '+_pull_class+'">'+item.price.formatted_price+'</span>':"")+'</li>';
  1308. });
  1309. _list+='</ul>'
  1310. }
  1311. return _list;
  1312. }
  1313. </script>
  1314. @endsection