outlet-pickup.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. @extends('layouts.app')
  2. @section('content')
  3. @php
  4. $resto = \Illuminate\Support\Facades\Auth::user()->restaurants;
  5. $lang = $resto->default_lang;
  6. app()->setLocale($lang);
  7. if(session('app_lang') !==null){
  8. $lang = session('app_lang');
  9. app()->setLocale($lang);
  10. }
  11. @endphp
  12. <link href="{!! env('APP_ASSETS') !!}/vendor_components/dropzone/dropzone.css" rel="stylesheet"/>
  13. <link href="{!! env('APP_ASSETS') !!}/vendor_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet"/>
  14. <link href="{!! env('APP_ASSETS') !!}/css/jquery.timepicker.min.css" rel="stylesheet"/>
  15. <style>
  16. .vtabs .tabs-vertical {
  17. width: 229px;
  18. }
  19. .bootstrap-tagsinput {
  20. min-height: 60px; width: 100%;
  21. }
  22. h4{ margin-top: 40px}
  23. .bootstrap-timepicker-widget table td input{ width: 46px}
  24. .content{
  25. padding: 0;
  26. }
  27. .form-control, .form-select {
  28. height: 46px !important;
  29. border-color: #E4E6EB !important;
  30. border-radius: 7px !important;
  31. }
  32. .payout-details{
  33. background-color: #fff4de;
  34. border-radius: 3px;
  35. padding: 15px;
  36. }
  37. .theme-primary [type=checkbox].filled-in:checked.chk-col-primary + label:after {
  38. border: 2px solid #ffab00;
  39. background-color: #ffab00;
  40. }
  41. .theme-primary .btn-success:hover, .theme-primary .btn-success:active, .theme-primary .btn-success:focus, .theme-primary .btn-success.active {
  42. background-color: #3fd642!important;
  43. border-color: #3fd642!important;
  44. color: #ffffff !important;
  45. }
  46. #output canvas{
  47. width: 100%;
  48. }
  49. @media (min-width: 820px) and (max-width: 1024px){
  50. html[dir="rtl"] .content-wrapper {
  51. width: 100% !important;
  52. margin-right: 0px !important;
  53. padding-left: 20px;
  54. padding-right: 10px;
  55. }
  56. html[dir="rtl"] .sidebar_div_main{
  57. padding-left: 0px;
  58. }
  59. }
  60. </style>
  61. <!-- Content Wrapper. Contains page content -->
  62. <!-- Content Wrapper. Contains page content -->
  63. <div class="content-wrapper">
  64. <div class="container-full">
  65. <!-- Main content -->
  66. <section class="content">
  67. <div class="row">
  68. <div class="col-12 col-sm-3 sidebar_div_main" style="padding-right: 0;background-color: #F5F5F5">
  69. @include('outlets.outlet-sidebar')
  70. </div>
  71. <div class="col-12 col-sm-9 p-15">
  72. <form id="save-outlet" method="POST" action="{!! env('APP_URL') !!}save/features/outlet" enctype="multipart/form-data">
  73. @csrf
  74. <input type="hidden" name="feature_type" value="pickup" />
  75. <input type="hidden" name="id" value="{!! $outlet->id !!}" />
  76. <div class="p-15">
  77. <div class="d-flex bd-highlight">
  78. <div class="p-2 flex-grow-1 bd-highlight">
  79. <h4 style="margin-top: 0; margin-bottom: 5px">{{__('label.pickup')}}</h4>
  80. <p>{{__('label.customers_can_pickup_their_orders_at_outlet')}} </p>
  81. </div>
  82. <div class="p-2 bd-highlight">
  83. <button type="button" class="btn btn-lg btn-toggle btn-success switch @if($outlet->is_pickup=="1") active @endif switch" data-bs-toggle="button" aria-pressed="@if($outlet->is_pickup=="1") true @else false @endif" autocomplete="off">
  84. <div class="handle"></div>
  85. </button>
  86. </div>
  87. </div>
  88. <div id="main" @if($outlet->is_pickup=="1") class="active" @endif>
  89. <div class="disabled"></div>
  90. <h4>{{__('label.payment_methods')}}</h4>
  91. <p>{{__('label.select_all_payment_methods_accepted_on_delivery')}}</p>
  92. @php
  93. $payment_methods = [];
  94. if(isset($features) && !empty($features->payment_methods)){
  95. $payment_methods = explode(',',$features->payment_methods);
  96. }
  97. @endphp
  98. <div class="row">
  99. <div class="col-sm-12">
  100. <input type="checkbox" id="card_on_delivery" name="payment_methods[]" @if(in_array('card',$payment_methods)) checked @endif value="card" class="filled-in chk-col-primary" />
  101. <label for="card_on_delivery">{{__('label.card_on_delivery')}}</label> <br />
  102. <input type="checkbox" id="cash_on_delivery" name="payment_methods[]" @if(in_array('cash',$payment_methods)) checked @endif value="cash" class="filled-in chk-col-primary" />
  103. <label for="cash_on_delivery">{{__('label.cash_on_delivery')}}</label>
  104. </div>
  105. </div>
  106. <h4> {{__('label.opening_hours')}}</h4>
  107. <p>{{__('label.select_all_payment_methods_accepted_on_delivery')}}</p>
  108. @php
  109. $days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
  110. $existing_days = \App\Models\BranchHours::where('branch_id',$outlet->id)->where('hours_for','pickup')->get();
  111. $day_exists = [];
  112. @endphp
  113. @if(isset($existing_days) && $existing_days->count() > 0)
  114. @foreach($existing_days as $d)
  115. <div class="row mb-3 hour-section">
  116. <div class="col-sm-2"> @if(!in_array($d->day_name,$day_exists))
  117. {{__('label.'.trim(strtolower($d->day_name)))}}
  118. @endif</div>
  119. <div class="col-sm-2">
  120. @if(!in_array($d->day_name,$day_exists))
  121. <button type="button" data-on-text="Open" data-off-text="Closed" class="btn btn-toggle btn-sm btn-success update-hour-status @if($d->status=="open") active @endif" data-bs-toggle="button" aria-pressed="@if($d->status=="open") true @else false @endif" autocomplete="off">
  122. <div class="handle"></div>
  123. </button>
  124. <input type="checkbox" name="is_open[{!! strtolower($d->day_name) !!}]" @if($d->status=="open") checked @endif />
  125. @endif
  126. </div>
  127. <div class="col-sm-3 time-show start_time" @if($d->status=="close") style="display: none" @endif >
  128. <div class="bootstrap-timepicker">
  129. <input type="text" name="start_time[{!! strtolower($d->day_name) !!}][]" value="{!! $d->start_time !!}" class=" form-control timepicker">
  130. </div>
  131. </div>
  132. <div class="col-sm-3 time-show end_time" @if($d->status=="close") style="display: none" @endif>
  133. <div class="bootstrap-timepicker">
  134. <input type="text" name="end_time[{!! strtolower($d->day_name) !!}][]" value="{!! date('H:i a',strtotime($d->end_time)) !!}" class="form-control timepicker ">
  135. </div>
  136. </div>
  137. <div class="col-sm-2 time-show " @if($d->status=="close") style="display: none" @endif>
  138. @if(!in_array($d->day_name,$day_exists))
  139. <a href="#!" class="text-primary add-more-hours" data-day="{!! strtolower($d->day_name) !!}"> <i class="fa fa-plus-square-o"></i>{{__('label.add_hours')}}</a>
  140. @endif
  141. </div>
  142. </div>
  143. @php
  144. $day_exists[] = $d->day_name;
  145. @endphp
  146. @endforeach
  147. @else
  148. @foreach($days as $d)
  149. <div class="row mb-3 hour-section">
  150. <div class="col-sm-2">{{__('label.'.trim(strtolower($d)))}}</div>
  151. <div class="col-sm-2">
  152. <button type="button" data-on-text="Open" data-off-text="Closed" class="btn btn-toggle btn-sm btn-success active update-hour-status" data-bs-toggle="button" aria-pressed="true" autocomplete="off">
  153. <div class="handle"></div>
  154. </button>
  155. <input type="checkbox" name="is_open[{!! strtolower($d) !!}]" checked />
  156. </div>
  157. <div class="col-sm-3 time-show start_time">
  158. <div class="bootstrap-timepicker">
  159. <input type="text" name="start_time[{!! strtolower($d) !!}][]" class="form-control timepicker time">
  160. </div>
  161. </div>
  162. <div class="col-sm-3 time-show end_time">
  163. <div class="bootstrap-timepicker">
  164. <input type="text" name="end_time[{!! strtolower($d) !!}][]" class="form-control timepicker time">
  165. </div>
  166. </div>
  167. <div class="col-sm-2 time-show"><a href="#!" class="text-primary add-more-hours" data-day="{!! strtolower($d) !!}"> <i class="fa fa-plus-square-o"></i> {{__('label.add_hours')}}</a></div>
  168. </div>
  169. @endforeach
  170. @endif
  171. <h4>{{__('label.operation_settings')}}</h4>
  172. <p>{{__('label.set_the_default_time_needed_for_preparing_and_delivering_orders')}}</p>
  173. <div class="row">
  174. <div class="col-sm-6">
  175. <div class="form-group">
  176. <label>{{__('label.preparation_minutes')}}</label>
  177. <input type="text" name="preparation_time" class="form-control" value="{!! isset($features)?$features->preparation_timing:15 !!}" />
  178. </div>
  179. </div>
  180. <!-- <div class="col-sm-6">
  181. <div class="form-group">
  182. <label>Preparation + delivery (minutes)</label>
  183. <input type="text" name="preperation_delivery" class="form-control" value="{!! isset($features)?$features->preparation_delivery_time:40 !!}" />
  184. </div>
  185. </div> -->
  186. </div>
  187. <div class="row">
  188. <div class="col-sm-12">
  189. <a href="#!" class="btn btn-primary save-changes mt-4">{{__('label.save_changes')}}</a>
  190. </div>
  191. </div>
  192. </div>
  193. </div>
  194. </form>
  195. </div>
  196. </div>
  197. </section>
  198. </div>
  199. </div>
  200. <!-- /.content-wrapper -->
  201. @endsection
  202. @section('js')
  203. <script src="{!! env('APP_ASSETS') !!}js/jquery.timepicker.min.js"></script>
  204. <script>
  205. $(function () {
  206. $("body").on("click",".switch",function () {
  207. var is_active = $(this).attr("aria-pressed");
  208. is_active = $.trim(is_active);
  209. if(is_active=="false"){
  210. $("#main").removeClass('active');
  211. }else{
  212. $("#main").addClass('active');
  213. }
  214. $.ajax({
  215. url:"{!! env('APP_URL') !!}update/outlet/feature/status",
  216. data:{
  217. outletId:"{!! $outlet->id !!}",
  218. feature:'is_pickup',
  219. is_active:is_active,
  220. "_token":"{!! csrf_token() !!}"
  221. },
  222. type:"POST",
  223. success:function () {
  224. }
  225. });
  226. });
  227. $("body").on("click",".add-more-hours",function () {
  228. var _hour_section = $(this).parents(".hour-section");
  229. var day = $(this).data('day');
  230. var start_time='<div class="bootstrap-timepicker mt-1">\n' +
  231. ' <input type="text" name="start_time['+day+'][]" class="form-control timepicker time">\n' +
  232. ' </div>';
  233. var end_time='<div class="bootstrap-timepicker mt-1">\n' +
  234. ' <input type="text" name="end_time['+day+'][]" class="form-control timepicker time">\n' +
  235. ' </div>';
  236. var input_start_time = _hour_section.find('.col-sm-3.time-show.start_time').append(start_time);
  237. var input_end_time = _hour_section.find('.col-sm-3.time-show.end_time').append(end_time);
  238. $(".timepicker").timepicker({ step:5});
  239. $('.timepicker').on('showTimepicker',function(){
  240. $("li['data-time=86340']").remove();
  241. $("body").find(".ui-timepicker-list").append('<li id="li-11-59" class="ui-timepicker-pm" data-time="86340">11:59pm</li>');
  242. });
  243. });
  244. $(".timepicker").timepicker({ step:5});
  245. $('.timepicker').on('showTimepicker',function(){
  246. $("li['data-time=86340']").remove();
  247. $("body").find(".ui-timepicker-list").append('<li id="li-11-59" class="ui-timepicker-pm" data-time="86340">11:59pm</li>');
  248. });
  249. $("body").on("click",".update-hour-status",function () {
  250. var is_active = $(this).attr("aria-pressed");
  251. is_active = $.trim(is_active);
  252. if(is_active=="false"){
  253. // alert('off');
  254. $(this).parents('.hour-section').find('input[type=checkbox]').prop('checked',false);
  255. $(this).parents('.hour-section').find('.time-show').hide();
  256. }else{
  257. $(this).parents('.hour-section').find('input[type=checkbox]').prop('checked','checked');
  258. $(this).parents('.hour-section').find('.time-show').show();
  259. }
  260. })
  261. $("body").on("click",".save-changes",function () {
  262. /*$.toast({
  263. heading: 'Welcome to my Riday Admin',
  264. text: 'Use the predefined ones, or specify a custom position object.',
  265. position: 'top-right',
  266. loaderBg: '#ff6849',
  267. icon: 'info',
  268. hideAfter: 3000,
  269. stack: 6
  270. });*/
  271. if($("#save-outlet").valid()){
  272. $("#save-outlet").ajaxForm(function (response) {
  273. response = $.parseJSON(response);
  274. if(response.type=="success"){
  275. $.toast({
  276. heading: '{{__("label.outlet_update")}}',
  277. text: response.message,
  278. position: 'top-right',
  279. loaderBg: '#ff6849',
  280. icon: 'success',
  281. hideAfter: 3000,
  282. stack: 1
  283. });
  284. setTimeout(function () {
  285. location.reload();
  286. },2000);
  287. }else{
  288. $.toast({
  289. heading: '{{__("label.outlet_update")}}',
  290. text: response.message,
  291. position: 'top-right',
  292. loaderBg: '#ff6849',
  293. icon: 'error',
  294. hideAfter: 3000,
  295. stack: 1
  296. });
  297. }
  298. }).submit();
  299. }
  300. });
  301. $("body").on("click",".switch",function () {
  302. var is_active = $(this).attr("aria-pressed");
  303. if(is_active=="false"){
  304. $("#main").removeClass('active');
  305. }else{
  306. $("#main").addClass('active');
  307. }
  308. });
  309. })
  310. </script>
  311. @endsection