outlet-pickup.blade.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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. </style>
  50. <!-- Content Wrapper. Contains page content -->
  51. <!-- Content Wrapper. Contains page content -->
  52. <div class="content-wrapper">
  53. <div class="container-full">
  54. <!-- Main content -->
  55. <section class="content">
  56. <div class="row">
  57. <div class="col-3" style="padding-right: 0;background-color: #F5F5F5">
  58. @include('outlets.outlet-sidebar')
  59. </div>
  60. <div class="col-9 p-15">
  61. <form id="save-outlet" method="POST" action="{!! env('APP_URL') !!}save/features/outlet" enctype="multipart/form-data">
  62. @csrf
  63. <input type="hidden" name="feature_type" value="pickup" />
  64. <input type="hidden" name="id" value="{!! $outlet->id !!}" />
  65. <div class="p-15">
  66. <div class="d-flex bd-highlight">
  67. <div class="p-2 flex-grow-1 bd-highlight">
  68. <h4 style="margin-top: 0; margin-bottom: 5px">{{__('label.pickup')}}</h4>
  69. <p>{{__('label.customers_can_pickup_their_orders_at_outlet')}} </p>
  70. </div>
  71. <div class="p-2 bd-highlight">
  72. <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">
  73. <div class="handle"></div>
  74. </button>
  75. </div>
  76. </div>
  77. <div id="main" @if($outlet->is_pickup=="1") class="active" @endif>
  78. <div class="disabled"></div>
  79. <h4>{{__('label.payment_methods')}}</h4>
  80. <p>{{__('label.select_all_payment_methods_accepted_on_delivery')}}</p>
  81. @php
  82. $payment_methods = [];
  83. if(isset($features) && !empty($features->payment_methods)){
  84. $payment_methods = explode(',',$features->payment_methods);
  85. }
  86. @endphp
  87. <div class="row">
  88. <div class="col-sm-12">
  89. <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" />
  90. <label for="card_on_delivery">{{__('label.card_on_delivery')}}</label> <br />
  91. <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" />
  92. <label for="cash_on_delivery">{{__('label.cash_on_delivery')}}</label>
  93. </div>
  94. </div>
  95. <h4> {{__('label.opening_hours')}}</h4>
  96. <p>{{__('label.select_all_payment_methods_accepted_on_delivery')}}</p>
  97. @php
  98. $days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
  99. $existing_days = \App\BranchHours::where('branch_id',$outlet->id)->where('hours_for','pickup')->get();
  100. $day_exists = [];
  101. @endphp
  102. @if(isset($existing_days) && $existing_days->count() > 0)
  103. @foreach($existing_days as $d)
  104. <div class="row mb-3 hour-section">
  105. <div class="col-sm-2"> @if(!in_array($d->day_name,$day_exists)){!! ucwords($d->day_name) !!}@endif</div>
  106. <div class="col-sm-2">
  107. @if(!in_array($d->day_name,$day_exists))
  108. <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">
  109. <div class="handle"></div>
  110. </button>
  111. <input type="checkbox" name="is_open[{!! strtolower($d->day_name) !!}]" @if($d->status=="open") checked @endif />
  112. @endif
  113. </div>
  114. <div class="col-sm-3 time-show start_time" @if($d->status=="close") style="display: none" @endif >
  115. <div class="bootstrap-timepicker">
  116. <input type="text" name="start_time[{!! strtolower($d->day_name) !!}][]" value="{!! $d->start_time !!}" class=" form-control timepicker">
  117. </div>
  118. </div>
  119. <div class="col-sm-3 time-show end_time" @if($d->status=="close") style="display: none" @endif>
  120. <div class="bootstrap-timepicker">
  121. <input type="text" name="end_time[{!! strtolower($d->day_name) !!}][]" value="{!! date('H:i a',strtotime($d->end_time)) !!}" class="form-control timepicker ">
  122. </div>
  123. </div>
  124. <div class="col-sm-2 time-show " @if($d->status=="close") style="display: none" @endif>
  125. @if(!in_array($d->day_name,$day_exists))
  126. <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>
  127. @endif
  128. </div>
  129. </div>
  130. @php
  131. $day_exists[] = $d->day_name;
  132. @endphp
  133. @endforeach
  134. @else
  135. @foreach($days as $d)
  136. <div class="row mb-3 hour-section">
  137. <div class="col-sm-2">{!! $d !!}</div>
  138. <div class="col-sm-2">
  139. <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">
  140. <div class="handle"></div>
  141. </button>
  142. <input type="checkbox" name="is_open[{!! strtolower($d) !!}]" checked />
  143. </div>
  144. <div class="col-sm-3 time-show start_time">
  145. <div class="bootstrap-timepicker">
  146. <input type="text" name="start_time[{!! strtolower($d) !!}][]" class="form-control timepicker time">
  147. </div>
  148. </div>
  149. <div class="col-sm-3 time-show end_time">
  150. <div class="bootstrap-timepicker">
  151. <input type="text" name="end_time[{!! strtolower($d) !!}][]" class="form-control timepicker time">
  152. </div>
  153. </div>
  154. <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>
  155. </div>
  156. @endforeach
  157. @endif
  158. <h4>{{__('label.operation_settings')}}</h4>
  159. <p>{{__('label.set_the_default_time_needed_for_preparing_and_delivering_orders')}}</p>
  160. <div class="row">
  161. <div class="col-sm-6">
  162. <div class="form-group">
  163. <label>{{__('label.preparation_minutes')}}</label>
  164. <input type="text" name="preparation_time" class="form-control" value="{!! isset($features)?$features->preparation_timing:15 !!}" />
  165. </div>
  166. </div>
  167. <!-- <div class="col-sm-6">
  168. <div class="form-group">
  169. <label>Preparation + delivery (minutes)</label>
  170. <input type="text" name="preperation_delivery" class="form-control" value="{!! isset($features)?$features->preparation_delivery_time:40 !!}" />
  171. </div>
  172. </div> -->
  173. </div>
  174. <div class="row">
  175. <div class="col-sm-12">
  176. <a href="#!" class="btn btn-primary save-changes mt-4">{{__('label.save_changes')}}</a>
  177. </div>
  178. </div>
  179. </div>
  180. </div>
  181. </form>
  182. </div>
  183. </div>
  184. </section>
  185. </div>
  186. </div>
  187. <!-- /.content-wrapper -->
  188. @endsection
  189. @section('js')
  190. <script src="{!! env('APP_ASSETS') !!}js/jquery.timepicker.min.js"></script>
  191. <script>
  192. $(function () {
  193. $("body").on("click",".switch",function () {
  194. var is_active = $(this).attr("aria-pressed");
  195. is_active = $.trim(is_active);
  196. if(is_active=="false"){
  197. $("#main").removeClass('active');
  198. }else{
  199. $("#main").addClass('active');
  200. }
  201. $.ajax({
  202. url:"{!! env('APP_URL') !!}update/outlet/feature/status",
  203. data:{
  204. outletId:"{!! $outlet->id !!}",
  205. feature:'is_pickup',
  206. is_active:is_active,
  207. "_token":"{!! csrf_token() !!}"
  208. },
  209. type:"POST",
  210. success:function () {
  211. }
  212. });
  213. });
  214. $("body").on("click",".add-more-hours",function () {
  215. var _hour_section = $(this).parents(".hour-section");
  216. var day = $(this).data('day');
  217. var start_time='<div class="bootstrap-timepicker mt-1">\n' +
  218. ' <input type="text" name="start_time['+day+'][]" class="form-control timepicker time">\n' +
  219. ' </div>';
  220. var end_time='<div class="bootstrap-timepicker mt-1">\n' +
  221. ' <input type="text" name="end_time['+day+'][]" class="form-control timepicker time">\n' +
  222. ' </div>';
  223. var input_start_time = _hour_section.find('.col-sm-3.time-show.start_time').append(start_time);
  224. var input_end_time = _hour_section.find('.col-sm-3.time-show.end_time').append(end_time);
  225. $(".timepicker").timepicker({ step:5});
  226. $('.timepicker').on('showTimepicker',function(){
  227. $("li['data-time=86340']").remove();
  228. $("body").find(".ui-timepicker-list").append('<li id="li-11-59" class="ui-timepicker-pm" data-time="86340">11:59pm</li>');
  229. });
  230. });
  231. $(".timepicker").timepicker({ step:5});
  232. $('.timepicker').on('showTimepicker',function(){
  233. $("li['data-time=86340']").remove();
  234. $("body").find(".ui-timepicker-list").append('<li id="li-11-59" class="ui-timepicker-pm" data-time="86340">11:59pm</li>');
  235. });
  236. $("body").on("click",".update-hour-status",function () {
  237. var is_active = $(this).attr("aria-pressed");
  238. is_active = $.trim(is_active);
  239. if(is_active=="false"){
  240. // alert('off');
  241. $(this).parents('.hour-section').find('input[type=checkbox]').prop('checked',false);
  242. $(this).parents('.hour-section').find('.time-show').hide();
  243. }else{
  244. $(this).parents('.hour-section').find('input[type=checkbox]').prop('checked','checked');
  245. $(this).parents('.hour-section').find('.time-show').show();
  246. }
  247. })
  248. $("body").on("click",".save-changes",function () {
  249. /*$.toast({
  250. heading: 'Welcome to my Riday Admin',
  251. text: 'Use the predefined ones, or specify a custom position object.',
  252. position: 'top-right',
  253. loaderBg: '#ff6849',
  254. icon: 'info',
  255. hideAfter: 3000,
  256. stack: 6
  257. });*/
  258. if($("#save-outlet").valid()){
  259. $("#save-outlet").ajaxForm(function (response) {
  260. response = $.parseJSON(response);
  261. if(response.type=="success"){
  262. $.toast({
  263. heading: '{{__("label.outlet_update")}}',
  264. text: response.message,
  265. position: 'top-right',
  266. loaderBg: '#ff6849',
  267. icon: 'success',
  268. hideAfter: 3000,
  269. stack: 1
  270. });
  271. setTimeout(function () {
  272. location.reload();
  273. },2000);
  274. }else{
  275. $.toast({
  276. heading: '{{__("label.outlet_update")}}',
  277. text: response.message,
  278. position: 'top-right',
  279. loaderBg: '#ff6849',
  280. icon: 'error',
  281. hideAfter: 3000,
  282. stack: 1
  283. });
  284. }
  285. }).submit();
  286. }
  287. });
  288. $("body").on("click",".switch",function () {
  289. var is_active = $(this).attr("aria-pressed");
  290. if(is_active=="false"){
  291. $("#main").removeClass('active');
  292. }else{
  293. $("#main").addClass('active');
  294. }
  295. });
  296. })
  297. </script>
  298. @endsection