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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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_metas = \App\Helpers\CommonMethods::getRestoMetas($restuarant1);
  49. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  50. $business_type = isset($resto_metas['BUSSINESS_TYPE'])?$resto_metas['BUSSINESS_TYPE']:"Restaurants";
  51. $outlet_meta = isset($outlet->resto_metas)?$outlet->resto_metas:NULL;
  52. $outlet_metas = [];
  53. if(isset($outlet_meta)){
  54. foreach($outlet_meta as $meta){
  55. $index_name = isset($meta->resto_meta_defs->parents)?$meta->resto_meta_defs->parents->meta_def_name:$meta->resto_meta_defs->meta_def_name;
  56. // dump($meta->resto_meta_defs);
  57. if($index_name=="BILLING_GATEWAY"){
  58. // dump($meta->resto_meta_defs->meta_def_name);
  59. // $resto_metas['BILLING_GATEWAY'][] = $meta->meta_val;
  60. $billing[] = array('id'=>$meta->meta_id,'value'=>$meta->meta_val);
  61. }
  62. $outlet_metas[$index_name] = $meta->meta_val;
  63. }
  64. }
  65. $currency = isset($outlet_metas['BUSSINESS_CCY'])?$outlet_metas['BUSSINESS_CCY']:$resto_metas['BUSSINESS_CCY'];
  66. @endphp
  67. <div class="content-wrapper">
  68. <div class="container-full">
  69. <!-- Content Header (Page header) -->
  70. <!-- Main content -->
  71. <section class="content">
  72. <div class="row">
  73. <div class="col-12 col-sm-4 sidebar_div_main" style="padding-right: 0;background-color: #F5F5F5">
  74. @include('outlets.outlet-sidebar')
  75. </div>
  76. <div class="col-12 col-sm-8 p-15">
  77. <div class="row">
  78. <div class="col-12">
  79. <div class="box">
  80. <div class="box-header sm-prl-15"><a href="{!! env('APP_URL') !!}new/outlet/area?o={!! $outlet->unique_key !!}" class="btn btn-primary">{{__('label.add_new_outlet_area')}}</a> </div>
  81. <div class="box-body">
  82. <div class="table-responsive rounded card-table">
  83. <table class="table border-no sm-text-center" id="dataTable">
  84. <thead>
  85. <tr class="">
  86. <th>{{__('label.status')}}</th>
  87. <th>{{__('label.name')}}</th>
  88. <th>{{__('label.delivery_fee')}} </th>
  89. <th>{{__('label.min_price')}}</th>
  90. <th></th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. @if(isset($areas) && $areas->count() > 0)
  95. @foreach($areas as $area)
  96. <tr>
  97. <td>
  98. <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">
  99. <div class="handle"></div>
  100. </button> {{__('label.active')}}
  101. </td>
  102. <td>{!! $area->area_name !!}</td>
  103. <td>{!! $currency !!} {!! $area->delivery_fee !!}</td>
  104. <td>{!! $currency !!} {!! $area->min_price !!}</td>
  105. <td>
  106. <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>
  107. <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>
  108. </td>
  109. </tr>
  110. @endforeach
  111. @endif
  112. </tbody>
  113. </table>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. <!-- /.box -->
  120. </div>
  121. </div>
  122. </section>
  123. <!-- /.content -->
  124. </div>
  125. </div>
  126. <!-- /.content-wrapper -->
  127. @endsection
  128. @section('js')
  129. <script>
  130. $(function () {
  131. $("body").on("click",".delete-area",function () {
  132. var id = $(this).data('id');
  133. var _this = $(this);
  134. $.ajax({
  135. url:"{!! env('APP_URL') !!}area/delete/"+id,
  136. success:function (response) {
  137. $.toast({
  138. heading: '{{__("label.outlet_area_update")}}',
  139. text: "{{__('label.area_is_deleted')}}",
  140. position: 'top-right',
  141. loaderBg: '#ff6849',
  142. icon: 'error',
  143. hideAfter: 3000,
  144. stack: 1
  145. });
  146. _this.parents('tr').remove();
  147. }
  148. });
  149. });
  150. $("body").on("click",".switch-me",function () {
  151. var is_active = $(this).attr("aria-pressed");
  152. var id = $(this).data('id');
  153. is_active = $.trim(is_active);
  154. var status = 0;
  155. if(is_active=="false"){
  156. status = 0;
  157. }else{
  158. status = 1;
  159. }
  160. $.ajax({
  161. url:"{!! env('APP_URL') !!}area/update/status",
  162. type:"POST",
  163. data:{
  164. id:id,
  165. status:status,
  166. "_token":'{!! csrf_token() !!}'
  167. },
  168. success:function () {
  169. if(is_active=="false"){
  170. $.toast({
  171. heading: '{{__("label.area_status")}}',
  172. text: '{{__("label.area_is_deactive")}}',
  173. position: 'top-right',
  174. loaderBg: '#ff6849',
  175. icon: 'error',
  176. hideAfter: 3000,
  177. stack: 1
  178. });
  179. }else{
  180. $.toast({
  181. heading:'{{__("label.area_status")}}',
  182. text: '{{__("label.area_is_deactive")}}',
  183. position: 'top-right',
  184. loaderBg: '#ff6849',
  185. icon: 'success',
  186. hideAfter: 3000,
  187. stack: 1
  188. });
  189. }
  190. }
  191. });
  192. });
  193. })
  194. </script>
  195. @endsection