menu-form.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. @extends('layouts.app')
  2. @if(isset($menu))
  3. @section('page-title')| {!! isset($menu)?$menu->name:"" !!}@endsection
  4. @else
  5. @section('page-title')| New Outlet @endsection
  6. @endif
  7. @section('content')
  8. <link href="{!! env('APP_ASSETS') !!}/vendor_components/dropzone/dropzone.css" rel="stylesheet"/>
  9. <link href="{!! env('APP_ASSETS') !!}/vendor_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet"/>
  10. <link href="{!! env('APP_ASSETS') !!}vendor_components/select2/dist/css/select2.min.css" rel="stylesheet">
  11. <!--
  12. <link href="{!! env('APP_ASSETS') !!}css/outlets-inner-section.css?v=1" rel="stylesheet" type="text/css">
  13. -->
  14. <style>
  15. body {
  16. padding: 0px !important;
  17. }
  18. .vtabs .tabs-vertical {
  19. width: 229px;
  20. }
  21. .bootstrap-tagsinput {
  22. min-height: 60px; width: 100%;
  23. }
  24. h4{ margin-top: 40px}
  25. </style>
  26. <style type="text/css">
  27. .bootstrap-tagsinput{
  28. border: 1px solid #E4E6EB;
  29. }
  30. .bootstrap-tagsinput .label-info{
  31. background-color: #ffab00 !important;
  32. }
  33. .theme-primary [type=checkbox].filled-in:checked.chk-col-primary + label:after{
  34. border: 1px solid #ffab00;
  35. background-color: #ffab00 !important;
  36. }
  37. .form-control, .form-select {
  38. height: 46px !important;
  39. border-color: #E4E6EB !important;
  40. border-radius: 7px !important;
  41. }
  42. #image-preview {
  43. width: 100%;
  44. border-radius: 20px;
  45. height: 341px;
  46. position: relative;
  47. overflow: hidden;
  48. background-color: #f9f9f9;
  49. color: #ecf0f1;
  50. background-position: center !important;
  51. background-size: cover !important;
  52. }
  53. #image-preview input {
  54. line-height: 200px;
  55. font-size: 200px;
  56. position: absolute;
  57. opacity: 0;
  58. z-index: 10;
  59. }
  60. #image-preview label {
  61. position: absolute;
  62. z-index: 5;
  63. opacity: 0.8;
  64. cursor: pointer;
  65. background-color: #bdc3c7;
  66. width: 200px;
  67. height: 50px;
  68. font-size: 20px;
  69. line-height: 50px;
  70. text-transform: uppercase;
  71. top: 0;
  72. left: 0;
  73. right: 0;
  74. bottom: 0;
  75. margin: auto;
  76. text-align: center;
  77. }
  78. .select2-container--default .select2-selection--single{
  79. height: 40px !important;
  80. border-color: #E4E6EB !important;
  81. border-radius: 7px !important;
  82. padding: 9px 12px;
  83. }
  84. @media (min-width: 850px) and (max-width: 1020px){
  85. .content-wrapper {
  86. width: calc(100% - 1px) !important;
  87. }
  88. .fixed .content-wrapper{
  89. margin-top: 80px !important;
  90. padding: 0 !important;
  91. }
  92. }
  93. </style>
  94. <!-- Content Wrapper. Contains page content -->
  95. @php
  96. $resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  97. $lang = $resto->default_lang;
  98. app()->setLocale($lang);
  99. if(session('app_lang') !==null){
  100. $lang = session('app_lang');
  101. app()->setLocale($lang);
  102. }
  103. @endphp
  104. <div class="content-wrapper">
  105. <div class="container-full">
  106. <!-- Content Header (Page header) -->
  107. {{-- <div class="content-header">
  108. <div class="d-flex align-items-center">
  109. <div class="me-auto">
  110. <h4 class="page-title">{{__('label.outlets')}}</h4>
  111. <div class="d-inline-block align-items-center">
  112. <nav>
  113. <ol class="breadcrumb">
  114. <li class="breadcrumb-item"><a href="{!! env('APP_URL') !!}dashboard"><i
  115. class="mdi mdi-home-outline"></i></a></li>
  116. <li class="breadcrumb-item active" aria-current="page">{{__('label.outlets')}}</li>
  117. </ol>
  118. </nav>
  119. </div>
  120. </div>
  121. </div>
  122. </div>--}}
  123. <!-- Main content -->
  124. <section class="content">
  125. <div class="row">
  126. <div class="col-12 col-sm-3 sidebar_div_main" style="padding-right: 0;background-color: #F5F5F5">
  127. @include('shop-menu.menu-sidebar')
  128. </div>
  129. <div class="col-12 col-sm-9 p-15">
  130. <form id="save-outlet" method="POST" action="{!! env('APP_URL') !!}save/outlet" enctype="multipart/form-data">
  131. <input type="hidden" name="id" value="{!! isset($menu)?$menu->id:"" !!}" />
  132. @php
  133. //$resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
  134. // $image = null;
  135. // if(isset($menu)){
  136. // $image = \App\Photos::where('resto_id',\App\Helpers\CommonMethods::getRestuarantID())->where('branch_id',$menu->id)->first();
  137. // }
  138. @endphp
  139. @csrf
  140. <div class="outlet-info-section">
  141. <div class="row mt-4">
  142. <div class="col-12">
  143. <div class="form-group">
  144. <label>{{__('label.title')}}</label>
  145. <input type="text" value="{!! isset($menu)?$menu->title:"" !!}" class="form-control" name="title"
  146. required/>
  147. </div>
  148. <div class="form-group">
  149. <input type="checkbox" id="md_checkbox_21" class="filled-in chk-col-primary" name="status" checked />
  150. <label for="md_checkbox_21">{{__('label.status')}}</label>
  151. </div>
  152. <div class="form-group">
  153. <label>{{__('label.phone')}}</label> <br />
  154. <input type="text" class="form-control" name="phone" value="{!! isset($menu)?$menu->phone_number:"" !!}" required />
  155. </div>
  156. <div class="form-group">
  157. <label>{{__('label.whatsapp')}}</label> <br />
  158. <input type="text" class="form-control" name="whatsapp_number" value="{!! isset($menu)?$menu->whatsapp_number:"" !!}" required />
  159. </div>
  160. @php
  161. $countries = \App\Countries::whereNull('deleted_at')->get();
  162. @endphp
  163. <div class="form-group">
  164. <label>{{__('label.country')}}</label> <br />
  165. <select class="form-select" required name="country_id">
  166. <option value="">{{__('label.country')}}</option>
  167. @if(isset($countries) && $countries->count() > 0)
  168. @foreach($countries as $country)
  169. <option value="{!! $country->id !!}" @if(isset($menu) && $menu->country_id==$country->id) selected @endif>{!! $country->country_name !!}</option>
  170. @endforeach
  171. @endif
  172. </select>
  173. </div>
  174. @php
  175. $time_zones = \App\TimeZones::all();
  176. @endphp
  177. <div class="form-group">
  178. <label>{{__('label.time_zone')}}</label> <br />
  179. <select name="time_zone" class="form-control" required>
  180. <option value="">{{__('label.time_zone')}}</option>
  181. @if(isset($time_zones) && $time_zones->count() > 0)
  182. @foreach($time_zones as $timezone)
  183. <option value="{!! $timezone->timezone !!}" @if(isset($menu) && $menu->time_zone==$timezone->timezone) selected @endif>{!! $timezone->timezone !!}</option>
  184. @endforeach
  185. @endif
  186. </select>
  187. </div>
  188. @php
  189. $restaurant = \Illuminate\Support\Facades\Auth::user()->restaurants;
  190. $resto_metas = \App\RestoMetaDefs::where('parent_meta_def_id',0)->whereIn('meta_def_name',['BUSSINESS_CCY','DEFAUT_LANGUAGE'])->get();
  191. $existing_resto_meta = [];
  192. if(isset($menu))
  193. $existing_resto_meta = \App\RestoMetas::where('bussiness_id',$restaurant->id)->where('outlet_id',$menu->id)->pluck('meta_def_id')->toArray();
  194. // dump($existing_resto_meta);
  195. $existing_resto_meta = isset($existing_resto_meta )?$existing_resto_meta:[];
  196. $existing_resto_meta_value = null;
  197. if(isset($menu))
  198. $existing_resto_meta_value = \App\RestoMetas::where('bussiness_id',$restaurant->id)->where('outlet_id',$menu->id)->get();
  199. $v = [];
  200. if(isset($existing_resto_meta_value) && $existing_resto_meta_value->count() > 0){
  201. foreach($existing_resto_meta_value as $value){
  202. $v[$value->meta_def_id] = $value->meta_val;
  203. }
  204. }
  205. @endphp
  206. @if(isset($resto_metas) && $resto_metas->count() > 0)
  207. @foreach($resto_metas as $meta)
  208. <div class="form-group">
  209. <label>{!! str_replace('_',' ',$meta->meta_def_name) !!}</label> <br />
  210. @if(isset($meta->childern) && $meta->childern->count() > 0)
  211. <select class="form-control" name="resto_meta[]" @if($meta->is_required=="Yes") required @endif>
  212. <option>{{__('label.select_option')}}</option>
  213. @foreach($meta->childern as $childern)
  214. <option value="{!! $childern->meta_def_id !!}" @if(in_array($childern->meta_def_id,$existing_resto_meta)) selected @endif>{!! $childern->meta_def_name !!}</option>
  215. @endforeach
  216. </select>
  217. @else
  218. <input type="hidden" name="resto_meta[]" value="{!! $meta->meta_def_id !!}">
  219. <input type="text" class="form-control" name="resto_meta_value[{!! $meta->meta_def_id !!}]" @if(isset($restaurant) && isset($v[$meta->meta_def_id])) value="{!! $v[$meta->meta_def_id] !!}" @endif @if($meta->is_required=="Yes") required @endif placeholder="{!! $meta->meta_def_desc !!}">
  220. @endif
  221. </div>
  222. @endforeach
  223. @endif
  224. <h4>{{__('label.order_setting')}}</h4>
  225. <p>{{__('label.select_the_dates_customers_can_place_orders_for')}}</p>
  226. <div class="row">
  227. <div class="col-sm-12">
  228. <input type="checkbox" id="md_checkbox_21" class="filled-in chk-col-primary" checked />
  229. <label for="md_checkbox_21">{{__('label.same_day')}}</label> <br />
  230. <input type="checkbox" id="md_checkbox_21" class="filled-in chk-col-primary" checked />
  231. <label for="md_checkbox_21">{{__('label.next_day')}}</label>
  232. </div>
  233. </div>
  234. <a href="#!" class="btn btn-primary save-changes mt-4">{{__('label.save_changes')}}</a>
  235. </div>
  236. </div>
  237. </div>
  238. </form>
  239. </div>
  240. <!-- /.box -->
  241. </div>
  242. </section>
  243. <!-- /.content -->
  244. </div>
  245. </div>
  246. <!-- /.content-wrapper -->
  247. <div class="modal fade" id="crop-image" tabindex="-1" role="dialog" >
  248. <div class="modal-dialog" role="document">
  249. <div class="modal-content">
  250. <div class="modal-header">
  251. <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
  252. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  253. <span aria-hidden="true">&times;</span>
  254. </button>
  255. </div>
  256. <div class="modal-body">
  257. ...
  258. </div>
  259. <div class="modal-footer">
  260. <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
  261. <button type="button" class="btn btn-primary">Save changes</button>
  262. </div>
  263. </div>
  264. </div>
  265. </div>
  266. @endsection
  267. @section('js')
  268. <script src="{!! env('APP_ASSETS') !!}/vendor_components/dropzone/dropzone.js"></script>
  269. <script src="{!! env('APP_ASSETS') !!}/vendor_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>
  270. <script src="{!! env('APP_ASSETS') !!}vendor_components/select2/dist/js/select2.min.js"></script>
  271. <script type="text/javascript">
  272. $(document).ready(function() {
  273. $("select[name=time_zone]").select2();
  274. $.uploadPreview({
  275. input_field: "#image-upload", // Default: .image-upload
  276. preview_box: "#image-preview", // Default: .image-preview
  277. label_field: "#image-label", // Default: .image-label
  278. label_default: "Choose File", // Default: Choose File
  279. label_selected: "Change File", // Default: Change File
  280. no_label: true ,
  281. success_callback: function() {
  282. // alert();
  283. $("#crop-image").modal();
  284. }// Default: false
  285. });
  286. $("body").on("click",".save-changes",function () {
  287. /*$.toast({
  288. heading: 'Welcome to my Riday Admin',
  289. text: 'Use the predefined ones, or specify a custom position object.',
  290. position: 'top-right',
  291. loaderBg: '#ff6849',
  292. icon: 'info',
  293. hideAfter: 3000,
  294. stack: 6
  295. });*/
  296. if($("#save-outlet").valid()){
  297. $("#save-outlet").ajaxForm(function (response) {
  298. response = $.parseJSON(response);
  299. if(response.type=="success"){
  300. $.toast({
  301. heading: 'Outlet Update.',
  302. text: response.message,
  303. position: 'top-right',
  304. loaderBg: '#ff6849',
  305. icon: 'success',
  306. hideAfter: 3000,
  307. stack: 1
  308. });
  309. setTimeout(function () {
  310. window.location = "{!! env('APP_URL') !!}outlet/edit/"+response.unique_key
  311. },2000);
  312. }else{
  313. $.toast({
  314. heading: 'Outlet Update.',
  315. text: response.message,
  316. position: 'top-right',
  317. loaderBg: '#ff6849',
  318. icon: 'error',
  319. hideAfter: 3000,
  320. stack: 1
  321. });
  322. }
  323. }).submit();
  324. }
  325. });
  326. });
  327. </script>
  328. @endsection