Advertisement
Guest User

sale.order/main/script.js

a guest
Dec 9th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(App){
  2.  
  3.     window.App = App = App||{};
  4.  
  5.     var CheckoutWidget = App.CheckoutWidget = App.Widget.extend({
  6.  
  7.  
  8.  
  9.         defaults: function(){
  10.             return {
  11.                 ajaxHandler: CheckoutWidget.ajaxHandler,
  12.                 isAuth: false,
  13.                 props: {},
  14.                 paySystems: {},
  15.                 deliveries: {},
  16.                 authForm: {},
  17.                 componentParams: '',
  18.                 block:{
  19.                     part_pay:'.part_pay'
  20.                 },
  21.                 selector:{
  22.                     count_pay_part:'div.count-pay-part select'
  23.                 }
  24.  
  25.             }
  26.         },
  27.  
  28.  
  29.         initialize: function(){
  30.             this.__initForm();
  31.             this.__initUserProps();
  32.             this.__initPaySystems();
  33.             this.__initDeliveries();
  34.             this.__initAuthForm();
  35.             this.__initCoupon();
  36.             this.__events();
  37.         },
  38.         __events:function(){
  39.  
  40.                 },
  41.  
  42.         __initForm: function(){
  43.             this.$form = this.$el.find('form#checkout_main_form');
  44.             this.$form.on('submit', $.proxy(this, 'submit'));
  45.         },
  46.  
  47.         __initCoupon: function(){
  48.             var $couponInput = $("#js_coupon_input");
  49.             var $applyCouponButton = $("#js_apply_coupon");
  50.             var $removeCouponButton = $("#js_remove_coupon");
  51.             var _this = this;
  52.  
  53.             $applyCouponButton.on("click", function(event){
  54.                 event.preventDefault();
  55.                 _this.sendForm({
  56.                     func: 'processOrder',
  57.                     action: 'enterCoupon',
  58.                     coupon: $couponInput.val(),
  59.                     signedParamsString: _this.componentParams
  60.                 }, function(response){
  61.                     this.$el.replaceWith(response.data.html);
  62.                 });
  63.             });
  64.  
  65.             $removeCouponButton.on("click", function(event){
  66.                 event.preventDefault();
  67.                 _this.sendForm({
  68.                     func: 'processOrder',
  69.                     action: 'removeCoupon',
  70.                     coupon: $couponInput.val(),
  71.                     signedParamsString: _this.componentParams
  72.                 }, function(response){
  73.                     this.$el.replaceWith(response.data.html);
  74.                 });
  75.             });
  76.  
  77.             return false;
  78.         },
  79.  
  80.         __initUserProps: function(){
  81.             var _this = this;
  82.             this.$el.find('.a-checkout-user-prop').each(function(){
  83.                 var prop = PropWidget.build($(this));
  84.                 _this.props[prop.code] = prop;
  85.             });
  86.         },
  87.  
  88.         __initPaySystems: function(){
  89.             var _this = this;
  90.             this.$el.find('.checkout_pay_system').each(function(){
  91.                 var paySystem = new PaySystemWidget($(this));
  92.                 $(paySystem).on(':change', function(e, paySystem, refresh){
  93.  
  94.                     // if(refresh){
  95.                     //     _this.refresh();
  96.                     // }
  97.  
  98.                 });
  99.                 _this.paySystems[paySystem.id] = paySystem;
  100.                 $(_this.selector.count_pay_part).styler();
  101.  
  102.             });
  103.         },
  104.  
  105.         __initDeliveries: function(){
  106.             var _this = this;
  107.             this.$el.find('.checkout_delivery').each(function(){
  108.                 var delivery = DeliveryWidget.build($(this));
  109.                 $(delivery).on(':change', function(e, delivery, refresh){
  110.                     //console.log(refresh);
  111.                     if(refresh){
  112.                         _this.refresh();
  113.                         $.removeCookie("divide_confirmed");
  114.                     }
  115.                 });
  116.                 _this.deliveries[delivery.id] = delivery;
  117.             });
  118.         },
  119.  
  120.         __initAuthForm: function(){
  121.             var _this = this;
  122.             this.authForm = new AuthFormWidget(this.$el.find('#checkout_auth'), {
  123.                 ajaxHandler: this.ajaxHandler
  124.             });
  125.  
  126.             $(this.authForm).on(':submit', function(){
  127.                 _this.authorize();
  128.             });
  129.                  _this.eventts();
  130.         },
  131.         eventts:function(){
  132.             var _this = this;
  133.             var $email = this.$el.find('form#checkout_main_form input[data-name="EMAIL"]');
  134.             this.$errorEmail = $email.siblings('.err-text');
  135.             dataTime = this.$el.find("select[name='ORDER_PROP_19']");
  136.  
  137.             dataTime.on('change', function(){
  138.  
  139.                 if(dataTime.find("option:selected").data("express") != 1 || !($(this).data().no_refresh ? true : false)){ // getTimeData() local/modules/aniart.main/lib/services/novaposhtaservice.php
  140.                 _this.$el.find("select[name='DELIVERY_ID'] option:selected").val(3);/// 3 - доставка курьером
  141.                     _this.refresh();
  142.                 }
  143.  
  144.             });
  145.  
  146.             $(document).off('click').on('click', '.choose_another_delivery_type', function () {
  147.                 var delivery_types = App.Checkout.selector.deliveryType;
  148.                 var avaliable_delivery_variants = [];
  149.                 $(`${delivery_types} > option`).each(function (index, element) {
  150.                     avaliable_delivery_variants.push($(element).data('id'))
  151.                 });
  152.                 if(avaliable_delivery_variants.length > 1){
  153.                     $(`${delivery_types} > option:not(:selected)`).eq(0).prop('selected', true);
  154.                     $(delivery_types).trigger('refresh');
  155.                     _this.refresh();
  156.                 };
  157.             })
  158.  
  159.  
  160.  
  161.  
  162.             //проверка РЅР° уникальность емейла
  163.             // $email.focusout(function () {
  164.             //
  165.             //     $.post(App.CheckoutWidget.ajaxHandler, {
  166.             //         func: 'checkUniqueEmail',
  167.             //         email: $email.val(),
  168.             //
  169.             //     }, function(response){
  170.             //         if(response.status==='success'){
  171.             //             _this.$errorEmail.empty();
  172.             //             _this.$errorEmail.hide();
  173.             //         }else{
  174.             //             _this.$errorEmail.html(response.message);
  175.             //             _this.$errorEmail.show();
  176.             //         }
  177.             //     }, 'json');
  178.             // });
  179.  
  180.         },
  181.  
  182.  
  183.         authorize: function(){
  184.             var _this = this;
  185.             this.sendForm({
  186.                 func: 'authorize',
  187.                 do_authorize: 'Y',
  188.                 action: 'showAuthForm',
  189.                 save: 'Y',
  190.                 template:this.template,
  191.                 signedParamsString: this.componentParams
  192.             }, function(response){
  193.                 var isError = !!response.data.order['ERROR'];
  194.                 if(response.status=='ok'&&!isError){
  195.                     window.location.reload();
  196.                 }
  197.                 if(isError){
  198.                     _this.authForm.showErrors(response.data.order['ERROR']['AUTH'].join('<br />'));
  199.                 }
  200.                 return false;
  201.             }, this.authForm.$form);
  202.         },
  203.  
  204.         refresh: function(){
  205.             this.sendForm({
  206.                 func: 'processOrder',
  207.                 action: 'processOrder',
  208.                 template:this.template,
  209.                 signedParamsString: this.componentParams
  210.             }, function(response){
  211.                 this.$el.replaceWith(response.data.html);
  212.                 App.getStyler({object: $('select')});
  213.                 App.getStyler({object: $('input')});
  214.                 $('select').css({'visibility': 'visible'});
  215.                 $('input').css({'visibility': 'visible'});
  216.             });
  217.         },
  218.  
  219.         checkErrFields:function () {
  220.             var err = false;
  221.             $('#sale_order input').each(function (i,e) {
  222.                 if($(e).hasClass('inp-error-pink')){
  223.                     var top = $(this).offset().top;
  224.                     $('html, body').animate({ scrollTop: top }, 500);
  225.                     err = true;
  226.                     return;
  227.                 }
  228.             });
  229.  
  230.             if(err){return true;}
  231.         },
  232.  
  233.         submit: function(e){
  234.             if(e){
  235.                 e.preventDefault();
  236.             }
  237.  
  238.             if(!App.checkFormFields(this.$form)) {
  239.                 return false;
  240.             }
  241.  
  242.  
  243.             var _this = this;
  244.  
  245.  
  246.             var city,city_, policy;
  247.  
  248.             policy = this.$el.find('input[name="ORDER_POLICY"]');
  249.             if(!policy.is(':checked')){
  250.                 policy.addClass('inp-error-pink');
  251.                 policy.trigger('refresh');
  252.                 return;
  253.             }
  254.  
  255.             city = this.$el.find('input[name="ORDER_PROP_4"]');
  256.             city_ = this.$el.find('select[name="ORDER_PROP_4"]');
  257.             if(!city.val() && !city_.val()){
  258.                 city.addClass('inp-error-pink');
  259.                 city.trigger('refresh');
  260.                 return;
  261.             }
  262.  
  263.             var data = {
  264.                 func: 'processOrder',
  265.                 action: 'processOrder',
  266.                 json: 'Y',
  267.                 template:this.template,
  268.                 signedParamsString: this.componentParams,
  269.                 confirmorder: 'Y'
  270.             };
  271.  
  272.  
  273.             this.sendForm(data, function(response){
  274.  
  275.                 if(response.data.html['redirectUrl']){
  276.                     var url = response.data.html['redirectUrl'];
  277.                     window.location.href = url;
  278.                 }
  279.  
  280.                 if(response.data.html['redirect'] && !response.data.html['redirectUrl']){
  281.                     var url = response.data.html['redirect'].split('?');
  282.                     window.location = '/checkout/?'+url[1];
  283.                     return;
  284.                 }
  285.                 this.$el.replaceWith(response.data.html);
  286.  
  287.                 App.getStyler({object: $('input')});
  288.                 $('input').css({'visibility': 'visible'});
  289.             });
  290.         },
  291.  
  292.         sendForm: function(data, callback, $form){
  293.             var _this = this;
  294.             if(CheckoutWidget.sendFormTimeout){
  295.                 clearTimeout(CheckoutWidget.sendFormTimeout);
  296.             }
  297.             CheckoutWidget.sendFormTimeout = setTimeout(function(){
  298.                 _this.__sendForm(data, function(response){
  299.  
  300.  
  301.  
  302.                     if(response.status=='ok'){
  303.                         if(response.data.html.liqpayForm != undefined){
  304.                             $("body").append(response.data.html.liqpayForm);
  305.                             $("#liqpay-form").submit();
  306.                         }else{
  307.                             callback.apply(_this, [response]);
  308.                             _this.checkErrFields();
  309.                         }
  310.  
  311.  
  312.                     }else{
  313.                         alert(response.message);
  314.                     }
  315.                 }, $form);
  316.             }, 500);
  317.         },
  318.  
  319.         __sendForm: function(data, callback, $form){
  320.             data = data||{};
  321.             callback = callback||$.noop;
  322.             $form = $form||this.$form;
  323.  
  324.             var request = $form.serialize();
  325.             for(var paramName in data){
  326.                 var paramValue = data[paramName];
  327.                 request += '&'+paramName+'='+paramValue;
  328.             }
  329.             return $.post(this.ajaxHandler, request, callback, 'json');
  330.         }
  331.  
  332.     }, {
  333.         lang: 'ru',
  334.         ajaxHandler: App.AJAX_DIR+'?handler=order',
  335.         sendFormTimeout: false
  336.     });
  337.  
  338.     var BaseRadioWidget = App.Widget.extend({
  339.         defaults: function(){
  340.             return {
  341.                 $radio: null
  342.             }
  343.         },
  344.         initialize: function(){
  345.             var _this = this;
  346.             this.$radio = this.$el.is('[type="radio"]')?this.$el:this.$el.find('input[type="radio"]');
  347.             this.$radio.on('change', function(){
  348.                 //_this.__initAdditional($(this));
  349.                 $(_this).trigger(':change', [_this]);
  350.             });
  351.             this.$radio.styler();
  352.             _this.__initAdditional(this.$radio);
  353.         },
  354.         __initAdditional: function($radio){
  355.             if($radio.is(':checked')){
  356.                 $radio.closest('.order-form-choose').find('.order-radio').removeClass('checked');
  357.                 $radio.closest('.order-radio').addClass('checked');
  358.             }else{
  359.                 $radio.closest('.order-radio').removeClass('checked');
  360.             }
  361.         }
  362.  
  363.     });
  364.  
  365.     var BaseSelectWidget = App.Widget.extend({
  366.         defaults: function(){
  367.             return {
  368.                 $select: null
  369.             };
  370.         },
  371.         initialize: function(){
  372.             var _this = this;
  373.             this.$select = this.$el.find('select');
  374.             this.$select.styler();
  375.             this.$select.on('change', function(e){
  376.                 //global change block for select
  377.             var $option = _this.$select.find('option:selected');
  378.             var $refresh = ($(this).data().no_refresh ? false : true);
  379.             $(_this).trigger(':change', [$option, $refresh]);
  380.             });
  381.         }
  382.     });
  383.  
  384.     var PaySystemWidget = BaseSelectWidget.extend({
  385.         defaults: function(){
  386.             return {
  387.                 id: 0
  388.             }
  389.         },
  390.         initialize: function(){
  391.             PaySystemWidget.__super__.initialize.apply(this, arguments);
  392.  
  393.             var options = arguments[1] || {};
  394.             this.id = options.id || this.$el.data('id');
  395.         }
  396.     });
  397.  
  398.     var DeliveryWidget = BaseSelectWidget.extend({
  399.         defaults: function(){
  400.             return {
  401.                 id: 0
  402.             }
  403.         },
  404.         initialize: function(){
  405.             DeliveryWidget.__super__.initialize.apply(this, arguments);
  406.             var options = arguments[1]||{};
  407.             this.id = options.id||this.$el.data('id');
  408.  
  409.         }
  410.     }, {
  411.         build: function($el){
  412.             if($el.find('#checkout_np_city').length){
  413.                 return new NewPostDeliveryWidget($el);
  414.             }else if($el.find('#checkout_streets').length){
  415.                 return new NewPostDeliveryWidget($el);
  416.             }
  417.             return new DeliveryWidget($el);
  418.         }
  419.     });
  420.  
  421.  
  422.     var NewPostDeliveryWidget = DeliveryWidget.extend({
  423.  
  424.         defaults: function(){
  425.             return {
  426.                 cities: null,
  427.                 departments: null,
  428.                 $cityId: null,
  429.                 $dep: null,
  430.                 $address: null,
  431.                 $schedule: null,
  432.                 $streets: null,
  433.                 $depId: null,
  434.                 $deliveryId:null,
  435.                 $depref:null,
  436.                 $oldstreets:null
  437.             }
  438.         },
  439.  
  440.         initialize: function(){
  441.             NewPostDeliveryWidget.__super__.initialize.apply(this, arguments);
  442.             this.loader = new App.LoaderWidget(this.$el);
  443.             this.$deliveryId = this.$el.find('option:selected').val();
  444.             this.$streetsVal = this.$el.find('#checkout_np_streets input[type="text"]');
  445.             this.$houseVal = this.$el.find('#checkout_np_house input[type="text"]');
  446.             this.$roomsVal = this.$el.find('#checkout_np_rooms input[type="text"]');
  447.             this.__initCity();
  448.             this.__initStreets();
  449.             this.__initDepartments();
  450.  
  451.             this.$streetsId = this.$el.find('#checkout_np_streets input[type="hidden"]');
  452.             this.$cityId = this.$el.find('#checkout_np_city input[type="hidden"]');
  453.             this.$depId = this.$el.find('#checkout_np_departments input[type="hidden"]');
  454.             this.$dep = this.$el.find('.post-tit');
  455.             this.$address = this.$el.find('.post-adr');
  456.             this.$schedule = this.$el.find('.post-time');
  457.  
  458.         },
  459.  
  460.         __initCity: function(){
  461.             // console.log(this.$deliveryId);
  462.             var _this = this;
  463.             this.cities = new NewPostDeliveryWidget.CitiesWidget(this.$el.find('#checkout_np_city'), {
  464.                 loader: this.loader
  465.             });
  466.              /// для доставки Сѓ відділення
  467.             var DepartmentDelivery = BX.message('DepartmentDelivery');
  468.  
  469.             if(this.$deliveryId == DepartmentDelivery){
  470.                 $(this.cities).on(":select", function (e, suggestion) {
  471.  
  472.                     _this.departments.showForCity(suggestion.data, _this.$depref);
  473.                     _this.$cityId.val(suggestion.data);
  474.                 });
  475.             }else {
  476.                 $(this.cities).on(":selectForStreets", function (e, suggestion) {
  477.                     _this.streets.__initInput(suggestion.data, _this.$oldstreets);
  478.                     _this.$cityId.val(suggestion.data);
  479.  
  480.  
  481.                 });
  482.             }
  483.  
  484.             $(this.cities).on(':empty', function(e){
  485.                 _this.$houseVal.val("");
  486.                 _this.$roomsVal.val("");
  487.                 _this.$streetsVal.val("");
  488.                 _this.$streetsId.val("");
  489.                 _this.$cityId.val("");
  490.                 _this.departments.$select.empty();
  491.                 _this.departments.hide();
  492.                 _this.$cityId.empty();
  493.                 _this.$streetsId.empty();
  494.                 _this.$dep.empty();
  495.                 _this.$depId.empty();
  496.                 _this.$address.empty();
  497.                 _this.$address.hide();
  498.                 _this.$schedule.empty();
  499.             });
  500.         },
  501.         __initStreets: function(){
  502.             var _this = this;
  503.             this.streets = new NewPostDeliveryWidget.StreetsWidget(this.$el.find('#checkout_np_streets'), {
  504.                 loader: this.loader
  505.             });
  506.             $(this.streets).on(':selectStreets', function(e, streets){
  507.                 _this.$oldstreets = streets;
  508.                 _this.$streetsId.val(streets.data);
  509.                 _this.$streetsVal.val(streets.value);
  510.  
  511.             });
  512.             $(this.streets).on(':empty', function(e){
  513.                 _this.$cityId.empty();
  514.                 _this.$cityId.val("");
  515.                 _this.$streetsVal.val("");
  516.             });
  517.         },
  518.  
  519.         __initDepartments: function(){
  520.             var _this = this;
  521.             this.departments = new NewPostDeliveryWidget.DepartmentsWidget(this.$el.find('#checkout_np_departments'), {
  522.                 loader: this.loader
  523.             });
  524.             this.departments.hide(this.departments);
  525.             $(this.departments).on(':selectDepartment', function(e, department){
  526.              _this.$depref = department;
  527.                 var dep, addr, schedule;
  528.                 [dep, addr] = department.NAME.split(':');
  529.                 //schedule = department.SCHEDULE['Monday']||'';
  530.                 //schedule += '<br />'+department.PHONE;
  531.                 _this.$dep.html(dep);
  532.                 _this.$depId.val(department.REF);
  533.                 _this.$address.html(addr);
  534.                 //_this.$schedule.html(schedule);
  535.             });
  536.         }
  537.  
  538.     }, {
  539.         DepartmentsWidget: App.Widget.extend({
  540.             defaults: function(){
  541.                 return {
  542.                     $select: null,
  543.                     $error: null,
  544.                     loader: null,
  545.                     departments: {}
  546.                 };
  547.             },
  548.             initialize: function(){
  549.                 this.__initSelect();
  550.             },
  551.  
  552.             __initSelect: function(){
  553.                 var _this = this;
  554.                 this.$select = this.$el.find('select');
  555.  
  556.                 this.$select.styler();
  557.                 this.$select.on('change', function(){
  558.                     var $option = _this.$select.find('option:selected');
  559.                     var department = _this.departments[$option.data('id')];
  560.                     // console.log(department);
  561.                     if(department){
  562.                         $(_this).trigger(':selectDepartment', [department]);
  563.                     }
  564.                 });
  565.                 this.$error = this.$el.find('.err-text');
  566.             },
  567.  
  568.             showForCity: function(cityRef, oldDepRef){
  569.                 var _this = this;
  570.                 if(!cityRef){
  571.                     return;
  572.                 }
  573.                 oldDepRef = oldDepRef?oldDepRef:"";
  574.                 if(cityRef == oldDepRef.CITY_REF){
  575.                     _this.show();
  576.                     return;
  577.                 }
  578.                 this.clearError();
  579.                 this.loader.show();
  580.                 $.post(App.CheckoutWidget.ajaxHandler, {
  581.                     func: 'getNewPostDepartmentsByCityRef',
  582.                     cityRef: cityRef,
  583.                     lang: App.CheckoutWidget.lang
  584.                 }, function(response){
  585.  
  586.                     //console.log(response);
  587.                     _this.clearError();
  588.                     _this.loader.hide();
  589.                     if(response.status==='success'){
  590.                         _this.$select.empty();
  591.  
  592.                         var defaultDepartment = _this.$select.data('dep')||response.data[0]['NAME'];
  593.                         response.data.map(function(departmentData){
  594.  
  595.                             //console.log(departmentData);
  596.  
  597.                             var $option = $('<option>', {
  598.                                 text: departmentData.NAME,
  599.                                 value: departmentData.NAME
  600.                             });
  601.                             if(departmentData.NAME===defaultDepartment){
  602.                                 $option.attr('selected', 'selected');
  603.                             }
  604.  
  605.                             $option.data('id', departmentData['REF']);
  606.                             _this.$select.append($option);
  607.                             _this.departments[departmentData['REF']] = departmentData;
  608.                         });
  609.                         _this.$select.trigger('change');
  610.                         _this.$select.trigger('refresh');
  611.                         _this.show();
  612.                         _this.loader.reset();
  613.                     }else{
  614.                         _this.showError(response.message);
  615.                     }
  616.                 }, 'json');
  617.             },
  618.  
  619.             hide: function(){
  620.                 this.$el.hide();
  621.             },
  622.  
  623.             show: function(){
  624.                 this.$el.show();
  625.             },
  626.  
  627.             clearError: function(){
  628.                 this.$el.removeClass('error-inp');
  629.                 this.$error.empty();
  630.             },
  631.  
  632.             showError: function(message){
  633.                 this.$el.addClass('error-inp');
  634.                 this.$error.html(message);
  635.             }
  636.         }),
  637.  
  638.         CitiesWidget: App.Widget.extend({
  639.             defaults: function(){
  640.                 return {
  641.                     $input: null,
  642.                     $error: null,
  643.                     loader: null,
  644.                     $streetsVall:null
  645.                 }
  646.             },
  647.  
  648.             initialize: function(){
  649.  
  650.                 this.$error = this.$el.find('.err-text');
  651.                 this.__initInput();
  652.             },
  653.  
  654.             __initInput: function(){
  655.                 var _this = this;
  656.                 this.$input = this.$el.find('input[type="text"]');
  657.                 this.$inputHidden = this.$el.find('input[type="hidden"]');
  658.                 $(this.$el).on('input', _this.$input, function(e){
  659.  
  660.                     if(_this.$input.val()<2){
  661.                         $(_this).trigger(':empty');
  662.  
  663.                     }
  664.                 });
  665.  
  666.                 setTimeout(function(){
  667.                     _this.$input.autocomplete({
  668.                         serviceUrl: CheckoutWidget.ajaxHandler,
  669.                         type: 'POST',
  670.                         params: {
  671.                             lang: App.CheckoutWidget.lang,
  672.                             func: 'getNewPostCities'
  673.                         },
  674.                         deferRequestBy: 350,
  675.                         minChars: 2,
  676.                         onSearchStart: function(){
  677.                             // _this.loader.show();
  678.                             // _this.clearError();
  679.                         },
  680.                         transformResult: function(response){
  681.                             // _this.loader.hide();
  682.                             response = JSON.parse(response);
  683.                             var suggestions = [];
  684.                             if(response.status == 'error'){
  685.                                 // _this.$input.val('');
  686.                                 _this.$inputHidden.val("");
  687.                                 $(_this).trigger(':empty');
  688.                                 _this.showError(response.message);
  689.                                 return {suggestions: suggestions};
  690.                             }
  691.                             _this.clearError();
  692.                             suggestions = response.data.map(function(cityData){
  693.                                 return {value: cityData.NAME, data: cityData.REF};
  694.                             });
  695.                             if(!suggestions.length){
  696.                                 _this.showError(response.message);
  697.                                 _this.$inputHidden.val("");
  698.                                 // _this.$input.val('');
  699.                                 $(_this).trigger(':empty');
  700.                                
  701.                             }
  702.                             return {suggestions: suggestions};
  703.                         },
  704.                         onSelect: function(suggestion){
  705.                             $(_this).trigger(':select', [suggestion]);
  706.                             $(_this).trigger(':selectForStreets', [suggestion]);
  707.                         }
  708.                     });
  709.                     var value = _this.$input.val();
  710.                     if(value){
  711.                         _this.$input.focus();
  712.                     }
  713.                 }, 1000);
  714.  
  715.             },
  716.  
  717.             clearError: function(){
  718.                 this.$el.removeClass('error-inp');
  719.                 this.$error.empty();
  720.             },
  721.  
  722.             showError: function(message){
  723.                 this.$el.addClass('error-inp');
  724.                 this.$error.html(message);
  725.             }
  726.         }),
  727.  
  728.         StreetsWidget: App.Widget.extend({
  729.             defaults: function(){
  730.                 return {
  731.                     $input: null,
  732.                     $error: null,
  733.                     loader: null
  734.                 }
  735.             },
  736.  
  737.             initialize: function(){
  738.                 this.$error = this.$el.find('.err-text');
  739.                 this.__initInput();
  740.             },
  741.  
  742.             __initInput: function(cityRef, oldstreets){
  743.                 var _this = this;
  744.                 var $oldstreets = oldstreets;
  745.                 this.$input = this.$el.find('input[type="text"]');
  746.                 this.$inputHidden = this.$el.find('input[type="hidden"]');
  747.  
  748.                 if(!cityRef){
  749.                     cityRef = $('#checkout_np_city input[type="hidden"]').eq(1).val();
  750.  
  751.                 }if(!cityRef){
  752.                      cityRef = $('#checkout_np_city input[type="hidden"]').eq(0).val();
  753.  
  754.                 }
  755.                 setTimeout(function(){
  756.  
  757.                     _this.$input.autocomplete({
  758.  
  759.                         serviceUrl: CheckoutWidget.ajaxHandler,
  760.                         type: 'POST',
  761.  
  762.                         params: {
  763.  
  764.                             func: 'getNewPostStreets',
  765.                             cityRef: cityRef
  766.                         },
  767.                         deferRequestBy: 350,
  768.                         minChars: 2,
  769.                         onSearchStart: function(){
  770.  
  771.                             // _this.loader.show();
  772.                             _this.clearError();
  773.                         },
  774.                         transformResult: function(response, e){
  775.  
  776.                             response = JSON.parse(response);
  777.                             var suggestions = [];
  778.                             if(response.status == 'error'){
  779.                                 _this.showError(response.message);
  780.                                 _this.$inputHidden.val('');
  781.                                 $(_this).trigger(':empty');
  782.                                 return {suggestions: suggestions};
  783.                             }
  784.                             suggestions = response.data.map(function(streetData){
  785.  
  786.                                 return {value: streetData.Description + " (" + streetData.StreetsType+")", data: streetData.Ref};
  787.                             });
  788.  
  789.                             if(!suggestions.length){
  790.                                 _this.showError(response.message);
  791.                                 _this.$inputHidden.val('');
  792.                                 $(_this).trigger(':empty');
  793.                             }
  794.  
  795.                             return {suggestions: suggestions};
  796.                         },
  797.                         onSelect: function(suggestion){
  798.  
  799.                             $(_this).trigger(':selectStreets', [suggestion]);
  800.                         }
  801.                     });
  802.                     var value = _this.$input.val();
  803.                     if(value){
  804.                         _this.$input.focus();
  805.                     }
  806.                 }, 1000);
  807.  
  808.             },
  809.  
  810.             clearError: function(){
  811.                 this.$el.removeClass('error-inp');
  812.                 this.$error.empty();
  813.             },
  814.  
  815.             showError: function(message){
  816.                 this.$el.addClass('error-inp');
  817.                 this.$error.html(message);
  818.             },
  819.             isSelected: function(){
  820.                 return this.$el.is(':selected');
  821.             }
  822.         }),
  823.     });
  824.  
  825.  
  826.     var PropWidget = App.Widget.extend({
  827.         defaults: function(){
  828.             return {
  829.                 id: 0,
  830.                 code: '',
  831.                 $input: null
  832.             }
  833.         },
  834.  
  835.         initialize: function(){
  836.             this.$input = this.$el.find('input');
  837.         },
  838.  
  839.         getValue: function(){
  840.             return this.$input.val();
  841.         }
  842.  
  843.     }, {
  844.         build: function($el){
  845.             var params = {id: $el.data('id'), code: $el.data('code')};
  846.             if(!params.code){
  847.                 throw new Error('PropWidget: Invalid property code');
  848.             }
  849.             var propWidget;
  850.             if(params.code=='PHONE'){
  851.                 propWidget = new PhonePropWidget($el, params);
  852.             }else{
  853.                 propWidget = new PropWidget($el, params);
  854.             }
  855.             return propWidget;
  856.         }
  857.     });
  858.  
  859.     var PhonePropWidget = PropWidget.extend({
  860.  
  861.         initialize: function(){
  862.             PhonePropWidget.__super__.initialize.apply(this, arguments);
  863.             // App.phoneField(this.$input);
  864.         }
  865.  
  866.     });
  867.  
  868.     var AuthFormWidget = App.Widget.extend({
  869.  
  870.         defaults: function(){
  871.             return {
  872.                 $form: null,
  873.                 $emailInput: null,
  874.                 $passwordInput: null,
  875.                 $forgotLink: null,
  876.                 $forgotModal: null,
  877.                 $errors: null
  878.             }
  879.         },
  880.  
  881.         initialize: function(){
  882.             this.__initForm();
  883.             this.__initForgotLink();
  884.             this.$emailInput = this.$form.find('input[name="USER_LOGIN"]');
  885.             this.$passwordInput = this.$form.find('input[name="USER_PASSWORD"]');
  886.             this.$errors = this.$form.find('#checkout_auth_error');
  887.         },
  888.  
  889.         __initForm: function(){
  890.             var _this = this;
  891.             this.$form = this.$el.find('form');
  892.             this.$form.on('submit', function(e){
  893.                 e.preventDefault();
  894.                 _this.clearErrors();
  895.                 $(_this).trigger(':submit');
  896.             });
  897.         },
  898.  
  899.         __initForgotLink: function(){
  900.             this.$forgotLink = this.$form.find('#checkout_auth_forgot');
  901.             this.$forgotModal = $('#myModal');
  902.             var _this = this;
  903.             this.$forgotLink.on('click', function(){
  904.                 _this.$forgotModal.one('show.bs.modal', function(){
  905.                     _this.$forgotModal.find('div.one-log-forg a').click();
  906.                 });
  907.                 _this.$forgotModal.modal();
  908.             });
  909.         },
  910.  
  911.         clearErrors: function(){
  912.             this.$errors.empty().hide();
  913.         },
  914.  
  915.         showErrors: function(err){
  916.             this.$errors.html(err).show();
  917.         }
  918.  
  919.     });
  920.  
  921. })(window.App);
  922. var Checkout = App.Checkout  = (function(App){
  923.     window.App = App = App || {};
  924.     return {
  925.         storesDetached: false,
  926.         selector: {
  927.             idDeliv: '#checkout_np_timeInterval select',
  928.             idDelivSelected: '#checkout_np_timeInterval .selected',
  929.             deliveryType: '.checkout_delivery select[name="DELIVERY_ID"]',
  930.             inputHide: '#checkout_np_timeInterval input[type="hidden"]',
  931.             userDataProps: '.user-data-props input',
  932.             buyButton: '.one-click-bt span',
  933.             quantity: '.cart_item_quantity select',
  934.             checkout: '#cart_main_checkout',
  935.             selectedStore: ".all-hide-radio .selected",
  936.             selectStores: "select#checkout_stores_select",
  937.             selectCity: "select#checkout_cities_stores",
  938.             basketItemDelete: ".checkout_cart_item_delete a",
  939.             paySystemType: ".checkout_pay_system select[name='PAY_SYSTEM_ID']",
  940.             groupsModal: "#basket_groups",
  941.             paySystemPayParts: 9,
  942.             paySystemPayCashInShop: 8,
  943.             paySystemPayLiqpay: 7,
  944.             paySystemPayCash: 6,
  945.             deliveryTypeExpress: 5,
  946.             deliveryTypePickup: 6,
  947.         },
  948.         events: function () {
  949.             var _app = App,
  950.                 _this = this;
  951.  
  952.             if($(this.selector.deliveryType).val() == _this.selector.deliveryTypeExpress) {
  953.                 _this.changeValue();
  954.             }
  955.  
  956.             $(document).on('click', this.selector.buyButton, function (){
  957.                 setTimeout(function(){
  958.                     $('#myModal2').modal('show');
  959.                 },3000);
  960.  
  961.             });
  962.  
  963.             $(document).ready(setTimeout(function (){
  964.                     $('#myModal2').modal('show');
  965.             },3000));
  966.  
  967.             $(document).on("input", this.selector.userDataProps ,function () {
  968.              var  pattern = $(this).data("pattern");
  969.              var value = $(this).val();
  970.  
  971.                 if(pattern != "undefined" && pattern != undefined){
  972.                     pattern = pattern.split("/");
  973.                     reg = new RegExp(pattern[1]);
  974.                     if(reg.test(value.trim()) || value.trim() == ""){
  975.                         if ($(this).hasClass("inp-error-pink")) {
  976.                             $(this).removeClass("inp-error-pink");
  977.                             $(this).siblings(".err-text").hide();
  978.                         }
  979.                     }
  980.                     else
  981.                     {
  982.                         if (value.trim() != ""){
  983.                             $(this).siblings(".err-text").show();
  984.                             $(this).addClass("inp-error-pink");
  985.                         }
  986.  
  987.                     }
  988.                 }
  989.             });
  990.  
  991.             $(document).on("click",".confirm_devide",function () {
  992.                 var groupsArr = [];
  993.                 var groupObj = {};
  994.                 $(document).find('.devide-group').each(function(i,e){
  995.                     var store_id = $(e).find('#select_store option').data('id');
  996.                     groupObj[store_id] = [];
  997.  
  998.                     $(e).find('.one-prod-basket').each(function(i,e){
  999.                         groupObj[store_id].push($(e).data('id'))
  1000.                     })
  1001.                 });
  1002.                 var devideData = JSON.stringify(groupObj);
  1003.                 $("input[name='ORDER_PROP_37']").val(devideData);
  1004.                 $.cookie('divide_confirmed', 'true');
  1005.             });
  1006.  
  1007.  
  1008.             // $(document).on('change', _this.selector.deliveryType,  function(e){
  1009.             //
  1010.             //         if($(this).val() == _this.selector.deliveryTypeExpress) {
  1011.             //             setTimeout(function(e){
  1012.             //                 _this.changeValue(e);
  1013.             //             }, 1000);
  1014.             //         }
  1015.             //
  1016.             // });
  1017.             $(document).on('change', _this.selector.paySystemType, function(e){
  1018.  
  1019.                var delivery =  $('.checkout_delivery.one-del .deliver .selected').text();
  1020.                var paysyst =  $('.checkout_pay_system .selected').text();
  1021.                 _this.getMsgForPaySystemAndDelivery(paysyst, delivery);
  1022.                 $(".part_pay").hide();
  1023.                 $(".hidden_part").hide();
  1024.                 if($(this).val() == _this.selector.paySystemPayParts){
  1025.                     $('.part_pay').show();
  1026.                     $('.for_pp').show();
  1027.                 }
  1028.  
  1029.             });
  1030.  
  1031.             $(document).on("click", "span.show_check_limit", function () {
  1032.                $(".hidden_part").show();
  1033.             });
  1034.  
  1035.             $(document).on("click", "a#limit", function () {
  1036.                 var number = $(".part_pay .hidden_part input.phone").val();
  1037.                 _this.sendToCheckLimit(number);
  1038.             });
  1039.  
  1040.             $(document).on('change',this.selector.idDeliv, function (e) {
  1041.                 _this.changeValue(e);
  1042.  
  1043.             });
  1044.  
  1045.             $(document).on('click', _this.selector.basketItemDelete, function(params){
  1046.                 var productId = $(this).data("id");
  1047.                 var deliveryId = $(document).find(_this.selector.deliveryType).val();
  1048.                 var paySystemId = $(document).find(_this.selector.paySystemType).val();
  1049.                 var storeSityId = $(document).find("#checkout_stores .sel").data("id");
  1050.                 params.id = productId || 0;
  1051.                 params.deliveryId =  deliveryId || 0;
  1052.                 params.paySystemId =  paySystemId || 0;
  1053.                 params.storeSityId =  storeSityId || 1;
  1054.                 if(params.id <= 0){
  1055.                     return false;
  1056.                 }
  1057.                 _this.delete(params);
  1058.             });
  1059.  
  1060.             $(document).on('change', _this.selector.quantity, function(){
  1061.                 var deliveryId = $(document).find(_this.selector.deliveryType).val();
  1062.                 var paySystemId = $(document).find(_this.selector.paySystemType).val();
  1063.                 var storeSityId = $(document).find("#checkout_stores .sel").data("id");
  1064.                 _this.getCalculate({
  1065.                     id:$(this).data().id,
  1066.                     quantity:$(this).find('option:selected').val(),
  1067.                     deliveryId: deliveryId,
  1068.                     paySystemId:paySystemId,
  1069.                     storeSityId:storeSityId
  1070.                 });
  1071.             });
  1072.  
  1073.             $(document).on('change', "#checkout_stores #checkout_np_city select ", function(){
  1074.                 var cityValue = $(this).val();
  1075.                 var cityId = $('#checkout_cities_stores option[value="'+cityValue+'"]').data().id;
  1076.                 //$('.all-hide-radio').hide();
  1077.                 $(_this.selector.selectStores).remove();
  1078.                 $("span.address").text("");
  1079.                 $("#checkout_stores_select-styler").remove();
  1080.                 _this.getStoreByCityId(cityId);
  1081.  
  1082.             });
  1083.             $(document).on("change",_this.selector.selectStores, function(){
  1084.                 _this.setAdressAndShopId();
  1085.             });
  1086.  
  1087.             $(document).on('show.bs.modal', _this.selector.groupsModal, function () {
  1088.                 _this.attachStoresToModal();
  1089.                 $(document).find('#myModal1').addClass('modal_hidden');
  1090.             });
  1091.  
  1092.             $(document).on('hide.bs.modal', _this.selector.groupsModal, function () {
  1093.                 _this.attachStoresToPage();
  1094.                 $(document).find('#myModal1').removeClass('modal_hidden');
  1095.                 $(document).find('#myModal1').modal('hide');
  1096.             });
  1097.            
  1098.             App.getPhoneMask({
  1099.                 object:$(document).find(".part_pay .hidden_part input.phone")
  1100.             });
  1101.  
  1102.         },
  1103.  
  1104.         init: function () {
  1105.             this.setAdressAndShopId();
  1106.             this.events();
  1107.         },
  1108.  
  1109.         attachStoresToModal: function(){
  1110.             var _this = this;
  1111.             try{
  1112.                 if(! _this.storesDetached && $('#checkout-stores-attachable > #checkout_stores').length > 0){
  1113.                     $(document).find('#checkout-stores-attachable > #checkout_stores')
  1114.                         .detach()
  1115.                         .appendTo('#modal-stores-attacheble');
  1116.                     _this.storesDetached = true;
  1117.                 }
  1118.             } catch (e) {
  1119.                 console.log('err attachStoresToModal', e)
  1120.             }
  1121.         },
  1122.  
  1123.         attachStoresToPage: function(){
  1124.             var _this = this;
  1125.             try{
  1126.                 if( _this.storesDetached && $('#modal-stores-attacheble > #checkout_stores').length > 0 ){
  1127.                     $(document).find('#modal-stores-attacheble > #checkout_stores')
  1128.                         .detach()
  1129.                         .appendTo('#checkout-stores-attachable');
  1130.                     _this.storesDetached = false;
  1131.                 }
  1132.             } catch (e) {
  1133.                 console.log('err attachStoresToPage', e)
  1134.             }
  1135.         },
  1136.  
  1137.         setAdressAndShopId: function(){
  1138.             var _this =this;
  1139.                 var address = $(document).find(_this.selector.selectedStore).data("address");
  1140.                 var store_id = $(document).find(_this.selector.selectedStore).data("id");
  1141.                 $(document).find("span.address").text(address);
  1142.                 $(document).find(".radio-hide input[type='hidden']").val(store_id);
  1143.         },
  1144.  
  1145.         changeValue:function (e) {
  1146.             _this = this;
  1147.             var date = $(this.selector.idDelivSelected).data('code');
  1148.             var date_exp = $(this.selector.idDelivSelected).data('express');
  1149.             var data_id = $(this.selector.idDelivSelected).val();
  1150.             $(_this.selector.inputHide).val(date);
  1151.         },
  1152.  
  1153.         getCalculate:function(params){
  1154.  
  1155.  
  1156.             params.id = params.id || 0;
  1157.             params.quantity = params.quantity || 0;
  1158.             params.basket = params.basket || {};
  1159.             params.deliveryId =  params.deliveryId || 0;
  1160.             params.paySystemId =  params.paySystemId || 0;
  1161.             params.storeSityId =  params.storeSityId || 1;
  1162.             if(params.id <= 0 || params.quantity <= 0){
  1163.                 return false;
  1164.             }
  1165.             var _this = this;
  1166.  
  1167.             return _this.update({
  1168.                 id:params.id,
  1169.                 quantity:params.quantity,
  1170.                 deliveryId: params.deliveryId,
  1171.                 paySystemId: params.paySystemId,
  1172.                 storeSityId: params.storeSityId
  1173.             }, function(data){
  1174.  
  1175.             });
  1176.         },
  1177.         update:function(params, callback){
  1178.             var _app = App,
  1179.                 _this = this;
  1180.             _app.post({
  1181.                 data:{
  1182.                     handler:'basket',
  1183.                     func:'update',
  1184.                     id:params.id,
  1185.                     quantity:params.quantity,
  1186.                     checkout: "checkout",
  1187.                     getbasketHtml: true,
  1188.                     deliveryId: params.deliveryId,
  1189.                     storeSityId: params.storeSityId,
  1190.                     paySystemId: params.paySystemId
  1191.                 }
  1192.             }, function(response){
  1193.                 if(response.status != 'success'){
  1194.  
  1195.                     return $(_this.selector.popupError).modal('show');
  1196.  
  1197.                 }else {
  1198.  
  1199.                     if(response.data.basketHtml.length){
  1200.                         $(_this.selector.checkout).html(response.data.basketHtml);
  1201.                     }
  1202.                     if(response.data.textForPayPart !== null) {
  1203.                         $(".one-del.part_pay span.bold").text(response.data.basketCalcPayPart);
  1204.                     }
  1205.                     if (response.data.basketAmount < PAYPARTS_MIN_SUM){
  1206.                         $(".one-del.part_pay span.bold").addClass("err")
  1207.                     } else {
  1208.                         $(".one-del.part_pay span.bold").removeClass("err")
  1209.  
  1210.                     }
  1211.  
  1212.                     _this.devideBasket(response.data, params.storeSityId);
  1213.                 }
  1214.  
  1215.             });
  1216.         },
  1217.  
  1218.         devideBasket: function (data, id) {
  1219.             var _this = this;
  1220.  
  1221.             if(data.pickUp == false) {
  1222.                 $(document).find('.checkout_delivery option[data-id="6"]').attr('disabled', true).trigger('refresh');
  1223.  
  1224.                 if(data.changeDelivery == true){
  1225.                     // alert("РўРёРї доставки Р±СѓРґРµ змінено");
  1226.                     window.location.reload();
  1227.  
  1228.                 }
  1229.             }else {
  1230.                 $(document).find('.checkout_delivery option[data-id="6"]').attr('disabled', false).trigger('refresh');
  1231.                 $(_this.selector.selectStores).remove();
  1232.                 $("span.address").text("");
  1233.                 $("#checkout_stores_select-styler").remove();
  1234.                 if(data.showPopup == true) {
  1235.                     _this.getStoreByCityId(id);
  1236.                 }
  1237.                 $(document).find('#checkout_stores_select select').trigger('refresh');
  1238.             }
  1239.         },
  1240.  
  1241.         delete:function(params, callback){
  1242.             var _app = App,
  1243.                 _this = this;
  1244.             _app.post({
  1245.                 data:{
  1246.                     handler:'basket',
  1247.                     func:'delete',
  1248.                     id:params.id,
  1249.                     template: "checkout",
  1250.                     getbasketHtml: true,
  1251.                     deliveryId: params.deliveryId,
  1252.                     storeSityId: params.storeSityId,
  1253.                     paySystemId: params.paySystemId
  1254.                 }
  1255.             }, function(response){
  1256.                 if(response.status != 'success'){
  1257.  
  1258.                     return $(_this.selector.popupError).modal('show');
  1259.  
  1260.                 }else {
  1261.  
  1262.                     if(response.data.basketHtml.length){
  1263.                         $(_this.selector.checkout).html(response.data.basketHtml);
  1264.                     }
  1265.                     if(response.data.textForPayPart !== null) {
  1266.                         $(".one-del.part_pay span.bold").text(response.data.basketCalcPayPart);
  1267.                     }
  1268.                     if (response.data.basketAmount < PAYPARTS_MIN_SUM){
  1269.                         $(".one-del.part_pay span.bold").addClass("err")
  1270.                     } else {
  1271.                         $(".one-del.part_pay span.bold").removeClass("err")
  1272.  
  1273.                     }
  1274.  
  1275.                     _this.devideBasket(response.data, params.storeSityId);
  1276.                 }
  1277.  
  1278.             });
  1279.         },
  1280.         getStoreByCityId:function (cityId) {
  1281.             var _app = App,
  1282.                 _this = this;
  1283.             $.post(App.CheckoutWidget.ajaxHandler, {
  1284.                 func: 'getStoreByCityId',
  1285.                 cityId: cityId,
  1286.                 lang: App.CheckoutWidget.lang
  1287.             }, function(response){
  1288.                 response = JSON.parse(response);
  1289.  
  1290.                 if(response.status != 'success'){
  1291.  
  1292.                     $("#order_store_id").val("");
  1293.                     $(_this.selector.selectStores).val("");
  1294.                     var cityName = $(_this.selector.selectCity).val();
  1295.                     $('.radio-hide-select .err-text .store').html(cityName);
  1296.                     $('.radio-hide-select .err-text').show();
  1297.                     $('.modal-basket-cont-html').html(`<div class="error-msg">${response.message}</div>`);
  1298.  
  1299.                 } else {
  1300.                     $('.radio-hide-select .err-text').hide();
  1301.                     if(response.data.needDivide == true){
  1302.                         // $(".divide-popup div").remove();
  1303.                         _this.attachStoresToPage();
  1304.                         $("#checkout_stores_select").remove();
  1305.                         $(".divide-popup").html(response.data.divideHtml);
  1306.                         $(document).find('#basket_groups select').styler();
  1307.                         $(_this.selector.groupsModal).modal('show');
  1308.                     }else {
  1309.                         $('.radio-hide-select')
  1310.                             .append(`<select
  1311.                                 data-no_refresh="true"
  1312.                                 id="checkout_stores_select"
  1313.                                 name="ORDER_PROP_5"
  1314.                                 style="visibility:visible;"
  1315.                                 ></select>`
  1316.                             );
  1317.                         $select = $("select#checkout_stores_select");
  1318.                         response.data.map(function (stores) {
  1319.                             var $option = $('<option>', {
  1320.                                 text: stores.Title,
  1321.                                 value: stores.Title
  1322.                             });
  1323.                             $option.data("address", stores.Address);
  1324.                             $option.data("id", stores.xml_id);
  1325.                             $select.append($option);
  1326.                         });
  1327.                         $(document).find("select#checkout_stores_select").styler();
  1328.                         _this.setAdressAndShopId();
  1329.                         $('.all-hide-radio').show();
  1330.                     }
  1331.                 }
  1332.             });
  1333.  
  1334.         },
  1335.         getMsgForPaySystemAndDelivery:function (paySystem,delivery) {
  1336.             var _app = App,
  1337.                 _this = this;
  1338.             $.post(App.CheckoutWidget.ajaxHandler, {
  1339.                 func: 'getMsgForPaySystemAndDelivery',
  1340.                 paySystem: paySystem,
  1341.                 delivery: delivery,
  1342.                 lang: App.CheckoutWidget.lang
  1343.             }, function(response) {
  1344.                 response = JSON.parse(response);
  1345.  
  1346.                 if(response.status != 'success') {
  1347.                 }
  1348.                 else{
  1349.                     $(".message_info").text(response.data);
  1350.                 }
  1351.             });
  1352.         },
  1353.         sendToCheckLimit:function (number) {
  1354.             var _app = App,
  1355.                 _this = this;
  1356.             $.post(App.CheckoutWidget.ajaxHandler, {
  1357.                 func: 'sendToCheckLimit',
  1358.                 tel: number,
  1359.                 lang: App.CheckoutWidget.lang
  1360.             }, function(response) {
  1361.                 response = JSON.parse(response);
  1362.  
  1363.                 if(response.status != 'success') {
  1364.                 }
  1365.                 else{
  1366.                     $(".show_check_limit").hide();
  1367.                     $(".hidden_part").html("<span>Повідомлення надіслано</span>");
  1368.                 }
  1369.             });
  1370.         },
  1371.  
  1372.     }
  1373.  
  1374. })(window.App);
  1375. $(document).ready(function () {
  1376.     Checkout.init();
  1377. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement