Blame view

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

c7971bf4   Виталий   git
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  /**

   * @var View            $this

   * @var Portfolio       $portfolio

   * @var integer[]       $specializations

   * @var string[]        $galleries

   * @var PortfolioUser[] $portfolioUsers

   * @var PortfolioUser[] $portfolioUsersConfirmed

   */

  use common\components\Request;

  use common\models\Option;

  use common\models\Portfolio;

  use common\models\PortfolioUser;

  use common\models\Specialization;

  use common\modules\file\widgets\ImageUploader;

  use common\modules\file\widgets\ImageUploaderInput;

  use mihaildev\ckeditor\CKEditor;

  use yii\helpers\ArrayHelper;

  use yii\helpers\Html;

  use yii\web\View;

  use yii\widgets\ActiveForm;

  use \common\widgets\MultiLangForm;

  use kartik\select2\Select2;

  use yii\web\JsExpression;

eb7e82fb   Administrator   29.02.16
25
  

c7971bf4   Виталий   git
26
27
  $this->title = 'Портфолио';

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

eb7e82fb   Administrator   29.02.16
28
29
30
31
  ?>

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

  

  <?php

c7971bf4   Виталий   git
32
  $form = ActiveForm::begin();

eb7e82fb   Administrator   29.02.16
33
34
35
36
37
38
39
40
41
42
  ?>

  <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')

c7971bf4   Виталий   git
43
                  ->textInput([ 'class' => 'custom-input-2 fix-input-2' ]); ?>

eb7e82fb   Administrator   29.02.16
44
45
46
          </div>

      </div>

  

9fd076e8   Administrator   01.03.16
47
  

eb7e82fb   Administrator   29.02.16
48
49
      <div class="input-blocks-wrapper admin-menu-list">

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

8ab566d4   Виталий   git
50
51
52
              <div class="required">

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

              </div>

eb7e82fb   Administrator   29.02.16
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
          </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
72
                                                                  'template' => '{input}{label}{hint}{error}',

eb7e82fb   Administrator   29.02.16
73
                                                              ])

c7971bf4   Виталий   git
74
75
76
77
78
79
80
                                                                  ->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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
                                                          </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
101
102
103
      <div class="admin-specialization-selected style">

          <ul></ul>

      </div>

eb7e82fb   Administrator   29.02.16
104
  

f0a961be   Yarik   test
105
106
      <div class="input-blocks-wrapper input-blocks admin-avatar admin-blog-min-img admin-portfolio-foto" style="width: 100%">

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

fdc1c9de   Yarik   test
107
          <?= $form->field($portfolio, 'cover')

c7971bf4   Виталий   git
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
              ->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'    => 'Загрузить фото',

2f410996   Виталий   git
130
131
132
              ])

           ->label(false)

           ?>

eb7e82fb   Administrator   29.02.16
133
134
135
136
137
      </div>

  

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

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

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

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

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

eb7e82fb   Administrator   29.02.16
140
141
142
143
144
145
          </div>

      </div>

  

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

          <div class="input-blocks">

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

c7971bf4   Виталий   git
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
                  ->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; }'),

                      ],

                  ]); ?>

eb7e82fb   Administrator   29.02.16
161
162
163
164
165
  

          </div>

  

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

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

c7971bf4   Виталий   git
166
167
                  ->label('Улица')

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

eb7e82fb   Administrator   29.02.16
168
169
170
171
          </div>

  

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

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

c7971bf4   Виталий   git
172
173
                  ->label('Дом')

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

eb7e82fb   Administrator   29.02.16
174
175
176
177
178
179
          </div>

      </div>

  

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

          <div class="input-blocks">

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

c7971bf4   Виталий   git
180
                  ->widget(CKEditor::className(), [ 'editorOptions' => [ 'preset' => 'basic' ] ]) ?>

eb7e82fb   Administrator   29.02.16
181
182
183
184
185
186
          </div>

      </div>

  

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

          <div class="input-blocks">

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

c7971bf4   Виталий   git
187
                  ->widget(CKEditor::className()) ?>

eb7e82fb   Administrator   29.02.16
188
189
190
          </div>

      </div>

  

fdc1c9de   Yarik   test
191
192
      <div class="clearfix"></div>

  

3ddcc442   Yarik   test
193
      <?php

c7971bf4   Виталий   git
194
      /* == Project add user block == */

3ddcc442   Yarik   test
195
      ?>

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

c7971bf4   Виталий   git
197
198
199
200
          <div class="style add_participant-wr">Добавить участника(ов) проекта</div>

          <div class="style" style="margin-top: 10px"><?= Html::a('Добавить', false, [ 'class' => 'add_project_user_link add-participant' ]) ?></div>

          <div class="hidden_sentence style" style="display: none">Отправленные предложения:</div>

          <div class="add_project_user_list style">

fdc1c9de   Yarik   test
201
              <?php

c7971bf4   Виталий   git
202
203
204
205
206
207
              foreach($portfolioUsers as $portfolioUser) {

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

                      'model' => $portfolioUser,

                      'user'  => $portfolioUser->user,

                  ]);

              }

fdc1c9de   Yarik   test
208
209
              ?>

          </div>

2f324895   Yarik   test
210
          <?php

c7971bf4   Виталий   git
211
212
213
214
          if(!empty( $portfolioUsersConfirmed )) {

              ?>

              <div class="added_project_user_header _hidden_sentence style">Подтвержденные предложения:</div>

              <div class="added_project_user_list">

2f324895   Yarik   test
215
                  <?php

c7971bf4   Виталий   git
216
217
218
219
220
221
222
223
224
225
                  foreach($portfolioUsersConfirmed as $portfolioUserConfirmed) {

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

                          'model' => $portfolioUserConfirmed,

                          'user'  => $portfolioUserConfirmed->user,

                      ]);

                  }

                  ?>

              </div>

              <?php

          }

2f324895   Yarik   test
226
          ?>

fdc1c9de   Yarik   test
227
      </div>

3ddcc442   Yarik   test
228
      <?php

c7971bf4   Виталий   git
229
      /* == End of project add user block == */

3ddcc442   Yarik   test
230
      ?>

fdc1c9de   Yarik   test
231
  

eb7e82fb   Administrator   29.02.16
232
233
234
235
  </div>

  

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

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

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

eb7e82fb   Administrator   29.02.16
237
238
          <div class="admin-remove-note">

              <?php

c7971bf4   Виталий   git
239
240
241
242
243
244
245
246
247
248
249
250
              if(!$portfolio->isNewRecord) {

                  echo Html::a(Yii::t('app', 'delete'), [

                      'accounts/portfolio-delete',

                      'id' => $portfolio->portfolio_id,

                  ], [

                      'title'        => Yii::t('app', 'delete'),

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

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

                      'data-method'  => 'post',

                      'data-pjax'    => 0,

                  ]);

              }

eb7e82fb   Administrator   29.02.16
251
252
253
254
              ?>

          </div>

  

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

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

eb7e82fb   Administrator   29.02.16
256
257
258
259
          </div>

      </div>

  </div>

  <?php

c7971bf4   Виталий   git
260
  $form->end();

eb7e82fb   Administrator   29.02.16
261
262
263
  ?>

  <script>

      $(document).ready(

c7971bf4   Виталий   git
264
          function() {

eb7e82fb   Administrator   29.02.16
265
              bottomButton()

fdc1c9de   Yarik   test
266
267
268
269
              function bottomButton()

              {

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

                  {

eb7e82fb   Administrator   29.02.16
270
  

fdc1c9de   Yarik   test
271
272
273
                  } else

                  {

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

eb7e82fb   Administrator   29.02.16
274
275
                  }

              }

2293c233   Administrator   16.03.16
276
  

fdc1c9de   Yarik   test
277
278
279
280
281
282
              $('body').on(

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

                  {

                      bottomButton()

                  }

              )

2293c233   Administrator   16.03.16
283
  

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

                  function()

                  {

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

                      $.post(

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

                          {

236a608c   Yarik   test
291
                              if(data.length && !($('#cover_old_img').val().length) && !($('#portfolio-cover').val().length))

fdc1c9de   Yarik   test
292
                              {

239b3249   Yarik   test
293
                                  $('#portfolio-cover').val(data);

fdc1c9de   Yarik   test
294
295
                                  var newimg = document.createElement("img");

                                  newimg.setAttribute("src", data);

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

                              }

                          }

                      );

                  }

              );

c7971bf4   Виталий   git
302
303
304
305
306
307
308
309
310
311
312
                  var blocks = $('.add_project_user_list .project_user_wrapper')

                  if(blocks.length>0) {

                      $('.hidden_sentence').css({display:'block'})

                  }

              $('body').on('click', '.project_user_remove', function () {

                  blocks = $('.add_project_user_list .project_user_wrapper')

                      if((blocks.length-1)<1) {

                          $('.hidden_sentence').css({display:'none'})

                      }

              })

  

aa08967c   Виталий   git
313
314
315
              $('.input-blocks.home-input.time_fix input').keypress(function (e) {

                  if (!(e.which==8 || e.which==46 || (e.which>47 && e.which<58))) return false;

              })

fdc1c9de   Yarik   test
316
317
          }

      );

eb7e82fb   Administrator   29.02.16
318
  </script>