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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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\Models\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. <!-- Main content -->
  90. <section class="content">
  91. <div class="row">
  92. <div class="col-12 col-sm-3 sidebar_div_main" style="padding-right: 0;background-color: #F5F5F5">
  93. @include('outlets.outlet-sidebar')
  94. </div>
  95. <div class="col-12 col-sm-9 p-15">
  96. <div class="row">
  97. <div class="col-12">
  98. <div class="box">
  99. <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>
  100. <div class="box-body">
  101. <div class="table-responsive rounded card-table">
  102. <table class="table border-no" id="dataTable">
  103. <thead>
  104. <tr class="">
  105. <th>{{__('label.status')}}</th>
  106. <th>{{__('label.name')}}</th>
  107. <th>{{__('label.delivery_fee')}} </th>
  108. <th>{{__('label.min_price')}}</th>
  109. <th></th>
  110. </tr>
  111. </thead>
  112. <tbody>
  113. @if(isset($areas) && $areas->count() > 0)
  114. @foreach($areas as $area)
  115. <tr>
  116. <td>
  117. <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">
  118. <div class="handle"></div>
  119. </button> {{__('label.active')}}
  120. </td>
  121. <td>{!! $area->area_name !!}</td>
  122. <td>{!! $currency !!} {!! $area->delivery_fee !!}</td>
  123. <td>{!! $currency !!} {!! $area->min_price !!}</td>
  124. <td>
  125. <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>
  126. <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>
  127. </td>
  128. </tr>
  129. @endforeach
  130. @endif
  131. </tbody>
  132. </table>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <!-- /.box -->
  139. </div>
  140. </div>
  141. </section>
  142. <!-- /.content -->
  143. </div>
  144. </div>
  145. <!-- /.content-wrapper -->
  146. @endsection
  147. @section('js')
  148. <script>
  149. $(function () {
  150. $("body").on("click",".delete-area",function () {
  151. var id = $(this).data('id');
  152. var _this = $(this);
  153. $.ajax({
  154. url:"{!! env('APP_URL') !!}area/delete/"+id,
  155. success:function (response) {
  156. $.toast({
  157. heading: '{{__("label.outlet_area_update")}}',
  158. text: "{{__('label.area_is_deleted')}}",
  159. position: 'top-right',
  160. loaderBg: '#ff6849',
  161. icon: 'error',
  162. hideAfter: 3000,
  163. stack: 1
  164. });
  165. _this.parents('tr').remove();
  166. }
  167. });
  168. });
  169. $("body").on("click",".switch-me",function () {
  170. var is_active = $(this).attr("aria-pressed");
  171. var id = $(this).data('id');
  172. is_active = $.trim(is_active);
  173. var status = 0;
  174. if(is_active=="false"){
  175. status = 0;
  176. }else{
  177. status = 1;
  178. }
  179. $.ajax({
  180. url:"{!! env('APP_URL') !!}area/update/status",
  181. type:"POST",
  182. data:{
  183. id:id,
  184. status:status,
  185. "_token":'{!! csrf_token() !!}'
  186. },
  187. success:function () {
  188. if(is_active=="false"){
  189. $.toast({
  190. heading: '{{__("label.area_status")}}',
  191. text: '{{__("label.area_is_deactive")}}',
  192. position: 'top-right',
  193. loaderBg: '#ff6849',
  194. icon: 'error',
  195. hideAfter: 3000,
  196. stack: 1
  197. });
  198. }else{
  199. $.toast({
  200. heading:'{{__("label.area_status")}}',
  201. text: '{{__("label.area_is_deactive")}}',
  202. position: 'top-right',
  203. loaderBg: '#ff6849',
  204. icon: 'success',
  205. hideAfter: 3000,
  206. stack: 1
  207. });
  208. }
  209. }
  210. });
  211. });
  212. })
  213. </script>
  214. @endsection