forked from hiqdev/hipanel-module-stock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_form.php
103 lines (87 loc) · 3.1 KB
/
_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
<?php
/**
* @var \yii\web\View $this
* @var Order $model
*/
use hipanel\modules\stock\models\Order;
use hipanel\modules\stock\widgets\combo\ContactCombo;
use hipanel\widgets\DateTimePicker;
use hipanel\widgets\Box;
use hipanel\widgets\FileInput;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Url;
?>
<?php $form = ActiveForm::begin([
'id' => 'order-form',
'enableClientValidation' => true,
'validateOnBlur' => true,
'enableAjaxValidation' => true,
'validationUrl' => Url::toRoute(['validate-form', 'scenario' => $model->scenario]),
]) ?>
<div class="row">
<div class="col-md-6">
<?php Box::begin() ?>
<?php if (!$model->isNewRecord) : ?>
<?= Html::activeHiddenInput($model, 'id') ?>
<?php endif; ?>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'type')->dropDownList($model->typeOptions) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'seller_id')->widget(ContactCombo::class) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'state')->dropDownList($model->stateOptions) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'buyer_id')->widget(ContactCombo::class) ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= $form->field($model, 'no') ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'time')->widget(DateTimePicker::class, [
'clientOptions' => [
'todayBtn' => true,
'dateFormat' => 'Y-m-d H:i'
],
]) ?>
</div>
</div>
<?= $form->field($model, 'name')->textarea(['rows' => 3]) ?>
<?php Box::end() ?>
</div>
<?php if ($model->fileCount < Order::MAX_FILES_COUNT) : ?>
<div class="col-md-6">
<?php Box::begin() ?>
<?= $form->field($model, 'file[]')->widget(FileInput::class, [
'options' => [
'multiple' => true,
],
'pluginOptions' => [
'previewFileType' => 'any',
'showRemove' => true,
'showUpload' => false,
'initialPreviewShowDelete' => true,
'maxFileCount' => Order::MAX_FILES_COUNT - $model->fileCount,
'msgFilesTooMany' => Yii::t('hipanel', 'Number of files selected for upload ({n}) exceeds maximum allowed limit of {m}'),
],
]) ?>
<?php Box::end() ?>
</div>
<?php endif ?>
</div>
<div class='row'>
<div class='col-md-12 no'>
<?= Html::submitButton(Yii::t('hipanel', 'Save'), ['class' => 'btn btn-success']) ?>
<?= Html::a(Yii::t('hipanel', 'Cancel'), ['@order/index'], ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end() ?>