diff --git a/backend/controllers/VisitController.php b/backend/controllers/VisitController.php index 04ee4af..900c74f 100644 --- a/backend/controllers/VisitController.php +++ b/backend/controllers/VisitController.php @@ -45,12 +45,6 @@ 'index' => [ 'class' => Index::className(), 'columns' => [ - 'name' => [ - 'type' => Index::ACTION_COL, - ], - 'email' => [ - 'type' => Index::STRING_COL - ], 'phone' => [ 'type' => Index::STRING_COL ], diff --git a/backend/views/feedback/_form.php b/backend/views/feedback/_form.php index c0c9de9..f3ad439 100644 --- a/backend/views/feedback/_form.php +++ b/backend/views/feedback/_form.php @@ -11,19 +11,7 @@
- time){ - case 1: - echo "

В течении 30 минут

"; - break; - case 2: - echo "

C 9.00 до 12.00

"; - break; - case 3: - echo "

C 12.00 до 18.00

"; - break; - } - ?> + field($model, 'phone') ->textInput([ 'maxlength' => true ]) ?> diff --git a/backend/views/visit/_form.php b/backend/views/visit/_form.php index 17a17df..903d2ae 100644 --- a/backend/views/visit/_form.php +++ b/backend/views/visit/_form.php @@ -12,17 +12,23 @@ - field($model, 'name') - ->textInput([ 'maxlength' => true ]) ?> - - field($model, 'email') - ->textInput([ 'maxlength' => true ]) ?> + field($model, 'phone') ->textInput([ 'maxlength' => true ]) ?> - - field($model, 'message') - ->textarea([ 'rows' => 6 ]) ?> + time){ + case 1: + echo "

В течении 30 минут

"; + break; + case 2: + echo "

C 9.00 до 12.00

"; + break; + case 3: + echo "

C 12.00 до 18.00

"; + break; + } + ?> field($model, 'status') ->checkbox( diff --git a/common/models/Feedback.php b/common/models/Feedback.php index 07914ba..fc8cd46 100644 --- a/common/models/Feedback.php +++ b/common/models/Feedback.php @@ -26,15 +26,11 @@ const SCENARIO_FEEDBACK = 'feedback'; const SCENARIO_CALLBACK = 'callback'; - const DURING_30_MIN = '1'; - - const FROM_9_12 = '2'; - - const FROM_12_18 = '3' ; + public $returnUrl; - public $agree; + /** * @inheritdoc @@ -165,17 +161,8 @@ 'returnUrl', 'safe', ], - [ - [ 'time' ], 'integer' - ], - [ - [ - 'agree', - ], - 'in', - 'range' => [ 1 ], - 'allowArray' => false, - ], + + ]; } diff --git a/common/models/Visit.php b/common/models/Visit.php index 0e6a404..00b3ad6 100644 --- a/common/models/Visit.php +++ b/common/models/Visit.php @@ -17,7 +17,13 @@ */ class Visit extends \yii\db\ActiveRecord { - + const DURING_30_MIN = '1'; + + const FROM_9_12 = '2'; + + const FROM_12_18 = '3' ; + + public $agree; /** * @inheritdoc */ @@ -86,6 +92,17 @@ 'string', 'max' => 255, ], + [ + [ + 'agree', + ], + 'in', + 'range' => [ 1 ], + 'allowArray' => false, + ], + [ + [ 'time' ], 'integer' + ], ]; } diff --git a/console/migrations/m180712_081623_alter_table_visit.php b/console/migrations/m180712_081623_alter_table_visit.php index 5c5c511..daf70f8 100644 --- a/console/migrations/m180712_081623_alter_table_visit.php +++ b/console/migrations/m180712_081623_alter_table_visit.php @@ -12,7 +12,7 @@ class m180712_081623_alter_table_visit extends Migration */ public function safeUp() { - $this->addColumn('feedback', 'time', $this->integer()); + $this->addColumn('visit', 'time', $this->integer()); } /** @@ -20,7 +20,7 @@ class m180712_081623_alter_table_visit extends Migration */ public function safeDown() { - $this->dropColumn('feedback', 'time'); + $this->dropColumn('visit', 'time'); } /* diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index c7f92f7..ea5f95f 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -11,6 +11,7 @@ use common\models\Service; use common\models\Settings; use common\models\slider\Slide; + use common\models\Visit; use Yii; use yii\data\ActiveDataProvider; use yii\db\ActiveQuery; @@ -178,8 +179,7 @@ public function actionCallback(){ \Yii::$app->response->format = Response::FORMAT_JSON; - $model = new Feedback(); - $model->scenario = Feedback::SCENARIO_CALLBACK; + $model = new Visit(); if ($model->load(\Yii::$app->request->post()) && $model->save()){ return ['success' => true]; }else{ diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 981ba3b..afd5606 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -20,6 +20,7 @@ use artbox\core\seo\widgets\SeoBreadcrumbs; use common\models\Service; use common\models\Settings; + use common\models\Visit; use frontend\assets\AppAsset; use frontend\assets\SliderAsset; use frontend\widgets\ArtboxModalWidget; @@ -318,7 +319,7 @@