84 lines
2.4 KiB
PHP
Raw Normal View History

2022-11-08 18:01:42 +03:00
<?php
2022-11-10 16:00:43 +03:00
use backend\modules\company\models\Company;
use backend\modules\document\models\DocumentTemplate;
2022-12-01 14:11:29 +03:00
use kartik\depdrop\DepDrop;
2022-11-10 16:00:43 +03:00
use kartik\select2\Select2;
2022-11-08 18:01:42 +03:00
use yii\helpers\Html;
2022-12-01 14:11:29 +03:00
use yii\helpers\Url;
2022-11-08 18:01:42 +03:00
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\Document */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="document-form">
<?php $form = ActiveForm::begin(); ?>
2022-12-01 14:11:29 +03:00
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'template_id')->widget(Select2::class,
2022-11-10 16:00:43 +03:00
[
2022-12-01 14:11:29 +03:00
'data' => DocumentTemplate::find()->select(['title', 'id'])->indexBy('id')->column(),
2022-11-10 16:00:43 +03:00
'options' => ['placeholder' => '...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]
); ?>
2022-11-08 18:01:42 +03:00
2022-12-01 14:11:29 +03:00
<div>
<p>Не обязательные поля:</p>
</div>
<?= $form->field($model, 'company_id')->dropDownList(
Company::find()->select(['name', 'id'])->indexBy('id')->column(),
2022-11-10 16:00:43 +03:00
[
2022-12-01 14:11:29 +03:00
'id' => 'company-id',
'prompt' => 'Выберите'
2022-11-10 16:00:43 +03:00
]
2022-12-01 14:11:29 +03:00
);
?>
2022-11-08 18:01:42 +03:00
2022-12-01 14:11:29 +03:00
<?= $form->field($model, 'manager_id')->widget(DepDrop::className(),
2022-11-10 16:00:43 +03:00
[
2022-12-01 14:11:29 +03:00
'options' => ['id' => 'manager-id'],
2022-11-10 16:00:43 +03:00
'pluginOptions' => [
2022-12-01 14:11:29 +03:00
'depends' => ['company-id'],
'placeholder' => 'Выберите',
'url' => Url::to(['/document/document/managers'])
]
2022-11-10 16:00:43 +03:00
]
); ?>
2022-11-08 18:01:42 +03:00
<?= $form->field($model, 'contractor_company_id')->dropDownList(
Company::find()->select(['name', 'id'])->indexBy('id')->column(),
2022-11-10 16:00:43 +03:00
[
'id' => 'contractor-company-id',
'prompt' => 'Выберите'
2022-11-10 16:00:43 +03:00
]
);
?>
2022-11-10 16:00:43 +03:00
2022-12-01 14:11:29 +03:00
<?= $form->field($model, 'contractor_manager_id')->widget(DepDrop::className(),
2022-11-10 16:00:43 +03:00
[
2022-12-01 14:11:29 +03:00
'options' => ['id' => 'contractor-manager-id'],
2022-11-10 16:00:43 +03:00
'pluginOptions' => [
2022-12-01 14:11:29 +03:00
'depends' => ['contractor-company-id'],
'placeholder' => 'Выберите',
'url' => Url::to(['/document/document/managers']),
'params' => ['contractor-company-id']
]
2022-11-10 16:00:43 +03:00
]
); ?>
2022-11-08 18:01:42 +03:00
<div class="form-group">
2022-11-10 16:00:43 +03:00
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
2022-11-08 18:01:42 +03:00
</div>
<?php ActiveForm::end(); ?>
</div>