add accompanying document

This commit is contained in:
iIronside
2022-01-11 12:06:01 +03:00
parent 9c07e81fab
commit aaf4ee9f53
15 changed files with 1418 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?php
use backend\modules\document\models\Document;
use kartik\file\FileInput;
use kartik\select2\Select2;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\AccompanyingDocument */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="accompanying-document-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'document_id')->widget(Select2::className(),
[
'data' => Document::find()->select(['title', 'id'])
->indexBy('id')->column(),
'options' => ['placeholder' => 'Выберите документ','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]) ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'accompanying_document')->widget(FileInput::classname(), [
'options' => ['accept' => 'text/*'],
'pluginOptions' => [
'allowedFileExtensions'=>['docx'],'showUpload' => true
],
]); ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,31 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\AccompanyingDocumentSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="accompanying-document-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id') ?>
<?= $form->field($model, 'document_id') ?>
<?= $form->field($model, 'title') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,18 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\AccompanyingDocument */
$this->title = 'Добавить сопроводительный документ';
$this->params['breadcrumbs'][] = ['label' => 'Accompanying Documents', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="accompanying-document-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,36 @@
<?php
use backend\modules\document\models\Document;
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\document\models\AccompanyingDocumentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Сопроводительные бумги';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="accompanying-document-index">
<p>
<?= Html::a('Добавить сопроводительный документ', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
[
'attribute' => 'document_id',
'filter' => Document::find()->select(['title', 'id'])->indexBy('id')->column(),
'value' => 'document.title'
],
'title',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>

View File

@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\AccompanyingDocument */
$this->title = 'Update Accompanying Document: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Accompanying Documents', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="accompanying-document-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\AccompanyingDocument */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Accompanying Documents', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="accompanying-document-view">
<h1><?= Html::encode($this->title) ?></h1>
<p>
<?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Delete', ['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',
'document_id',
'title',
],
]) ?>
</div>