custom fields have been added to the documents
This commit is contained in:
		@@ -53,15 +53,14 @@ use yii\widgets\ActiveForm;
 | 
			
		||||
        ]
 | 
			
		||||
    ); ?>
 | 
			
		||||
 | 
			
		||||
    <?= $form->field($model, 'contractor_company_id')->widget(Select2::class,
 | 
			
		||||
    <?= $form->field($model, 'contractor_company_id')->dropDownList(
 | 
			
		||||
        Company::find()->select(['name', 'id'])->indexBy('id')->column(),
 | 
			
		||||
        [
 | 
			
		||||
            'data' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
 | 
			
		||||
            'options' => ['id' => 'contractor-company-id','placeholder' => '...','class' => 'form-control'],
 | 
			
		||||
            'pluginOptions' => [
 | 
			
		||||
                'allowClear' => true
 | 
			
		||||
            ],
 | 
			
		||||
            'id' => 'contractor-company-id',
 | 
			
		||||
            'prompt' => 'Выберите'
 | 
			
		||||
        ]
 | 
			
		||||
    ); ?>
 | 
			
		||||
    );
 | 
			
		||||
    ?>
 | 
			
		||||
 | 
			
		||||
    <?= $form->field($model, 'contractor_manager_id')->widget(DepDrop::className(),
 | 
			
		||||
        [
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,6 @@ $this->params['breadcrumbs'][] = 'Загрузить';
 | 
			
		||||
 | 
			
		||||
    <?php $form = ActiveForm::begin([
 | 
			
		||||
        'id' => 'update-resume-text-form',
 | 
			
		||||
        'action' => Url::to(['document/update-document-body', 'id' => $model->id]),
 | 
			
		||||
        'options' => ['method' => 'post']])
 | 
			
		||||
    ?>
 | 
			
		||||
 | 
			
		||||
@@ -35,16 +34,12 @@ $this->params['breadcrumbs'][] = 'Загрузить';
 | 
			
		||||
        ],
 | 
			
		||||
    ]); ?>
 | 
			
		||||
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <?= Html::submitButton('Сохраниить изменения', ['class' => 'btn btn-primary']) ?>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <?php ActiveForm::end(); ?>
 | 
			
		||||
 | 
			
		||||
    <div>
 | 
			
		||||
        <p>
 | 
			
		||||
            <?= Html::a('Скачать pdf', ['download-pdf', 'id' => $model->id], ['class' => 'btn btn-success']) ?>
 | 
			
		||||
            <?= Html::a('Скачать docx', ['download-docx', 'id' => $model->id], ['class' => 'btn btn-success']) ?>
 | 
			
		||||
            <?= Html::a('Скачать pdf', ['download', 'id' => $model->id, 'fileType' => 'docx'], ['class' => 'btn btn-success']) ?>
 | 
			
		||||
            <?= Html::a('Скачать docx', ['download', 'id' => $model->id, 'fileType' => 'pdf'], ['class' => 'btn btn-success']) ?>
 | 
			
		||||
        </p>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use backend\modules\company\models\Company;
 | 
			
		||||
use backend\modules\company\models\CompanyManager;
 | 
			
		||||
use backend\modules\employee\models\Manager;
 | 
			
		||||
use yii\helpers\Html;
 | 
			
		||||
use yii\grid\GridView;
 | 
			
		||||
@@ -25,7 +26,6 @@ $this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
            ['class' => 'yii\grid\SerialColumn'],
 | 
			
		||||
 | 
			
		||||
            'title',
 | 
			
		||||
//            'body:ntext',
 | 
			
		||||
            [
 | 
			
		||||
                'attribute' => 'company_id',
 | 
			
		||||
                'filter' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
 | 
			
		||||
@@ -38,24 +38,18 @@ $this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                'attribute' => 'manager_id',
 | 
			
		||||
                'filter' => Manager::find()->select(['fio', 'manager.id'])
 | 
			
		||||
                    ->joinWith('userCard')->indexBy('manager.id')->column(),
 | 
			
		||||
                'filter' => false,
 | 
			
		||||
                'value' => 'manager.userCard.fio'
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                'attribute' => 'contractor_manager_id',
 | 
			
		||||
                'filter' => Manager::find()->select(['fio', 'manager.id'])
 | 
			
		||||
                    ->joinWith('userCard')->indexBy('manager.id')->column(),
 | 
			
		||||
                'filter' => false,
 | 
			
		||||
                'value' => 'manager.userCard.fio'
 | 
			
		||||
            ],
 | 
			
		||||
            //'title',
 | 
			
		||||
            //'body:ntext',
 | 
			
		||||
            //'created_at',
 | 
			
		||||
            //'updated_at',
 | 
			
		||||
 | 
			
		||||
            [
 | 
			
		||||
                'class' => 'yii\grid\ActionColumn',
 | 
			
		||||
                'template' => '{view} {update} {download}',
 | 
			
		||||
                'template' => '{view} {update} {download} {delete}',
 | 
			
		||||
                'buttons' => [
 | 
			
		||||
                    'download' => function($url, $model) {
 | 
			
		||||
                        return Html::a(
 | 
			
		||||
@@ -67,4 +61,5 @@ $this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
            ]
 | 
			
		||||
        ],
 | 
			
		||||
    ]); ?>
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,13 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use common\classes\Debug;
 | 
			
		||||
use common\models\Document;
 | 
			
		||||
use yii\grid\GridView;
 | 
			
		||||
use yii\helpers\ArrayHelper;
 | 
			
		||||
use yii\helpers\Html;
 | 
			
		||||
use yii\widgets\DetailView;
 | 
			
		||||
 | 
			
		||||
/* @var $this yii\web\View */
 | 
			
		||||
/* @var $model backend\modules\document\models\Document */
 | 
			
		||||
/* @var $documentFieldValuesDataProvider yii\data\ActiveDataProvider */
 | 
			
		||||
 | 
			
		||||
$this->title = $model->title;
 | 
			
		||||
$this->params['breadcrumbs'][] = ['label' => 'Documents', 'url' => ['index']];
 | 
			
		||||
@@ -49,7 +49,7 @@ $this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                'attribute' => 'contractor_manager_id',
 | 
			
		||||
                'value' => ArrayHelper::getValue($model, 'manager.userCard.fio'),
 | 
			
		||||
                'value' => ArrayHelper::getValue($model, 'contractorManager.userCard.fio'),
 | 
			
		||||
            ],
 | 
			
		||||
            [
 | 
			
		||||
                'attribute' => 'body',
 | 
			
		||||
@@ -61,4 +61,37 @@ $this->params['breadcrumbs'][] = $this->title;
 | 
			
		||||
        ],
 | 
			
		||||
    ]) ?>
 | 
			
		||||
 | 
			
		||||
    <div>
 | 
			
		||||
        <h2>
 | 
			
		||||
            <?= 'Поля документа:'?>
 | 
			
		||||
        </h2>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <?= GridView::widget([
 | 
			
		||||
        'dataProvider' => $documentFieldValuesDataProvider,
 | 
			
		||||
        'columns' => [
 | 
			
		||||
            ['class' => 'yii\grid\SerialColumn'],
 | 
			
		||||
 | 
			
		||||
            [
 | 
			
		||||
                'attribute' => 'document_field_id',
 | 
			
		||||
                'value' => 'documentField.title'
 | 
			
		||||
            ],
 | 
			
		||||
            'attribute' => 'value',
 | 
			
		||||
 | 
			
		||||
            [
 | 
			
		||||
                'class' => 'yii\grid\ActionColumn',
 | 
			
		||||
                'template' => '{update}',//'{view} {update} {delete}',
 | 
			
		||||
                'controller' => 'document-field-value',
 | 
			
		||||
                'buttons' => [
 | 
			
		||||
 | 
			
		||||
                    'update' => function ($url,$model) {
 | 
			
		||||
                        return Html::a(
 | 
			
		||||
                            '<span class="glyphicon glyphicon-pencil"></span>',
 | 
			
		||||
                            ['document-field-value/update', 'id' => $model['id'], 'fromDocument' => true]);
 | 
			
		||||
                    },
 | 
			
		||||
                ],
 | 
			
		||||
            ],
 | 
			
		||||
        ],
 | 
			
		||||
    ]); ?>
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user