Blame view

frontend/views/site/registration.php 13.1 KB
9b69b051   Administrator   add Vitaliy's wid...
1
  <?php
143979c5   Yarik   test
2
3
4
5
      /**
       * @var $user      common\models\User
       * @var $user_info common\models\UserInfo
       */
f0f915df   Administrator   add Vitaliy's wid...
6
      use yii\captcha\Captcha;
143979c5   Yarik   test
7
8
      use yii\web\View;
      use yii\widgets\ActiveForm;
998611ce   Administrator   add Vitaliy's wid...
9
10
11
      use kartik\select2\Select2;
      use yii\web\JsExpression;
  
9b69b051   Administrator   add Vitaliy's wid...
12
  ?>
157bff4e   Виталий   tokar commit
13
14
15
16
17
18
  <div class="section-box content">
      <div class="section-box registration">
          <div class="box-wr">
              <div class="box-all">
                  <div class="registration-title style">Регистрация</div>
                  <div class="registration-form style">
be426331   Administrator   add Vitaliy's wid...
19
                      <?php $form = ActiveForm::begin(); ?>
157bff4e   Виталий   tokar commit
20
  
143979c5   Yarik   test
21
22
23
24
25
26
27
                      <div class="input-blocks-wrapper">
                          <div class="input-blocks">
                              <?= $form->field($model, 'username')
                                       ->textInput([ 'class' => 'custom-input-2' ]) ?>
                          </div>
                          <div class="input-blocks-help-wr">
                              <div class="input-blocks-help">Логин должен содержать не менее 3-х символов, начинаться с английской буквы и заканчиваться буквой или цифрой. Допускаются английские буквы, цифры и знаки 'тире', 'подчеркивание', 'точка'</div>
157bff4e   Виталий   tokar commit
28
                          </div>
143979c5   Yarik   test
29
                      </div>
157bff4e   Виталий   tokar commit
30
  
143979c5   Yarik   test
31
32
                      <div class="input-blocks-wrapper">
                          <div class="input-blocks">
157bff4e   Виталий   tokar commit
33
  
143979c5   Yarik   test
34
35
                              <?= $form->field($model, 'password')
                                       ->passwordInput([ 'class' => 'custom-input-2' ]) ?>
157bff4e   Виталий   tokar commit
36
  
157bff4e   Виталий   tokar commit
37
                          </div>
143979c5   Yarik   test
38
39
40
41
                          <div class="input-blocks-help-wr">
                              <div class="input-blocks-help">Пароль должен содержать не менее 6-ти символов.</div>
                          </div>
                      </div>
157bff4e   Виталий   tokar commit
42
  
143979c5   Yarik   test
43
44
45
46
47
48
49
                      <div class="input-blocks-wrapper">
                          <div class="input-blocks">
                              <?= $form->field($model, 'email')
                                       ->textInput([ 'class' => 'custom-input-2' ]) ?>
                          </div>
                          <div class="input-blocks-help-wr">
                              <div class="input-blocks-help">На этот адрес электронной почты будет отправлено уведомление о регистрации.</div>
157bff4e   Виталий   tokar commit
50
                          </div>
143979c5   Yarik   test
51
                      </div>
157bff4e   Виталий   tokar commit
52
  
143979c5   Yarik   test
53
54
55
56
                      <div class="who-you-are style">
                          <div class="who-you-are-title style">Кто Вы</div>
                          <div class="who-you-are-form-wr style">
                              <div class="who-you-are-form">
f0f915df   Administrator   add Vitaliy's wid...
57
  
143979c5   Yarik   test
58
59
                                  <div class="register-val-company">
                                      <?php
62fd6713   Виталий   tokar commit
60
                                          $model->type = '1';
143979c5   Yarik   test
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
                                          echo $form->field($model, 'type', [ 'options' => [ 'class' => 'check-radio-wr' ] ])
                                                    ->label(false)
                                                    ->radioList([
                                                        1 => 'Частное лицо',
                                                        2 => 'Компания',
                                                    ], [
                                                        'item' => function($index, $label, $name, $checked, $value) {
                                                            $return = '<div class="custom-form-buttons">';
                                                            $return .= '<input class="custom-radio" id="custom-radio-' . $value . '" ' . ( $checked ? "checked" : "" ) . ' type="radio" name="' . $name . '" value="' . $value . '" >';
                                                            $return .= '<label for="custom-radio-' . $value . '" ><span></span>' . $label . '</label>';
                                                            $return .= '</div>';
                                                            return $return;
                                                        },
                                                    ]);
                                      ?>
                                  </div>
998611ce   Administrator   add Vitaliy's wid...
77
  
143979c5   Yarik   test
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
                                  <div class="check-radio-wr">
                                      <?= $form->field($model, 'is_freelancer', [
                                          'template' => "{input}\n{label}\n{error}",
                                          'options'  => [ 'class' => 'custom-form-buttons' ],
                                      ])
                                               ->label('<span></span>Я - Фрилансер')
                                               ->checkbox([
                                                   'class' => 'custom-check',
                                               ], false); ?>
  
                                      <?= $form->field($model, 'is_customer', [
                                          'template' => "{input}\n{label}\n{error}",
                                          'options'  => [ 'class' => 'custom-form-buttons' ],
                                      ])
                                               ->label('<span></span>Я - Заказчик')
                                               ->checkbox([
                                                   'class' => 'custom-check',
                                               ], false); ?>
                                  </div>
157bff4e   Виталий   tokar commit
97
  
143979c5   Yarik   test
98
99
100
101
102
                                  <div id="register-company-block-target"></div>
                                  <div class="input-blocks-wrapper register-company-block">
                                      <div class="input-blocks">
                                          <?= $form->field($model, 'name')
                                                   ->textInput([ 'class' => 'custom-input-2' ]) ?>
7e6d3f52   Administrator   24.02.16
103
                                      </div>
143979c5   Yarik   test
104
                                  </div>
7e6d3f52   Administrator   24.02.16
105
  
143979c5   Yarik   test
106
107
108
109
                                  <div class="input-blocks-wrapper">
                                      <div class="input-blocks">
                                          <?= $form->field($model, 'firstname')
                                                   ->textInput([ 'class' => 'custom-input-2' ]) ?>
157bff4e   Виталий   tokar commit
110
                                      </div>
143979c5   Yarik   test
111
112
113
114
115
                                  </div>
                                  <div class="input-blocks-wrapper">
                                      <div class="input-blocks">
                                          <?= $form->field($model, 'lastname')
                                                   ->textInput([ 'class' => 'custom-input-2' ]) ?>
157bff4e   Виталий   tokar commit
116
                                      </div>
143979c5   Yarik   test
117
118
119
                                  </div>
                                  <div class="input-blocks-wrapper">
                                      <div class="input-blocks">
3735dff7   Yarik   test
120
121
122
123
                                          <?= $form->field($model, 'city', [
                                              'enableClientValidation' => false,
                                              'options'                => [ 'class' => 'required-no-star' ],
                                          ])
143979c5   Yarik   test
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
                                                   ->widget(Select2::classname(), [
                                                       'options'       => [ 'placeholder' => 'Выбор города ...' ],
                                                       'pluginOptions' => [
                                                           'allowClear'         => true,
                                                           'minimumInputLength' => 3,
                                                           'ajax'               => [
                                                               'url'      => \yii\helpers\Url::to([ 'site/city' ]),
                                                               'dataType' => 'json',
                                                               'data'     => new JsExpression('function(params) { return {q:params.term}; }'),
                                                           ],
                                                           'escapeMarkup'       => new JsExpression('function (markup) { return markup; }'),
                                                           'templateResult'     => new JsExpression('function(city) { return city.text; }'),
                                                           'templateSelection'  => new JsExpression('function (city) { return city.text; }'),
                                                       ],
                                                   ]); ?>
fe41f4ed   Виталий   tokar commit
139
                                      </div>
143979c5   Yarik   test
140
                                  </div>
998611ce   Administrator   add Vitaliy's wid...
141
142
  
  
143979c5   Yarik   test
143
144
145
146
147
148
149
150
151
152
153
                                  <div class="input-blocks-wrapper city-two">
                                      <?= $form->field($model, 'city_custom', [ 'options' => [ 'class' => 'input-blocks' ] ])
                                               ->label('Город не в списке')
                                               ->textInput([ 'class' => 'custom-input-2' ]) ?>
                                      <div class="form-help-two">Если вашего города нет в списке, введите его.</div>
                                  </div>
                                  <div class="input-blocks-wrapper captcha-wr">
                                      <?= $form->field($model, 'verifyCode')
                                               ->widget(Captcha::className(), [
                                                   'options'  => [ 'class' => 'custom-input-2' ],
                                                   'template' => '
fe41f4ed   Виталий   tokar commit
154
155
156
157
                                                          <div class="input-blocks-wrapper captcha">
                                                              <div class="input-blocks-captcha">
                                                                  {image}
                                                              </div>
f0f915df   Administrator   add Vitaliy's wid...
158
                                                          </div>
fe41f4ed   Виталий   tokar commit
159
160
161
162
163
                                                          <div class="input-blocks-wrapper">
                                                              <div class="input-blocks">
                                                                  <label for="signupform-verifycode">Введите проверочный код</label>
                                                                  {input}
                                                              </div>
f0f915df   Administrator   add Vitaliy's wid...
164
                                                          </div>
fe41f4ed   Виталий   tokar commit
165
                                                          ',
143979c5   Yarik   test
166
167
168
169
170
                                               ])
                                               ->label(false) ?>
                                  </div>
                                  <div class="input-blocks-wrapper button">
                                      <button type="submit" value="Submit">Зарегистрироваться</button>
157bff4e   Виталий   tokar commit
171
172
173
                                  </div>
                              </div>
                          </div>
143979c5   Yarik   test
174
                      </div>
157bff4e   Виталий   tokar commit
175
  
143979c5   Yarik   test
176
                      <?php ActiveForm::end() ?>
157bff4e   Виталий   tokar commit
177
178
179
180
181
                  </div>
              </div>
          </div>
      </div>
  
62fd6713   Виталий   tokar commit
182
  </div>
808969ba   Administrator   01.03.16
183
  <?php
143979c5   Yarik   test
184
      $js = "
808969ba   Administrator   01.03.16
185
186
187
188
189
190
191
      var labelName= $('.field-signupform-firstname label').text()
      var labelLastName= $('.field-signupform-lastname label').text()
      var newLabelName= 'представителя'
  
      var registerValCompany =  $('.register-val-company .custom-radio:checked').attr('value');
      var regHideBlock = $('.register-company-block .form-group');
      if(registerValCompany==1) {
939c12c6   Виталий   tokar commit
192
193
         $('.field-signupform-firstname label').html(labelName)
         $('.field-signupform-lastname label').html(labelLastName)
3dc20ff7   Administrator   24.02.16
194
         $('.register-company-block').css('display', 'none');
808969ba   Administrator   01.03.16
195
196
197
         $('#w0').yiiActiveForm('remove','signupform-name');
      }
      $('.register-val-company .custom-radio').change(function(){
3dc20ff7   Administrator   24.02.16
198
         var newRegisterValCompany = +$(this).attr('value');
62fd6713   Виталий   tokar commit
199
         if(newRegisterValCompany==1){
3dc20ff7   Administrator   24.02.16
200
             //human
939c12c6   Виталий   tokar commit
201
202
                 $('.field-signupform-firstname label').html(labelName)
                 $('.field-signupform-lastname label').html(labelLastName)
3dc20ff7   Administrator   24.02.16
203
                  $('.register-company-block').css('display', 'none');
808969ba   Administrator   01.03.16
204
                  $('#w0').yiiActiveForm('remove','signupform-name');
62fd6713   Виталий   tokar commit
205
         } else {
3dc20ff7   Administrator   24.02.16
206
             //company
939c12c6   Виталий   tokar commit
207
208
                 $('.field-signupform-firstname label').html(labelName+' '+newLabelName)
                 $('.field-signupform-lastname label').html(labelLastName+' '+newLabelName)
3dc20ff7   Administrator   24.02.16
209
                 $('.register-company-block').css('display', 'block');
808969ba   Administrator   01.03.16
210
211
212
213
214
215
216
217
218
                 $('#w0').yiiActiveForm('add', {
                     'container': '.field-signupform-name',
                     'error': '.help-block',
                     'id': 'signupform-name',
                     'input': '#signupform-name',
                     'name': 'name',
                     validate: function (attribute, value, messages, deferred, \$form) {yii.validation.required(value, messages, {'message':'Необходимо заполнить «Название компании».'});}
  
                 });
62fd6713   Виталий   tokar commit
219
220
         }
  
808969ba   Administrator   01.03.16
221
222
223
      })
  ";
  
143979c5   Yarik   test
224
      $this->registerJS($js);
808969ba   Administrator   01.03.16
225
  ?>
62fd6713   Виталий   tokar commit