the document module is finished
This commit is contained in:
47
backend/modules/document/views/document/_form.php
Normal file
47
backend/modules/document/views/document/_form.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\document\models\Template;
|
||||
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, 'manager_id')->widget(Select2::className(),
|
||||
[
|
||||
'data' => Manager::find()->select(['user_card.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::className(),
|
||||
[
|
||||
'data' => Template::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>
|
37
backend/modules/document/views/document/_search.php
Normal file
37
backend/modules/document/views/document/_search.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\document\models\DocumentSearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="document-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id') ?>
|
||||
|
||||
<?= $form->field($model, 'title') ?>
|
||||
|
||||
<?= $form->field($model, 'created_at') ?>
|
||||
|
||||
<?= $form->field($model, 'updated_at') ?>
|
||||
|
||||
<?= $form->field($model, 'template_id') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'manager_id') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
18
backend/modules/document/views/document/create.php
Normal file
18
backend/modules/document/views/document/create.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\document\models\Document */
|
||||
|
||||
$this->title = 'Создать документ';
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Documents', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="document-create">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
88
backend/modules/document/views/document/index.php
Normal file
88
backend/modules/document/views/document/index.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
use backend\modules\document\models\Document;
|
||||
use backend\modules\document\models\Template;
|
||||
use kartik\select2\Select2;
|
||||
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 */
|
||||
|
||||
$this->title = 'Документы';
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="document-index">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Создать документ', ['create'], ['class' => 'btn btn-success']) ?>
|
||||
</p>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'filterModel' => $searchModel,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'attribute' => 'title',
|
||||
'filter' => Select2::widget([
|
||||
'model' => $searchModel,
|
||||
'attribute' => 'title',
|
||||
'data' => Document::find()
|
||||
->select(['title', 'id'])->indexBy('id')->column(),
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true,
|
||||
'width' => '150px',
|
||||
],
|
||||
'options' => [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'Выберите значение'
|
||||
],
|
||||
]),
|
||||
'value' => 'title',
|
||||
],
|
||||
[
|
||||
'attribute' => 'template_id',
|
||||
'filter' => Select2::widget([
|
||||
'model' => $searchModel,
|
||||
'attribute' => 'template_id',
|
||||
'data' => Template::find()->select(['title', 'id'])->indexBy('id')->column(),
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true,
|
||||
'width' => '150px',
|
||||
],
|
||||
'options' => [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'Выберите значение'
|
||||
],
|
||||
]),
|
||||
'value' => 'template.title'
|
||||
],
|
||||
[
|
||||
'attribute' => 'manager_id',
|
||||
'filter' => Select2::widget([
|
||||
'model' => $searchModel,
|
||||
'attribute' => 'manager_id',
|
||||
'data' => Document::find()
|
||||
->joinWith(['manager', 'manager.userCard'])
|
||||
->select(['user_card.fio', 'manager.id'])->indexBy('id')->column(),
|
||||
'pluginOptions' => [
|
||||
'allowClear' => true,
|
||||
'width' => '150px',
|
||||
],
|
||||
'options' => [
|
||||
'class' => 'form-control',
|
||||
'placeholder' => 'Выберите значение'
|
||||
],
|
||||
]),
|
||||
'value' => 'manager.userCard.fio',
|
||||
],
|
||||
'created_at',
|
||||
'updated_at',
|
||||
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
</div>
|
19
backend/modules/document/views/document/update.php
Normal file
19
backend/modules/document/views/document/update.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model backend\modules\document\models\Document */
|
||||
|
||||
$this->title = 'Изменить Документ: ' . $model->title;
|
||||
$this->params['breadcrumbs'][] = ['label' => 'Documents', 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
|
||||
$this->params['breadcrumbs'][] = 'Update';
|
||||
?>
|
||||
<div class="document-update">
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
94
backend/modules/document/views/document/view.php
Normal file
94
backend/modules/document/views/document/view.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
use yii\grid\GridView;
|
||||
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']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
\yii\web\YiiAsset::register($this);
|
||||
?>
|
||||
<div class="document-view">
|
||||
|
||||
<p>
|
||||
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => 'Are you sure you want to delete this item?',
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id',
|
||||
'title',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'template_id',
|
||||
'manager_id',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
<div>
|
||||
<h2>
|
||||
<?= 'Поля документа:'?>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $documentFieldValuesDataProvider,
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
[
|
||||
'attribute' => 'field_id',
|
||||
'value' => 'field.title'
|
||||
],
|
||||
'attribute' => 'value',
|
||||
|
||||
[
|
||||
'class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{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'], 'document_id' => $model['document_id']]);
|
||||
},
|
||||
'delete' => function ($url,$model) {
|
||||
return Html::a(
|
||||
'<span class="glyphicon glyphicon-trash"></span>',
|
||||
[
|
||||
'document-field-value/delete', 'id' => $model['id'], 'document_id' => $model['document_id']
|
||||
],
|
||||
[
|
||||
'data' => ['confirm' => 'Вы уверены, что хотите удалить этот вопрос?', 'method' => 'post']
|
||||
]
|
||||
);
|
||||
},
|
||||
],
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
<p>
|
||||
<?= Html::a(
|
||||
'Добавить поле',
|
||||
['document-field-value/create', 'document_id' => $model->id],
|
||||
['class' => 'btn btn-primary']
|
||||
) ?>
|
||||
</p>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user