Commit 8a7ade313b05d27420cb858695b9e10a4592e164

Authored by alex
1 parent 71755f79

Add new fields to customer table

backend/views/request/update.php
... ... @@ -51,7 +51,18 @@
51 51  
52 52 <?= $form->field($model, 'organization')
53 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 67 <?= $form->field($model, 'post_address')
57 68 ->textInput() ?>
... ... @@ -61,6 +72,10 @@
61 72 ->textInput() ?>
62 73 <?= $form->field($model, 'fax')
63 74 ->textInput() ?>
  75 + <?= $form->field($model, 'nationality')
  76 + ->textInput() ?>
  77 + <?= $form->field($model, 'country_from')
  78 + ->textInput() ?>
64 79 <?= $form->field($model, 'citizenship')
65 80 ->textInput() ?>
66 81 <?= $form->field($model, 'gender')
... ...
common/mail/request.php
... ... @@ -21,6 +21,11 @@
21 21 <td><?= $formatter->asText($model->organization) ?></td>
22 22 </tr>
23 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 29 <td><b>Официальный почтовый адресс</b> :</td>
25 30 <td><?= $formatter->asText($model->post_address) ?></td>
26 31 </tr>
... ... @@ -40,8 +45,18 @@
40 45 <td><b>Факс</b> :</td>
41 46 <td><?= $formatter->asText($model->fax) ?></td>
42 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 58 <tr>
44   - <td><b>Страна\организация</b> :</td>
  59 + <td><b>Организация</b> :</td>
45 60 <td><?= $formatter->asText($model->citizenship) ?></td>
46 61 </tr>
47 62 <tr>
... ...
common/messages/en/app.php
... ... @@ -7,7 +7,7 @@ return [
7 7 'Dignity' => 'Title',
8 8 'Gender' => 'Gender',
9 9 'Birth' => 'Date of birth',
10   - 'Citizenship' => 'Сountry/organization represented',
  10 + 'Citizenship' => 'Organization represented',
11 11 'Passport' => 'Series and passport number',
12 12 'Post address' => 'Official mailing address (for dispatch of documents)',
13 13 'Email' => 'E-mail',
... ... @@ -248,7 +248,16 @@ Direct link for booking: &lt;br /&gt;
248 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 8 'Dignity' => 'Le titre',
9 9 'Gender' => 'Devenir',
10 10 'Birth' => 'Date de naissance',
11   - 'Citizenship' => 'Pays / organisation representee',
  11 + 'Citizenship' => 'Organisation representee',
12 12 'Passport' => 'Série et numéro de passeport',
13 13 'Post address' => 'Adresse postale officielle (pour l\'envoi de documents)',
14 14 'Email' => 'E-mail',
... ... @@ -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 8 'Dignity' => 'Титул',
9 9 'Gender' => 'Пол',
10 10 'Birth' => 'Дата рождения',
11   - 'Citizenship' => 'Страна\организация',
  11 + 'Citizenship' => 'Oрганизация',
12 12 'Passport' => 'Серия и номер паспорта',
13 13 'Post address' => 'Официальный почтовый адресс (для отправки документов)',
14 14 'Email' => 'Е-мейл',
... ... @@ -222,4 +222,20 @@ ENERGYU)&lt;/strong&gt;&lt;/span&gt;
222 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 242 \ No newline at end of file
... ...
common/messages/ua/app.php
... ... @@ -8,7 +8,7 @@ return [
8 8 'Dignity' => 'Титул',
9 9 'Gender' => 'Стать',
10 10 'Birth' => 'Дата народження',
11   - 'Citizenship' => 'Країна/Організація',
  11 + 'Citizenship' => 'Організація',
12 12 'Passport' => 'Серія та номер паспорта',
13 13 'Post address' => 'Офіційна поштова адреса (для відправки документів)',
14 14 'Email' => 'Е-мейл',
... ... @@ -256,4 +256,44 @@ ENERGYU)&lt;/strong&gt;&lt;/span&gt;
256 256  
257 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 300 \ No newline at end of file
... ...
common/models/Customer.php
... ... @@ -45,6 +45,15 @@
45 45 * @property integer $working_lang
46 46 * @property string $post_address ==> официальный почтовый адрес
47 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 58 class Customer extends \yii\db\ActiveRecord
50 59 {
... ... @@ -53,18 +62,42 @@
53 62 public $acceptance;
54 63  
55 64 const ADMIN_SCENARIO = 'admin';
56   -
  65 +
  66 + #----------------------------------------------------------------------
  67 + # Текущий статус пользователя
  68 + #----------------------------------------------------------------------
57 69 const STATUS_NEW = 2;
58 70 const STATUS_ACTIVE = 1;
59 71 const STATUS_NO = 0;
60   -
  72 +
  73 + #----------------------------------------------------------------------
  74 + # Специальная еда
  75 + #----------------------------------------------------------------------
61 76 const MEAL_1 = 'Халяль';
62 77 const MEAL_2 = 'Кашрут';
63 78 const MEAL_3 = 'Вегитарианець';
64 79 const MEAL_NONE = 'Не выбрано';
65   -
  80 +
  81 +
  82 + #----------------------------------------------------------------------
  83 + # Пол
  84 + #----------------------------------------------------------------------
66 85 const MALE = '1';
67 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 102 * {@inheritdoc}
70 103 */
... ... @@ -145,6 +178,8 @@
145 178 'passport_date',
146 179 'passport_valid',
147 180 'post_address',
  181 + 'nationality',
  182 + 'country_from',
148 183 ],
149 184 'string',
150 185 'max' => 255,
... ... @@ -168,6 +203,14 @@
168 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 216 'gender',
... ... @@ -187,6 +230,9 @@
187 230 'phone_office',
188 231 'phone_other',
189 232 'need_visa',
  233 + 'nationality',
  234 + 'country_from',
  235 + 'work_status',
190 236 ],
191 237 'required',
192 238 ],
... ... @@ -266,7 +312,11 @@
266 312 'working_lang' => Yii::t('app', 'Working language'),
267 313 'special_meal' => Yii::t('app', 'Special meal'),
268 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 242 ->setTo(
243 243 [
244 244 // 'kennen.md@gmail.com',
245   -
  245 + 'alkhonko@gmail.com',
246 246 'energyforum@euromediacompany.com',
247 247 ]
248 248 )
... ...
frontend/views/site/signup.php
... ... @@ -39,6 +39,21 @@ $js=$dp-&gt;getDatepickerJs();
39 39 <div class="input-wr">
40 40 <?=$form->field($model, 'name')->textInput(['class' => ''])?>
41 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 57 <div class="input-wr">
43 58 <?=$form->field($model, 'organization')->textInput(['class' => ''])?>
44 59 </div>
... ... @@ -62,6 +77,12 @@ $js=$dp-&gt;getDatepickerJs();
62 77 <?=$form->field($model, 'fax')->textInput(['class' => ''])?>
63 78 </div>
64 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 86 <?php echo $form->field($model, 'citizenship')->textInput(['class' => ''])?>
66 87 </div>
67 88  
... ...