123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818 |
- @extends('layouts.app')
- @section('css')
- <style>
- .card-header{
- padding:10px 15px; border-radius: 3px
- }
- .select2-container{width:100% !important}
- </style>
- @endsection
- @php
- $resto = \App\Restaurants::find(\App\Helpers\CommonMethods::getRestuarantID());
- $lang = $resto->default_lang;
- app()->setLocale($lang);
- @endphp
- @section('content')
- <link href="{!! env('APP_ASSETS') !!}vendor_components/spectrum/spectrum.css" rel="stylesheet">
- <link href="{!! env('APP_ASSETS') !!}vendor_components/select2/dist/css/select2.min.css" rel="stylesheet">
- <link href="{!! env('APP_ASSETS') !!}/vendor_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet"/>
- <style>
- .alert {
- display: none;
- }
- .border-red {
- border: 1px solid #F00 !important;
- }
- .tab-pane{}
- .container-full,.content-wrapper{
- background-color: transparent !important;
- }
- #image-preview {
- width: 700px;
- border-radius: 20px;
- height: 341px;
- position: relative;
- overflow: hidden;
- background-color: #f9f9f9;
- color: #ecf0f1;
- background-position: center !important;
- background-size: cover !important;
- }
- #image-preview input {
- line-height: 200px;
- font-size: 200px;
- position: absolute;
- opacity: 0;
- z-index: 10;
- }
- #image-preview label {
- position: absolute;
- z-index: 5;
- opacity: 0.8;
- cursor: pointer;
- background-color: #bdc3c7;
- width: 200px;
- height: 50px;
- font-size: 20px;
- line-height: 50px;
- text-transform: uppercase;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- margin: auto;
- text-align: center;
- }
- .select2-container .select2-selection--multiple{
- min-height: 46px;
- }
- .form-control, .form-select {
- height: 46px !important;
- border-color: #E4E6EB !important;
- border-radius: 7px !important;
- }
- .select2-container--default .select2-selection--single{
- height: 40px !important;
- border-color: #E4E6EB !important;
- border-radius: 7px !important;
- padding: 9px 12px;
- }
- </style>
- <div class="content-wrapper">
- <div class="container-full">
- <section class="content">
- @if(isset($restaurant))
- <h3 style="margin-left: 10px">{!! $restaurant->name !!}</h3>
- @endif
- <form id="restaurant-form" method="POST" action="{!! env('APP_URL') !!}restaurant/save"
- enctype="multipart/form-data">
- @csrf
- <input type="hidden" name="id" value="{!! isset($restaurant)?$restaurant->id:'' !!}"/>
- <div class="row">
- <div class="col-xl-9">
- <div class="card mb-4">
- <div class="card-header bg-warning"><h4 class="card-title">{{__('label.busniess_information')}}</h4></div>
- <div class="card-body">
- @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
- <div class="row mb-4">
- <div class="col-sm-12">
- <p style="font-size: 14px">{{__('label.cover_image')}}</p>
- <div id="image-preview" @if(isset($restaurant) && isset($restaurant->home_images) && !empty($restaurant->home_images->file_name)) style="background: url({!! $restaurant->home_images->file_name !!})" @endif>
- <label for="image-upload" id="image-label">{{__('label.choose_file')}}</label>
- <input type="file" name="home_image" id="image-upload" />
- </div>
- </div>
- </div>
- @endif
- <div class="row">
- <div class="col-sm-4 col-md-6">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.name_english')}}</label>
- <input type="text" class="form-control" placeholder="" name="name"
- value="{!! isset($restaurant)?$restaurant->name:'' !!}" required>
- </div>
- </div>
- <div class="col-sm-4 col-md-6">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.name_arabic')}}</label>
- <input type="text" class="form-control" placeholder="" name="arabic_name"
- value="{!! isset($restaurant)?$restaurant->arabic_name:'' !!}" required>
- </div>
- </div>
- </div>
-
-
- @if(\Illuminate\Support\Facades\Auth::user()->role=="restaurant")
- <div class="row">
- <div class="col-sm-4 col-md-6">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.short_description')}}</label>
- <textarea class="form-control" placeholder=""
- name="short_description">{!! isset($restaurant)?$restaurant->short_description:'' !!}</textarea>
- </div>
- </div>
-
- <div class="col-sm-4 col-md-6">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.address')}}</label>
- <textarea class="form-control" placeholder="" name="address"
- required>{!! isset($restaurant)?$restaurant->address:'' !!}</textarea>
- </div>
- </div>
-
- </div>
- @endif
-
- <div class="row">
- <div class="col-sm-3 col-md-3">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.default_language')}}</label>
- <select class="form-select" required name="default_lang">
- <option value="">{{__('label.default_language')}}</option>
- <option value="ar" @if(isset($restaurant) && $restaurant->default_lang=='ar') selected @endif>{{__('label.arabic')}}</option>
- <option value="en" @if(isset($restaurant) && $restaurant->default_lang=='en') selected @endif>{{__('label.english')}}</option>
- </select>
- </div>
- </div>
- <div class="col-sm-12 col-md-6">
- @php
- $multiple_langs = !empty($restaurant->multiple_langs)?explode(',',$restaurant->multiple_langs):[];
- $countries = \App\Countries::whereNull('deleted_at')->get();
-
- $outlet_countries = !empty($restaurant->outlet_countries)?explode(',',$restaurant->outlet_countries):[];
- @endphp
- <label style="font-weight: bold">{{__('label.choose_languages')}}</label> <small><i>({{__('label.languages_supported_in_order_page')}})</i></small><br />
- <select class="form-control multiple_langs" multiple required name="multiple_langs[]">
-
- <option @if(isset($restaurant) && in_array('en',$multiple_langs))) selected @endif value="en">{{__('label.arabic')}}</option>
- <option @if(isset($restaurant) && in_array('ar',$multiple_langs))) selected @endif value="ar">{{__('label.english')}}</option>
- </select>
- </div>
- <div class="col-sm-12 col-md-3">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.country')}}</label>
- <select class="form-select" required name="country_id">
- <option value="">{{__('label.select_country')}}</option>
- @if(isset($countries) && $countries->count() > 0)
- @foreach($countries as $country)
- <option value="{!! $country->id !!}" @if(isset($restaurant) && $restaurant->country_id==$country->id) selected @endif>{!! $country->country_name !!}</option>
- @endforeach
- @endif
- </select>
- </div>
- </div>
-
-
- </div>
-
- @php
-
-
- @endphp
-
- @if(\Illuminate\Support\Facades\Auth::user()->role=="administrator")
- <div class="row">
-
- <div class="col-sm-3 col-md-3">
-
- @if(\Illuminate\Support\Facades\Auth::User()->role=="administrator")
- <div class="form-group">
- <label style="visibility: hidden; margin-bottom: 15px">{{__('label.default_color_for_order')}}</label><br />
- <div class="custom-control custom-checkbox">
- <input class="custom-control-input" id="active"
- @if(isset($restaurant) && $restaurant->active=="1") checked
- @endif name="active" type="checkbox"/>
- <label class="custom-control-label" for="active">{{__('label.active')}}</label>
- </div>
- </div>
- @endif
- </div>
- <div class="col-sm-3 col-md-3">
- @if(\Illuminate\Support\Facades\Auth::User()->role=="administrator")
- <div class="form-group">
- <label style="visibility: hidden; margin-bottom: 15px">{{__('label.default_color_for_order')}}</label><br />
- <div class="custom-control custom-checkbox">
- <input class="custom-control-input" id="allow_whatsapp_notifications"
- @if(isset($restaurant) && $restaurant->allow_whatsapp_notifications=="1") checked
- @endif name="allow_whatsapp_notifications" type="checkbox"/>
- <label class="custom-control-label" for="allow_whatsapp_notifications">{{__('label.allow_whatsapp_notifications')}}</label>
- </div>
- </div>
- @endif
- </div>
- </div>
- @endif
-
-
-
- </div>
-
-
- </div>
-
- <div class="card mb-4">
- <div class="card-header bg-warning"><h4 class="card-title">{{__('label.busniess_meta')}}</h4></div>
- <div class="card-body">
- <div class="row">
- @php
- $resto_metas = \App\RestoMetaDefs::where('parent_meta_def_id',0)->get();
- //dump($resto_metas);
- $existing_resto_meta = [];
- if(isset($restaurant))
- $existing_resto_meta = \App\RestoMetas::where('bussiness_id',$restaurant->id)->whereNull('outlet_id')->pluck('meta_def_id')->toArray();
- $existing_resto_meta = isset($existing_resto_meta )?$existing_resto_meta:[];
- $existing_resto_meta_value = null;
- if(isset($restaurant))
- $existing_resto_meta_value = \App\RestoMetas::where('bussiness_id',$restaurant->id)->whereNull('outlet_id')->get();
- $v = [];
- if(isset($existing_resto_meta_value) && $existing_resto_meta_value->count() > 0){
- foreach($existing_resto_meta_value as $value){
- $v[$value->meta_def_id] = $value->meta_val;
- }
- }
-
- $multiple_options = ['BILLING_GATEWAY'];
- @endphp
- @if(isset($resto_metas) && $resto_metas->count() > 0)
- @foreach($resto_metas as $meta)
- @if($meta->for_role==\Illuminate\Support\Facades\Auth::user()->role)
- @if(($meta->meta_def_name=="DISPLAY_TAX_INFO" || $meta->meta_def_name=="TERM_AND_CONDITIONS" ) && $restaurant->countries->country_name=="Iraq" ) @continue @endif
-
-
-
- <div class="col-md-6">
- <div class="form-group">
- <label style="font-weight:;font-size:12px">{!! ucwords(str_replace('_',' ',$meta->meta_def_name)) !!}</label>
- @if(isset($meta->childern) && $meta->childern->count() > 0)
-
- <select @if(in_array($meta->meta_def_name, $multiple_options)) multiple rel="multiple-option" @endif class="form-control" name="resto_meta[]" @if($meta->is_required=="Yes") required @endif>
- <option value="">{{__('label.choose')}} {!! ucwords(strtolower(str_replace('_',' ',$meta->meta_def_name))) !!}</option>
- @foreach($meta->childern as $childern)
-
- <option value="{!! $childern->meta_def_id !!}" @if(in_array($childern->meta_def_id,$existing_resto_meta)) selected @endif>{!! $childern->meta_def_name !!}</option>
-
- @endforeach
- </select>
- @else
- <input type="hidden" name="resto_meta[]" value="{!! $meta->meta_def_id !!}">
- @if($meta->input_type=="text-field")
- <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="">
- @endif
-
- @if($meta->input_type=="text-area")
- <textarea style="height:40px !important" class="form-control" placeholder="{!! $meta->meta_def_desc !!}" name="resto_meta_value[{!! $meta->meta_def_id !!}]" @if($meta->is_required=="Yes") required @endif>{!! isset($v[$meta->meta_def_id])?$v[$meta->meta_def_id]:"" !!}</textarea>
-
- @endif
- @endif
- </div>
- </div>
-
-
- @endif
- @endforeach
- @endif
- </div>
- </div>
- </div>
-
-
-
-
-
- </div>
- <div class="col-xl-3">
- <div class="card mb-4">
- <div class="card-header bg-warning"><h4 class="card-title">{{__('label.business_qr_code')}}</h4></div>
- <div class="card-body">
- <div class="row">
- @if(isset($restaurant))
- <div class="col-md-12">
- <div class="text-center">
- <p>{{__('label.order_qr_code')}}</p>
- <div id="output-order"></div>
- <div id="download-order" style="display: none"></div>
- <a style="position: relative; top: 13px; font-size: 13px" href="#!"
- class="download-image-order mt-4"><i style="font-size: 20px"
- class="fa fa-download"></i> </a>
-
- <p class="mt-4"><a href="{!! env('QRCODE_HOST_ORDER') !!}d/{!! $restaurant->resto_unique_name !!}"
- target="_blank">{!! env('QRCODE_HOST_ORDER') !!}d/{!! $restaurant->resto_unique_name !!}</a></p>
-
-
- </div>
- </div>
- @endif
- </div>
- </div>
- </div>
- <div class="card mb-4">
- <div class="card-header bg-warning"><h4 class="card-title">{{__('label.logo')}}</h4></div>
- <div class="card-body">
-
-
- <div class="row">
- <div class="col-sm-12">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.logo')}}</label>
- <input type="file" class="form-control" placeholder=""
- accept="image/x-png,image/jpeg" name="logo">
- <span class="text-danger m-1">{{__('label.note_please_use_jpg_or_png_images')}}</span>
- </div>
- @if(isset($restaurant) && isset($restaurant->photos))
- <div class="col-2">
- <img src="{!! $restaurant->photos->file_name !!}"
- class="img-fluid mb-2" alt="{!! $restaurant->name !!}">
- </div>
- @endif
- </div>
-
- </div>
-
- </div>
-
- </div>
-
-
- <div class="card card-body mb-4">
- <div class="row">
- <div class="col-sm-12">
- <a href="#!" class="btn btn-primary save" style="width: 100% !important"><i class="feather-save mr-1"></i> {{__('label.save')}}</a>
- <!-- @if( isset($restaurant))
- <a href="#!" class="btn btn-primary upload-gallery"><i
- class="feather-image mr-1"></i> Upload Gallery</a>
- @endif -->
-
- </div>
- </div>
- <div class="row mt-2">
- <div class="col-md-12">
- <div class="alert alert-success success"></div>
- <div class="alert alert-danger error"></div>
- </div>
- </div>
- </div>
-
- </div>
-
-
- </div>
- </div>
- </form>
- </section>
- </div>
- </div>
-
- @if( isset($restaurant))
- <div class="modal" id="upload-gallery" tabindex="-1" role="dialog">
- <div class="modal-dialog modal-lg" role="document">
- <div class="modal-content">
- <div class="modal-header">
- <h5 class="modal-title">{{__('label.resto_gallery')}}</h5>
- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
- <span aria-hidden="true">×</span>
- </button>
- </div>
- <div class="modal-body">
- <div class="row">
- <div class="col-sm-12 col-md-12">
- <div class="form-group">
- <label style="font-weight: bold">{{__('label.gallery')}}</label>
- <div class="dropzone dz-clickable" id="gallery">
- <div class="dz-default dz-message" data-dz-message="">
- <span>{{__('label.drop_files_here_to_upload')}}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-primary upload">{{__('label.upload')}}</button>
- <button type="button" class="btn btn-secondary" data-dismiss="modal">{{__('label.close')}}</button>
- </div>
- </div>
- </div>
- </div>
- @endif
- @endsection
- @section('js')
-
- <script src="{!! env('APP_ASSETS') !!}vendor_components/spectrum/spectrum.js"></script>
- <script src="{!! env('APP_ASSETS') !!}vendor_components/select2/dist/js/select2.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}js/jquery.qrcode.min.js"></script>
- <script src="{!! env('APP_ASSETS') !!}/vendor_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.min.js"></script>
- <script>
-
- $(function () {
-
- $("select[name=time_zone]").select2();
- $(".multiple_langs").select2();
- $(".outlet_countries").select2();
- $("select[rel=multiple-option]").select2();
-
- $("#color").spectrum({
- preferredFormat: "hex",
- color: "{!! isset($restaurant->default_color)?$restaurant->default_color:"#F00" !!}",
- showInput: true,
- });
- $.uploadPreview({
- input_field: "#image-upload", // Default: .image-upload
- preview_box: "#image-preview", // Default: .image-preview
- label_field: "#image-label", // Default: .image-label
- label_default: "Choose File", // Default: Choose File
- label_selected: "Change File", // Default: Change File
- no_label: true ,
- success_callback: function() {
-
- }// Default: false
- });
- $("body").on("click",".delete-delivery-fee",function () {
- var id = $(this).data('id');
- var _this = $(this);
- $.ajax({
- url:"{!! env('APP_URL') !!}delete/save/delivery/fee/"+id,
- success:function () {
- //_this.parents('tr').remove();
- location.reload();
- }
- });
- });
- $("body").on("change","select[name=country_id]",function () {
- var id = $(this).val();
- $("select[name=city_id]").html('');
- $.ajax({
- url:"{!! env('APP_URL') !!}get/city/by/country/"+id,
- success:function (response) {
- response = $.parseJSON(response);
- var str = "";
- $.each(response,function (i,v) {
- str+='<option value="'+v.id+'">'+v.name+'</option>'
- });
- $("select[name=city]").append(str);
- @if(isset($restaurant))
- $( "select[name=city]" ).val("{!! $restaurant->city !!}");
- @endif
- }
- });
- });
- setTimeout(function () {
- $("body").on("change","select[name=city]",function () {
- var id = $(this).val();
- $("select[name=place]").html('');
- $.ajax({
- url:"{!! env('APP_URL') !!}get/place/by/city/"+id,
- success:function (response) {
- response = $.parseJSON(response);
- var str = '<option value="">{{__("label.choose_place")}}</option>';
- $.each(response,function (i,v) {
- str+='<option value="'+v.id+'">'+v.place_name+'</option>'
- });
- $("select[name=place]").append(str);
- @if(isset($restaurant))
- $( "select[name=place]" ).val("{!! $restaurant->place !!}");
- @endif
- }
- });
- });
- },1000);
- @if(isset($restaurant))
-
- $('#output-order').qrcode({
- render: "canvas",
- text: "{!! env('QRCODE_HOST_ORDER') !!}d/{!! $restaurant->resto_unique_name !!}",
- width: 200,
- height: 200,
- background: "#ffffff",
- foreground: "#000000",
- src: "{!! isset($restaurant) && isset($restaurant->photos)?env('APP_URL').'public/uploads/logo/'.$restaurant->photos->file_name:env('APP_URL').'public/layout/img/favicon.png' !!}",
- imgWidth: 50,
- imgHeight: 50
- });
- $('#download-order').qrcode({
- render: "canvas",
- text: "{!! env('QRCODE_HOST_ORDER') !!}d/{!! $restaurant->resto_unique_name !!}",
- width: 2000,
- height: 2000,
- background: "#ffffff",
- foreground: "#000000",
- src: "{!! isset($restaurant) && isset($restaurant->photos)?env('APP_URL').'public/uploads/logo/'.$restaurant->photos->file_name:env('APP_URL').'public/layout/img/favicon.png' !!}",
- imgWidth: 500,
- imgHeight: 500
- });
- $(".download-image-order").click(function () {
- var canvas = $('#download-order canvas')[0];
- var _this = $(this);
- // Change here
- $.ajax({
- url: "{!! env('APP_URL') !!}download/qrcode",
- type: "POST",
- data: {
- resto:"{!! $restaurant->resto_unique_name !!}-{!! $restaurant->id !!}",
- data: canvas.toDataURL(),
- '_token': "{!! csrf_token() !!}"
- },
- success: function (response) {
- console.log(response);
- var link = document.createElement('a');
- link.href = response;
- link.download = "{!! $restaurant->resto_unique_name !!}-qrcode.png";
- link.click();
- }
- });
- });
-
- $( "select[name=country_id]" ).trigger( "change" );
- setTimeout(function () {
- $("select[name=city]").trigger("change");
- },1000);
- $("body").on("click", ".map-category-resto", function () {
- var categories = $(".default-category");
- var price_array = [];
- var category_array = [];
- var price = $(".default-price");
- $.each(categories, function () {
- category_array.push($(this).val());
- });
- $.each(price, function () {
- price_array.push($(this).val());
- });
- $.ajax({
- url: "{!! env('APP_URL') !!}map/category/resto",
- type: "POST",
- data: {
- price: price_array,
- categories: category_array,
- resto_id: "{!! $restaurant->id !!}",
- "_token": "{!! csrf_token() !!}"
- },
- success: function (response) {
- }
- });
- });
- @endif
- $("#choose-categories").select2().on("change", function () {
- var data = ($('#choose-categories').select2('data'));
- if (data) {
- var str = "";
- $.each(data, function (i, v) {
- str += "<tr>";
- str += "<td>" + v.text + "</td>";
- str += '<td><input type="hidden" name="category[]" class="default-category" value="' + v.id + '" /><input type="text" class="form-control default-price" name="price[]" /> </td>';
- str += "</tr>"
- });
- $("#table-default-price tbody").html(str);
- }
- });
- $("body").on("click", ".edit-fee", function () {
- var id = $(this).data('id');
- });
- $("body").on("click", ".save-delivery-fee", function () {
- $(this).parents('.tab-pane').find("form").ajaxForm(function (response) {
- response = $.parseJSON(response);
- if (response) {
- if (response.type == "success") {
- $('#delivery-fee-modal .alert.success').html(response.message);
- $('#delivery-fee-modal .alert.success').show();
- setTimeout(function () {
- location.reload();
- }, 2000)
- } else {
- $('#special-offers .alert.error').html(response.message);
- $('#special-offers .alert.error').show();
- }
- }
- }).submit();
- });
- $("body").on("click", ".add-delivery-fee", function () {
- $("#delivery-fee-modal").modal();
- });
- $("body").on("change", ".country_id", function () {
- var _this = $(this);
- var code = $(this).val();
- _this.parents('.delivery-fee-item').find('.city').html('');
- $.ajax({
- url: "{!! env('APP_URL') !!}get/cities/by/country/" + code,
- success: function (response) {
- response = $.parseJSON(response);
- var str = '<option value="">{{__("label.choose_city")}}</option>';
- _this.parents('.delivery-fee-item').find(".city").html(str);
- if (response) {
- $.each(response, function (i, v) {
- str += '<option value="' + v.city + '">' + v.city + '</option>';
- });
- _this.parents('.delivery-fee-item').find(".city").html(str);
- }
- }
- });
- });
- $("body").on("change", ".city", function () {
- var name = $(this).val();
- var _this = $(this);
-
- $.ajax({
- url: "{!! env('APP_URL') !!}get/places/by/city/" + name,
- success: function (response) {
- response = $.parseJSON(response);
- var str = '<option value="">{{__("label.choose_city")}}</option>';
- _this.parents('.delivery-fee-item').find(".place").html(str);
- if (response) {
- $.each(response, function (i, v) {
- str += '<option value="' + v.city_unique_id + '" data-category="' + v.category + '">' + v.city_name + '</option>';
- });
- _this.parents('.delivery-fee-item').find(".place").html(str);
- }
- }
- });
- });
-
-
-
-
-
-
- $("body").on("change", ".make_active", function () {
- var value = $(this).val();
- var resto_id = $(this).data('resto-id');
- if ($(this).is(":checked")) {
- $.ajax({
- url: "{!! env('APP_URL') !!}offer/make/active",
- type: "POST",
- data: {
- id: value,
- resto_id: resto_id,
- "_token": "{!! csrf_token() !!}"
- },
- success: function (response) {
- }
- });
- }
- });
-
-
-
- $("body").on('click', '.save', function () {
- $(".alert").hide();
- if ($("#restaurant-form").valid()) {
- $("#restaurant-form").ajaxForm(function (response) {
- response = $.parseJSON(response);
- if (response) {
- if (response.type == "success") {
- $('#restaurant-form .alert.success').html(response.message);
- $('#restaurant-form .alert.success').show();
- setTimeout(function () {
- @if(\Illuminate\Support\Facades\Auth::user()->role=="administrator" )
- window.location = '{!! env('APP_URL') !!}businesses';
- @else
- location.reload();
- @endif
- }, 2000)
- } else {
- $('#restaurant-form .alert.error').html(response.message);
- $('#restaurant-form .alert.error').show();
- }
- }
- }).submit();
- }
- });
-
- })
- </script>
- @endsection
|