tmp commit

This commit is contained in:
iIronside
2022-11-10 16:00:43 +03:00
parent 45b110ac44
commit 1175b9f973
25 changed files with 4032 additions and 95 deletions

View File

@ -1,5 +1,9 @@
<?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;
@ -12,16 +16,62 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'company_id')->textInput() ?>
<?= $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, 'contractor_company_id')->textInput() ?>
<?= $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, 'manager_id')->textInput() ?>
<?= $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')->textInput() ?>
<?= $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('Save', ['class' => 'btn btn-success']) ?>
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>

View File

@ -25,6 +25,16 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'contractor_manager_id') ?>
<?php // echo $form->field($model, 'template_id') ?>
<?php // echo $form->field($model, 'title') ?>
<?php // echo $form->field($model, 'body') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>

View File

@ -5,14 +5,12 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\Document */
$this->title = 'Create Document';
$this->title = 'Создать документ';
$this->params['breadcrumbs'][] = ['label' => 'Documents', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="document-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>

View File

@ -0,0 +1,52 @@
<?php
use asmoday74\ckeditor5\EditorClassic;
//use backend\modules\card\models\ResumeTemplate;
use common\helpers\StatusHelper;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\Document */
$this->title = 'Документ: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Документы', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Загрузить';
?>
<div class="form-group">
<?= Html::a('Редактировать документ', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Просмотр документа', ['view', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
</div>
<div class="resume-form">
<?php $form = ActiveForm::begin([
'id' => 'update-resume-text-form',
'action' => Url::to(['document/update-document-body', 'id' => $model->id]),
'options' => ['method' => 'post']])
?>
<?= $form->field($model, 'body')->widget(EditorClassic::className(), [
'clientOptions' => [
'language' => 'ru',
]
]); ?>
<div class="form-group">
<?= Html::submitButton('Сохраниить изменения', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<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']) ?>
</p>
</div>

View File

@ -1,5 +1,7 @@
<?php
use backend\modules\company\models\Company;
use backend\modules\employee\models\Manager;
use yii\helpers\Html;
use yii\grid\GridView;
@ -7,16 +9,13 @@ use yii\grid\GridView;
/* @var $searchModel backend\modules\document\models\DocumentSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Documents';
$this->title = 'Документы';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="document-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Document', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Создать документ', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
@ -25,13 +24,47 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'company_id',
'contractor_company_id',
'manager_id',
'contractor_manager_id',
'title',
// 'body:ntext',
[
'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' => Manager::find()->select(['fio', 'manager.id'])
->joinWith('userCard')->indexBy('manager.id')->column(),
'value' => 'manager.userCard.fio'
],
[
'attribute' => 'contractor_manager_id',
'filter' => Manager::find()->select(['fio', 'manager.id'])
->joinWith('userCard')->indexBy('manager.id')->column(),
'value' => 'manager.userCard.fio'
],
//'title',
//'body:ntext',
//'created_at',
//'updated_at',
['class' => 'yii\grid\ActionColumn'],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view} {update} {download}',
'buttons' => [
'download' => function($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-download-alt"></span>',
['document/download', 'id' => $model->id]
);
}
]
]
],
]); ?>
</div>

View File

@ -5,15 +5,13 @@ use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\Document */
$this->title = 'Update Document: ' . $model->id;
$this->title = 'Изменить документ: ' . $model->title;
$this->params['breadcrumbs'][] = ['label' => 'Documents', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = ['label' => $model->title, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update';
?>
<div class="document-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>

View File

@ -1,39 +1,61 @@
<?php
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\Document */
$this->title = $model->id;
$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">
<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], [
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
<?= Html::a('Скачать', ['download', 'id' => $model->id], ['class' => 'btn btn-success']) ?>
<?= 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',
'company_id',
'contractor_company_id',
'manager_id',
'contractor_manager_id',
'title',
[
'attribute' => 'company_id',
'value' => ArrayHelper::getValue($model, 'company.name'),
],
[
'attribute' => 'manager_id',
'value' => ArrayHelper::getValue($model, 'manager.userCard.fio'),
],
[
'attribute' => 'contractor_company_id',
'value' => ArrayHelper::getValue($model, 'contractorCompany.name'),
],
[
'attribute' => 'contractor_manager_id',
'value' => ArrayHelper::getValue($model, 'manager.userCard.fio'),
],
[
'attribute' => 'body',
'format' => 'raw',
],
// 'body:ntext',
'created_at',
'updated_at',
],
]) ?>