From 78ab74363363bfdf6d500458879cc3ea37b113b2 Mon Sep 17 00:00:00 2001 From: Yarik Date: Fri, 25 Mar 2016 11:16:26 +0200 Subject: [PATCH] test --- common/models/UserInfo.php | 10 ++++++++-- console/migrations/m160325_085819_user_info_radio.php | 30 ++++++++++++++++++++++++++++++ frontend/views/accounts/employment.php | 3 --- frontend/views/accounts/general.php | 2 +- frontend/views/accounts/service.php | 86 +++++++++++++++++++++++++------------------------------------------------------------- frontend/views/performer/common.php | 8 ++++---- frontend/web/js/forms.js | 6 ++++++ 7 files changed, 74 insertions(+), 71 deletions(-) create mode 100644 console/migrations/m160325_085819_user_info_radio.php diff --git a/common/models/UserInfo.php b/common/models/UserInfo.php index b2314a5..520681f 100755 --- a/common/models/UserInfo.php +++ b/common/models/UserInfo.php @@ -142,12 +142,18 @@ [ 'busy', 'member', + ], + 'boolean', + ], + [ + [ 'contract', 'estimate', 'purchase', 'delivery', ], - 'boolean', + 'string', + 'max' => 50, ], [ [ @@ -230,7 +236,7 @@ ], 'filter', 'filter' => function($value) { - if(empty($value)) { + if(empty( $value )) { return $value; } if(!preg_match('/^https?:\/{2}.*$/', $value)) { diff --git a/console/migrations/m160325_085819_user_info_radio.php b/console/migrations/m160325_085819_user_info_radio.php new file mode 100644 index 0000000..5b3c6a0 --- /dev/null +++ b/console/migrations/m160325_085819_user_info_radio.php @@ -0,0 +1,30 @@ +dropColumn('{{%user_info}}', 'contract'); + $this->dropColumn('{{%user_info}}', 'estimate'); + $this->dropColumn('{{%user_info}}', 'purchase'); + $this->dropColumn('{{%user_info}}', 'delivery'); + $this->addColumn('{{%user_info}}', 'contract', $this->string(50)); + $this->addColumn('{{%user_info}}', 'estimate', $this->string(50)); + $this->addColumn('{{%user_info}}', 'purchase', $this->string(50)); + $this->addColumn('{{%user_info}}', 'delivery', $this->string(50)); + } + + public function down() + { + $this->dropColumn('{{%user_info}}', 'contract'); + $this->dropColumn('{{%user_info}}', 'estimate'); + $this->dropColumn('{{%user_info}}', 'purchase'); + $this->dropColumn('{{%user_info}}', 'delivery'); + $this->addColumn('{{%user_info}}', 'contract', $this->smallInteger()); + $this->addColumn('{{%user_info}}', 'estimate', $this->smallInteger()); + $this->addColumn('{{%user_info}}', 'purchase', $this->smallInteger()); + $this->addColumn('{{%user_info}}', 'delivery', $this->smallInteger()); + } +} diff --git a/frontend/views/accounts/employment.php b/frontend/views/accounts/employment.php index 9c8c776..a9af519 100755 --- a/frontend/views/accounts/employment.php +++ b/frontend/views/accounts/employment.php @@ -208,9 +208,6 @@ $( function() { - $(document).on('change', '.no-client-validation', function() { - $(this).parent().find('.help-block').hide(); - }); var regexp = /^[\w]+\[(\d+)\].*$/; var prevEmploy = $('.prev_job_inputs').length if(prevEmploy < 1) diff --git a/frontend/views/accounts/general.php b/frontend/views/accounts/general.php index 7c7b0dc..210183f 100755 --- a/frontend/views/accounts/general.php +++ b/frontend/views/accounts/general.php @@ -98,7 +98,7 @@
field($company_info, 'name', [ 'options' => [ 'class' => 'form-group company_info' ], 'enableClientValidation' => false ]) - ->textInput([ 'class' => 'custom-input-2' ]); ?> + ->textInput([ 'class' => 'custom-input-2 no-client-validation' ]); ?>
diff --git a/frontend/views/accounts/service.php b/frontend/views/accounts/service.php index 56959da..aa51405 100755 --- a/frontend/views/accounts/service.php +++ b/frontend/views/accounts/service.php @@ -149,83 +149,47 @@
- field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ]) - ->label('Работа по договору') - ->radioList([ - 1 => 'Да', - 0 => 'Нет', - ], [ - 'item' => function($index, $label, $name, $checked, $value) { - $return = '
'; - $return .= ''; - $return .= ''; - $return .= '
'; - return $return; - }, - ]) ?> + field($user_info, 'contract', [ + 'template' => "{label}
{input}\n{hint}\n{error}", + 'options' => [ 'class' => 'form-inline' ], + ]) + ->textInput([ + 'class' => 'custom-input-2 custom-input-2-margin-r', + ]) ?>
- field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ]) - ->label('Предоставляете смету') - ->radioList([ - 1 => 'Да', - 0 => 'Нет', - ], [ - 'item' => function($index, $label, $name, $checked, $value) { - $return = '
'; - $return .= ''; - $return .= ''; - $return .= '
'; - return $return; - }, + field($user_info, 'estimate', [ + 'template' => "{label}
{input}\n{hint}\n{error}", + 'options' => [ 'class' => 'form-inline' ], + ]) + ->textInput([ + 'class' => 'custom-input-2 custom-input-2-margin-r', ]) ?>
- field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ]) - ->label('Делаете сами закупку материалов') - ->radioList([ - 1 => 'Да', - 0 => 'Нет', - ], [ - 'item' => function($index, $label, $name, $checked, $value) { - $return = '
'; - $return .= ''; - $return .= ''; - $return .= '
'; - return $return; - }, + field($user_info, 'purchase', [ + 'template' => "{label}
{input}\n{hint}\n{error}", + 'options' => [ 'class' => 'form-inline' ], + ]) + ->textInput([ + 'class' => 'custom-input-2 custom-input-2-margin-r', ]) ?>
- field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ]) - ->label('Занимаетесь сами доставкой материалов') - ->radioList([ - 1 => 'Да', - 0 => 'Нет', - ], [ - 'item' => function($index, $label, $name, $checked, $value) { - $return = '
'; - $return .= ''; - $return .= ''; - $return .= '
'; - return $return; - }, + field($user_info, 'delivery', [ + 'template' => "{label}
{input}\n{hint}\n{error}", + 'options' => [ 'class' => 'form-inline' ], + ]) + ->textInput([ + 'class' => 'custom-input-2 custom-input-2-margin-r', ]) ?>
diff --git a/frontend/views/performer/common.php b/frontend/views/performer/common.php index 30337ab..e44b4a4 100755 --- a/frontend/views/performer/common.php +++ b/frontend/views/performer/common.php @@ -182,7 +182,7 @@ if(!empty( $user->userInfo->contract )) { ?>
  • - Договор: formatter->asBoolean($user->userInfo->contract) ?> + Договор: userInfo->contract ?>
  • userInfo->estimate )) { ?>
  • - Смета: formatter->asBoolean($user->userInfo->estimate) ?> + Смета: userInfo->estimate ?>
  • userInfo->purchase )) { ?>
  • - Закупка стройматериалов: formatter->asBoolean($user->userInfo->purchase) ?> + Закупка стройматериалов: userInfo->purchase ?>
  • userInfo->delivery )) { ?>
  • - Доставка стройматериалов: formatter->asBoolean($user->userInfo->delivery) ?> + Доставка стройматериалов: userInfo->delivery ?>