new-outlets.blade.php 22 KB

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