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,7 @@
<?php
use asmoday74\ckeditor5\EditorClassic;
use common\helpers\StatusHelper;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
@ -8,18 +10,153 @@ use yii\widgets\ActiveForm;
/* @var $form yii\widgets\ActiveForm */
?>
<div class="document-template-form">
<div class="row">
<div class="col-md-8">
<div class="document-template-form">
<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'template_body')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'status')->dropDownList(
StatusHelper::statusList(),
[
'prompt' => 'Выберите'
]
) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
<?= $form->field($model, 'template_body')->widget(EditorClassic::className(), [
'clientOptions' => [
'language' => 'ru',
]
]); ?>
<!-- composer require --prefer-dist stkevich/yii2-ckeditor5 "*"-->
<!-- --><?//= $form->field($model, 'text')->widget(CKEditor::className(),[
// 'editorOptions' => [ TODO
// 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
// 'inline' => false, //по умолчанию false
// ],
// ]); ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>
<!-- ['Акт', $time],-->
<!-- ['Акт сверки', $time],-->
<!-- ['Детализация', $time],-->
<!-- ['Доверенность', $time],-->
<!-- ['Договор', $time],-->
<!-- ['Доп соглашение к договору', $time],-->
<!-- ['Транспортная накладная', $time],-->
<!-- ['Ценовой лист', $time],-->
<div class="col-md-4">
<div class="table-responsive">
<table class="table" id="fieldNameTable">
<thead>
<tr>
<th>Поле</th>
<th>Сигнатура поля</th>
</tr>
</thead>
<tbody>
<tr class="info">
<td class="table-cell">№ договора</td>
<td class="table-cell">${contract_number}</td>
</tr>
<tr class="info">
<td class="table-cell">Название</td>
<td class="table-cell">${title}</td>
</tr>
<tr class="info">
<td class="table-cell">Компания</td>
<td class="table-cell">${company}</td>
</tr>
<tr class="info">
<td class="table-cell">Представитель</td>
<td class="table-cell">${manager}</td>
</tr>
<tr class="info">
<td class="table-cell">Компания контрагент</td>
<td class="table-cell">${contractor_company}</td>
</tr>
<tr class="info">
<td class="table-cell">Представитель контрагента</td>
<td class="table-cell">${contractor_manager}</td>
</tr>
<!-- <tr class="info">-->
<!-- <td class="table-cell"></td>-->
<!-- <td class="table-cell"></td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">№ документа</td>-->
<!-- <td class="table-cell">${document_number}</td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">от </td>-->
<!-- <td class="table-cell">${from}</td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">сумма с НДС</td>-->
<!-- <td class="table-cell">${sum_with_NDS}</td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">НДС</td>-->
<!-- <td class="table-cell">${NDS}</td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">цена</td>-->
<!-- <td class="table-cell">${price}</td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">к договору</td>-->
<!-- <td class="table-cell">${to_the_contract}</td>-->
<!-- </tr>-->
<!-- <tr class="info">-->
<!-- <td class="table-cell">№</td>-->
<!-- <td class="table-cell">${number}</td>-->
<!-- </tr>-->
<?php ActiveForm::end(); ?>
</table>
</div>
<div>
<p>
Нажмите на ячейку чтобы скопировать содержимое
</p>
</div>
</div>
</div>
<script>
const popup = document.createElement('h4')
popup.textContent = 'Скопировано'
popup.style.cssText = `
background: #a6caf0;
position: absolute;
right: 0;
top: 0;
`
document.querySelectorAll('.table-cell').forEach(function (elm) {
elm.style.position = 'relative'
elm.addEventListener('click', function (e) {
e.target.style.backgroundColor = '#76d7c4'
var copyText = e.target.textContent
const el = document.createElement('textarea')
el.value = copyText
document.body.appendChild(el)
el.select()
document.execCommand('copy')
document.body.removeChild(el)
elm.appendChild(popup)
setTimeout(() => {
elm.removeChild(popup)
}, 1000)
})
})
</script>

View File

@ -21,6 +21,12 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'template_body') ?>
<?= $form->field($model, 'status') ?>
<?= $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\DocumentTemplate */
$this->title = 'Create Document Template';
$this->title = 'Создать шаблон документа';
$this->params['breadcrumbs'][] = ['label' => 'Document Templates', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="document-template-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>

View File

@ -1,5 +1,6 @@
<?php
use common\helpers\StatusHelper;
use yii\helpers\Html;
use yii\grid\GridView;
@ -7,16 +8,13 @@ use yii\grid\GridView;
/* @var $searchModel backend\modules\document\models\DocumentTemplateSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Document Templates';
$this->title = 'Шаблоны документов';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="document-template-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create Document Template', ['create'], ['class' => 'btn btn-success']) ?>
<?= Html::a('Создать шаблон', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?= GridView::widget([
@ -25,9 +23,19 @@ $this->params['breadcrumbs'][] = $this->title;
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
'title',
'template_body:ntext',
[
'attribute' => 'status',
'format' => 'raw',
'filter' => StatusHelper::statusList(),
'value' => function($model){
return StatusHelper::statusLabel($model->status);
}
],
'created_at',
//'updated_at',
// 'template_body:ntext',
['class' => 'yii\grid\ActionColumn'],
],

View File

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

View File

@ -1,5 +1,6 @@
<?php
use common\helpers\StatusHelper;
use yii\helpers\Html;
use yii\widgets\DetailView;
@ -13,11 +14,10 @@ $this->params['breadcrumbs'][] = $this->title;
?>
<div class="document-template-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('Удалить', ['delete', 'id' => $model->id], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => 'Are you sure you want to delete this item?',
@ -31,7 +31,24 @@ $this->params['breadcrumbs'][] = $this->title;
'attributes' => [
'id',
'title',
'template_body:ntext',
[
'attribute' => 'status',
'format' => 'raw',
'value' => StatusHelper::statusLabel($model->status),
],
'created_at',
'updated_at',
[
'attribute' => 'template_body',
'format' => 'raw'
],
[
'attribute' => 'Переменные в шаблоне',
'value' => function($model){
preg_match_all('/(\${\w+})/', $model->template_body,$out);
return implode(",", $out[0]);
},
],
],
]) ?>