Commit 87f1520d233b1f8d5a7aae0a92fcdc34d491bb68
1 parent
36d39dfa
mailing
Showing
5 changed files
with
54 additions
and
40 deletions
Show diff stats
common/config/.gitignore
common/config/main.php
| @@ -58,8 +58,8 @@ | @@ -58,8 +58,8 @@ | ||
| 58 | 'transport' => [ | 58 | 'transport' => [ |
| 59 | 'class' => 'Swift_SmtpTransport', | 59 | 'class' => 'Swift_SmtpTransport', |
| 60 | 'host' => 'smtp.gmail.com', | 60 | 'host' => 'smtp.gmail.com', |
| 61 | - 'username' => 'kbenergy.kiev@gmail.com', | ||
| 62 | - 'password' => '', | 61 | + 'username' => 'clud.net.mails@gmail.com', |
| 62 | + 'password' => 'a3E6yNb9KUtF', | ||
| 63 | 'port' => '587', | 63 | 'port' => '587', |
| 64 | 'encryption' => 'tls', | 64 | 'encryption' => 'tls', |
| 65 | ], | 65 | ], |
frontend/assets/AppAsset.php
| @@ -12,9 +12,8 @@ | @@ -12,9 +12,8 @@ | ||
| 12 | public $basePath = '@webroot'; | 12 | public $basePath = '@webroot'; |
| 13 | public $baseUrl = '@web'; | 13 | public $baseUrl = '@web'; |
| 14 | public $css = [ | 14 | public $css = [ |
| 15 | - 'css/site.css', | 15 | +// 'css/site.css', |
| 16 | 'css/animate.css', | 16 | 'css/animate.css', |
| 17 | - //'css/style.css', | ||
| 18 | 'css/style.blue.kb.css', | 17 | 'css/style.blue.kb.css', |
| 19 | 'css/owl.carousel.css', | 18 | 'css/owl.carousel.css', |
| 20 | 'css/owl.theme.css', | 19 | 'css/owl.theme.css', |
| @@ -34,7 +33,7 @@ | @@ -34,7 +33,7 @@ | ||
| 34 | 'js/photoswipe.min.js', | 33 | 'js/photoswipe.min.js', |
| 35 | 'js/photoswipe-ui-default.min.js', | 34 | 'js/photoswipe-ui-default.min.js', |
| 36 | 'js/script.js', | 35 | 'js/script.js', |
| 37 | - '//maps.googleapis.com/maps/api/js?key=AIzaSyCoR1Jb-mIFUjPwKiuSlmtYBEwnJOBnAgg&callback=initMap', | 36 | +// '//maps.googleapis.com/maps/api/js?key=AIzaSyCoR1Jb-mIFUjPwKiuSlmtYBEwnJOBnAgg&callback=initMap', |
| 38 | 'js/gmaps.init.js', | 37 | 'js/gmaps.init.js', |
| 39 | ]; | 38 | ]; |
| 40 | public $depends = [ | 39 | public $depends = [ |
frontend/controllers/SiteController.php
| @@ -101,26 +101,40 @@ | @@ -101,26 +101,40 @@ | ||
| 101 | public function actionFeedback() | 101 | public function actionFeedback() |
| 102 | { | 102 | { |
| 103 | Yii::$app->response->format = Response::FORMAT_JSON; | 103 | Yii::$app->response->format = Response::FORMAT_JSON; |
| 104 | - if (empty( Yii::$app->request->post() )) { | 104 | + if (empty(Yii::$app->request->post())) { |
| 105 | throw new BadRequestHttpException(); | 105 | throw new BadRequestHttpException(); |
| 106 | } else { | 106 | } else { |
| 107 | $model = new Feedback(); | 107 | $model = new Feedback(); |
| 108 | if ($model->load(Yii::$app->request->post()) && $model->save()) { | 108 | if ($model->load(Yii::$app->request->post()) && $model->save()) { |
| 109 | - Yii::$app->mailer->compose('feedback.php', ['model' => $model]) | ||
| 110 | - ->setFrom('zhegal@gmail.com') | ||
| 111 | - ->setTo($model->email) | ||
| 112 | - ->setSubject($model->title) | ||
| 113 | - ->send(); | ||
| 114 | - return [ | ||
| 115 | - 'success' => true, | ||
| 116 | - 'message' => 'Success message', | ||
| 117 | - 'alert' => '<div class="alert alert-success"> | ||
| 118 | - <h3>Success</h3> | ||
| 119 | - <p> | ||
| 120 | - Success text | ||
| 121 | - </p> | ||
| 122 | - </div>', | ||
| 123 | - ]; | 109 | + $settings = Settings::getInstance(); |
| 110 | + | ||
| 111 | + $mailer = Yii::$app->mailer->compose( | ||
| 112 | + 'feedback.php', | ||
| 113 | + [ 'model' => $model ] | ||
| 114 | + ) | ||
| 115 | + ->setFrom('clud.net.mails@gmail.com') | ||
| 116 | + ->setTo([$settings->email]) | ||
| 117 | + ->setSubject($model->title); | ||
| 118 | + | ||
| 119 | + if ( $mailer->send() ){ | ||
| 120 | + return [ | ||
| 121 | + 'success' => true, | ||
| 122 | + 'message' => 'Success message', | ||
| 123 | + 'alert' => '<div class="alert alert-success"> | ||
| 124 | + <h3>Success</h3> | ||
| 125 | + <p> | ||
| 126 | + Success text | ||
| 127 | + </p> | ||
| 128 | + </div>', | ||
| 129 | + ]; | ||
| 130 | + } | ||
| 131 | + else{ | ||
| 132 | + return [ | ||
| 133 | + 'success' => false, | ||
| 134 | + 'error' => 'mail->send() didn\'t send email', | ||
| 135 | + ]; | ||
| 136 | + } | ||
| 137 | + | ||
| 124 | } else { | 138 | } else { |
| 125 | return [ | 139 | return [ |
| 126 | 'success' => false, | 140 | 'success' => false, |
frontend/views/layouts/main.php
| @@ -93,8 +93,9 @@ _________________________________________________________ --> | @@ -93,8 +93,9 @@ _________________________________________________________ --> | ||
| 93 | <p class="hidden-sm hidden-xs"> | 93 | <p class="hidden-sm hidden-xs"> |
| 94 | <?php | 94 | <?php |
| 95 | if (!empty($settings->phone)) { | 95 | if (!empty($settings->phone)) { |
| 96 | + $phone = str_replace(" ", "", $settings->phone); | ||
| 96 | echo \Yii::t('app', 'Зв\'яжіться з нами по тел. '); | 97 | echo \Yii::t('app', 'Зв\'яжіться з нами по тел. '); |
| 97 | - echo Html::a($settings->phone, "tel: {$settings->phone}"); | 98 | + echo Html::a($settings->phone, "tel:{$phone}"); |
| 98 | if (!empty($settings->email)) { | 99 | if (!empty($settings->email)) { |
| 99 | echo \Yii::t('app', ' або '); | 100 | echo \Yii::t('app', ' або '); |
| 100 | echo Html::a($settings->email, "mailto:$settings->email"); | 101 | echo Html::a($settings->email, "mailto:$settings->email"); |
| @@ -366,7 +367,7 @@ _________________________________________________________ --> | @@ -366,7 +367,7 @@ _________________________________________________________ --> | ||
| 366 | 367 | ||
| 367 | <div class="modal-content"> | 368 | <div class="modal-content"> |
| 368 | <div class="modal-header"> | 369 | <div class="modal-header"> |
| 369 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | 370 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
| 370 | <h3 class="modal-title" id="Login">Зворотній зв'язок</h3> | 371 | <h3 class="modal-title" id="Login">Зворотній зв'язок</h3> |
| 371 | </div> | 372 | </div> |
| 372 | <div class="modal-body"> | 373 | <div class="modal-body"> |
| @@ -398,16 +399,16 @@ _________________________________________________________ --> | @@ -398,16 +399,16 @@ _________________________________________________________ --> | ||
| 398 | ] | 399 | ] |
| 399 | ); ?> | 400 | ); ?> |
| 400 | 401 | ||
| 401 | - <p class="text-center"> | ||
| 402 | - <?= Html::submitButton( | ||
| 403 | - 'Надіслати', | ||
| 404 | - [ | ||
| 405 | - 'class' => 'send-form btn btn-lg btn-template-primary button-consultation', | ||
| 406 | - 'onclick' => "ga('send', 'event', 'button-consultation.cec', 'send')", | ||
| 407 | - ] | ||
| 408 | - ) ?> | ||
| 409 | - </p> | ||
| 410 | - <p class="text-center"> | 402 | + <p class="text-center"> |
| 403 | + <?= Html::submitButton( | ||
| 404 | + 'Надіслати', | ||
| 405 | + [ | ||
| 406 | + 'class' => 'send-form btn btn-lg btn-template-primary button-consultation', | ||
| 407 | + 'onclick' => "ga('send', 'event', 'button-consultation.cec', 'send')", | ||
| 408 | + ] | ||
| 409 | + ) ?> | ||
| 410 | + </p> | ||
| 411 | + <p class="text-center"> | ||
| 411 | <?= Html::submitButton( | 412 | <?= Html::submitButton( |
| 412 | 'Надіслати', | 413 | 'Надіслати', |
| 413 | [ | 414 | [ |
| @@ -415,8 +416,8 @@ _________________________________________________________ --> | @@ -415,8 +416,8 @@ _________________________________________________________ --> | ||
| 415 | 'onclick' => "ga('send', 'event', 'button-сalculate the cost.cec', 'send')", | 416 | 'onclick' => "ga('send', 'event', 'button-сalculate the cost.cec', 'send')", |
| 416 | ] | 417 | ] |
| 417 | ) ?> | 418 | ) ?> |
| 418 | - </p> | ||
| 419 | - <p class="text-center"> | 419 | + </p> |
| 420 | + <p class="text-center"> | ||
| 420 | <?= Html::submitButton( | 421 | <?= Html::submitButton( |
| 421 | 'Надіслати', | 422 | 'Надіслати', |
| 422 | [ | 423 | [ |
| @@ -424,7 +425,7 @@ _________________________________________________________ --> | @@ -424,7 +425,7 @@ _________________________________________________________ --> | ||
| 424 | 'onclick' => "ga('send', 'event', 'button-order station.cec', 'send')", | 425 | 'onclick' => "ga('send', 'event', 'button-order station.cec', 'send')", |
| 425 | ] | 426 | ] |
| 426 | ) ?> | 427 | ) ?> |
| 427 | - </p> | 428 | + </p> |
| 428 | 429 | ||
| 429 | <?php ActiveForm::end(); ?> | 430 | <?php ActiveForm::end(); ?> |
| 430 | 431 | ||
| @@ -443,12 +444,12 @@ _________________________________________________________ --> | @@ -443,12 +444,12 @@ _________________________________________________________ --> | ||
| 443 | 444 | ||
| 444 | <div class="modal-content"> | 445 | <div class="modal-content"> |
| 445 | <div class="modal-header"> | 446 | <div class="modal-header"> |
| 446 | - <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
| 447 | - <h3 class="modal-title" id="Success">Success</h3> | 447 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> |
| 448 | + <h3 class="modal-title" id="Success">Спасибо за заявку</h3> | ||
| 448 | </div> | 449 | </div> |
| 449 | <div class="modal-body"> | 450 | <div class="modal-body"> |
| 450 | 451 | ||
| 451 | - <p>Thank for your reply, we will call you, maybe.</p> | 452 | + <p>Мы свяжемся с вами в ближайшее время</p> |
| 452 | <p class="text-center"> | 453 | <p class="text-center"> |
| 453 | <button type="button" class="btn btn-template-primary" data-dismiss="modal">Close</button> | 454 | <button type="button" class="btn btn-template-primary" data-dismiss="modal">Close</button> |
| 454 | </p> | 455 | </p> |