outlet-digital-menu.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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. .content{
  16. padding: 0;
  17. }
  18. .form-control, .form-select {
  19. height: 46px !important;
  20. border-color: #E4E6EB !important;
  21. border-radius: 7px !important;
  22. }
  23. .payout-details{
  24. background-color: #fff4de;
  25. border-radius: 3px;
  26. padding: 15px;
  27. }
  28. .theme-primary [type=checkbox].filled-in:checked.chk-col-primary + label:after {
  29. border: 2px solid #ffab00;
  30. background-color: #ffab00;
  31. }
  32. .theme-primary .btn-success:hover, .theme-primary .btn-success:active, .theme-primary .btn-success:focus, .theme-primary .btn-success.active {
  33. background-color: #3fd642!important;
  34. border-color: #3fd642!important;
  35. color: #ffffff !important;
  36. }
  37. #output canvas{
  38. width: 100%;
  39. }
  40. @media (min-width: 820px) and (max-width: 1024px){
  41. html[dir="rtl"] .content-wrapper {
  42. width: 100% !important;
  43. margin-right: 0px !important;
  44. padding-left: 20px;
  45. padding-right: 10px;
  46. margin-top: 78px !important;
  47. }
  48. html[dir="rtl"] .sidebar_div_main{
  49. padding-left: 0px;
  50. }
  51. }
  52. </style>
  53. <!-- Content Wrapper. Contains page content -->
  54. <div class="content-wrapper">
  55. <div class="container-full">
  56. <!-- Content Header (Page header) -->
  57. <!-- Main content -->
  58. <section class="content">
  59. <div class="row">
  60. <div class="col-12 col-sm-3 sidebar_div_main" style="padding-right: 0;background-color: #F5F5F5">
  61. @include('outlets.outlet-sidebar')
  62. </div>
  63. @php
  64. $resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  65. $lang = $resto->default_lang;
  66. app()->setLocale($lang);
  67. if(session('app_lang') !==null){
  68. $lang = session('app_lang');
  69. app()->setLocale($lang);
  70. }
  71. @endphp
  72. @php
  73. $restuarant1 = $resto;
  74. $resto_meta = isset($restuarant1->resto_metas)?$restuarant1->resto_metas:null;
  75. //dump($resto_meta);
  76. $resto_metas = [];
  77. $billing = [];
  78. if(isset($resto_meta)){
  79. foreach($resto_meta as $meta){
  80. if($meta->outlet_id!=""){
  81. continue;
  82. }
  83. $index_name = isset($meta->resto_meta_defs->parents)?$meta->resto_meta_defs->parents->meta_def_name:$meta->resto_meta_defs->meta_def_name;
  84. // dump($meta->resto_meta_defs);
  85. if($index_name=="BILLING_GATEWAY"){
  86. // dump($meta->resto_meta_defs->meta_def_name);
  87. // $resto_metas['BILLING_GATEWAY'][] = $meta->meta_val;
  88. $billing[] = array('id'=>$meta->meta_id,'value'=>$meta->meta_val);
  89. }
  90. $resto_metas[$index_name] = $meta->meta_val;
  91. }
  92. }
  93. $resto_metas['BILLING_GATEWAY'] = $billing;
  94. $currency = isset($resto_metas['BUSSINESS_CCY'])?$resto_metas['BUSSINESS_CCY']:"IQD";
  95. $business_type = isset($resto_metas['BUSSINESS_TYPE'])?$resto_metas['BUSSINESS_TYPE']:"Restaurants";
  96. $business_pwa = isset($resto_metas['USE_PWA_DMENU'])?$resto_metas['USE_PWA_DMENU']:"false";
  97. $url = env('QRCODE_HOST')."m/".$resto->resto_unique_name."?outlet=". \Illuminate\Support\Str::slug($outlet->name);
  98. if($business_pwa == "true")
  99. $url = "https://rjsdemo.taiftec.com/";
  100. @endphp
  101. <div class="col-12 col-sm-9 p-15">
  102. <div id="main" >
  103. <div class="row">
  104. <div class="col-sm-12 col-md-4">
  105. <div class="card mt-4">
  106. <div class="card-header">{{__('label.digital_menu_qr_code')}}</div>
  107. <div class="card-body">
  108. <div id="output"></div>
  109. <a style="width: 100%; margin: 10px 0" class="btn btn-primary download-image ">{{__('label.download')}}</a>
  110. <p>{{__('label.this_is_your_unique_qr_code_for_customers_to_see_the_menu_and_order_from_this_outlet_print_it_and_leave_it_on_the_tables_customers_just_need_to_scan_it_with_a_smartphone_to_place_their_order')}}</p>
  111. <!-- <input type="text" class="form-control" readonly name="" value="{!! env('QRCODE_HOST') !!}m/{!! $resto->resto_unique_name !!}">-->
  112. <input type="text" class="form-control" readonly name="" value="{!! env('QRCODE_HOST') !!}m/{!! $resto->resto_unique_name !!}?outlet={!! \Illuminate\Support\Str::slug($outlet->name) !!}">
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. </section>
  122. <!-- /.content -->
  123. </div>
  124. <div id="download" style="display: none"></div>
  125. </div>
  126. <!-- /.content-wrapper -->
  127. @endsection
  128. @section('js')
  129. <script src="{!! env('APP_ASSETS') !!}js/jquery.timepicker.min.js"></script>
  130. <script src="{!! env('APP_ASSETS') !!}js/jquery.qrcode.min.js"></script>
  131. <script>
  132. $(function () {
  133. $('#output').qrcode({
  134. render: "canvas",
  135. text: "{!! $url !!}",
  136. width: 250,
  137. height: 250,
  138. background: "#ffffff",
  139. foreground: "#000000",
  140. /* src: "{!! isset(\Illuminate\Support\Facades\Auth::user()->restaurants) && isset(\Illuminate\Support\Facades\Auth::user()->restaurants->home_images) && !empty(\Illuminate\Support\Facades\Auth::user()->restaurants->home_images->file_name)?\Illuminate\Support\Facades\Auth::user()->restaurants->home_images->file_name:env('APP_URL').'public/layout/img/favicon.png' !!}",
  141. */ imgWidth: 50,
  142. imgHeight: 50
  143. });
  144. $('#download').qrcode({
  145. render: "canvas",
  146. text: "{!! $url !!}",
  147. width: 2000,
  148. height: 2000,
  149. background: "#ffffff",
  150. foreground: "#000000",
  151. /* src: "{!! isset(\Illuminate\Support\Facades\Auth::user()->restaurants) && isset(\Illuminate\Support\Facades\Auth::user()->restaurants->home_images) && !empty(\Illuminate\Support\Facades\Auth::user()->restaurants->home_images->file_name)?\Illuminate\Support\Facades\Auth::user()->restaurants->home_images->file_name:env('APP_URL').'public/layout/img/favicon.png' !!}",
  152. */ imgWidth: 500,
  153. imgHeight: 500
  154. });
  155. $(".download-image").click(function () {
  156. var canvas = $('#download canvas')[0];
  157. var _this = $(this);
  158. console.log(canvas.toDataURL());
  159. // Change here
  160. $.ajax({
  161. url: "{!! env('APP_URL') !!}download/qrcode",
  162. type: "POST",
  163. data: {
  164. resto:"digital-menu-{!! $resto->resto_unique_name !!}-outlet-{!! \Illuminate\Support\Str::slug($outlet->name) !!}",
  165. data: canvas.toDataURL(),
  166. '_token': "{!! csrf_token() !!}"
  167. },
  168. success: function (response) {
  169. console.log(response);
  170. var link = document.createElement('a');
  171. link.href = response;
  172. link.download = "digital-menu-{!! $resto->resto_unique_name !!}-qrcode.png";
  173. link.click();
  174. }
  175. });
  176. });
  177. $("body").on("click",".remove-hours",function () {
  178. var _id = $(this).data('id');
  179. var _this = $(this);
  180. $.ajax({
  181. url:"{!! env('APP_URL') !!}remove/hour",
  182. type:"POST",
  183. data:{
  184. id:_id,
  185. "_token":"{!! csrf_token() !!}"
  186. },
  187. success:function (response) {
  188. response = $.parseJSON(response);
  189. if(response.type=="success"){
  190. $.toast({
  191. heading: 'Hours',
  192. text: response.message,
  193. position: 'top-right',
  194. loaderBg: '#ff6849',
  195. icon: 'success',
  196. hideAfter: 3000,
  197. stack: 6
  198. });
  199. }else{
  200. $.toast({
  201. heading: 'Hours',
  202. text: response.message,
  203. position: 'top-right',
  204. loaderBg: '#ff6849',
  205. icon: 'danger',
  206. hideAfter: 3000,
  207. stack: 6
  208. });
  209. }
  210. }
  211. });
  212. _this.parents('.hour-section').remove();
  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><i class="fa fa-ban delete-hour"></i>';
  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. /* var hour_sections = _hour_section.find('.col-sm-2.time-show.hours-action').append('<div style="margin-top: 37px"><a href="#!" class="text-mute remove-hours" data-id="60" data-day="sunday"> <i class="fa fa-ban"></i> Remove hours</a></div>');
  226. */
  227. $(".timepicker").timepicker({ step:5});
  228. $('.timepicker').on('showTimepicker',function(){
  229. $("#li-11-59").remove();
  230. $("body").find(".ui-timepicker-list").append('<li id="li-11-59" class="ui-timepicker-pm" data-time="86340">11:59pm</li>');
  231. });
  232. });
  233. $("body").on("click",".update-hour-status",function () {
  234. var is_active = $(this).attr("aria-pressed");
  235. is_active = $.trim(is_active);
  236. if(is_active=="false"){
  237. // alert('off');
  238. $(this).parents('.hour-section').find('input[type=checkbox]').prop('checked',false);
  239. $(this).parents('.hour-section').find('.time-show').hide();
  240. }else{
  241. $(this).parents('.hour-section').find('input[type=checkbox]').prop('checked','checked');
  242. $(this).parents('.hour-section').find('.time-show').show();
  243. }
  244. })
  245. /*$("body").on("click",".action-on-off",function () {
  246. var unique_key =
  247. });*/
  248. $(".timepicker").timepicker({ step:5});
  249. $('.timepicker').on('showTimepicker',function(){
  250. $("#li-11-59").remove();
  251. $("body").find(".ui-timepicker-list").append('<li id="li-11-59" class="ui-timepicker-pm" data-time="86340">11:59pm</li>');
  252. });
  253. $("body").on("click",".switch",function () {
  254. var is_active = $(this).attr("aria-pressed");
  255. is_active = $.trim(is_active);
  256. if(is_active=="false"){
  257. $("#main").removeClass('active');
  258. }else{
  259. $("#main").addClass('active');
  260. }
  261. $.ajax({
  262. url:"{!! env('APP_URL') !!}update/outlet/feature/status",
  263. data:{
  264. outletId:"{!! $outlet->id !!}",
  265. feature:'is_contactless_dining',
  266. is_active:is_active,
  267. "_token":"{!! csrf_token() !!}"
  268. },
  269. type:"POST",
  270. success:function () {
  271. }
  272. });
  273. });
  274. $("body").on("click",".save-changes",function () {
  275. /*$.toast({
  276. heading: 'Welcome to my Riday Admin',
  277. text: 'Use the predefined ones, or specify a custom position object.',
  278. position: 'top-right',
  279. loaderBg: '#ff6849',
  280. icon: 'info',
  281. hideAfter: 3000,
  282. stack: 6
  283. });*/
  284. if($("#save-outlet").valid()){
  285. $("#save-outlet").ajaxForm(function (response) {
  286. response = $.parseJSON(response);
  287. if(response.type=="success"){
  288. $.toast({
  289. heading: '{{__("label.outlet_update")}}',
  290. text: response.message,
  291. position: 'top-right',
  292. loaderBg: '#ff6849',
  293. icon: 'success',
  294. hideAfter: 3000,
  295. stack: 1
  296. });
  297. setTimeout(function () {
  298. location.reload();
  299. },2000);
  300. }else{
  301. $.toast({
  302. heading: '{{__("label.outlet_update")}}',
  303. text: response.message,
  304. position: 'top-right',
  305. loaderBg: '#ff6849',
  306. icon: 'error',
  307. hideAfter: 3000,
  308. stack: 1
  309. });
  310. }
  311. }).submit();
  312. }
  313. });
  314. })
  315. </script>
  316. @endsection