From ad9ed0fb003ecf37065240d6c69471d3ac40e181 Mon Sep 17 00:00:00 2001 From: Andrei Date: Wed, 18 Jun 2025 11:32:56 +0300 Subject: [PATCH] =?UTF-8?q?Andrei=20|=20=D1=84=D0=B8=D0=BA=D1=81=20=D0=BA?= =?UTF-8?q?=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0=20(=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=B0=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20?= =?UTF-8?q?=D1=81=D0=BE=D0=BE=D0=B1=D1=89=D0=B8=D1=82=D1=8C=20=D0=BE=20?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D0=B8=D1=87=D0=B8=D0=B8=20=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=20=D0=B2=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cosmopet/modules/forms/assets/js/form.js | 24 ++++++++++ .../modules/forms/module-ajax-controller.php | 11 +++++ .../layout/assets/css/gp-style-core.css | 2 +- .../modules/layout/module-controller.php | 1 + .../cosmopet/modules/popup/assets/js/modal.js | 8 +++- .../themes/cosmopet/templates/modal.twig | 47 +----------------- .../cosmopet/templates/modal/to_know.twig | 48 +++++++++++++++++++ .../woocommerce/assets/css/gp-style-core.css | 5 +- 8 files changed, 94 insertions(+), 52 deletions(-) create mode 100644 wp-content/themes/cosmopet/templates/modal/to_know.twig diff --git a/wp-content/themes/cosmopet/modules/forms/assets/js/form.js b/wp-content/themes/cosmopet/modules/forms/assets/js/form.js index 8fa3faf..ffcb297 100644 --- a/wp-content/themes/cosmopet/modules/forms/assets/js/form.js +++ b/wp-content/themes/cosmopet/modules/forms/assets/js/form.js @@ -73,6 +73,28 @@ jQuery(document).ready(function($) { }); } }); + + $('.modal__form-sub').on('submit', function (e) { + e.preventDefault(); + var email = $(this).find('input[name="email"]').val() + var data = $(this).serialize() + $.ajax({ + type: 'post', + url: woocommerce_params.ajax_url, + data: data, + beforeSend: function (response) { + + }, + complete: function (response) { + $('.modal__to-know').removeClass('active') + $('#sub-result-email').html(email) + $('.modal__to-know-submit').addClass('active').css('filter', 'blur(0px)') + }, + success: function (response) { + + }, + }); + }); }); const metaLocale = document.querySelector('meta[property="og:locale"]'); @@ -141,3 +163,5 @@ const localeValue = metaLocale.getAttribute('content'); errorMessage.remove(); }); } + + diff --git a/wp-content/themes/cosmopet/modules/forms/module-ajax-controller.php b/wp-content/themes/cosmopet/modules/forms/module-ajax-controller.php index 445e0bd..dba0f27 100644 --- a/wp-content/themes/cosmopet/modules/forms/module-ajax-controller.php +++ b/wp-content/themes/cosmopet/modules/forms/module-ajax-controller.php @@ -23,6 +23,17 @@ add_action('wp_ajax_nopriv_subscribe_form', function() { }); +add_action('wp_ajax_to_know_form', function() { + $enabledHandlers = ['b24']; + process_form($enabledHandlers); +}); + +add_action('wp_ajax_nopriv_to_know_form', function() { + $enabledHandlers = ['b24']; + process_form($enabledHandlers); +}); + + function process_form($enabledHandlers) { $formData = $_POST['formData']; $handler = FormHandlerFactory::getHandler($enabledHandlers); diff --git a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css index a6d7943..189d7f4 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css +++ b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css @@ -1352,7 +1352,7 @@ textarea{ .checkbox.active .checkbox__state{ background-color: var(--background-black); - background-image: url(../img/svg/main/arrow-selected-white.svg); + background-image: url(../../../../static/img/svg/main/arrow-selected-white.svg); background-repeat: no-repeat; background-position: center; } diff --git a/wp-content/themes/cosmopet/modules/layout/module-controller.php b/wp-content/themes/cosmopet/modules/layout/module-controller.php index c41f59c..3fb597f 100644 --- a/wp-content/themes/cosmopet/modules/layout/module-controller.php +++ b/wp-content/themes/cosmopet/modules/layout/module-controller.php @@ -10,4 +10,5 @@ include_module('header'); include_component('shop', 'cart'); include_module('shop'); include_module('popup'); +include_module('forms'); include_module('footer'); diff --git a/wp-content/themes/cosmopet/modules/popup/assets/js/modal.js b/wp-content/themes/cosmopet/modules/popup/assets/js/modal.js index 78b2cde..22f6343 100644 --- a/wp-content/themes/cosmopet/modules/popup/assets/js/modal.js +++ b/wp-content/themes/cosmopet/modules/popup/assets/js/modal.js @@ -92,5 +92,9 @@ window.addEventListener('resize', () => { modalOpen('.basket-open', '.modal__basket'); modalOpen('.open-to-know', '.modal__to-know'); modalOpen('.login-open', '.modal__login'); - modalClose('.modal__close'); -}); \ No newline at end of file + modalClose('.modal__close, .m__close'); +}); + +jQuery('[data-pname]').on('click', function(){ + jQuery('#sub_product_name').val(jQuery(this).data('pname')) +}) \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/modal.twig b/wp-content/themes/cosmopet/templates/modal.twig index b1dd851..c924119 100644 --- a/wp-content/themes/cosmopet/templates/modal.twig +++ b/wp-content/themes/cosmopet/templates/modal.twig @@ -16,52 +16,7 @@ {% include 'modal/basket.twig' %} - - - + {% include 'modal/to_know.twig' %} {% include 'modal/login.twig' %} diff --git a/wp-content/themes/cosmopet/templates/modal/to_know.twig b/wp-content/themes/cosmopet/templates/modal/to_know.twig new file mode 100644 index 0000000..85b356c --- /dev/null +++ b/wp-content/themes/cosmopet/templates/modal/to_know.twig @@ -0,0 +1,48 @@ + + + \ No newline at end of file diff --git a/wp-content/themes/cosmopet/woocommerce/assets/css/gp-style-core.css b/wp-content/themes/cosmopet/woocommerce/assets/css/gp-style-core.css index b0ea991..0118d9f 100644 --- a/wp-content/themes/cosmopet/woocommerce/assets/css/gp-style-core.css +++ b/wp-content/themes/cosmopet/woocommerce/assets/css/gp-style-core.css @@ -876,8 +876,7 @@ button{ width: 16px; aspect-ratio: 1; - - background-image: url(../img/svg/main/arrow-selected-white.svg); + background-image: url(../../static/img/svg/main/arrow-selected-white.svg); background-repeat: no-repeat; background-position: center; } @@ -1258,7 +1257,7 @@ button{ .wpfFilterContent ul li input[type="checkbox"]:checked { background-color: var(--background-black); - background-image: url(../img/svg/main/arrow-selected-white.svg); + background-image: url(../../static/img/svg/main/arrow-selected-white.svg); background-repeat: no-repeat; background-position: center; }