Commit 7754a925b9c9e48706e1813e626c2589fe7477a1
1 parent
f1a1680e
Отправка сообщений (1)
Showing
9 changed files
with
110 additions
and
28 deletions
Show diff stats
common/config/main.php
... | ... | @@ -52,5 +52,17 @@ |
52 | 52 | 'useFilename' => true, |
53 | 53 | 'absoluteUrl' => false, |
54 | 54 | ], |
55 | + 'mailer' => [ | |
56 | + 'class' => 'yii\swiftmailer\Mailer', | |
57 | + 'viewPath'=>'@common/mail', | |
58 | + 'transport' => [ | |
59 | + 'class' => 'Swift_SmtpTransport', | |
60 | + 'host' => 'smtp.gmail.com', | |
61 | + 'username' => 'kbenergy.kiev@gmail.com', | |
62 | + 'password' => '', | |
63 | + 'port' => '587', | |
64 | + 'encryption' => 'tls', | |
65 | + ], | |
66 | + ], | |
55 | 67 | ], |
56 | 68 | ]; | ... | ... |
common/config/settings.php
1 | +<?php | |
2 | + | |
3 | +/** | |
4 | + * @var \common\models\Feedback $model | |
5 | + */ | |
6 | + | |
7 | +?> | |
8 | + | |
9 | +<table> | |
10 | + <tr> | |
11 | + <td colspan="2"><?php echo $model->title; ?></td> | |
12 | + </tr> | |
13 | + <tr> | |
14 | + <td><hr/></td> | |
15 | + </tr> | |
16 | + <tr> | |
17 | + <td><b>Имя: </b></td> | |
18 | + <td><?php echo $model->name; ?></td> | |
19 | + </tr> | |
20 | + <tr> | |
21 | + <td><b>Email: </b></td> | |
22 | + <td><?php echo $model->email; ?></td> | |
23 | + </tr> | |
24 | + <tr> | |
25 | + <td><b>Телефон: </b></td> | |
26 | + <td><?php echo $model->phone; ?></td> | |
27 | + </tr> | |
28 | + <tr> | |
29 | + <td><b>Текст сообщения: </b></td> | |
30 | + <td><?php echo $model->message; ?></td> | |
31 | + </tr> | |
32 | +</table> | ... | ... |
common/models/Feedback.php
frontend/controllers/SiteController.php
1 | 1 | <?php |
2 | 2 | namespace frontend\controllers; |
3 | - | |
4 | - use artbox\core\models\Feedback; | |
3 | + | |
4 | + use common\models\Feedback; | |
5 | 5 | use common\models\Settings; |
6 | 6 | use Yii; |
7 | 7 | use yii\web\BadRequestHttpException; |
... | ... | @@ -106,6 +106,11 @@ |
106 | 106 | } else { |
107 | 107 | $model = new Feedback(); |
108 | 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(); | |
109 | 114 | return [ |
110 | 115 | 'success' => true, |
111 | 116 | 'message' => 'Success message', | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -306,19 +306,19 @@ _________________________________________________________ --> |
306 | 306 | 'items' => [ |
307 | 307 | [ |
308 | 308 | 'label' => \Yii::t('app', 'Чому ми'), |
309 | - 'url' => [ '#section1' ], | |
309 | + 'url' => [ '../#section1' ], | |
310 | 310 | ], |
311 | 311 | [ |
312 | 312 | 'label' => \Yii::t('app', 'Наші проекти'), |
313 | - 'url' => [ '#section2' ], | |
313 | + 'url' => [ '../#section2' ], | |
314 | 314 | ], |
315 | 315 | [ |
316 | 316 | 'label' => \Yii::t('app', '10 кроків до енергонезалежності'), |
317 | - 'url' => [ '#section3' ], | |
317 | + 'url' => [ '../#section3' ], | |
318 | 318 | ], |
319 | 319 | [ |
320 | 320 | 'label' => \Yii::t('app', 'Контакти'), |
321 | - 'url' => [ '#section4' ], | |
321 | + 'url' => [ '../#section4' ], | |
322 | 322 | ], |
323 | 323 | ], |
324 | 324 | 'options' => [ |
... | ... | @@ -379,6 +379,9 @@ _________________________________________________________ --> |
379 | 379 | ] |
380 | 380 | ); ?> |
381 | 381 | |
382 | + <?= $form->field($feedback, 'title') | |
383 | + ->hiddenInput(); ?> | |
384 | + | |
382 | 385 | <?= $form->field($feedback, 'name') |
383 | 386 | ->textInput(); ?> |
384 | 387 | |
... | ... | @@ -479,7 +482,7 @@ _________________________________________________________ --> |
479 | 482 | <?php |
480 | 483 | } |
481 | 484 | ?> |
482 | - <a href="#" class="btn btn-template-transparent-primary" data-toggle="modal" data-target="#feedback-modal">Напишіть нам</a> | |
485 | + <a href="#" class="btn btn-template-transparent-primary modaled" data-title="Зворотній зв'язок" data-toggle="modal" data-target="#feedback-modal">Напишіть нам</a> | |
483 | 486 | </div> |
484 | 487 | |
485 | 488 | <div class="col-md-4 col-sm-12 col-md-offset-2"> | ... | ... |
frontend/views/site/index.php
... | ... | @@ -202,15 +202,15 @@ $this->registerJs($js, View::POS_END); |
202 | 202 | </div> |
203 | 203 | </div> |
204 | 204 | <div class="head_video_buttons"> |
205 | - <a href="#" class="btn button1 icon_phone" data-toggle="modal" data-target="#feedback-modal" style="width: 200px;">Замовити <span>консультацію</span></a> | |
206 | - <a href="#" class="btn button2 right" data-toggle="modal" data-target="#feedback-modal">Розрахувати <span>вартість проекту</span></a> | |
205 | + <a href="#" class="btn button1 icon_phone modaled" data-title="Замовити консультацію" data-toggle="modal" data-target="#feedback-modal" style="width: 200px;">Замовити <span>консультацію</span></a> | |
206 | + <a href="#" class="btn button2 right modaled" data-title="Розрахувати вартість проекту" data-toggle="modal" data-target="#feedback-modal">Розрахувати <span>вартість проекту</span></a> | |
207 | 207 | </div> |
208 | 208 | </div> |
209 | 209 | </div> |
210 | 210 | </div> |
211 | 211 | </section> |
212 | 212 | |
213 | -<section class="bar background-kben block-why"> | |
213 | +<section class="bar background-kben block-why" id="section1"> | |
214 | 214 | <div class="container"> |
215 | 215 | <div class="col-md-12"> |
216 | 216 | <div class="heading text-left"><h2>Чому ми</h2></div> |
... | ... | @@ -242,7 +242,7 @@ $this->registerJs($js, View::POS_END); |
242 | 242 | <div class="box-simple"> |
243 | 243 | <div class="icon icon_why" id="icon04"></div> |
244 | 244 | <h3>Енергоаудит</h3> |
245 | - <p>перед встановленням ми робимо повний аналіз вашої домашньої енергосистеми</p> | |
245 | + <p>перед встановленням ми робимо повний аналіз вашої енергосистеми</p> | |
246 | 246 | </div> |
247 | 247 | </div> |
248 | 248 | <div class="col-md-4"> |
... | ... | @@ -255,14 +255,14 @@ $this->registerJs($js, View::POS_END); |
255 | 255 | </div> |
256 | 256 | <div class="row"> |
257 | 257 | <div class="col-md-12" style="text-align:center;"> |
258 | - <a href="#" class="btn button1 icon_phone" data-toggle="modal" data-target="#feedback-modal">Замовити <span>консультацію</span></a> | |
258 | + <a href="#" class="btn button1 icon_phone modaled" data-title="Замовити консультацію" data-toggle="modal" data-target="#feedback-modal">Замовити <span>консультацію</span></a> | |
259 | 259 | </div> |
260 | 260 | </div> |
261 | 261 | </div> |
262 | 262 | </div> |
263 | 263 | </section> |
264 | 264 | |
265 | -<section class="bar background-white"> | |
265 | +<section class="bar background-white" id="section2"> | |
266 | 266 | <div class="container"> |
267 | 267 | <div class="col-md-12"> |
268 | 268 | <div class="heading text-left"> |
... | ... | @@ -289,23 +289,23 @@ $this->registerJs($js, View::POS_END); |
289 | 289 | </div> |
290 | 290 | <div class="col-md-4"> |
291 | 291 | <div class="col-md-12 row project-right"> |
292 | - <a href="#" class="open_gal" id="gal01"> | |
293 | - <p class="pr_title">Освітлення Харківського шосе</p> | |
294 | - <div class="pr_cover"><img src="../img/pic02.jpg"></div> | |
292 | + <a href="#" class="open_gal" id="gal02"> | |
293 | + <p class="pr_title">Металоконструкція. Власне виробництво</p> | |
294 | + <div class="pr_cover"><img src="../img/pic01.jpg"></div> | |
295 | 295 | </a> |
296 | 296 | <div class="buttons text-right row"> |
297 | - <a href="#" class="open_gal sqre_btn blue_arrow" id="gal01"></a> | |
298 | - <a href="#" class="btn sqre_btn yellow_calc" data-toggle="modal" data-target="#feedback-modal"></a> | |
297 | + <a href="#" class="open_gal sqre_btn blue_arrow" id="gal02"></a> | |
298 | + <a href="#" class="btn sqre_btn yellow_calc modaled" data-title="Металоконструкція. Розрахувати вартість проекту" data-toggle="modal" data-target="#feedback-modal"></a> | |
299 | 299 | </div> |
300 | 300 | </div> |
301 | 301 | <div class="col-md-12 row project-right"> |
302 | - <a href="#" class="open_gal" id="gal02"> | |
303 | - <p class="pr_title">Металоконструкція. Власне виробництво</p> | |
304 | - <div class="pr_cover"><img src="../img/pic01.jpg"></div> | |
302 | + <a href="#" class="open_gal" id="gal01"> | |
303 | + <p class="pr_title">Освітлення Харківського шосе</p> | |
304 | + <div class="pr_cover"><img src="../img/pic02.jpg"></div> | |
305 | 305 | </a> |
306 | 306 | <div class="buttons text-right row"> |
307 | - <a href="#" class="open_gal sqre_btn blue_arrow" id="gal02"></a> | |
308 | - <a href="#" class="btn sqre_btn yellow_calc" data-toggle="modal" data-target="#feedback-modal"></a> | |
307 | + <a href="#" class="open_gal sqre_btn blue_arrow" id="gal01"></a> | |
308 | + <a href="#" class="btn sqre_btn yellow_calc modaled" data-title="Освітлення Харківського шосе. Розрахувати вартість проекту" data-toggle="modal" data-target="#feedback-modal"></a> | |
309 | 309 | </div> |
310 | 310 | </div> |
311 | 311 | <div class="col-md-12 row project-right"> |
... | ... | @@ -316,7 +316,7 @@ $this->registerJs($js, View::POS_END); |
316 | 316 | </a> |
317 | 317 | <div class="buttons text-right row"> |
318 | 318 | <a href="#" class="open_gal sqre_btn blue_arrow" id="gal03"></a> |
319 | - <a href="#" class="btn sqre_btn yellow_calc" data-toggle="modal" data-target="#feedback-modal"></a> | |
319 | + <a href="#" class="btn sqre_btn yellow_calc modaled" data-title="Укртрансгаз. Розрахувати вартість проекту" data-toggle="modal" data-target="#feedback-modal"></a> | |
320 | 320 | </div> |
321 | 321 | </div> |
322 | 322 | </div> |
... | ... | @@ -325,7 +325,7 @@ $this->registerJs($js, View::POS_END); |
325 | 325 | </div> |
326 | 326 | </section> |
327 | 327 | |
328 | -<section class="bar background-kben no-mb"> | |
328 | +<section class="bar background-kben no-mb" id="section3"> | |
329 | 329 | <div class="container"> |
330 | 330 | <div class="row showcase"> |
331 | 331 | <div class="col-md-3 col-sm-6"> |
... | ... | @@ -362,7 +362,7 @@ $this->registerJs($js, View::POS_END); |
362 | 362 | <!-- /.container --> |
363 | 363 | </section> |
364 | 364 | |
365 | -<section class="bar background-white"> | |
365 | +<section class="bar background-white" id="section4"> | |
366 | 366 | <div class="container"> |
367 | 367 | <div class="col-md-12"> |
368 | 368 | <div class="heading text-left"> |
... | ... | @@ -455,7 +455,7 @@ $this->registerJs($js, View::POS_END); |
455 | 455 | <p class="text-center">Або звернутись до нас та</p> |
456 | 456 | </div> |
457 | 457 | <div class="col-md-12" style="text-align:center;"> |
458 | - <a href="#" class="btn button1 icon_stat" data-toggle="modal" data-target="#feedback-modal">Замовити <span>електростанцію</span></a> | |
458 | + <a href="#" class="btn button1 icon_stat modaled" data-title="Замовити електростанцію" data-toggle="modal" data-target="#feedback-modal">Замовити <span>електростанцію</span></a> | |
459 | 459 | </div> |
460 | 460 | </div> |
461 | 461 | </div> | ... | ... |
frontend/web/css/style.css
... | ... | @@ -167,4 +167,10 @@ a.sqre_btn { |
167 | 167 | display: inline-block; |
168 | 168 | position: relative; |
169 | 169 | width: 100%; |
170 | +} | |
171 | +.field-feedback-title{display:none!important;} | |
172 | +#footer { | |
173 | + background: #0080ca; | |
174 | + padding: 50px 0; | |
175 | + color: #ffffff; | |
170 | 176 | } |
171 | 177 | \ No newline at end of file | ... | ... |
frontend/web/js/script.js
... | ... | @@ -178,6 +178,24 @@ $( |
178 | 178 | w: 960, |
179 | 179 | h: 535, |
180 | 180 | title: 'Нами розроблена металоконструкція для встановлення сонячних панелей для наземних сонячних електростанцій, яка може застосовуватися як для промислових об\'єктів так і для приватних домоволодінь.', |
181 | + }, | |
182 | + { | |
183 | + src: '../img/galpics/15.jpg', | |
184 | + w: 1398, | |
185 | + h: 790, | |
186 | + title: 'Нами розроблена металоконструкція для встановлення сонячних панелей для наземних сонячних електростанцій, яка може застосовуватися як для промислових об\'єктів так і для приватних домоволодінь.', | |
187 | + }, | |
188 | + { | |
189 | + src: '../img/galpics/16.jpg', | |
190 | + w: 1054, | |
191 | + h: 790, | |
192 | + title: 'Нами розроблена металоконструкція для встановлення сонячних панелей для наземних сонячних електростанцій, яка може застосовуватися як для промислових об\'єктів так і для приватних домоволодінь.', | |
193 | + }, | |
194 | + { | |
195 | + src: '../img/galpics/17.jpg', | |
196 | + w: 1054, | |
197 | + h: 790, | |
198 | + title: 'Нами розроблена металоконструкція для встановлення сонячних панелей для наземних сонячних електростанцій, яка може застосовуватися як для промислових об\'єктів так і для приватних домоволодінь.', | |
181 | 199 | } |
182 | 200 | ]; |
183 | 201 | |
... | ... | @@ -233,5 +251,10 @@ $( |
233 | 251 | return false; |
234 | 252 | }); |
235 | 253 | |
254 | + | |
255 | + $(".modaled").on('click', function(){ | |
256 | + $(".modal-title#Login").text($(this).data('title')); | |
257 | + $(".field-feedback-title #feedback-title").val($(this).data('title')); | |
258 | + }); | |
236 | 259 | } |
237 | 260 | ); |
238 | 261 | \ No newline at end of file | ... | ... |