1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use hipanel\widgets\Pjax; |
4
|
|
|
use yii\bootstrap\ActiveForm; |
5
|
|
|
use yii\bootstrap\Html; |
6
|
|
|
use yii\helpers\Url; |
7
|
|
|
use hipanel\widgets\RefCombo; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @var \yii\web\View |
11
|
|
|
* @var array|string $actionUrl url to send the form |
12
|
|
|
*/ |
13
|
|
|
?> |
14
|
|
|
|
15
|
|
|
<?php Pjax::begin(['id' => 'nss-pjax-container', 'enablePushState' => false, 'enableReplaceState' => false]) ?> |
16
|
|
|
<?php $form = ActiveForm::begin([ |
17
|
|
|
'id' => 'nss-form-pjax', |
18
|
|
|
'action' => $actionUrl, |
19
|
|
|
'enableAjaxValidation' => false, |
20
|
|
|
'enableClientValidation' => true, |
21
|
|
|
'validationUrl' => Url::toRoute(['@requisite/validate-form', 'scenario' => 'set-serie']), |
22
|
|
|
'options' => [ |
23
|
|
|
'data-pjax' => true, |
24
|
|
|
'data-pjaxPush' => false, |
25
|
|
|
], |
26
|
|
|
]) ?> |
27
|
|
View Code Duplication |
<?php if (!is_array($model)) : ?> |
|
|
|
|
28
|
|
|
<?= Html::activeHiddenInput($model, 'id') ?> |
29
|
|
|
<?php else : ?> |
30
|
|
|
<?php foreach ($model as $item) : ?> |
31
|
|
|
<?= Html::activeHiddenInput($item, "[$item->id]id") ?> |
32
|
|
|
<?php endforeach ?> |
33
|
|
|
<?php endif ?> |
34
|
|
|
|
35
|
|
|
<div class="row" style="margin-top: 15pt;"> |
36
|
|
|
<div class="col-md-10 inline-form-selector"> |
37
|
|
|
<?php $model = is_array($model) ? reset($model) : $model ?> |
38
|
|
|
<div class="col-md-6"> |
39
|
|
|
<?= $form->field($model, "serie") ?> |
40
|
|
|
</div> |
41
|
|
|
</div> |
42
|
|
|
</div> |
43
|
|
|
<div class="row" style="margin-top: 15pt;"> |
44
|
|
|
<div class="col-md-2 text-right"> |
45
|
|
|
<?= Html::submitButton(Yii::t('hipanel', 'Save'), [ |
46
|
|
|
'class' => 'btn btn-success', |
47
|
|
|
'id' => 'nss-save-button', |
48
|
|
|
'data-loading-text' => '<i class="fa fa-circle-o-notch fa-spin"></i> ' . Yii::t('hipanel', 'saving'), |
49
|
|
|
'disabled' => false, |
50
|
|
|
]) ?> |
51
|
|
|
</div> |
52
|
|
|
</div> |
53
|
|
|
<?php ActiveForm::end() ?> |
54
|
|
|
<?php Pjax::end() ?> |
55
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.