new-outlets.blade.php11111 20 KB

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