Commit 8a7ade313b05d27420cb858695b9e10a4592e164

Authored by alex
1 parent 71755f79

Add new fields to customer table

backend/views/request/update.php
@@ -51,7 +51,18 @@ @@ -51,7 +51,18 @@
51 51
52 <?= $form->field($model, 'organization') 52 <?= $form->field($model, 'organization')
53 ->textInput() ?> 53 ->textInput() ?>
54 - <?= $form->field($model, 'email') 54 + <?= $form->field($model, 'user_work_status')
  55 + ->dropDownList(
  56 + [
  57 + 0 => \Yii::t('app',$model::WORK_STATUS_0),
  58 + 1 => \Yii::t('app',$model::WORK_STATUS_1),
  59 + 2 => \Yii::t('app',$model::WORK_STATUS_2),
  60 + 3 => \Yii::t('app',$model::WORK_STATUS_3),
  61 + 4 => \Yii::t('app',$model::WORK_STATUS_4),
  62 +
  63 + ]
  64 + ) ?>
  65 + <?= $form->field($model, 'email')
55 ?> 66 ?>
56 <?= $form->field($model, 'post_address') 67 <?= $form->field($model, 'post_address')
57 ->textInput() ?> 68 ->textInput() ?>
@@ -61,6 +72,10 @@ @@ -61,6 +72,10 @@
61 ->textInput() ?> 72 ->textInput() ?>
62 <?= $form->field($model, 'fax') 73 <?= $form->field($model, 'fax')
63 ->textInput() ?> 74 ->textInput() ?>
  75 + <?= $form->field($model, 'nationality')
  76 + ->textInput() ?>
  77 + <?= $form->field($model, 'country_from')
  78 + ->textInput() ?>
64 <?= $form->field($model, 'citizenship') 79 <?= $form->field($model, 'citizenship')
65 ->textInput() ?> 80 ->textInput() ?>
66 <?= $form->field($model, 'gender') 81 <?= $form->field($model, 'gender')
common/mail/request.php
@@ -21,6 +21,11 @@ @@ -21,6 +21,11 @@
21 <td><?= $formatter->asText($model->organization) ?></td> 21 <td><?= $formatter->asText($model->organization) ?></td>
22 </tr> 22 </tr>
23 <tr> 23 <tr>
  24 + <td><b>Рабочий статус делегата:</b> :</td>
  25 + <td><?= $formatter->asText(\Yii::t('app',
  26 + $model::WORK_STATUS_.$model->user_work_status)) ?></td>
  27 + </tr>
  28 + <tr>
24 <td><b>Официальный почтовый адресс</b> :</td> 29 <td><b>Официальный почтовый адресс</b> :</td>
25 <td><?= $formatter->asText($model->post_address) ?></td> 30 <td><?= $formatter->asText($model->post_address) ?></td>
26 </tr> 31 </tr>
@@ -40,8 +45,18 @@ @@ -40,8 +45,18 @@
40 <td><b>Факс</b> :</td> 45 <td><b>Факс</b> :</td>
41 <td><?= $formatter->asText($model->fax) ?></td> 46 <td><?= $formatter->asText($model->fax) ?></td>
42 </tr> 47 </tr>
  48 +
  49 + <tr>
  50 + <td><b>Национальность</b> :</td>
  51 + <td><?= $formatter->asText($model->nationality) ?></td>
  52 + </tr>
  53 +
  54 + <tr>
  55 + <td><b>Страна</b> :</td>
  56 + <td><?= $formatter->asText($model->country_from) ?></td>
  57 + </tr>
43 <tr> 58 <tr>
44 - <td><b>Страна\организация</b> :</td> 59 + <td><b>Организация</b> :</td>
45 <td><?= $formatter->asText($model->citizenship) ?></td> 60 <td><?= $formatter->asText($model->citizenship) ?></td>
46 </tr> 61 </tr>
47 <tr> 62 <tr>
common/messages/en/app.php
@@ -7,7 +7,7 @@ return [ @@ -7,7 +7,7 @@ return [
7 'Dignity' => 'Title', 7 'Dignity' => 'Title',
8 'Gender' => 'Gender', 8 'Gender' => 'Gender',
9 'Birth' => 'Date of birth', 9 'Birth' => 'Date of birth',
10 - 'Citizenship' => 'Сountry/organization represented', 10 + 'Citizenship' => 'Organization represented',
11 'Passport' => 'Series and passport number', 11 'Passport' => 'Series and passport number',
12 'Post address' => 'Official mailing address (for dispatch of documents)', 12 'Post address' => 'Official mailing address (for dispatch of documents)',
13 'Email' => 'E-mail', 13 'Email' => 'E-mail',
@@ -248,7 +248,16 @@ Direct link for booking: &lt;br /&gt; @@ -248,7 +248,16 @@ Direct link for booking: &lt;br /&gt;
248 'DearMs' => 'Dear ', 248 'DearMs' => 'Dear ',
249 249
250 250
  251 + 'Nationality' => 'Nationality',
  252 + 'Country from' => 'Country',
  253 + 'Work status' => 'Delegate status:',
251 254
  255 + # customer ==> user_work_status
  256 + 'International organization' => 'International organization',
  257 + 'Official delegation' => 'Official delegation',
  258 + 'Non-government organization' => 'Non-government organization' ,
  259 + 'Expert' => 'Expert',
  260 + 'Press' => 'Press',
252 261
253 262
254 263
common/messages/fr/app.php
@@ -8,7 +8,7 @@ return [ @@ -8,7 +8,7 @@ return [
8 'Dignity' => 'Le titre', 8 'Dignity' => 'Le titre',
9 'Gender' => 'Devenir', 9 'Gender' => 'Devenir',
10 'Birth' => 'Date de naissance', 10 'Birth' => 'Date de naissance',
11 - 'Citizenship' => 'Pays / organisation representee', 11 + 'Citizenship' => 'Organisation representee',
12 'Passport' => 'Série et numéro de passeport', 12 'Passport' => 'Série et numéro de passeport',
13 'Post address' => 'Adresse postale officielle (pour l\'envoi de documents)', 13 'Post address' => 'Adresse postale officielle (pour l\'envoi de documents)',
14 'Email' => 'E-mail', 14 'Email' => 'E-mail',
@@ -228,8 +228,16 @@ Affaires&#39;, @@ -228,8 +228,16 @@ Affaires&#39;,
228 228
229 229
230 230
  231 + 'Nationality' => 'Nationalité',
  232 + 'Country from' => 'Le pays',
  233 + 'Work status' => 'Déléguer le statut',
231 234
232 - 235 +# customer ==> user_work_status
  236 + 'International organization' => 'Organisation internationale',
  237 + 'Official delegation' => 'Délégation officielle',
  238 + 'Non-government organization' => 'Organisation non gouvernementale',
  239 + 'Expert' => 'Expert',
  240 + 'Press' => 'La presse ',
233 241
234 242
235 243
common/messages/ru/app.php
@@ -8,7 +8,7 @@ return [ @@ -8,7 +8,7 @@ return [
8 'Dignity' => 'Титул', 8 'Dignity' => 'Титул',
9 'Gender' => 'Пол', 9 'Gender' => 'Пол',
10 'Birth' => 'Дата рождения', 10 'Birth' => 'Дата рождения',
11 - 'Citizenship' => 'Страна\организация', 11 + 'Citizenship' => 'Oрганизация',
12 'Passport' => 'Серия и номер паспорта', 12 'Passport' => 'Серия и номер паспорта',
13 'Post address' => 'Официальный почтовый адресс (для отправки документов)', 13 'Post address' => 'Официальный почтовый адресс (для отправки документов)',
14 'Email' => 'Е-мейл', 14 'Email' => 'Е-мейл',
@@ -222,4 +222,20 @@ ENERGYU)&lt;/strong&gt;&lt;/span&gt; @@ -222,4 +222,20 @@ ENERGYU)&lt;/strong&gt;&lt;/span&gt;
222 'DearMs' => 'Уважаемая', 222 'DearMs' => 'Уважаемая',
223 223
224 224
  225 +
  226 + 'Nationality' => 'Национальность',
  227 + 'Country from' => 'Страна',
  228 + 'Work status' => 'Статус делегата:',
  229 +
  230 + # customer ==> user_work_status
  231 + 'International organization' => 'Международная организация',
  232 + 'Official delegation' => 'Официальная организация',
  233 + 'Non-government organization' => 'Неправительственная организация',
  234 + 'Expert' => 'Эксперт',
  235 + 'Press' => 'Пресса',
  236 +
  237 +
  238 +
  239 +
  240 +
225 ]; 241 ];
226 \ No newline at end of file 242 \ No newline at end of file
common/messages/ua/app.php
@@ -8,7 +8,7 @@ return [ @@ -8,7 +8,7 @@ return [
8 'Dignity' => 'Титул', 8 'Dignity' => 'Титул',
9 'Gender' => 'Стать', 9 'Gender' => 'Стать',
10 'Birth' => 'Дата народження', 10 'Birth' => 'Дата народження',
11 - 'Citizenship' => 'Країна/Організація', 11 + 'Citizenship' => 'Організація',
12 'Passport' => 'Серія та номер паспорта', 12 'Passport' => 'Серія та номер паспорта',
13 'Post address' => 'Офіційна поштова адреса (для відправки документів)', 13 'Post address' => 'Офіційна поштова адреса (для відправки документів)',
14 'Email' => 'Е-мейл', 14 'Email' => 'Е-мейл',
@@ -256,4 +256,44 @@ ENERGYU)&lt;/strong&gt;&lt;/span&gt; @@ -256,4 +256,44 @@ ENERGYU)&lt;/strong&gt;&lt;/span&gt;
256 256
257 'studio-link' => 'Створення сайтів', 257 'studio-link' => 'Створення сайтів',
258 258
  259 +
  260 + 'Nationality' => 'Національність',
  261 + 'Country from' => 'Країна',
  262 + 'Work status' => 'Статус делегата:',
  263 +
  264 +# customer ==> user_work_status
  265 + 'International organization' => 'Міжнародна організація',
  266 + 'Official delegation' => 'Офіційна делегація',
  267 + 'Non-government organization' => 'Неурядова організація',
  268 + 'Expert' => 'Експерт',
  269 + 'Press' => 'Преса',
  270 +
  271 +
  272 +
  273 +
  274 +
  275 +
  276 +
  277 +
  278 +
  279 +
  280 +
  281 +
  282 +
  283 +
  284 +
  285 +
  286 +
  287 +
  288 +
  289 +
  290 +
  291 +
  292 +
  293 +
  294 +
  295 +
  296 +
  297 +
  298 +
259 ]; 299 ];
260 \ No newline at end of file 300 \ No newline at end of file
common/models/Customer.php
@@ -45,6 +45,15 @@ @@ -45,6 +45,15 @@
45 * @property integer $working_lang 45 * @property integer $working_lang
46 * @property string $post_address ==> официальный почтовый адрес 46 * @property string $post_address ==> официальный почтовый адрес
47 * @property integer $created_at 47 * @property integer $created_at
  48 + *
  49 + * -- from 19.09
  50 + * @property string $nationality
  51 + * @property string $country_from
  52 + * @property integer $user_work_status
  53 + *
  54 + *
  55 + *
  56 + *
48 */ 57 */
49 class Customer extends \yii\db\ActiveRecord 58 class Customer extends \yii\db\ActiveRecord
50 { 59 {
@@ -53,18 +62,42 @@ @@ -53,18 +62,42 @@
53 public $acceptance; 62 public $acceptance;
54 63
55 const ADMIN_SCENARIO = 'admin'; 64 const ADMIN_SCENARIO = 'admin';
56 - 65 +
  66 + #----------------------------------------------------------------------
  67 + # Текущий статус пользователя
  68 + #----------------------------------------------------------------------
57 const STATUS_NEW = 2; 69 const STATUS_NEW = 2;
58 const STATUS_ACTIVE = 1; 70 const STATUS_ACTIVE = 1;
59 const STATUS_NO = 0; 71 const STATUS_NO = 0;
60 - 72 +
  73 + #----------------------------------------------------------------------
  74 + # Специальная еда
  75 + #----------------------------------------------------------------------
61 const MEAL_1 = 'Халяль'; 76 const MEAL_1 = 'Халяль';
62 const MEAL_2 = 'Кашрут'; 77 const MEAL_2 = 'Кашрут';
63 const MEAL_3 = 'Вегитарианець'; 78 const MEAL_3 = 'Вегитарианець';
64 const MEAL_NONE = 'Не выбрано'; 79 const MEAL_NONE = 'Не выбрано';
65 - 80 +
  81 +
  82 + #----------------------------------------------------------------------
  83 + # Пол
  84 + #----------------------------------------------------------------------
66 const MALE = '1'; 85 const MALE = '1';
67 const FEMALE = '2'; 86 const FEMALE = '2';
  87 +
  88 +
  89 +
  90 + #----------------------------------------------------------------------
  91 + # Деловые статусы посетителя форума
  92 + #----------------------------------------------------------------------
  93 +
  94 + const WORK_STATUS_0 = 'International organization';
  95 + const WORK_STATUS_1 = 'Official delegation';
  96 + const WORK_STATUS_2 = 'Non-government organization';
  97 + const WORK_STATUS_3 = 'Expert';
  98 + const WORK_STATUS_4 = 'Press';
  99 +
  100 +
68 /** 101 /**
69 * {@inheritdoc} 102 * {@inheritdoc}
70 */ 103 */
@@ -145,6 +178,8 @@ @@ -145,6 +178,8 @@
145 'passport_date', 178 'passport_date',
146 'passport_valid', 179 'passport_valid',
147 'post_address', 180 'post_address',
  181 + 'nationality',
  182 + 'country_from',
148 ], 183 ],
149 'string', 184 'string',
150 'max' => 255, 185 'max' => 255,
@@ -168,6 +203,14 @@ @@ -168,6 +203,14 @@
168 self::FEMALE, 203 self::FEMALE,
169 ], 204 ],
170 ], 205 ],
  206 + [
  207 + [ 'user_work_status' ],
  208 + 'in',
  209 + 'range' => [
  210 + '0',
  211 + '4',
  212 + ],
  213 + ],
171 [ 214 [
172 [ 215 [
173 'gender', 216 'gender',
@@ -187,6 +230,9 @@ @@ -187,6 +230,9 @@
187 'phone_office', 230 'phone_office',
188 'phone_other', 231 'phone_other',
189 'need_visa', 232 'need_visa',
  233 + 'nationality',
  234 + 'country_from',
  235 + 'work_status',
190 ], 236 ],
191 'required', 237 'required',
192 ], 238 ],
@@ -266,7 +312,11 @@ @@ -266,7 +312,11 @@
266 'working_lang' => Yii::t('app', 'Working language'), 312 'working_lang' => Yii::t('app', 'Working language'),
267 'special_meal' => Yii::t('app', 'Special meal'), 313 'special_meal' => Yii::t('app', 'Special meal'),
268 'post_address' => Yii::t('app', 'Post address'), 314 'post_address' => Yii::t('app', 'Post address'),
269 - 315 +
  316 + 'nationality' => Yii::t('app', 'Nationality'),
  317 + 'country_from' => Yii::t('app', 'Country from'),
  318 + 'user_work_status' => Yii::t('app', 'Work status'),
  319 +
270 ]; 320 ];
271 } 321 }
272 322
console/migrations/m180919_092511_customer_add_new_fields.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +/**
  6 + * Class m180919_092511_customer_add_new_fields
  7 + */
  8 +class m180919_092511_customer_add_new_fields extends Migration
  9 +{
  10 +
  11 + public function up()
  12 + {
  13 + $this->addColumn(
  14 + 'customer',
  15 + 'nationality',
  16 + $this->string()->defaultValue(0) // не указано
  17 + );
  18 +
  19 + $this->addColumn(
  20 + 'customer',
  21 + 'country_from',
  22 + $this->string()
  23 + );
  24 +
  25 + $this->addColumn('customer','user_work_status',
  26 + $this->tinyInteger()
  27 + );
  28 +
  29 + $this->addCommentOnColumn('customer',
  30 + 'country_from',
  31 + 'Страна, откуда приедет юзер');
  32 +
  33 +
  34 +
  35 + }
  36 +
  37 + public function down()
  38 + {
  39 + $this->dropColumn('customer','nationality');
  40 + $this->dropColumn('customer','country_from');
  41 + $this->dropColumn('customer','user_work_status');
  42 +
  43 + }
  44 +}
frontend/controllers/SiteController.php
@@ -242,7 +242,7 @@ @@ -242,7 +242,7 @@
242 ->setTo( 242 ->setTo(
243 [ 243 [
244 // 'kennen.md@gmail.com', 244 // 'kennen.md@gmail.com',
245 - 245 + 'alkhonko@gmail.com',
246 'energyforum@euromediacompany.com', 246 'energyforum@euromediacompany.com',
247 ] 247 ]
248 ) 248 )
frontend/views/site/signup.php
@@ -39,6 +39,21 @@ $js=$dp-&gt;getDatepickerJs(); @@ -39,6 +39,21 @@ $js=$dp-&gt;getDatepickerJs();
39 <div class="input-wr"> 39 <div class="input-wr">
40 <?=$form->field($model, 'name')->textInput(['class' => ''])?> 40 <?=$form->field($model, 'name')->textInput(['class' => ''])?>
41 </div> 41 </div>
  42 + <div class="col-xs-12 col-sm-12 col-md-9 col-md-push-2 form-register-inputs-wr">
  43 +
  44 + <div class="input-wr">
  45 +
  46 + <?php echo $form->field($model, 'user_work_status')->dropDownList([
  47 + null => \Yii::t('app', 'Choose'),
  48 + 0 => \Yii::t('app', Customer::WORK_STATUS_0),
  49 + 1 => \Yii::t('app', Customer::WORK_STATUS_1),
  50 + 2 => \Yii::t('app', Customer::WORK_STATUS_2),
  51 + 3 => \Yii::t('app', Customer::WORK_STATUS_3),
  52 + 4 => \Yii::t('app', Customer::WORK_STATUS_4),
  53 + ],['class' => '','template' => '{input}{label}',])?>
  54 + </div>
  55 +
  56 + </div>
42 <div class="input-wr"> 57 <div class="input-wr">
43 <?=$form->field($model, 'organization')->textInput(['class' => ''])?> 58 <?=$form->field($model, 'organization')->textInput(['class' => ''])?>
44 </div> 59 </div>
@@ -62,6 +77,12 @@ $js=$dp-&gt;getDatepickerJs(); @@ -62,6 +77,12 @@ $js=$dp-&gt;getDatepickerJs();
62 <?=$form->field($model, 'fax')->textInput(['class' => ''])?> 77 <?=$form->field($model, 'fax')->textInput(['class' => ''])?>
63 </div> 78 </div>
64 <div class="input-wr"> 79 <div class="input-wr">
  80 + <?=$form->field($model, 'nationality')->textInput(['class' => ''])?>
  81 + </div>
  82 + <div class="input-wr">
  83 + <?=$form->field($model, 'country_from')->textInput(['class' => ''])?>
  84 + </div>
  85 + <div class="input-wr">
65 <?php echo $form->field($model, 'citizenship')->textInput(['class' => ''])?> 86 <?php echo $form->field($model, 'citizenship')->textInput(['class' => ''])?>
66 </div> 87 </div>
67 88