Blame view

frontend/views/accounts/_team_form.php 5.64 KB
eb7e82fb   Administrator   29.02.16
1
2
3
4
5
6
7
8
  <?php

      /**

       * @var Team     $team

       * @var string[] $department

       * @var string[] $country

       */

      use common\components\Request;

      use common\models\Team;

2293c233   Administrator   16.03.16
9
      use common\modules\file\widgets\ImageUploader;

eb7e82fb   Administrator   29.02.16
10
      use kartik\select2\Select2;

eb7e82fb   Administrator   29.02.16
11
      use yii\helpers\Html;

3568bee8   Yarik   test
12
      use yii\helpers\Url;

eb7e82fb   Administrator   29.02.16
13
14
15
16
17
18
19
20
21
      use yii\web\JsExpression;

      use yii\widgets\ActiveForm;

  

      $this->title = 'Команда';

      $this->params[ 'breadcrumbs' ][] = $this->title;

  ?>

  <div class="login-left-column-title"><?= $this->title ?></div>

  <div class="login-left-column-title-two style">Редактирование:</div>

  

816e328e   Yarik   test
22
23
24
  <?php

      $form = ActiveForm::begin();

  ?>

eb7e82fb   Administrator   29.02.16
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  

  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'lastname')

                   ->textInput([ 'class' => 'custom-input-2' ]) ?>

      </div>

  </div>

  

  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'firstname')

                   ->textInput([ 'class' => 'custom-input-2' ]) ?>

      </div>

  </div>

  

  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'middlename')

                   ->textInput([ 'class' => 'custom-input-2' ]) ?>

      </div>

  </div>

  

3568bee8   Yarik   test
47
48
49
50
51
52
53
  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'link')

                   ->hint('Пример: ' . $_SERVER[ 'HTTP_HOST' ] . '/performer/common/1')

                   ->textInput([ 'class' => 'custom-input-2' ]) ?>

      </div>

  </div>

eb7e82fb   Administrator   29.02.16
54
55
56
57
58
59
60
61
62
63
64
  

  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'position')

                   ->textInput([ 'class' => 'custom-input-2' ]) ?>

      </div>

  </div>

  

  <div class="input-blocks-wrapper admn-select-company">

      <div class="input-blocks">

          <?= $form->field($team, 'department_id')

816e328e   Yarik   test
65
                   ->dropDownList($department, [ 'prompt' => 'Выберите отдел' ]) ?>

eb7e82fb   Administrator   29.02.16
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
      </div>

  </div>

  

  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'experience_from', [ 'template' => "{label},<span style='font-weight: 700;font-size: 13px'>лет</span><br /><span class='admn-input-txt' style='margin-right: 10px'>с</span>{input}<span class='admn-input-txt' style='margin-left: 10px'>года</span> \n{hint}\n{error}" ])

                   ->textInput([

                       'class' => 'custom-input-2 custom-input-2-date',

                       'type'  => 'number',

                       'min'   => 1950,

                       'max'   => date('Y'),

                   ]) ?>

      </div>

  </div>

  

  <div class="input-blocks-wrapper">

      <div class="input-blocks">

          <?= $form->field($team, 'country_id')

                   ->widget(Select2::classname(), [

                       'options'       => [ 'placeholder' => 'Выбор страны ...' ],

                       'pluginOptions' => [

                           'allowClear'         => true,

                           'minimumInputLength' => 3,

                           'ajax'               => [

                               'url'      => \yii\helpers\Url::to([ 'site/country' ]),

                               'dataType' => 'json',

                               'data'     => new JsExpression('function(params) { return {q:params.term}; }'),

                           ],

                           'escapeMarkup'       => new JsExpression('function (markup) { return markup; }'),

                           'templateResult'     => new JsExpression('function(country) { return country.text; }'),

                           'templateSelection'  => new JsExpression('function (country) { return country.text; }'),

                       ],

                   ]); ?>

      </div>

  </div>

  

  <div class="input-blocks-wrapper admin-avatar amin-team-foto">

      <?= ImageUploader::widget([

816e328e   Yarik   test
104
          'remover' => true,

eb7e82fb   Administrator   29.02.16
105
106
          'model'   => $team,

          'field'   => 'photo',

816e328e   Yarik   test
107
          'size'    => [

eb7e82fb   Administrator   29.02.16
108
              [

816e328e   Yarik   test
109
110
111
                  'width'  => 100,

                  'height' => 100,

              ],

eb7e82fb   Administrator   29.02.16
112
113
114
115
116
117
118
119
120
          ],

          'multi'   => false,

          'gallery' => $team->photo,

          'name'    => 'Загрузить фото',

      ]); ?>

  </div>

  

  <div class="input-blocks-wrapper">

      <div class="admin-save-btn skills-save-btn admin-add-remove-wr style">

06ec2844   Administrator   28.03.16
121
          <?= Html::submitButton($team->isNewRecord ? Yii::t('app', 'add') : 'Обновить', [ 'class' => 'input-blocks-wrapper button' ]) ?>

eb7e82fb   Administrator   29.02.16
122
123
124
          <div class="admin-remove-note">

              <?php

                  if(!$team->isNewRecord) {

06ec2844   Administrator   28.03.16
125
                      echo Html::a(Yii::t('app', 'delete'), [

eb7e82fb   Administrator   29.02.16
126
127
128
                          'accounts/team-delete',

                          'id' => $team->team_id,

                      ], [

06ec2844   Administrator   28.03.16
129
130
131
                          'title'        => Yii::t('app', 'delete'),

                          'aria-label'   => Yii::t('app', 'delete'),

                          'data-confirm' =>  Yii::t('app', 'delete_confirm'),

eb7e82fb   Administrator   29.02.16
132
133
134
135
136
137
138
                          'data-method'  => 'post',

                          'data-pjax'    => 0,

                      ]);

                  }

              ?>

          </div>

          <div class="admin-back-note">

816e328e   Yarik   test
139
              <?= Html::a('вернуться', Request::getIsLocal(\Yii::$app->request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/team' ]) ?>

eb7e82fb   Administrator   29.02.16
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
          </div>

      </div>

  </div>

  

  <?php

      $form->end();

  ?>

  <script>

      $(document).ready(

          function()

          {

              $('.input-blocks-wrapper.admn-select-company select').change(

                  function()

                  {

                      $(this).blur()

                  }

              );

          }

      )

  </script>