Blame view

frontend/views/accounts/_portfolio_form.php 12.8 KB
eb7e82fb   Administrator   29.02.16
1
2
  <?php

      /**

2f324895   Yarik   test
3
4
5
6
7
8
       * @var View            $this

       * @var Portfolio       $portfolio

       * @var integer[]       $specializations

       * @var string[]        $galleries

       * @var PortfolioUser[] $portfolioUsers

       * @var PortfolioUser[] $portfolioUsersConfirmed

eb7e82fb   Administrator   29.02.16
9
10
11
12
       */

      use common\components\Request;

      use common\models\Option;

      use common\models\Portfolio;

2f324895   Yarik   test
13
      use common\models\PortfolioUser;

eb7e82fb   Administrator   29.02.16
14
      use common\models\Specialization;

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

fdc1c9de   Yarik   test
16
17
      use common\modules\file\widgets\ImageUploaderInput;

      use mihaildev\ckeditor\CKEditor;

eb7e82fb   Administrator   29.02.16
18
19
      use yii\helpers\ArrayHelper;

      use yii\helpers\Html;

fdc1c9de   Yarik   test
20
      use yii\web\View;

eb7e82fb   Administrator   29.02.16
21
22
23
24
25
26
27
      use yii\widgets\ActiveForm;

      use \common\widgets\MultiLangForm;

      use kartik\select2\Select2;

      use yii\web\JsExpression;

  

      $this->title = 'Портфолио';

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

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

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

  

  <?php

      $form = ActiveForm::begin();

  ?>

  <div class="input-blocks-wrapper full-blocks data-block">

      <?= !empty( $portfolio->date_add ) ? "Дата создания: $portfolio->date_add" : "" ?>

  

  </div>

  <div class="style">

  

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

          <div class="input-blocks">

              <?= $form->field($portfolio, 'name')

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

          </div>

      </div>

  

9fd076e8   Administrator   01.03.16
47
  

eb7e82fb   Administrator   29.02.16
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
      <div class="input-blocks-wrapper admin-menu-list">

          <div class="input-blocks" style="width: 100%; margin-bottom: 5px">

              <label>Специализации</label>

              <div class="required"></div>

          </div>

  

          <div class="style">

              <ul class="content-menu-first">

                  <?php foreach($specializations as $specialization): ?>

                      <li data-img="<?= $specialization->image ?>">

                          <span data-menu-bg="<?= $specialization->background ?>" style="background: <?= $specialization->background ?>"></span><a href="#"><?= $specialization->specialization_name ?></a>

                          <ul>

                              <?php foreach($specialization->children as $child_first): ?>

  

                                  <?php if($child_first instanceof Specialization): ?>

                                      <li>

                                          <a href="#"><?= $child_first->specialization_name ?></a>

                                          <ul>

                                              <?php foreach($child_first->children as $child_second): ?>

                                                  <?php if($child_first instanceof Specialization): ?>

                                                      <li>

                                                          <a href="#" title="<?= $child_second->specialization_name ?>">

                                                              <?= $form->field($portfolio, "specializationInput[{$child_second->specialization_id}]", [

fdc1c9de   Yarik   test
71
                                                                  'template' => '{input}{label}{hint}{error}',

eb7e82fb   Administrator   29.02.16
72
                                                              ])

fdc1c9de   Yarik   test
73
74
75
76
77
78
79
                                                                       ->label('<span></span>' . $child_second->specialization_name)

                                                                       ->checkbox([

                                                                           'value'   => $child_second->specialization_id,

                                                                           'label'   => NULL,

                                                                           'uncheck' => NULL,

                                                                           'class'   => 'custom-check',

                                                                       ], false) ?>

eb7e82fb   Administrator   29.02.16
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
                                                          </a>

                                                      </li>

                                                  <?php endif; ?>

                                              <?php endforeach; ?>

                                          </ul>

                                      </li>

                                  <?php endif; ?>

                              <?php endforeach; ?>

  

                          </ul>

                      </li>

                  <?php endforeach; ?>

              </ul>

          </div>

  

          <div class="style admn-menu-err">

              <div class="help-block">Необходимо выбрать хотя бы одну «специализацию».</div>

          </div>

      </div>

  

fdc1c9de   Yarik   test
100
101
102
      <div class="admin-specialization-selected style">

          <ul></ul>

      </div>

eb7e82fb   Administrator   29.02.16
103
104
105
  

      <div class="input-blocks-wrapper admin-avatar admin-blog-min-img admin-portfolio-foto">

          <div style="font-size: 13px;color: inherit;font-weight: 700;">Фото главное</div>

fdc1c9de   Yarik   test
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
          <?= $form->field($portfolio, 'cover')

                   ->widget(ImageUploaderInput::className(), [

                       'size'    => [

                           [

                               'width'  => 720,

                               'height' => 280,

                           ],

                           [

                               'width'  => 318,

                               'height' => 228,

                           ],

                           [

                               'width'  => 152,

                               'height' => 108,

                           ],

                           [

                               'width'  => 210,

                               'height' => 150,

                           ],

                       ],

                       'multi'   => false,

                       'gallery' => $portfolio->cover,

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

                   ]); ?>

eb7e82fb   Administrator   29.02.16
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
      </div>

  

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

          <div class="input-blocks admin-project-list admin-currency-second admin-portfolio-select">

              <?= $form->field($portfolio, 'gallery_id')

                       ->hint("<p>Для создания галереи перейдите по " . Html::a('ссылке', [ 'accounts/gallery-create' ], [ 'target' => '_BLANK' ]) . "</p>")

                       ->dropDownList($galleries, [ 'prompt' => 'Выберите галерею' ]) ?>

          </div>

      </div>

  

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

          <div class="input-blocks">

              <?= $form->field($portfolio, 'city')

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

                           'options'       => [ 'class' => 'Выбор города ...' ],

                           '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; }'),

                           ],

                       ]); ?>

  

          </div>

  

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

              <?= $form->field($portfolio, 'street', [ 'options' => [ 'class' => 'form-group company_info' ] ])

                       ->label('Улица')

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

          </div>

  

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

              <?= $form->field($portfolio, 'house', [ 'options' => [ 'class' => 'form-group company_info' ] ])

                       ->label('Дом')

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

          </div>

      </div>

  

      <div class="input-blocks-wrapper full-blocks admin-editor-bl">

          <div class="input-blocks">

              <?= $form->field($portfolio, 'preview')

                       ->widget(CKEditor::className(), [ 'editorOptions' => [ 'preset' => 'basic' ] ]) ?>

          </div>

      </div>

  

      <div class="input-blocks-wrapper full-blocks admin-editor-bl">

          <div class="input-blocks">

              <?= $form->field($portfolio, 'description')

                       ->widget(CKEditor::className()) ?>

          </div>

      </div>

  

fdc1c9de   Yarik   test
188
189
      <div class="clearfix"></div>

  

3ddcc442   Yarik   test
190
      <?php

2f324895   Yarik   test
191
          /* == Project add user block == */

3ddcc442   Yarik   test
192
      ?>

fdc1c9de   Yarik   test
193
194
195
      <div class="add_project_user_wrapper" id="<?= $form->id ?>_project_user">

          <p>Добавить пользователя</p>

          <p><?= Html::a('Добавить', false, [ 'class' => 'add_project_user_link' ]) ?></p>

2f324895   Yarik   test
196
          <p>Отправлено предложение:</p>

fdc1c9de   Yarik   test
197
198
199
          <div class="add_project_user_list">

              <?php

                  foreach($portfolioUsers as $portfolioUser) {

2f324895   Yarik   test
200
201
202
203
204
                      echo $this->render('@frontend/views/ajax/project_user', [

                          'model' => $portfolioUser,

                          'user'  => $portfolioUser->user,

                      ]);

                  }

fdc1c9de   Yarik   test
205
206
              ?>

          </div>

2f324895   Yarik   test
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
          <?php

              if(!empty( $portfolioUsersConfirmed )) {

                  ?>

                  <p class="added_project_user_header">Подтвержденные:</p>

                  <div class="added_project_user_list">

                      <?php

                          foreach($portfolioUsersConfirmed as $portfolioUserConfirmed) {

                              echo $this->render('@frontend/views/ajax/project_user', [

                                  'model' => $portfolioUserConfirmed,

                                  'user'  => $portfolioUserConfirmed->user,

                              ]);

                          }

                      ?>

                  </div>

                  <?php

              }

          ?>

fdc1c9de   Yarik   test
224
      </div>

3ddcc442   Yarik   test
225
      <?php

2f324895   Yarik   test
226
          /* == End of project add user block == */

3ddcc442   Yarik   test
227
      ?>

fdc1c9de   Yarik   test
228
  

eb7e82fb   Administrator   29.02.16
229
230
231
232
  </div>

  

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

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

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

eb7e82fb   Administrator   29.02.16
234
235
236
          <div class="admin-remove-note">

              <?php

                  if(!$portfolio->isNewRecord) {

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

eb7e82fb   Administrator   29.02.16
238
239
240
                          'accounts/portfolio-delete',

                          'id' => $portfolio->portfolio_id,

                      ], [

06ec2844   Administrator   28.03.16
241
242
                          'title'        => Yii::t('app', 'delete'),

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

fdc1c9de   Yarik   test
243
                          'data-confirm' => Yii::t('app', 'delete_confirm'),

eb7e82fb   Administrator   29.02.16
244
245
246
247
248
249
250
251
                          'data-method'  => 'post',

                          'data-pjax'    => 0,

                      ]);

                  }

              ?>

          </div>

  

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

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

eb7e82fb   Administrator   29.02.16
253
254
255
256
257
258
259
260
261
262
263
          </div>

      </div>

  </div>

  <?php

      $form->end();

  ?>

  <script>

      $(document).ready(

          function()

          {

              bottomButton()

fdc1c9de   Yarik   test
264
265
266
267
              function bottomButton()

              {

                  if(($('.admin-portfolio-foto .admin-avatar-pattern img').length) > 0)

                  {

eb7e82fb   Administrator   29.02.16
268
  

fdc1c9de   Yarik   test
269
270
271
                  } else

                  {

                      $('.admin-portfolio-foto .tst').css({marginBottom : 0})

eb7e82fb   Administrator   29.02.16
272
273
                  }

              }

2293c233   Administrator   16.03.16
274
  

fdc1c9de   Yarik   test
275
276
277
278
279
280
              $('body').on(

                  'click', '.admin-portfolio-foto #cover_remove_img', function()

                  {

                      bottomButton()

                  }

              )

2293c233   Administrator   16.03.16
281
  

fdc1c9de   Yarik   test
282
283
284
285
286
287
288
289
290
291
292
293
              $('#portfolio-gallery_id').change(

                  function()

                  {

                      var gallery_id = $(this).val();

                      $.post(

                          "/accounts/gallery-cover", {gallery_id : gallery_id}, function(data)

                          {

                              if(!($('#cover_old_img').val().length))

                              {

                                  $('#cover_picture_link').val(data);

                                  var newimg = document.createElement("img");

                                  newimg.setAttribute("src", data);

2293c233   Administrator   16.03.16
294
  

fdc1c9de   Yarik   test
295
296
297
298
299
300
301
302
                                  $('#cover_img_block .admin-avatar-pattern').append(newimg);

                              }

                          }

                      );

                  }

              );

          }

      );

eb7e82fb   Administrator   29.02.16
303
  </script>