guild/backend/modules/document/views/document-template/_form.php

105 lines
3.3 KiB
PHP
Raw Normal View History

2022-11-08 18:01:42 +03:00
<?php
2022-11-16 14:24:52 +03:00
use backend\modules\document\models\DocumentField;
2022-11-10 16:00:43 +03:00
use common\helpers\StatusHelper;
use mihaildev\ckeditor\CKEditor;
2022-11-08 18:01:42 +03:00
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model backend\modules\document\models\DocumentTemplate */
/* @var $form yii\widgets\ActiveForm */
?>
2022-11-10 16:00:43 +03:00
<div class="row">
<div class="col-md-8">
<div class="document-template-form">
2022-11-08 18:01:42 +03:00
2022-11-10 16:00:43 +03:00
<?php $form = ActiveForm::begin(); ?>
2022-11-08 18:01:42 +03:00
2022-11-10 16:00:43 +03:00
<?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>
2022-11-08 18:01:42 +03:00
2022-11-10 16:00:43 +03:00
<?= $form->field($model, 'status')->dropDownList(
StatusHelper::statusList(),
[
'prompt' => 'Выберите'
]
) ?>
2022-11-08 18:01:42 +03:00
<?= $form->field($model, 'template_body')->widget(CKEditor::className(),[
'editorOptions' => [
'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
'inline' => false, //по умолчанию false
],
2022-11-10 16:00:43 +03:00
]); ?>
<div class="form-group">
<?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
2022-11-08 18:01:42 +03:00
2022-11-10 16:00:43 +03:00
</div>
</div>
2022-11-16 14:24:52 +03:00
2022-11-10 16:00:43 +03:00
<div class="col-md-4">
<div class="table-responsive">
2022-12-01 14:11:29 +03:00
<h2>Поля договоров</h2>
2022-11-10 16:00:43 +03:00
<table class="table" id="fieldNameTable">
<thead>
<tr>
<th>Поле</th>
<th>Сигнатура поля</th>
</tr>
</thead>
<tbody>
2022-11-16 14:24:52 +03:00
<?php
foreach (DocumentField::getTitleFieldTemplateArr() as $fieldTitle => $fieldTemplate) {
echo "
<tr class='info'>
<td class='table-cell'>$fieldTitle</td>
<td class='table-cell'>$fieldTemplate</td>
</tr>
";
}
?>
</tbody>
2022-11-10 16:00:43 +03:00
</table>
</div>
<div>
<p>
Нажмите на ячейку чтобы скопировать содержимое
</p>
</div>
</div>
2022-11-08 18:01:42 +03:00
</div>
2022-11-10 16:00:43 +03:00
<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>