outlet-pickup.blade.php 23 KB

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