outlet-delivery-area-listing.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. @extends('layouts.app')
  2. @section('content')
  3. <link href="{!! env('APP_ASSETS') !!}/vendor_components/dropzone/dropzone.css" rel="stylesheet"/>
  4. <link href="{!! env('APP_ASSETS') !!}/vendor_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet"/>
  5. <link href="{!! env('APP_ASSETS') !!}/css/jquery.timepicker.min.css" rel="stylesheet"/>
  6. <style>
  7. .vtabs .tabs-vertical {
  8. width: 229px;
  9. }
  10. .bootstrap-tagsinput {
  11. min-height: 60px; width: 100%;
  12. }
  13. h4{ margin-top: 40px}
  14. .bootstrap-timepicker-widget table td input{ width: 46px}
  15. #map{
  16. width: 100%; height: 100vh;
  17. }
  18. .delivery-section{
  19. width: 400px;
  20. height: auto;
  21. background: white;
  22. position: absolute;
  23. left: 10px; top: 10px;
  24. z-index: 10; padding: 10px;
  25. }
  26. .input-group input[type=text]{
  27. border-left: 0; padding-left: 0;
  28. }
  29. </style>
  30. <!-- Content Wrapper. Contains page content -->
  31. @php
  32. $resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  33. $lang = $resto->default_lang;
  34. app()->setLocale($lang);
  35. if(session('app_lang') !==null){
  36. $lang = session('app_lang');
  37. app()->setLocale($lang);
  38. }
  39. // $resto = \Illuminate\Support\Facades\Auth::user()->restaurants;
  40. $address = isset($resto->places)?$resto->places->place_name:"Baghdad";
  41. $polygons = isset($resto->places)?$resto->places->coordinates:NULL;
  42. if(!empty($outlet->address))
  43. $address = $outlet->address.', '.$outlet->place;
  44. // dd($resto->places->place_name);
  45. @endphp
  46. @php
  47. $restuarant1 = $resto;
  48. $resto_meta = isset($restuarant1->resto_metas)?$restuarant1->resto_metas:null;
  49. //dump($outlet->resto_metas);
  50. $resto_metas = [];
  51. $billing = [];
  52. if(isset($resto_meta)){
  53. foreach($resto_meta as $meta){
  54. if($meta->outlet_id!=""){
  55. continue;
  56. }
  57. $index_name = isset($meta->resto_meta_defs->parents)?$meta->resto_meta_defs->parents->meta_def_name:$meta->resto_meta_defs->meta_def_name;
  58. // dump($meta->resto_meta_defs);
  59. if($index_name=="BILLING_GATEWAY"){
  60. // dump($meta->resto_meta_defs->meta_def_name);
  61. // $resto_metas['BILLING_GATEWAY'][] = $meta->meta_val;
  62. $billing[] = array('id'=>$meta->meta_id,'value'=>$meta->meta_val);
  63. }
  64. $resto_metas[$index_name] = $meta->meta_val;
  65. }
  66. }
  67. $resto_metas['BILLING_GATEWAY'] = $billing;
  68. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  69. $business_type = isset($resto_metas['BUSSINESS_TYPE'])?$resto_metas['BUSSINESS_TYPE']:"Restaurants";
  70. $outlet_meta = isset($outlet->resto_metas)?$outlet->resto_metas:NULL;
  71. $outlet_metas = [];
  72. if(isset($outlet_meta)){
  73. foreach($outlet_meta as $meta){
  74. $index_name = isset($meta->resto_meta_defs->parents)?$meta->resto_meta_defs->parents->meta_def_name:$meta->resto_meta_defs->meta_def_name;
  75. // dump($meta->resto_meta_defs);
  76. if($index_name=="BILLING_GATEWAY"){
  77. // dump($meta->resto_meta_defs->meta_def_name);
  78. // $resto_metas['BILLING_GATEWAY'][] = $meta->meta_val;
  79. $billing[] = array('id'=>$meta->meta_id,'value'=>$meta->meta_val);
  80. }
  81. $outlet_metas[$index_name] = $meta->meta_val;
  82. }
  83. }
  84. $currency = isset($outlet_metas['BUSSINESS_CCY'])?$outlet_metas['BUSSINESS_CCY']:$resto_metas['BUSSINESS_CCY'];
  85. @endphp
  86. <div class="content-wrapper">
  87. <div class="container-full">
  88. <!-- Content Header (Page header) -->
  89. <div class="content-header">
  90. <div class="d-flex align-items-center">
  91. <div class="me-auto">
  92. <h4 class="page-title">{{__('label.outlets')}}</h4>
  93. <div class="d-inline-block align-items-center">
  94. <nav>
  95. <ol class="breadcrumb">
  96. <li class="breadcrumb-item"><a href="{!! env('APP_URL') !!}dashboard"><i
  97. class="mdi mdi-home-outline"></i></a></li>
  98. <li class="breadcrumb-item active" aria-current="page">{{__('label.outlets')}}</li>
  99. </ol>
  100. </nav>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- Main content -->
  106. <section class="content">
  107. <div class="row">
  108. <div class="col-12">
  109. <div class="box">
  110. <div class="box-header with-border">
  111. @if(isset($outlet))
  112. <h4 class="box-title">{{__('label.update')}} {!! $outlet->name !!}</h4>
  113. @else
  114. <h4 class="box-title">{{__('label.create_new_outlet')}}</h4>
  115. @endif{{--{{--
  116. <h6 class="box-subtitle">{{__('label.use_default_tab_with_class')}} <code>{{__('label.vtabs')}} &amp; {{__('label.tabs-vertical')}}</code></h6>--}}
  117. </div>
  118. <!-- /.box-header -->
  119. <div class="box-body">
  120. <!-- Nav tabs -->
  121. <div class="vtabs">
  122. @include('outlets.outlet-sidebar')
  123. <!-- Tab panes -->
  124. <div class="tab-content" style="width: 84%">
  125. <div class="tab-pane active" id="basic-information" role="tabpanel" style="position: relative">
  126. <div class="row">
  127. <div class="col-12">
  128. <div class="box">
  129. <div class="box-header"><a href="{!! env('APP_URL') !!}new/outlet/area?o={!! $outlet->unique_key !!}" class="btn btn-primary">{{__('label.add_new_outlet_area')}}</a> </div>
  130. <div class="box-body">
  131. <div class="table-responsive rounded card-table">
  132. <table class="table border-no" id="dataTable">
  133. <thead>
  134. <tr class="">
  135. <th>{{__('label.status')}}</th>
  136. <th>{{__('label.name')}}</th>
  137. <th>{{__('label.delivery_fee')}} </th>
  138. <th>{{__('label.min_price')}}</th>
  139. <th></th>
  140. </tr>
  141. </thead>
  142. <tbody>
  143. @if(isset($areas) && $areas->count() > 0)
  144. @foreach($areas as $area)
  145. <tr>
  146. <td>
  147. <button type="button" data-on-text="Open" data-off-text="Closed" class="btn btn-toggle btn-sm btn-success @if($area->status=="1") active @endif switch-me" data-id="{!! $area->id !!}" data-bs-toggle="button" aria-pressed="@if($outlet->status=="1") true @else false @endif" autocomplete="off">
  148. <div class="handle"></div>
  149. </button> {{__('label.active')}}
  150. </td>
  151. <td>{!! $area->area_name !!}</td>
  152. <td>{!! $currency !!} {!! $area->delivery_fee !!}</td>
  153. <td>{!! $currency !!} {!! $area->min_price !!}</td>
  154. <td>
  155. <a href="{!! env('APP_URL') !!}area/edit/{!! $area->id !!}?o={!! $outlet->unique_key !!}" type="button" class="waves-effect waves-circle btn btn-circle btn-primary btn-xs mb-5"><i class="mdi mdi-check"></i></a>
  156. <a type="button" data-id="{!! $area->id !!}" class="waves-effect waves-circle btn btn-circle delete-area btn-danger btn-xs mb-5"><i class="mdi mdi-delete"></i></a>
  157. </td>
  158. </tr>
  159. @endforeach
  160. @endif
  161. </tbody>
  162. </table>
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. </div></div>
  170. </div>
  171. <!-- /.box-body -->
  172. </div>
  173. <!-- /.box -->
  174. </div>
  175. </div>
  176. </section>
  177. <!-- /.content -->
  178. </div>
  179. </div>
  180. <!-- /.content-wrapper -->
  181. @endsection
  182. @section('js')
  183. <script>
  184. $(function () {
  185. $("body").on("click",".delete-area",function () {
  186. var id = $(this).data('id');
  187. var _this = $(this);
  188. $.ajax({
  189. url:"{!! env('APP_URL') !!}area/delete/"+id,
  190. success:function (response) {
  191. $.toast({
  192. heading: '{{__("label.outlet_area_update")}}',
  193. text: "{{__('label.area_is_deleted')}}",
  194. position: 'top-right',
  195. loaderBg: '#ff6849',
  196. icon: 'error',
  197. hideAfter: 3000,
  198. stack: 1
  199. });
  200. _this.parents('tr').remove();
  201. }
  202. });
  203. });
  204. $("body").on("click",".switch-me",function () {
  205. var is_active = $(this).attr("aria-pressed");
  206. var id = $(this).data('id');
  207. is_active = $.trim(is_active);
  208. var status = 0;
  209. if(is_active=="false"){
  210. status = 0;
  211. }else{
  212. status = 1;
  213. }
  214. $.ajax({
  215. url:"{!! env('APP_URL') !!}area/update/status",
  216. type:"POST",
  217. data:{
  218. id:id,
  219. status:status,
  220. "_token":'{!! csrf_token() !!}'
  221. },
  222. success:function () {
  223. if(is_active=="false"){
  224. $.toast({
  225. heading: '{{__("label.area_status")}}',
  226. text: '{{__("label.area_is_deactive")}}',
  227. position: 'top-right',
  228. loaderBg: '#ff6849',
  229. icon: 'error',
  230. hideAfter: 3000,
  231. stack: 1
  232. });
  233. }else{
  234. $.toast({
  235. heading:'{{__("label.area_status")}}',
  236. text: '{{__("label.area_is_deactive")}}',
  237. position: 'top-right',
  238. loaderBg: '#ff6849',
  239. icon: 'success',
  240. hideAfter: 3000,
  241. stack: 1
  242. });
  243. }
  244. }
  245. });
  246. });
  247. })
  248. </script>
  249. @endsection