80 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
use backend\modules\company\models\Company;
 | 
						|
use backend\modules\document\models\DocumentTemplate;
 | 
						|
use backend\modules\employee\models\Manager;
 | 
						|
use kartik\select2\Select2;
 | 
						|
use yii\helpers\Html;
 | 
						|
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(); ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'company_id')->widget(Select2::class,
 | 
						|
        [
 | 
						|
            'data' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ); ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'manager_id')->widget(Select2::class,
 | 
						|
        [
 | 
						|
            'data' => Manager::find()->select(['fio', 'manager.id'])
 | 
						|
                ->joinWith('userCard')->indexBy('manager.id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ); ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'contractor_company_id')->widget(Select2::class,
 | 
						|
        [
 | 
						|
            'data' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ); ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'contractor_manager_id')->widget(Select2::class,
 | 
						|
        [
 | 
						|
            'data' => Manager::find()->select(['fio', 'manager.id'])
 | 
						|
                ->joinWith('userCard')->indexBy('manager.id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ); ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
 | 
						|
 | 
						|
    <?= $form->field($model, 'template_id')->widget(Select2::class,
 | 
						|
        [
 | 
						|
            'data' => DocumentTemplate::find()->select(['title', 'id'])->indexBy('id')->column(),
 | 
						|
            'options' => ['placeholder' => '...','class' => 'form-control'],
 | 
						|
            'pluginOptions' => [
 | 
						|
                'allowClear' => true
 | 
						|
            ],
 | 
						|
        ]
 | 
						|
    ); ?>
 | 
						|
 | 
						|
    <div class="form-group">
 | 
						|
        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
 | 
						|
    </div>
 | 
						|
 | 
						|
    <?php ActiveForm::end(); ?>
 | 
						|
 | 
						|
</div>
 |