From e095876b7edc480fc7116beced9a7ab6649eb718 Mon Sep 17 00:00:00 2001 From: dozer111 Date: Mon, 13 Aug 2018 10:41:44 +0300 Subject: [PATCH] правки по формам --- common/messages/ru/app.php | 9 ++++++++- common/messages/ua/app.php | 8 ++++++-- frontend/config/main.php | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- frontend/mail/layouts/html.php | 2 +- frontend/views/site/index.php | 20 ++++++++++++++------ frontend/web/js/script.js | 5 +++++ 6 files changed, 128 insertions(+), 20 deletions(-) diff --git a/common/messages/ru/app.php b/common/messages/ru/app.php index e36311f..c1449a4 100644 --- a/common/messages/ru/app.php +++ b/common/messages/ru/app.php @@ -6,6 +6,10 @@ return [ 'Brands' => 'Бренды', 'Free!' => 'Бесплатная', + 'Your request1' => 'Ваша заявка', + + + 'Flexible system' => 'гибкая система', @@ -14,6 +18,7 @@ return [ 'Purchase' => 'Заказать', 'dev1' => 'заводы', + 'Fill tel/name' => 'Заполните поля имя и телефон', 'Name' => 'Имя', @@ -49,7 +54,7 @@ return [ 'About Product!' => 'О товаре', 'by dev' => 'от производителя', 'Callback' => 'Обратный звонок', - + 'Set your request' => 'Оставьте вашу заявку', 'Support' => 'Помощь', @@ -81,6 +86,8 @@ return [ 'from 2004' => 'с 2004 года', 'build/montage' => 'строительно-монтажные', 'build' => 'строительные', + 'Message' => 'Сообщение', + 'Message wasn`t send' => 'Сообщение не отправлено', 'Phone' => 'Телефон', diff --git a/common/messages/ua/app.php b/common/messages/ua/app.php index 0872a45..afea675 100644 --- a/common/messages/ua/app.php +++ b/common/messages/ua/app.php @@ -10,7 +10,7 @@ return [ 'About Product' => 'ПРО ТОВАР', 'Advantages' => 'ПЕРЕВАГИ', - + 'Message wasn`t send' => 'Сообщение не отправлено', 'Brands' => 'Бренди', 'Free!' => 'Безкоштовна', @@ -94,12 +94,16 @@ return [ 'transport' => 'транспортні', 'Phone' => 'Телефон', 'Email' => 'Email', + 'Message' => 'Повiдомлення', + + 'Ukr' => 'укр', 'Packing tape' => 'Пакувальний скотч', 'success work stage' => 'успішний досвід роботи', - + 'Set your request' => 'Залиште вашу заявку', + 'Your request1' => 'Ваша заявка', 'Company Title' => 'ArtPlast', diff --git a/frontend/config/main.php b/frontend/config/main.php index 5ad2bb6..bfe55bc 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -10,8 +10,10 @@ ); $send="Отправить"; + $request1='Ваша заявка'; if(strpos($_SERVER['REQUEST_URI'],"/ua")!==false) { $send = "Вiдправити"; + } @@ -86,26 +88,28 @@ 'templateForm' => '
{form}
', 'attributes' => [ 'name', - 'email', 'phone', + 'message', ], 'rules' => [ [ - [ 'email' ], - 'email', + [ 'message' ], + 'text', ], [ [ - 'email', + 'name', 'phone', ], 'required', - ] + + ], + ], 'labels' => [ - 'email' => 'Email', + 'message' => 'Message', 'name' => 'Name', 'phone' => 'Phone' ], @@ -114,9 +118,11 @@ 'name' => [ 'template' => '
{input}
' ], - 'email' => [ - 'template' => '
{input}
' - ], + 'message' => [ + 'type' => 'textarea', + 'options' => [], + 'template' => '
{input}
' + ], 'phone' => [ 'template' => '
{input}
' ], @@ -130,7 +136,7 @@ 'subject' => 'test tt22', 'ajax' => true, 'formId' => 'contact-form', - 'scenario' => 'default', + 'scenario' => 'callback', 'successCallback' => 'function (data) { document.getElementById("contact-form").reset(); @@ -145,7 +151,85 @@ },400)}', ], + 'request_1' => [ + 'class' => 'artbox\core\forms\Module', + 'activeRecord' => "common\models\Feedback", + 'templateForm' => '
{form}
', + 'attributes' => [ + 'name', + 'phone', + 'message', + + ], + 'rules' => [ + [ + [ 'message' ], + 'text', + ], + [ + [ + + 'name', + 'phone', + ], + 'required', + + ] + ], + 'labels' => [ + 'message' => 'Message', + 'name' => 'Name', + 'phone' => 'Phone' + ], + + 'inputOptions' => [ + 'name' => [ + 'template' => '
{input}
' + ], + 'message' => [ + 'type' => 'textarea', + 'options' => [], + 'template' => '
{input}
' + ], + 'phone' => [ + 'template' => '
{input}
' + ], + + ], + 'buttonTemplate' => '
{button}
', + + 'buttonContent' => ''.$request1, + 'sendEmail' => true, + 'email' => 'alkhonko@gmail.com', + 'subject' => 'test tt22', + 'ajax' => true, + 'formId' => 'contact-form', + 'scenario' => 'callback', + 'successCallback' => 'function (data) { + document.getElementById("contact-form").reset(); + + + var pos = ($(window).scrollTop()) + 30; + + $(".forms_").animate({opacity: 0, top: "0"}, 200,function(){ + $(this).css("display", "none"); + }); + setTimeout(function () { + $("#overlay").fadeIn(400); + + if(data.status=="success"){ + $("#success_form").css("display", "block").animate({opacity: 1, top: pos}, 700); + } + else{ + $("#success_form.error_form").css("display", "block").animate({opacity: 1, top: pos}, 700); + } + + + + + },400)}', + ], diff --git a/frontend/mail/layouts/html.php b/frontend/mail/layouts/html.php index ed688a9..79053f8 100644 --- a/frontend/mail/layouts/html.php +++ b/frontend/mail/layouts/html.php @@ -2,6 +2,6 @@

Поступила новая заявка от пользователя

-

Email:

Имя:

Телефон:

+

Cообщение:

diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index 70a3154..d043aa3 100644 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -19,7 +19,7 @@ use artbox\core\models\Language; $settings = Settings::getInstance(); $module=\Yii::$app->getModule('contact'); - +$moduleRequest=\Yii::$app->getModule('request_1'); ?> @@ -348,9 +348,11 @@ $module=\Yii::$app->getModule('contact');
-
+
+ +
- renderForm($this); ?> + renderForm($this); ?>
@@ -438,14 +440,14 @@ $module=\Yii::$app->getModule('contact');
-
- renderForm($this); ?> +
+ renderForm($this); ?>
@@ -456,3 +458,9 @@ $module=\Yii::$app->getModule('contact');

+ + diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index dc77bc2..b4d596b 100644 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -251,6 +251,11 @@ $(document).ready(function() { $(this).prev("#overlay").css('display', 'none'); $(this).css({top:'50%'}); }); + $('#success_form.error_form').animate({opacity: 0, top: '0'}, 200,function(){ + $(this).css('display', 'none'); + $(this).prev("#overlay").css('display', 'none'); + $(this).css({top:'50%'}); + }); }); } //после удачной отправки формы запускать success() -- libgit2 0.21.4