Commit c4d8db85d30753cebf32a1ece33cb536ac867934
Merge remote-tracking branch 'origin/master'
Showing
9 changed files
with
224 additions
and
116 deletions
Show diff stats
common/mail/feedback.php
1 | <?php | 1 | <?php |
2 | - use artbox\core\models\Feedback; | 2 | + use common\models\Feedback; |
3 | use yii\web\View; | 3 | use yii\web\View; |
4 | 4 | ||
5 | /** | 5 | /** |
@@ -10,22 +10,26 @@ | @@ -10,22 +10,26 @@ | ||
10 | ?> | 10 | ?> |
11 | 11 | ||
12 | <table> | 12 | <table> |
13 | - <tbody> | ||
14 | - <tr> | ||
15 | - <td><b><?= \Yii::t('app', 'Name: ') ?></b></td> | ||
16 | - <td><?= $model->name ?></td> | ||
17 | - </tr> | ||
18 | - <tr> | ||
19 | - <td><b><?= \Yii::t('app', 'Phone: ') ?></b></td> | ||
20 | - <td><?= $model->phone ?></td> | ||
21 | - </tr> | ||
22 | - <tr> | ||
23 | - <td><b><?= \Yii::t('app', 'Email: ') ?></b></td> | ||
24 | - <td><?= $model->email ?></td> | ||
25 | - </tr> | ||
26 | - <tr> | ||
27 | - <td><b><?= \Yii::t('app', 'Message: ') ?></b></td> | ||
28 | - <td><?= $model->message ?></td> | ||
29 | - </tr> | ||
30 | - </tbody> | 13 | + <tbody> |
14 | + <tr> | ||
15 | + <td><b><?= \Yii::t('app', 'Name: ') ?></b></td> | ||
16 | + <td><?= $model->name ?></td> | ||
17 | + </tr> | ||
18 | + <tr> | ||
19 | + <td><b><?= \Yii::t('app', 'Topic: ') ?></b></td> | ||
20 | + <td><?= $model->topic ?></td> | ||
21 | + </tr> | ||
22 | + <tr> | ||
23 | + <td><b><?= \Yii::t('app', 'Phone: ') ?></b></td> | ||
24 | + <td><?= $model->phone ?></td> | ||
25 | + </tr> | ||
26 | + <tr> | ||
27 | + <td><b><?= \Yii::t('app', 'Email: ') ?></b></td> | ||
28 | + <td><?= $model->email ?></td> | ||
29 | + </tr> | ||
30 | + <tr> | ||
31 | + <td><b><?= \Yii::t('app', 'Message: ') ?></b></td> | ||
32 | + <td><?= $model->message ?></td> | ||
33 | + </tr> | ||
34 | + </tbody> | ||
31 | </table> | 35 | </table> |
1 | +<?php | ||
2 | + namespace common\models; | ||
3 | + /** | ||
4 | + * User: timur | ||
5 | + * Date: 31.01.18 | ||
6 | + * Time: 10:56 | ||
7 | + */ | ||
8 | + | ||
9 | + use artbox\core\models\Feedback as ArtboxFeedback; | ||
10 | + use yii\helpers\VarDumper; | ||
11 | + | ||
12 | + /** | ||
13 | + * Class Feedback | ||
14 | + * | ||
15 | + * @property string $topic | ||
16 | + * | ||
17 | + * @package common\models | ||
18 | + */ | ||
19 | + class Feedback extends ArtboxFeedback | ||
20 | + { | ||
21 | + | ||
22 | + const SCENARIO_CALCULATOR = 'calculator'; | ||
23 | + | ||
24 | + public function scenarios() | ||
25 | + { | ||
26 | + return array_merge( | ||
27 | + parent::scenarios(), | ||
28 | + [ | ||
29 | + parent::SCENARIO_FEEDBACK => [ | ||
30 | + 'name', | ||
31 | + 'email', | ||
32 | + 'message', | ||
33 | + 'returnUrl', | ||
34 | + 'topic', | ||
35 | + ], | ||
36 | + parent::SCENARIO_CALLBACK => [ | ||
37 | + 'name', | ||
38 | + 'phone', | ||
39 | + 'message', | ||
40 | + 'returnUrl', | ||
41 | + 'topic', | ||
42 | + ], | ||
43 | + self::SCENARIO_CALCULATOR => [ | ||
44 | + 'name', | ||
45 | + 'phone', | ||
46 | + 'returnUrl', | ||
47 | + 'topic', | ||
48 | + 'calc_json_info', | ||
49 | + | ||
50 | + ] | ||
51 | + ] | ||
52 | + ); | ||
53 | + } | ||
54 | + | ||
55 | + public function rules() | ||
56 | + { | ||
57 | + | ||
58 | + return array_merge( | ||
59 | + parent::rules(), | ||
60 | + [ | ||
61 | + [ | ||
62 | + [ | ||
63 | + 'topic', | ||
64 | + ], | ||
65 | + 'required', | ||
66 | + ], | ||
67 | + [ | ||
68 | + [ | ||
69 | + 'topic', | ||
70 | + ], | ||
71 | + 'string', | ||
72 | + 'max' => 100, | ||
73 | + ], | ||
74 | + [ | ||
75 | + [ | ||
76 | + 'calc_json_info' | ||
77 | + ], | ||
78 | + 'required', | ||
79 | + 'on' => self::SCENARIO_CALCULATOR, | ||
80 | + ] | ||
81 | + ] | ||
82 | + ); | ||
83 | + } | ||
84 | + | ||
85 | + | ||
86 | + } | ||
0 | \ No newline at end of file | 87 | \ No newline at end of file |
console/migrations/m180131_085430_add_topic_column_to_feedback_table.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +/** | ||
6 | + * Handles adding topic to table `feedback`. | ||
7 | + */ | ||
8 | +class m180131_085430_add_topic_column_to_feedback_table extends Migration | ||
9 | +{ | ||
10 | + /** | ||
11 | + * @inheritdoc | ||
12 | + */ | ||
13 | + public function up() | ||
14 | + { | ||
15 | + $this->addColumn('feedback', 'topic', $this->string(100)); | ||
16 | + } | ||
17 | + | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public function down() | ||
22 | + { | ||
23 | + $this->dropColumn('feedback', 'topic'); | ||
24 | + } | ||
25 | +} |
console/migrations/m180131_090632_add_calc_json_info_column_to_feedback_table.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +/** | ||
6 | + * Handles adding calc_json_info to table `feedback`. | ||
7 | + */ | ||
8 | +class m180131_090632_add_calc_json_info_column_to_feedback_table extends Migration | ||
9 | +{ | ||
10 | + /** | ||
11 | + * @inheritdoc | ||
12 | + */ | ||
13 | + public function up() | ||
14 | + { | ||
15 | + $this->addColumn('feedback', 'calc_json_info', $this->text()); | ||
16 | + } | ||
17 | + | ||
18 | + /** | ||
19 | + * @inheritdoc | ||
20 | + */ | ||
21 | + public function down() | ||
22 | + { | ||
23 | + $this->dropColumn('feedback', 'calc_json_info'); | ||
24 | + } | ||
25 | +} |
frontend/controllers/SiteController.php
1 | <?php | 1 | <?php |
2 | + | ||
2 | namespace frontend\controllers; | 3 | namespace frontend\controllers; |
3 | 4 | ||
4 | - use artbox\core\models\Feedback; | 5 | + use common\models\Feedback; |
5 | use common\models\Settings; | 6 | use common\models\Settings; |
6 | use common\models\Slider; | 7 | use common\models\Slider; |
7 | use Yii; | 8 | use Yii; |
@@ -52,9 +53,10 @@ | @@ -52,9 +53,10 @@ | ||
52 | public function actionIndex() | 53 | public function actionIndex() |
53 | { | 54 | { |
54 | 55 | ||
55 | - $slider = Slider::find()->with("slides.lang.image") | ||
56 | - ->where(['on_home_page'=>true]) | ||
57 | - ->one(); | 56 | + $slider = Slider::find() |
57 | + ->with("slides.lang.image") | ||
58 | + ->where(['on_home_page'=>true]) | ||
59 | + ->one(); | ||
58 | 60 | ||
59 | $objects = Objectkb::find() | 61 | $objects = Objectkb::find() |
60 | ->with('lang.alias') | 62 | ->with('lang.alias') |
@@ -96,7 +98,7 @@ | @@ -96,7 +98,7 @@ | ||
96 | { | 98 | { |
97 | return $this->render('about'); | 99 | return $this->render('about'); |
98 | } | 100 | } |
99 | - | 101 | + |
100 | public function actionIndividual() | 102 | public function actionIndividual() |
101 | { | 103 | { |
102 | return $this->render('individual'); | 104 | return $this->render('individual'); |
@@ -121,7 +123,7 @@ | @@ -121,7 +123,7 @@ | ||
121 | { | 123 | { |
122 | return $this->render('blog'); | 124 | return $this->render('blog'); |
123 | } // блог | 125 | } // блог |
124 | - | 126 | + |
125 | /** | 127 | /** |
126 | * Action to view robots.txt file dinamycli | 128 | * Action to view robots.txt file dinamycli |
127 | * | 129 | * |
@@ -165,22 +167,23 @@ | @@ -165,22 +167,23 @@ | ||
165 | 'model' => $model, | 167 | 'model' => $model, |
166 | ] | 168 | ] |
167 | ) | 169 | ) |
168 | - ->setFrom('artbox@domain.com') | ||
169 | - ->setTo($settings->email) | 170 | + ->setFrom('artbox@domain.com')// ->setTo($settings->email) |
171 | + ->setTo( | ||
172 | + [ | ||
173 | + 'tamerlan8.05.92@gmail.com', | ||
174 | + 'mpav@artweb.ua', | ||
175 | + ] | ||
176 | + ) | ||
170 | ->setSubject(\Yii::t('app', 'Feedback')) | 177 | ->setSubject(\Yii::t('app', 'Feedback')) |
171 | ->send(); | 178 | ->send(); |
172 | 179 | ||
173 | return [ | 180 | return [ |
174 | 'success' => true, | 181 | 'success' => true, |
175 | 'message' => 'Success message', | 182 | 'message' => 'Success message', |
176 | - 'alert' => '<div class="alert alert-success"> | ||
177 | - <h3>Success</h3> | ||
178 | - <p> | ||
179 | - Success text | ||
180 | - </p> | ||
181 | - </div>', | 183 | + 'alert' => $this->renderPartial('success_alert'), |
182 | ]; | 184 | ]; |
183 | } else { | 185 | } else { |
186 | + Yii::$app->response->setStatusCode(500); | ||
184 | return [ | 187 | return [ |
185 | 'success' => false, | 188 | 'success' => false, |
186 | 'error' => $model->errors, | 189 | 'error' => $model->errors, |
frontend/views/layouts/main.php
@@ -10,7 +10,6 @@ | @@ -10,7 +10,6 @@ | ||
10 | 10 | ||
11 | use artbox\core\components\SeoComponent; | 11 | use artbox\core\components\SeoComponent; |
12 | use artbox\core\helpers\ImageHelper; | 12 | use artbox\core\helpers\ImageHelper; |
13 | - use artbox\core\models\Feedback; | ||
14 | use artbox\core\models\PageCategory; | 13 | use artbox\core\models\PageCategory; |
15 | use artbox\core\models\User; | 14 | use artbox\core\models\User; |
16 | use common\models\Settings; | 15 | use common\models\Settings; |
@@ -23,6 +22,7 @@ | @@ -23,6 +22,7 @@ | ||
23 | use yii\helpers\Url; | 22 | use yii\helpers\Url; |
24 | use yii\web\View; | 23 | use yii\web\View; |
25 | use yii\widgets\Breadcrumbs; | 24 | use yii\widgets\Breadcrumbs; |
25 | + use common\models\Feedback; | ||
26 | 26 | ||
27 | AppAsset::register($this); | 27 | AppAsset::register($this); |
28 | $user = \Yii::$app->user->identity; | 28 | $user = \Yii::$app->user->identity; |
@@ -386,6 +386,10 @@ | @@ -386,6 +386,10 @@ | ||
386 | ] | 386 | ] |
387 | ); ?> | 387 | ); ?> |
388 | 388 | ||
389 | + <?= $form->field($feedback, 'topic') | ||
390 | + ->hiddenInput(['value' => Feedback::SCENARIO_FEEDBACK]) | ||
391 | + ->label(false)?> | ||
392 | + | ||
389 | <?= $form->field($feedback, 'name') | 393 | <?= $form->field($feedback, 'name') |
390 | ->textInput(); ?> | 394 | ->textInput(); ?> |
391 | 395 |
frontend/views/site/index.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | /** | 3 | /** |
4 | - * @var $this yii\web\View | ||
5 | - * @var $slider \common\models\Slider | 4 | + * @var $this yii\web\View |
5 | + * @var $slider \common\models\Slider | ||
6 | * @var $objects \common\models\Objectkb | 6 | * @var $objects \common\models\Objectkb |
7 | */ | 7 | */ |
8 | 8 | ||
9 | -use common\models\Settings; | ||
10 | -use frontend\assets\MapAsset; | ||
11 | -use yii\web\View; | ||
12 | - | ||
13 | -MapAsset::register($this); | ||
14 | -$settings = Settings::getInstance(); | ||
15 | -$this->title = 'KB Energy'; | ||
16 | - | ||
17 | -$js = <<< JS | 9 | + use common\models\Settings; |
10 | + use frontend\assets\MapAsset; | ||
11 | + use yii\web\View; | ||
12 | + use yii\helpers\Url; | ||
13 | + | ||
14 | + MapAsset::register($this); | ||
15 | + $settings = Settings::getInstance(); | ||
16 | + $this->title = 'KB Energy'; | ||
17 | + | ||
18 | + $js = <<< JS | ||
18 | window.lat = {$settings->lat}; | 19 | window.lat = {$settings->lat}; |
19 | window.lon = {$settings->lon}; | 20 | window.lon = {$settings->lon}; |
20 | JS; | 21 | JS; |
21 | - | ||
22 | -$this->registerJs($js, View::POS_END); | 22 | + |
23 | + $this->registerJs($js, View::POS_END); | ||
23 | ?> | 24 | ?> |
24 | 25 | ||
25 | <div id="main-page"> | 26 | <div id="main-page"> |
@@ -229,80 +230,18 @@ $this->registerJs($js, View::POS_END); | @@ -229,80 +230,18 @@ $this->registerJs($js, View::POS_END); | ||
229 | </div> | 230 | </div> |
230 | <div class="row"> | 231 | <div class="row"> |
231 | <div class="col-md-12 col-xs-12" style="text-align:center;margin-top: 20px;margin-bottom: -35px;"> | 232 | <div class="col-md-12 col-xs-12" style="text-align:center;margin-top: 20px;margin-bottom: -35px;"> |
232 | - <a href='site/object/' class="button1 more-projects"><?= Yii::t('app', 'sect2_6') ?></a> | 233 | + <a |
234 | + href="<?= Url::toRoute(['blog/index'])?>" | ||
235 | + class="button1 more-projects" | ||
236 | + > | ||
237 | + <?= Yii::t('app', 'sect2_6') ?> | ||
238 | + </a> | ||
233 | </div> | 239 | </div> |
234 | </div> | 240 | </div> |
235 | </div> | 241 | </div> |
236 | </div> | 242 | </div> |
237 | </section> | 243 | </section> |
238 | 244 | ||
239 | -<!-- новый блок с объектами для главной--> | ||
240 | -<!-- <section class="bar background-white objects-main-wr">--> | ||
241 | -<!-- <div class="container">--> | ||
242 | -<!-- <div class="col-md-12">--> | ||
243 | -<!-- <div class="heading text-center">--> | ||
244 | -<!-- <h2>--><?//=\Yii::t('app', 'index_objects')?><!--</h2>--> | ||
245 | -<!-- </div>--> | ||
246 | -<!-- <div class="row portfolio">--> | ||
247 | -<!-- --><?php | ||
248 | -// foreach ($objects as $object) { | ||
249 | -// ?> | ||
250 | -<!-- <div class="col-sm-6">--> | ||
251 | -<!-- <div class="box-image">--> | ||
252 | -<!-- <div class="image">--> | ||
253 | -<!-- <div class="image_link_wr">--> | ||
254 | -<!-- <a href="--><?//=\yii\helpers\Url::toRoute( | ||
255 | -// [ | ||
256 | -// 'object/view', | ||
257 | -// 'alias' => $object->lang->alias, | ||
258 | -// ] | ||
259 | -// ) ?><!--" class="image_link">--> | ||
260 | -<!-- --><?//=$object->image->getImg([])?> | ||
261 | -<!-- </a>--> | ||
262 | -<!-- </div>--> | ||
263 | -<!-- <div class="img-title">--> | ||
264 | -<!-- <table>--> | ||
265 | -<!-- <tr>--> | ||
266 | -<!-- <td class="buts text-left">--> | ||
267 | -<!-- <a href="--><?//=\yii\helpers\Url::toRoute( | ||
268 | -// [ | ||
269 | -// 'object/view', | ||
270 | -// 'alias' => $object->lang->alias, | ||
271 | -// ] | ||
272 | -// ) ?><!--" class="sqre_btn blue_arrow" alt="--><?//=$object->lang->object_name?><!--"></a>--> | ||
273 | -<!-- <a href="#" class="btn sqre_btn yellow_calc modaled init-button-сalculate" data-title="Заказать консультацию" data-toggle="modal" data-target="#feedback-modal"></a>--> | ||
274 | -<!-- </td>--> | ||
275 | -<!-- <td class="i-title" valign="center">--> | ||
276 | -<!-- <p class="pr_title2">--> | ||
277 | -<!-- <a href="--><?//=\yii\helpers\Url::toRoute( | ||
278 | -// [ | ||
279 | -// 'object/view', | ||
280 | -// 'alias' => $object->lang->alias, | ||
281 | -// ] | ||
282 | -// ) ?><!--">--> | ||
283 | -<!-- --><?//=$object->lang->object_name?> | ||
284 | -<!-- </a>--> | ||
285 | -<!-- </p>--> | ||
286 | -<!-- </td>--> | ||
287 | -<!-- </tr>--> | ||
288 | -<!-- </table>--> | ||
289 | -<!-- </div>--> | ||
290 | -<!-- </div>--> | ||
291 | -<!-- </div>--> | ||
292 | -<!-- </div>--> | ||
293 | -<!-- --><?php | ||
294 | -// } | ||
295 | -// ?> | ||
296 | -<!-- </div>--> | ||
297 | -<!-- <div class="row">--> | ||
298 | -<!-- <div class="col-md-12 col-xs-12" style="text-align:center;margin-top: 20px;margin-bottom: -35px;">--> | ||
299 | -<!-- <a href='site/object/' class="button1 more-projects">--><?//= Yii::t('app', 'sect2_6') ?><!--</a>--> | ||
300 | -<!-- </div>--> | ||
301 | -<!-- </div>--> | ||
302 | -<!-- </div>--> | ||
303 | -<!-- </div>--> | ||
304 | -<!-- </section>--> | ||
305 | - | ||
306 | <section class="blue-fon no-mg economy-wr"> | 245 | <section class="blue-fon no-mg economy-wr"> |
307 | <div class="container"> | 246 | <div class="container"> |
308 | <div class="heading text-center"> | 247 | <div class="heading text-center"> |
@@ -403,7 +342,12 @@ $this->registerJs($js, View::POS_END); | @@ -403,7 +342,12 @@ $this->registerJs($js, View::POS_END); | ||
403 | </div> | 342 | </div> |
404 | </div> | 343 | </div> |
405 | <div class="col-md-12 col-xs-12" style="text-align:center;margin-top: 20px;margin-bottom: -35px;"> | 344 | <div class="col-md-12 col-xs-12" style="text-align:center;margin-top: 20px;margin-bottom: -35px;"> |
406 | - <a href="site/object/" class="button1 more-projects"><?=\Yii::t('app', 'more_about_ours')?></a> | 345 | + <a |
346 | + href="<?= Url::toRoute(['blog/index'])?>" | ||
347 | + class="button1 more-projects" | ||
348 | + > | ||
349 | + <?=\Yii::t('app', 'more_about_ours')?> | ||
350 | + </a> | ||
407 | </div> | 351 | </div> |
408 | </div> | 352 | </div> |
409 | </section> | 353 | </section> |
frontend/web/js/script.js
@@ -19,6 +19,7 @@ $( | @@ -19,6 +19,7 @@ $( | ||
19 | f.reset(); | 19 | f.reset(); |
20 | $('#feedback-modal') | 20 | $('#feedback-modal') |
21 | .modal('hide'); | 21 | .modal('hide'); |
22 | + $(this).data('yiiActiveForm').validated = false; | ||
22 | $('#success-modal') | 23 | $('#success-modal') |
23 | .modal('show'); | 24 | .modal('show'); |
24 | }, | 25 | }, |