use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
+
use kartik\select2\Select2;
use dosamigos\datetimepicker\DateTimePicker;
+
use yii_app\records\Admin;
+
+use yii_app\helpers\PrintBlockHelper;
use yii_app\services\FileService;
/* @var $this yii\web\View */
/* @var $model yii_app\records\Task */
/* @var $form yii\widgets\ActiveForm */
-/* @var $comment yii_app\records\Comment|null */
-/* @var $entities array */
-/* @var $taskEntity array */
-/* @var $tasksType array */
-/* @var $taskStatus array */
-/* @var $taskAlertLevels array */
+/* @var $comment \yii_app\records\Comment */
/* @var $canUpdateAll boolean */
/* @var $canUpdateStatusAndDuration boolean */
?>
- <div class="task-form p-4">
+<div class="task-form">
-<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
+ <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
<div style="display: none">
<?= $form->field($model, 'id')->hiddenInput()->label(false) ?>
</div>
- <div class="form-group">
- <label>Тип задачи</label>
- <?= $form->field($model, 'task_type_id')->dropDownList(
- ArrayHelper::map($tasksType, 'id', 'name'),
- ['disabled' => $canUpdateAll ? null : 'disabled']
- )->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Название</label>
- <?= $form->field($model, 'name')->textInput([
- 'maxlength' => true,
- 'disabled' => $canUpdateAll ? null : 'disabled'
- ])->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Описание задачи</label>
- <?= $form->field($model, 'description')->textarea([
- 'rows' => 6,
- 'disabled' => $canUpdateAll ? null : 'disabled'
- ])->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Тип сущности</label>
- <?= $form->field($model, 'entity_type')->widget(Select2::class, [
- 'data' => ArrayHelper::map($taskEntity, 'id', 'name'),
- 'language' => 'ru',
- 'options' => ['placeholder' => 'Тип сущности для привязки...'],
- 'pluginOptions' => [
- 'allowClear' => true,
- 'disabled' => !$canUpdateAll
- ],
- 'pluginEvents' => [
- "change" => "function() {
- var value= $(this).val();
- console.log(value);
- $.ajax({
- method: 'POST',
- dataType: 'text',
- url: window.location.href,
- data: { value : value },
- success: function (response) {
- var r = JSON.parse(response);
- console.log(r);
- var myDropDownList = document.getElementById('task-entity_id');
- while (myDropDownList.options.length > 0) {
- myDropDownList.remove(myDropDownList.options.length - 1);
- }
- $.each(r, function(index, value) {
- var option = document.createElement(\"option\");
- option.text = value;
- option.value = index;
- try {
- myDropDownList.options.add(option);
- } catch (e) {
- alert(e);
- }
- });
+ <?php PrintBlockHelper::printBlock('Тип задачи', $form->field($model, 'task_type_id')->dropDownList(
+ ArrayHelper::map($tasksType, 'id', 'name'), ['disabled' => $canUpdateAll ? null : 'disabled'])->label(false)); ?>
+
+ <?php PrintBlockHelper::printBlock('Название', $form->field($model, 'name')->textInput(['maxlength' => true, 'disabled' => $canUpdateAll ? null : 'disabled'])->label(false)) ?>
+
+ <?php PrintBlockHelper::printBlock('Описание задачи', $form->field($model, 'description')->textarea(['rows' => 6, 'disabled' => $canUpdateAll ? null : 'disabled'])->label(false)) ?>
+
+ <?php // $form->field($model, 'group_id')->textInput() ?>
+
+ <?php PrintBlockHelper::printBlock('Тип сущности', $form->field($model, 'entity_type')->widget(Select2::class, [
+ 'data' => ArrayHelper::map($taskEntity, 'id', 'name'),
+ 'language' => 'ru',
+ 'options' => ['placeholder' => 'Тип сущности для привязки...'],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ 'disabled' => !$canUpdateAll
+ ],
+ 'pluginEvents' => [
+ "change" => "function() {
+ var value= $(this).val();
+
+ $.ajax({
+ method: 'POST',
+ dataType: 'text',
+ url: window.location.href,
+ data: { value : value },
+ success: function (response) {
+ var r = JSON.parse(response);
+ var myDropDownList = document.getElementById('task-entity_id');
+ while (myDropDownList.options.length > 0) {
+ myDropDownList.remove(myDropDownList.options.length - 1);
}
- });
- }",
- ]
- ])->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Сущность</label>
- <?= $form->field($model, 'entity_id')->dropDownList(
- $entities,
- ['disabled' => $canUpdateAll ? null : 'disabled']
- )->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Статус</label>
- <?= $form->field($model, 'status')->dropDownList(
- ArrayHelper::map($taskStatus, 'id', 'name'),
- ['disabled' => $canUpdateStatusAndDuration ? null : 'disabled']
- )->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Приоритет</label>
- <?= $form->field($model, 'prioritet')->dropDownList(
- [
- 0 => 'Очень низкий',
- 1 => 'Низкий',
- 2 => 'Терпит',
- 3 => 'Можно не спешить',
- 4 => 'Пониженый',
- 5 => 'Обычный',
- 6 => 'Повышенный',
- 7 => 'Ниже среднего',
- 8 => 'Средний',
- 9 => 'Высокий',
- 10 => 'Самая важная'
- ],
- ['prompt' => 'Выберите приоритет'] // Опционально: можно добавить "пустую" опцию
- )->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Продолжительность</label>
- <div class="row border">
- <div class="col-2 text-right mt-2">Продолжительность</div>
- <div class="col-4 mt-2">
- <?php
- // Разбиваем значение продолжительности на число и масштаб (минуты, часы, дни)
- $paramArray = explode(":", $model->duration);
- $value = $paramArray[0] ?? 0;
- $scale = $paramArray[1] ?? 'm'; // По умолчанию "минуты"
- ?>
-
- <!-- Поле ввода для значения -->
- <input id="durationValue" type="number" value="<?= Html::encode($value) ?>" <?= !$canUpdateStatusAndDuration ? 'disabled' : '' ?>/>
-
- <!-- Выбор масштаба (минуты, часы, дни) -->
- <select id="durationScale" <?= !$canUpdateStatusAndDuration ? 'disabled' : '' ?>>
- <option value="m" <?= $scale == 'm' ? 'selected' : '' ?>>Минуты</option>
- <option value="h" <?= $scale == 'h' ? 'selected' : '' ?>>Часы</option>
- <option value="d" <?= $scale == 'd' ? 'selected' : '' ?>>Дни</option>
- </select>
-
- <!-- Синхронизация изменений в скрытое поле формы -->
- <script>
- const $durationValue = $("#durationValue");
- const $durationScale = $("#durationScale");
-
- function syncDuration() {
- $("#task-duration").val($durationValue.val() + ":" + $durationScale.val());
- }
-
- // Обработчики событий для изменения значения и масштаба
- $durationValue.on('change', () => syncDuration());
- $durationScale.on('change', () => syncDuration());
-
- // Установка начального значения
- $durationScale.val("<?= Html::encode($scale) ?>");
- </script>
- </div>
- </div>
-
- <!-- Скрытое поле для хранения результата (число + масштаб) -->
- <div style="display: none">
- <?= $form->field($model, 'duration')->hiddenInput()->label(false) ?>
- </div>
- </div>
-
- <?php if (!$canUpdateStatusAndDuration): ?>
- <script>
- $(document).ready(() => {
- $('#durationValue').attr('disabled', 'disabled');
- $('#durationScale').attr('disabled', 'disabled');
+ $.each(r, function(index, value) {
+ var option = document.createElement(\"option\");
+ option.text = value;
+ option.value = index;
+ try {
+ myDropDownList.options.add(option);
+ } catch (e) {
+ alert(e);
+ }
+ });
+ }
});
- </script>
- <?php endif; ?>
-
- <div class="form-group">
- <label>Дата начала</label>
- <?= $form->field($model, 'data_start')->widget(DateTimePicker::class, [
- 'language' => 'ru',
- 'template' => '{input}',
- 'clientOptions' => [
- 'autoclose' => true,
- 'format' => 'yyyy-mm-dd hh:ii',
- 'todayBtn' => true
+ }",
+ ]
+ ])->label(false)) ?>
+
+ <?php // $form->field($model, 'entity_id')->textInput() ?>
+
+ <?php PrintBlockHelper::printBlock('Сущность', $form->field($model, 'entity_id')->dropDownList($entities, ['disabled' => $canUpdateAll ? null : 'disabled'])->label(false)) ?>
+
+
+ <?php // $form->field($model, 'entity_type')->dropDownList(
+ // ArrayHelper::map($entityType, 'id', 'name')) ?>
+
+ <?php PrintBlockHelper::printBlock('Статус', $form->field($model, 'status')->dropDownList(
+ ArrayHelper::map($taskStatus, 'id','name'), ['disabled' => $canUpdateStatusAndDuration ? null : 'disabled'])->label(false)) ?>
+
+ <?php
+ PrintBlockHelper::printBlock(
+ 'Приоритет',
+ $form->field($model, 'prioritet')->dropDownList(
+ [
+ 0 => 'Очень низкий',
+ 1 => 'Низкий',
+ 2 => 'Терпит',
+ 3 => 'Можно не спешить',
+ 4 => 'Пониженный',
+ 5 => 'Обычный',
+ 6 => 'Повышенный',
+ 7 => 'Ниже среднего',
+ 8 => 'Средний',
+ 9 => 'Высокий',
+ 10 => 'Самая важная'
],
- ])->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Дата завершения</label>
- <?= $form->field($model, 'data_end')->widget(DateTimePicker::class, [
- 'language' => 'ru',
- 'template' => '{input}',
- 'clientOptions' => [
- 'autoclose' => true,
- 'format' => 'yyyy-mm-dd hh:ii',
- 'todayBtn' => true
- ],
- ])->label(false); ?>
- </div>
-
-<?php if ($model->deadline_permission != 0 || ($model->controller && ($model->controller->id == $_SESSION['admin_id']))): ?>
- <div class="form-group">
- <label>Крайний срок</label>
- <?= $form->field($model, 'deadline')->widget(DateTimePicker::class, [
+ ['prompt' => 'Выберите приоритет'] // Опционально: можно добавить "пустую" опцию
+ )->label(false)
+ );
+ ?>
+
+ <?php PrintBlockHelper::printValueWithScale('Продолжительность', 'duration', $form, $model, 'task') ?>
+
+ <?php if (!$canUpdateStatusAndDuration): ?>
+ <script>
+ $(document).ready(() => {
+ $('#durationValue').attr('disabled', 'disabled');
+ $('#durationScale').attr('disabled', 'disabled');
+ })
+ </script>
+ <?php endif; ?>
+
+ <?php //PrintBlockHelper::printBlock('Продолжительность (мин.)', $form->field($model, 'duration')->textInput(['type' => 'number'])->label(false)) ?>
+
+ <?php // $form->field($model, 'is_completed')->textInput() ?>
+
+ <?php PrintBlockHelper::printBlock('Дата начала', $form->field($model, 'data_start')->widget(DateTimePicker::class, [
+ 'language' => 'ru',
+ 'template' => '{input}',
+ 'clientOptions' => [
+ 'autoclose' => true,
+ 'format' => 'yyyy-m-d H:i:s',
+ 'todayBtn' => true
+ ],
+ ])->label(false)) ?>
+
+ <?php PrintBlockHelper::printBlock('Дата Окончания', $form->field($model, 'data_end')->widget(DateTimePicker::class, [
+ 'language' => 'ru',
+ 'template' => '{input}',
+ 'clientOptions' => [
+ 'autoclose' => true,
+ 'format' => 'yyyy-m-d H:i:s',
+ 'todayBtn' => true
+ ],
+ ])->label(false)) ?>
+
+ <?php /* PrintBlockHelper::printBlock('Дата начала', $form->field($model, 'data_start', [
+ 'inputOptions' => [
+ 'class' => 'form-control datetime',
+ 'type' => 'datetime-local',
+ ],
+ 'options' => ['tag' => null],
+ ])->textInput()->label(false)) */ ?>
+
+ <?php // $form->field($model, 'data_start')->textInput() // календарь ?>
+
+ <?php
+
+ if ($model->deadline_permission != 0 || ($model->controller && ($model->controller->id == $_SESSION['admin_id']))) {
+ PrintBlockHelper::printBlock('Крайний срок', $form->field($model, 'deadline')->widget(DateTimePicker::class, [
'language' => 'ru',
'template' => '{input}',
'clientOptions' => [
'autoclose' => true,
- 'format' => 'yyyy-mm-dd hh:ii',
+ 'format' => 'yyyy-m-d H:i:s',
'todayBtn' => true
],
- ])->label(false); ?>
- </div>
-<?php endif; ?>
-
- <div class="form-group">
- <label>Уровень важности</label>
- <?= $form->field($model, 'alert_level_id')->dropDownList(
- ArrayHelper::map($taskAlertLevels, 'id', 'name'),
- ['disabled' => $canUpdateAll ? null : 'disabled']
- )->label(false); ?>
- </div>
-
- <div class="form-group">
- <label>Сложность задачи</label>
- <?= $form->field($model, 'motivation_id')->dropDownList(
- ArrayHelper::map(\yii_app\records\TaskMotivation::find()->all(), 'id', 'name'),
- ['disabled' => $canUpdateAll ? null : 'disabled']
- )->label(false); ?>
- </div>
-
-<?php
-$adminArr = [];
-foreach (Admin::find()->with('adminGroup')->all() as $admin) {
- $adminArr[] = ['id' => $admin->id, 'name' => $admin->name, 'groupName' => $admin->adminGroup->name ?? "Другие"];
-}
-$admins = ArrayHelper::map($adminArr, 'id', 'name', 'groupName');
-?>
-
- <div class="form-group">
- <label>Получатель задачи</label>
- <?= $form->field($model, 'updated_by')->widget(Select2::class, [
- 'data' => $admins,
- 'language' => 'ru',
- 'options' => ['placeholder' => 'Кому адресовать задачу...'],
- 'pluginOptions' => [
- 'allowClear' => true,
- 'disabled' => !$canUpdateAll
- ],
- ])->label(false); ?>
- </div>
+ ])->label(false));
+ }
+
+ ?>
+
+ <?php /* PrintBlockHelper::printBlock('Крайний срок', $form->field($model, 'deadline', [
+ 'inputOptions' => [
+ 'class' => 'form-control datetime',
+ 'type' => 'datetime-local',
+ ],
+ 'options' => ['tag' => null],
+ ])->textInput()->label(false)) */ ?>
+
+ <?php // $form->field($model, 'dead_line')->textInput() // календарь ?>
+
+ <?php // $form->field($model, 'data_end')->textInput() ?>
+
+ <?php // $form->field($model, 'result')->textarea(['rows' => 6]) ?>
+
+ <?php // $form->field($model, 'updated_by')->textInput() // проверяющий id должен быть в бд, а поле это "для кого" подтягивается из админа ?>
+
+ <?php PrintBlockHelper::printBlock('Уровень важности', $form->field($model, 'alert_level_id')->dropDownList(
+ ArrayHelper::map($taskAlertLevels, 'id', 'name'), ['disabled' => $canUpdateAll ? null : 'disabled'])->label(false)) ?>
+
+ <?php PrintBlockHelper::printBlock('Сложность задачи', $form->field($model, 'motivation_id')->dropDownList(
+ ArrayHelper::map(\yii_app\records\TaskMotivation::find()->all(), 'id', 'name'), ['disabled' => $canUpdateAll ? null : 'disabled'])->label(false)) ?>
+
+ <?php
+
+ $adminArr = [];
+ foreach (Admin::find()->with('adminGroup')->all() as $admin) {
+ $adminArr[] = ['id' => $admin->id, 'name' => $admin->name, 'groupName' => $admin->adminGroup->name ?? "Другие"];
+ }
+
+ ?>
+
+ <?php $admins = ArrayHelper::map($adminArr, 'id', 'name', 'groupName') ?>
+
+ <?php PrintBlockHelper::printBlock('Получатель задачи', $form->field($model, 'updated_by')->widget(Select2::class, [
+ 'data' => $admins,
+ 'language' => 'ru',
+ 'options' => ['placeholder' => 'Кому адресовать задачу...'],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ 'disabled' => !$canUpdateAll
+ ],
+ ])->label(false)); ?>
+
+ <?php PrintBlockHelper::printBlock('Контроллёр задачи', $form->field($model, 'controller_id')->widget(Select2::class, [
+ 'data' => $admins,
+ 'language' => 'ru',
+ 'options' => ['placeholder' => 'Кто контроллирует задачу...'],
+ 'pluginOptions' => [
+ 'allowClear' => true,
+ 'disabled' => !$canUpdateAll
+ ],
+ ])->label(false)); ?>
+
+ <?php PrintBlockHelper::printBlock('Участники задачи', Select2::widget([
+ 'name' => 'taskUsers',
+ 'value' => array_values(ArrayHelper::map($model->users, 'id', 'id')),
+ 'data' => $admins,
+ 'options' => ['multiple' => true, 'placeholder' => 'Выберете участников ...'],
+ 'pluginOptions' => [
+ 'disabled' => !$canUpdateAll
+ ],
+ ])); ?>
+
+ <?php PrintBlockHelper::printBlock('Наблюдатели задачи', Select2::widget([
+ 'name' => 'taskViewers',
+ 'value' => array_values(ArrayHelper::map($model->viewers, 'id', 'id')),
+ 'data' => $admins,
+ 'options' => ['multiple' => true, 'placeholder' => 'Выберете наблюдателей ...'],
+ 'pluginOptions' => [
+ 'disabled' => !$canUpdateAll
+ ],
+ ])); ?>
+
+ <?php // $form->field($model, 'created_by')->textInput() // создаётся из под того кто сидит ?>
+
+ <?php // $form->field($model, 'created_at')->textInput() // автоматом в момент создания ?>
+
+ <?php // $form->field($model, 'updated_at')->textInput() ?>
+
+ <?php // $form->field($model, 'close_at')->textInput() ?>
+
+ <?php // $form->field($model, 'closed_by')->textInput() ?>
+
+ <?php if ($model->attachedFiles): ?>
+ <div class="row">
+ <?php foreach($model->attachedFiles as $file): ?>
+ <div class="col-2">
+ <?php if ($file->file_type == 'image'): ?>
+ <img width=100 src="<?= FileService::padWithSlash($file->url) ?>" alt="img" onclick="window.open(this.src, '_blank');" />
+ <?php else: ?>
+ <a href="<?= Url::to(['/files/download', 'url' => $file->url]) ?>" class="btn btn-link" target="_blank" data-pjax="0"><?= basename($file->url)?></a>
+ <?php endif; ?>
+ </div>
+ <?php endforeach; ?>
+ </div>
+ <?php endif; ?>
- <div class="form-group">
- <label>Контроллёр задачи</label>
- <?= $form->field($model, 'controller_id')->widget(Select2::class, [
- 'data' => $admins,
- 'language' => 'ru',
- 'options' => ['placeholder' => 'Кто контроллирует задачу...'],
- 'pluginOptions' => [
- 'allowClear' => true,
- 'disabled' => !$canUpdateAll
- ],
- ])->label(false); ?>
- </div>
+ <?php if ($canUpdateAll): ?>
+ <?php PrintBlockHelper::printBlock('Медиа файлы',
+ '<div class="taskMediaFiles"><button onclick="addTaskMediaFile(); return false;" class="btn btn-success btn-sm">Добавить медиа файлы к задаче</button></div>'); ?>
+ <?php endif; ?>
<div class="form-group">
- <label>Участники задачи</label>
- <?= Select2::widget([
- 'name' => 'taskUsers',
- 'value' => array_values(ArrayHelper::map($model->users, 'id', 'id')),
- 'data' => $admins,
- 'options' => ['multiple' => true, 'placeholder' => 'Выберете участников ...'],
- 'pluginOptions' => [
- 'disabled' => !$canUpdateAll
- ],
- ]); ?>
+ <?= Html::submitButton('Сохранить задачу', ['class' => 'btn btn-success btn-lg']) ?>
</div>
- <div class="form-group">
- <label>Наблюдатели задачи</label>
-<?= Select2::widget([
- 'name' => 'taskViewers',
- 'value' => array_values(ArrayHelper::map($model->viewers, 'id', 'id')),
- 'data' => $admins,
- 'options' => ['multiple' => true, 'placeholder' => 'Выберете наблюдателей ...'],
- 'pluginOptions' => [
- 'disabled' => !$canUpdateAll
- ],
-]); ?>
- </div>
+ <?php ActiveForm::end(); ?>
- <?php if ($model->attachedFiles): ?>
- <div class="row">
- <?php foreach ($model->attachedFiles as $file): ?>
- <div class="col-2">
- <?php if ($file->file_type == 'image'): ?>
- <img width="100" src="<?= FileService::padWithSlash($file->url) ?>" alt="img" onclick="window.open(this.src, '_blank');" />
- <?php else: ?>
- <a href="<?= Url::to(['/files/download', 'url' => $file->url]) ?>" class="btn btn-link" target="_blank" data-pjax="0"><?= basename($file->url) ?></a>
- <?php endif; ?>
- </div>
- <?php endforeach; ?>
- </div>
- <?php endif; ?>
+ <?php if (isset($comment)): ?>
+ <?php $commentForm = ActiveForm::begin(['id' => 'comment-form', 'options' => ['enctype' => 'multipart/form-data']]) ?>
+ <?php PrintBlockHelper::printBlock('Комментарий', $commentForm->field($comment, 'msg')->textInput()->label(false)) ?>
- <?php if ($canUpdateAll): ?>
- <div class="form-group">
- <label>Медиа файлы</label>
- <div class="taskMediaFiles">
- <button onclick="addTaskMediaFile(); return false;" class="btn btn-success btn-sm">Добавить медиа файлы к задаче</button>
- </div>
- </div>
- <?php endif; ?>
+ <?php PrintBlockHelper::printBlock('Медиа файлы',
+ '<div class="mediaFiles"><button onclick="addMediaFile(); return false;" class="btn btn-success btn-sm">Добавить медиа файлы к комментарию</button></div>'); ?>
<div class="form-group">
- <?= Html::submitButton('СоÑ\85Ñ\80аниÑ\82Ñ\8c задаÑ\87Ñ\83', ['class' => 'btn btn-success btn-lg']) ?>
+ <?= Html::submitButton('СоÑ\85Ñ\80аниÑ\82Ñ\8c комменÑ\82аÑ\80ий', ['class' => 'btn btn-success btn']) ?>
</div>
-
- <?php ActiveForm::end(); ?>
-
- <?php if (isset($comment)): ?>
- <?php $commentForm = ActiveForm::begin(['id' => 'comment-form', 'options' => ['enctype' => 'multipart/form-data']]) ?>
- <div class="form-group">
- <label>Комментарий</label>
- <?= $commentForm->field($comment, 'msg')->textInput()->label(false) ?>
- </div>
-
- <div class="form-group">
- <label>Медиа файлы</label>
- <div class="mediaFiles">
- <button onclick="addMediaFile(); return false;" class="btn btn-success btn-sm">Добавить медиа файлы к комментарию</button>
+ <?php ActiveForm::end() ?>
+ <?php endif; ?>
+ <?php if (isset($model->comments)): ?>
+ <?php foreach ($model->comments as $cmnt): ?>
+ <div class="row">
+ <div class="col-3 text-right">
+ <?= $cmnt->createdBy->name ?> (<?= \yii_app\services\DateTimeService::formatHuman($cmnt->created_at) ?>):
</div>
- </div>
-
- <div class="form-group">
- <?= Html::submitButton('Сохранить комментарий', ['class' => 'btn btn-success btn']) ?>
- </div>
- <?php ActiveForm::end() ?>
- <?php endif; ?>
-
- <?php if (isset($model->comments)): ?>
- <?php foreach ($model->comments as $cmnt): ?>
- <div class="row">
- <div class="col-3 text-right">
- <?= $cmnt->createdBy->name ?> (<?= \yii_app\services\DateTimeService::formatHuman($cmnt->created_at) ?>):
- </div>
- <div class="col-9">
- <?= $cmnt->msg ?>
- <?php if (isset($cmnt->attachedFiles)): ?>
- <?php foreach ($cmnt->attachedFiles as $file): ?>
- <?php if ($file->file_type == 'image'): ?>
- <?= Html::a(basename($file->url), [$file->url], ['class' => 'btn btn-link', 'target' => '_blank']) ?>
- <?php else: ?>
- <?= Html::a(basename($file->url), ['/files/download', 'url' => $file->url], ['class' => 'btn btn-link']) ?>
- <?php endif; ?>
- <?php endforeach; ?>
- <?php endif; ?>
- </div>
+ <div class="col-9">
+ <?= $cmnt->msg ?>
+ <?php if (isset($cmnt->attachedFiles)): ?>
+ <?php foreach ($cmnt->attachedFiles as $file): ?>
+ <?php if ($file->file_type == 'image'): ?>
+ <?= Html::a(basename($file->url), [$file->url], ['class' => 'btn btn-link', 'target' => '_blank']) ?>
+ <?php else: ?>
+ <?= Html::a(basename($file->url), ['/files/download', 'url' => $file->url], ['class' => 'btn btn-link']) ?>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
</div>
- <?php endforeach; ?>
- <?php endif; ?>
- </div>
\ No newline at end of file
+ </div>
+ <?php endforeach; ?>
+ <?php endif; ?>
+</div>
+<script>
+ $(document).ready(function(){
+ // Очищаем предыдущий datetimepicker, если он был инициализирован
+ console.log('start');
+ $('#task-data_start').datetimepicker('destroy');
+ $('#task-deadline').datetimepicker('destroy');
+ // Инициализируем снова
+
+ $('#task-data_start').on('click', function() {
+ $('#task-data_start').datetimepicker({
+ format: 'Y-m-d H:i',
+ autoclose: true
+ });
+ });
+ $('#task-data_start').on('click', function() {
+ $('#task-deadline').datetimepicker({
+ format: 'Y-m-d H:i',
+ autoclose: true
+ });
+ });
+ });
+</script>
\ No newline at end of file