Commit 1e28d2b49e5c3b06e53581932db55dfa78220d56
Merge remote-tracking branch 'origin/master'
Showing
8 changed files
with
211 additions
and
26 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 | /** |
| @@ -24,8 +24,12 @@ | @@ -24,8 +24,12 @@ | ||
| 24 | <td><?= $model->email ?></td> | 24 | <td><?= $model->email ?></td> |
| 25 | </tr> | 25 | </tr> |
| 26 | <tr> | 26 | <tr> |
| 27 | - <td><b><?= \Yii::t('app', 'Message: ') ?></b></td> | ||
| 28 | - <td><?= $model->message ?></td> | 27 | + <td><b><?= \Yii::t('app', 'Promocode: ') ?></b></td> |
| 28 | + <td><?= isset($model->promocode)? $model->promocode : 'без промокода' ?></td> | ||
| 29 | + </tr> | ||
| 30 | + <tr> | ||
| 31 | + <td><b><?= \Yii::t('app', 'Oplata: ') ?></b></td> | ||
| 32 | + <td><?= $model->oplata ?></td> | ||
| 29 | </tr> | 33 | </tr> |
| 30 | </tbody> | 34 | </tbody> |
| 31 | </table> | 35 | </table> |
common/messages/ru/app.php
| 1 | <?php | 1 | <?php |
| 2 | - return []; | ||
| 3 | \ No newline at end of file | 2 | \ No newline at end of file |
| 3 | + return [ | ||
| 4 | + 'oplata' => 'оплата', | ||
| 5 | + 'promocode' => 'промокод', | ||
| 6 | + 'Name: ' => 'Имя :', | ||
| 7 | + 'Phone: ' => 'Телефон: ', | ||
| 8 | + 'Email: ' => 'Email: ', | ||
| 9 | + 'Promocode: ' => 'Промокод: ', | ||
| 10 | + 'Oplata: ' => 'Оплата: ', | ||
| 11 | + ]; | ||
| 4 | \ No newline at end of file | 12 | \ No newline at end of file |
| 1 | +<?php | ||
| 2 | + /** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: timur | ||
| 5 | + * Date: 05.12.17 | ||
| 6 | + * Time: 13:45 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | + namespace common\models; | ||
| 10 | + | ||
| 11 | + use artbox\core\models\Feedback as FeefbackCore; | ||
| 12 | + use Yii; | ||
| 13 | + | ||
| 14 | + class Feedback extends FeefbackCore | ||
| 15 | + { | ||
| 16 | + | ||
| 17 | + public function scenarios() | ||
| 18 | + { | ||
| 19 | + $scenarios = parent::scenarios(); | ||
| 20 | + $scenarios = array_merge( | ||
| 21 | + $scenarios, | ||
| 22 | + [ | ||
| 23 | + self::SCENARIO_FEEDBACK => [ | ||
| 24 | + 'name', | ||
| 25 | + 'email', | ||
| 26 | + 'message', | ||
| 27 | + 'returnUrl', | ||
| 28 | + 'phone', | ||
| 29 | + 'oplata', | ||
| 30 | + 'promocode', | ||
| 31 | + ], | ||
| 32 | + self::SCENARIO_CALLBACK => [ | ||
| 33 | + 'name', | ||
| 34 | + 'phone', | ||
| 35 | + 'message', | ||
| 36 | + 'returnUrl', | ||
| 37 | + ], | ||
| 38 | + ] | ||
| 39 | + ); | ||
| 40 | + return $scenarios; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public function rules() | ||
| 44 | + { | ||
| 45 | + return [ | ||
| 46 | + [ | ||
| 47 | + [ | ||
| 48 | + 'name', | ||
| 49 | + 'email', | ||
| 50 | + 'phone', | ||
| 51 | + ], | ||
| 52 | + 'required', | ||
| 53 | + 'on' => self::SCENARIO_DEFAULT, | ||
| 54 | + ], | ||
| 55 | + [ | ||
| 56 | + [ | ||
| 57 | + 'name', | ||
| 58 | + 'email', | ||
| 59 | + 'phone', | ||
| 60 | + 'oplata' | ||
| 61 | + ], | ||
| 62 | + 'required', | ||
| 63 | + 'on' => self::SCENARIO_FEEDBACK, | ||
| 64 | + ], | ||
| 65 | + [ | ||
| 66 | + [ | ||
| 67 | + 'phone', | ||
| 68 | + 'name', | ||
| 69 | + ], | ||
| 70 | + 'required', | ||
| 71 | + 'on' => self::SCENARIO_CALLBACK, | ||
| 72 | + ], | ||
| 73 | + [ | ||
| 74 | + [ 'email' ], | ||
| 75 | + 'email', | ||
| 76 | + ], | ||
| 77 | + // [ | ||
| 78 | + // [ 'phone' ], | ||
| 79 | + // 'match', | ||
| 80 | + // 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/', | ||
| 81 | + // ], | ||
| 82 | + [ | ||
| 83 | + [ | ||
| 84 | + 'name', | ||
| 85 | + 'phone', | ||
| 86 | + 'email', | ||
| 87 | + 'oplata', | ||
| 88 | + 'promocode', | ||
| 89 | + ], | ||
| 90 | + 'string', | ||
| 91 | + 'max' => 255, | ||
| 92 | + ], | ||
| 93 | + [ | ||
| 94 | + [ | ||
| 95 | + 'message', | ||
| 96 | + ], | ||
| 97 | + 'string', | ||
| 98 | + ], | ||
| 99 | + [ | ||
| 100 | + [ | ||
| 101 | + 'status', | ||
| 102 | + ], | ||
| 103 | + 'boolean', | ||
| 104 | + ], | ||
| 105 | + [ | ||
| 106 | + 'returnUrl', | ||
| 107 | + 'safe', | ||
| 108 | + ], | ||
| 109 | + ]; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public function attributeLabels() | ||
| 113 | + { | ||
| 114 | + return [ | ||
| 115 | + 'id' => Yii::t('core', 'id'), | ||
| 116 | + 'name' => Yii::t('core', 'name'), | ||
| 117 | + 'phone' => Yii::t('core', 'phone'), | ||
| 118 | + 'created_at' => Yii::t('core', 'created_at'), | ||
| 119 | + 'ip' => Yii::t('core', 'ip'), | ||
| 120 | + 'url' => Yii::t('core', 'url'), | ||
| 121 | + 'status' => Yii::t('core', 'status'), | ||
| 122 | + 'message' => Yii::t('core', 'message'), | ||
| 123 | + 'email' => Yii::t('core', 'email'), | ||
| 124 | + 'oplata' => Yii::t('app', 'oplata'), | ||
| 125 | + 'promocode' => Yii::t('app', 'promocode'), | ||
| 126 | + ]; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + } | ||
| 130 | + | ||
| 0 | \ No newline at end of file | 131 | \ No newline at end of file |
console/migrations/m171205_114149_add_promocode_column_to_feedback_table.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use yii\db\Migration; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Handles adding promocode to table `feedback`. | ||
| 7 | + */ | ||
| 8 | +class m171205_114149_add_promocode_column_to_feedback_table extends Migration | ||
| 9 | +{ | ||
| 10 | + /** | ||
| 11 | + * @inheritdoc | ||
| 12 | + */ | ||
| 13 | + public function up() | ||
| 14 | + { | ||
| 15 | + $this->addColumn('feedback', 'promocode', $this->string(255)); | ||
| 16 | + $this->addColumn('feedback', 'oplata', $this->string(150)); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @inheritdoc | ||
| 21 | + */ | ||
| 22 | + public function down() | ||
| 23 | + { | ||
| 24 | + $this->dropColumn('feedback', 'promocode'); | ||
| 25 | + $this->dropColumn('feedback', 'oplata'); | ||
| 26 | + } | ||
| 27 | +} |
frontend/assets/AppAsset.php
| @@ -27,8 +27,6 @@ | @@ -27,8 +27,6 @@ | ||
| 27 | 'js/jquery.parallax-1.1.3.js', | 27 | 'js/jquery.parallax-1.1.3.js', |
| 28 | 'js/front.js', | 28 | 'js/front.js', |
| 29 | 'js/owl.carousel.min.js', | 29 | 'js/owl.carousel.min.js', |
| 30 | - '//maps.googleapis.com/maps/api/js?key=AIzaSyCgyPQhOmGEwyAdZ0uS6fJLLvnNxgncfy0&callback=initMap', | ||
| 31 | - '/js/gmaps.init.js', | ||
| 32 | 'js/script.js', | 30 | 'js/script.js', |
| 33 | ]; | 31 | ]; |
| 34 | public $depends = [ | 32 | public $depends = [ |
frontend/assets/MapAsset.php
| @@ -15,7 +15,7 @@ | @@ -15,7 +15,7 @@ | ||
| 15 | public $baseUrl = '@web'; | 15 | public $baseUrl = '@web'; |
| 16 | public $css = []; | 16 | public $css = []; |
| 17 | public $js = [ | 17 | public $js = [ |
| 18 | - '//maps.googleapis.com/maps/api/js?key=AIzaSyCoR1Jb-mIFUjPwKiuSlmtYBEwnJOBnAgg&callback=initMap', | 18 | + '//maps.googleapis.com/maps/api/js?key=AIzaSyCgyPQhOmGEwyAdZ0uS6fJLLvnNxgncfy0', |
| 19 | 'js/gmaps.init.js', | 19 | 'js/gmaps.init.js', |
| 20 | ]; | 20 | ]; |
| 21 | public $depends = [ | 21 | public $depends = [ |
frontend/controllers/SiteController.php
| 1 | <?php | 1 | <?php |
| 2 | namespace frontend\controllers; | 2 | namespace frontend\controllers; |
| 3 | 3 | ||
| 4 | - use artbox\core\models\Feedback; | 4 | + use common\models\Feedback; |
| 5 | use common\models\Settings; | 5 | use common\models\Settings; |
| 6 | use Yii; | 6 | use Yii; |
| 7 | use yii\filters\VerbFilter; | 7 | use yii\filters\VerbFilter; |
| @@ -121,9 +121,15 @@ | @@ -121,9 +121,15 @@ | ||
| 121 | 'model' => $model, | 121 | 'model' => $model, |
| 122 | ] | 122 | ] |
| 123 | ) | 123 | ) |
| 124 | - ->setFrom('artbox@domain.com') | ||
| 125 | - ->setTo($settings->email) | ||
| 126 | - ->setSubject(\Yii::t('app', 'Feedback')) | 124 | + ->setFrom(['artwebdev17@gmail.com'=> 'artweb']) |
| 125 | + ->setTo( | ||
| 126 | + [ | ||
| 127 | + 'kotets.nik@gmail.com', | ||
| 128 | + 'kazimirova.artweb@gmail.com', | ||
| 129 | +// 'tamerlan8.05.92@gmail.com', | ||
| 130 | + ] | ||
| 131 | + ) | ||
| 132 | + ->setSubject('Bitcoin Invest участие в форуме') | ||
| 127 | ->send(); | 133 | ->send(); |
| 128 | 134 | ||
| 129 | return [ | 135 | return [ |
frontend/views/layouts/main.php
| @@ -10,11 +10,12 @@ | @@ -10,11 +10,12 @@ | ||
| 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; | 13 | + use common\models\Feedback; |
| 14 | use artbox\core\models\PageCategory; | 14 | use artbox\core\models\PageCategory; |
| 15 | use artbox\core\models\User; | 15 | use artbox\core\models\User; |
| 16 | use common\models\Settings; | 16 | use common\models\Settings; |
| 17 | use frontend\assets\AppAsset; | 17 | use frontend\assets\AppAsset; |
| 18 | + use frontend\assets\MapAsset; | ||
| 18 | use artbox\core\components\imagemanager\models\ImageManager; | 19 | use artbox\core\components\imagemanager\models\ImageManager; |
| 19 | use yii\bootstrap\ActiveForm; | 20 | use yii\bootstrap\ActiveForm; |
| 20 | use yii\bootstrap\Nav; | 21 | use yii\bootstrap\Nav; |
| @@ -25,9 +26,10 @@ | @@ -25,9 +26,10 @@ | ||
| 25 | use yii\widgets\Breadcrumbs; | 26 | use yii\widgets\Breadcrumbs; |
| 26 | 27 | ||
| 27 | AppAsset::register($this); | 28 | AppAsset::register($this); |
| 29 | + MapAsset::register($this); | ||
| 28 | $user = \Yii::$app->user->identity; | 30 | $user = \Yii::$app->user->identity; |
| 29 | $seo = Yii::$app->get('seo'); | 31 | $seo = Yii::$app->get('seo'); |
| 30 | - $feedback = new Feedback(); | 32 | + $feedback = new Feedback(['scenario' => Feedback::SCENARIO_FEEDBACK]); |
| 31 | $settings = Settings::getInstance(); | 33 | $settings = Settings::getInstance(); |
| 32 | $controller = Yii::$app->controller; | 34 | $controller = Yii::$app->controller; |
| 33 | $default_controller = Yii::$app->defaultRoute; | 35 | $default_controller = Yii::$app->defaultRoute; |
| @@ -190,25 +192,35 @@ _________________________________________________________ --> | @@ -190,25 +192,35 @@ _________________________________________________________ --> | ||
| 190 | ->textInput()->Label('Номер телефона'); ?> | 192 | ->textInput()->Label('Номер телефона'); ?> |
| 191 | </div> | 193 | </div> |
| 192 | <div class="col-md-6"> | 194 | <div class="col-md-6"> |
| 193 | - <?= $form->field($feedback, 'message') | 195 | + <?= $form->field($feedback, 'promocode') |
| 194 | ->textInput()->Label('Впишите промокод для получения скидки -20%'); ?> | 196 | ->textInput()->Label('Впишите промокод для получения скидки -20%'); ?> |
| 195 | </div> | 197 | </div> |
| 196 | </div> | 198 | </div> |
| 197 | <div class="col-md-10 col-md-offset-1 form-down"> | 199 | <div class="col-md-10 col-md-offset-1 form-down"> |
| 198 | <div style="font-weight:bold;font-size: 18px;padding-bottom: 5px;">Как вам удобно оплатить?<span style="color:red;">*</span></div> | 200 | <div style="font-weight:bold;font-size: 18px;padding-bottom: 5px;">Как вам удобно оплатить?<span style="color:red;">*</span></div> |
| 199 | - <label><input type="radio" name="payvariant" value="1"> Перевод на карту Приватбанка (до 16 декабря стоимость билета 150 грн)</label> | ||
| 200 | - <label><input type="radio" name="payvariant" value="2"> Перевод на карту Приватбанка (с промокодом стоимость до 16 декабря 120 грн)</label> | ||
| 201 | - <label><input type="radio" name="payvariant" value="3"> Наличными представителю (в день мероприятия, 16 декабря, цена 200 грн)</label> | 201 | + <?= $form->field($feedback, 'oplata') |
| 202 | + ->radioList( | ||
| 203 | + [ | ||
| 204 | + "Перевод на карту Приватбанка без промокода (150 грн)" => 'Перевод на карту Приватбанка (до 16 декабря стоимость билета 150 грн)', | ||
| 205 | + "Перевод на карту Приватбанка с промокода (120 грн)" => 'Перевод на карту Приватбанка (с промокодом стоимость до 16 декабря 120 грн)', | ||
| 206 | + "Наличными представителю" => 'Наличными представителю (в день мероприятия, 16 декабря, цена 200 грн)', | ||
| 207 | + ], | ||
| 208 | + [ | ||
| 209 | + 'unselect' => null, | ||
| 210 | + ] | ||
| 211 | + )->label(false); | ||
| 212 | + ?> | ||
| 202 | </div> | 213 | </div> |
| 203 | -<div class="col-md-12"> | ||
| 204 | - <p class="text-center"> | ||
| 205 | - <?= Html::submitButton( | ||
| 206 | - 'Отправить', | ||
| 207 | - [ | ||
| 208 | - 'class' => 'send-form btn btn-lg btn-template-primary', | ||
| 209 | - ] | ||
| 210 | - ) ?> | ||
| 211 | - </p></div> | 214 | + <div class="col-md-12"> |
| 215 | + <p class="text-center"> | ||
| 216 | + <?= Html::submitButton( | ||
| 217 | + 'Отправить', | ||
| 218 | + [ | ||
| 219 | + 'class' => 'send-form btn btn-lg btn-template-primary', | ||
| 220 | + ] | ||
| 221 | + ) ?> | ||
| 222 | + </p> | ||
| 223 | + </div> | ||
| 212 | <div style="clear:both;"></div> | 224 | <div style="clear:both;"></div> |
| 213 | 225 | ||
| 214 | <?php ActiveForm::end(); ?> | 226 | <?php ActiveForm::end(); ?> |