diff --git a/front/js/components/order.es6 b/front/js/components/order.es6 index 92a0da7c..6e732098 100644 --- a/front/js/components/order.es6 +++ b/front/js/components/order.es6 @@ -1,7 +1,8 @@ (() => { const DOM = { $fancybox: $('.fancybox'), - $formErrorText: $('.js-form-error-text'), + $contactsError: $('.js-contacts-error'), + $privacyPolicyError: $('.js-privacy-policy-error'), $order: $('.js-order-contain'), yandexFormWrapper: '#yandex-form-wrapper', yandexForm: '#yandex-form', @@ -13,6 +14,7 @@ paymentOptions: 'input[name=payment_type]', defaultPaymentOptions: 'input[for=id_payment_type_0]', orderFieldData: $('#order-form-full').data('fields'), + privacyCheckbox: '.js-privacy-checkbox', }; const config = { @@ -161,14 +163,19 @@ return orderInfo; }; - /** - * Return true if form has valid phone & email. - */ - function isValid(customerInfo) { + function isContactsValid(customerInfo) { return helpers.isPhoneValid(customerInfo.phone) && helpers.isEmailValid(customerInfo.email); } + function isPrivacyPolicyAccepted() { + return $(DOM.privacyCheckbox).is(':checked'); + } + + function showFormError($error) { + $error.removeClass('hidden').addClass('shake animated'); + } + function renderYandexForm(formData) { const formHtml = `