Commit 78ab74363363bfdf6d500458879cc3ea37b113b2

Authored by Yarik
1 parent 5d627502

test

common/models/UserInfo.php
... ... @@ -142,12 +142,18 @@
142 142 [
143 143 'busy',
144 144 'member',
  145 + ],
  146 + 'boolean',
  147 + ],
  148 + [
  149 + [
145 150 'contract',
146 151 'estimate',
147 152 'purchase',
148 153 'delivery',
149 154 ],
150   - 'boolean',
  155 + 'string',
  156 + 'max' => 50,
151 157 ],
152 158 [
153 159 [
... ... @@ -230,7 +236,7 @@
230 236 ],
231 237 'filter',
232 238 'filter' => function($value) {
233   - if(empty($value)) {
  239 + if(empty( $value )) {
234 240 return $value;
235 241 }
236 242 if(!preg_match('/^https?:\/{2}.*$/', $value)) {
... ...
console/migrations/m160325_085819_user_info_radio.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m160325_085819_user_info_radio extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->dropColumn('{{%user_info}}', 'contract');
  10 + $this->dropColumn('{{%user_info}}', 'estimate');
  11 + $this->dropColumn('{{%user_info}}', 'purchase');
  12 + $this->dropColumn('{{%user_info}}', 'delivery');
  13 + $this->addColumn('{{%user_info}}', 'contract', $this->string(50));
  14 + $this->addColumn('{{%user_info}}', 'estimate', $this->string(50));
  15 + $this->addColumn('{{%user_info}}', 'purchase', $this->string(50));
  16 + $this->addColumn('{{%user_info}}', 'delivery', $this->string(50));
  17 + }
  18 +
  19 + public function down()
  20 + {
  21 + $this->dropColumn('{{%user_info}}', 'contract');
  22 + $this->dropColumn('{{%user_info}}', 'estimate');
  23 + $this->dropColumn('{{%user_info}}', 'purchase');
  24 + $this->dropColumn('{{%user_info}}', 'delivery');
  25 + $this->addColumn('{{%user_info}}', 'contract', $this->smallInteger());
  26 + $this->addColumn('{{%user_info}}', 'estimate', $this->smallInteger());
  27 + $this->addColumn('{{%user_info}}', 'purchase', $this->smallInteger());
  28 + $this->addColumn('{{%user_info}}', 'delivery', $this->smallInteger());
  29 + }
  30 +}
... ...
frontend/views/accounts/employment.php
... ... @@ -208,9 +208,6 @@
208 208 $(
209 209 function()
210 210 {
211   - $(document).on('change', '.no-client-validation', function() {
212   - $(this).parent().find('.help-block').hide();
213   - });
214 211 var regexp = /^[\w]+\[(\d+)\].*$/;
215 212 var prevEmploy = $('.prev_job_inputs').length
216 213 if(prevEmploy < 1)
... ...
frontend/views/accounts/general.php
... ... @@ -98,7 +98,7 @@
98 98 <div class="input-blocks-wrapper">
99 99 <div class="input-blocks">
100 100 <?= $form->field($company_info, 'name', [ 'options' => [ 'class' => 'form-group company_info' ], 'enableClientValidation' => false ])
101   - ->textInput([ 'class' => 'custom-input-2' ]); ?>
  101 + ->textInput([ 'class' => 'custom-input-2 no-client-validation' ]); ?>
102 102 </div>
103 103 </div>
104 104 <div class="input-blocks-wrapper">
... ...
frontend/views/accounts/service.php
... ... @@ -149,83 +149,47 @@
149 149  
150 150 <div class="input-blocks-wrapper">
151 151 <div class="input-blocks">
152   - <?= $form->field($user_info, 'contract', [ 'options' => [ 'class' => 'form-inline' ] ])
153   - ->label('Работа по договору')
154   - ->radioList([
155   - 1 => 'Да',
156   - 0 => 'Нет',
157   - ], [
158   - 'item' => function($index, $label, $name, $checked, $value) {
159   - $return = '<div class="admin-who-check">';
160   - $return .= '<input class="custom-radio" id="select_admin_doc' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
161   - $return .= '<label for="select_admin_doc' . $value . '" >';
162   - $return .= '<span></span>' . ucwords($label);
163   - $return .= '</label>';
164   - $return .= '</div>';
165   - return $return;
166   - },
167   - ]) ?>
  152 + <?= $form->field($user_info, 'contract', [
  153 + 'template' => "{label}<br />{input}\n{hint}\n{error}",
  154 + 'options' => [ 'class' => 'form-inline' ],
  155 + ])
  156 + ->textInput([
  157 + 'class' => 'custom-input-2 custom-input-2-margin-r',
  158 + ]) ?>
168 159 </div>
169 160 </div>
170 161  
171 162 <div class="input-blocks-wrapper">
172 163 <div class="input-blocks">
173   - <?= $form->field($user_info, 'estimate', [ 'options' => [ 'class' => 'form-inline' ] ])
174   - ->label('Предоставляете смету')
175   - ->radioList([
176   - 1 => 'Да',
177   - 0 => 'Нет',
178   - ], [
179   - 'item' => function($index, $label, $name, $checked, $value) {
180   - $return = '<div class="admin-who-check">';
181   - $return .= '<input class="custom-radio" id="select_admin_estimate' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
182   - $return .= '<label for="select_admin_estimate' . $value . '" >';
183   - $return .= '<span></span>' . ucwords($label);
184   - $return .= '</label>';
185   - $return .= '</div>';
186   - return $return;
187   - },
  164 + <?= $form->field($user_info, 'estimate', [
  165 + 'template' => "{label}<br />{input}\n{hint}\n{error}",
  166 + 'options' => [ 'class' => 'form-inline' ],
  167 + ])
  168 + ->textInput([
  169 + 'class' => 'custom-input-2 custom-input-2-margin-r',
188 170 ]) ?>
189 171 </div>
190 172 </div>
191 173  
192 174 <div class="input-blocks-wrapper">
193 175 <div class="input-blocks">
194   - <?= $form->field($user_info, 'purchase', [ 'options' => [ 'class' => 'form-inline' ] ])
195   - ->label('Делаете сами закупку материалов')
196   - ->radioList([
197   - 1 => 'Да',
198   - 0 => 'Нет',
199   - ], [
200   - 'item' => function($index, $label, $name, $checked, $value) {
201   - $return = '<div class="admin-who-check">';
202   - $return .= '<input class="custom-radio" id="select_admin_purchase' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
203   - $return .= '<label for="select_admin_purchase' . $value . '" >';
204   - $return .= '<span></span>' . ucwords($label);
205   - $return .= '</label>';
206   - $return .= '</div>';
207   - return $return;
208   - },
  176 + <?= $form->field($user_info, 'purchase', [
  177 + 'template' => "{label}<br />{input}\n{hint}\n{error}",
  178 + 'options' => [ 'class' => 'form-inline' ],
  179 + ])
  180 + ->textInput([
  181 + 'class' => 'custom-input-2 custom-input-2-margin-r',
209 182 ]) ?>
210 183 </div>
211 184 </div>
212 185 <div class="input-blocks-wrapper">
213 186 <div class="input-blocks">
214   - <?= $form->field($user_info, 'delivery', [ 'options' => [ 'class' => 'form-inline' ] ])
215   - ->label('Занимаетесь сами доставкой материалов')
216   - ->radioList([
217   - 1 => 'Да',
218   - 0 => 'Нет',
219   - ], [
220   - 'item' => function($index, $label, $name, $checked, $value) {
221   - $return = '<div class="admin-who-check">';
222   - $return .= '<input class="custom-radio" id="select_admin_delivery' . $value . '" type="radio" name="' . $name . '" value="' . $value . '" ' . ( $checked ? "checked" : "" ) . ' >';
223   - $return .= '<label for="select_admin_delivery' . $value . '" >';
224   - $return .= '<span></span>' . ucwords($label);
225   - $return .= '</label>';
226   - $return .= '</div>';
227   - return $return;
228   - },
  187 + <?= $form->field($user_info, 'delivery', [
  188 + 'template' => "{label}<br />{input}\n{hint}\n{error}",
  189 + 'options' => [ 'class' => 'form-inline' ],
  190 + ])
  191 + ->textInput([
  192 + 'class' => 'custom-input-2 custom-input-2-margin-r',
229 193 ]) ?>
230 194 </div>
231 195 </div>
... ...
frontend/views/performer/common.php
... ... @@ -182,7 +182,7 @@
182 182 if(!empty( $user->userInfo->contract )) {
183 183 ?>
184 184 <li>
185   - <span>Договор: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->contract) ?>
  185 + <span>Договор: </span><?= $user->userInfo->contract ?>
186 186 </li>
187 187 <?php
188 188 }
... ... @@ -191,7 +191,7 @@
191 191 if(!empty( $user->userInfo->estimate )) {
192 192 ?>
193 193 <li>
194   - <span>Смета: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->estimate) ?>
  194 + <span>Смета: </span><?= $user->userInfo->estimate ?>
195 195 </li>
196 196 <?php
197 197 }
... ... @@ -200,7 +200,7 @@
200 200 if(!empty( $user->userInfo->purchase )) {
201 201 ?>
202 202 <li>
203   - <span>Закупка стройматериалов: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->purchase) ?>
  203 + <span>Закупка стройматериалов: </span><?= $user->userInfo->purchase ?>
204 204 </li>
205 205 <?php
206 206 }
... ... @@ -209,7 +209,7 @@
209 209 if(!empty( $user->userInfo->delivery )) {
210 210 ?>
211 211 <li>
212   - <span>Доставка стройматериалов: </span><?= \Yii::$app->formatter->asBoolean($user->userInfo->delivery) ?>
  212 + <span>Доставка стройматериалов: </span><?= $user->userInfo->delivery ?>
213 213 </li>
214 214 <?php
215 215 }
... ...
frontend/web/js/forms.js
... ... @@ -533,5 +533,11 @@ $(document).ready(
533 533 );
534 534 }
535 535  
  536 + // Remove error for no client validation fields
  537 + $(document).on('change', '.no-client-validation', function() {
  538 + console.log('debug');
  539 + $(this).parent().find('.help-block').hide();
  540 + });
  541 +
536 542 }
537 543 )
538 544 \ No newline at end of file
... ...