guild/backend/modules/document/views/document/index.php

66 lines
2.1 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\company\models\CompanyManager;
2022-11-10 16:00:43 +03:00
use backend\modules\employee\models\Manager;
2022-11-08 18:01:42 +03:00
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\document\models\DocumentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
2022-11-10 16:00:43 +03:00
$this->title = 'Документы';
2022-11-08 18:01:42 +03:00
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="document-index">
<p>
2022-11-10 16:00:43 +03:00
<?= Html::a('Создать документ', ['create'], ['class' => 'btn btn-success']) ?>
2022-11-08 18:01:42 +03:00
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
2022-11-10 16:00:43 +03:00
'title',
[
'attribute' => 'company_id',
'filter' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
'value' => 'company.name'
],
[
'attribute' => 'contractor_company_id',
'filter' => Company::find()->select(['name', 'id'])->indexBy('id')->column(),
'value' => 'contractorCompany.name'
],
[
'attribute' => 'manager_id',
'filter' => false,
2022-11-10 16:00:43 +03:00
'value' => 'manager.userCard.fio'
],
[
'attribute' => 'contractor_manager_id',
'filter' => false,
2022-11-10 16:00:43 +03:00
'value' => 'manager.userCard.fio'
],
2022-11-08 18:01:42 +03:00
2022-11-10 16:00:43 +03:00
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {download} {delete}',
2022-11-10 16:00:43 +03:00
'buttons' => [
'download' => function($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-download-alt"></span>',
['document/download', 'id' => $model->id]
);
}
]
]
2022-11-08 18:01:42 +03:00
],
]); ?>
2022-11-08 18:01:42 +03:00
</div>