From d3518c61dacf46807f9e3ca7ce71e41b87d96b2f Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 27 May 2025 09:36:26 +0300 Subject: [PATCH] ERP-417 --- erp24/views/write_offs_erp/_form.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index 85f9ea48..9f35aa2e 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -245,13 +245,13 @@ JS [ 'name' => 'videoFiles', 'title' => 'Видео: mp4, mov, avi', - 'type' => FileInput::className(), + 'type' => FileInput::class, 'value' => function ($row) { if (!isset($row['id'])) return null; $file = Files::findOne([ 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, - 'entity_id' => $row['id'] + 'entity_id' => $row['id'], ]); return $file ? $file->url : null; @@ -264,7 +264,7 @@ JS if (isset($rowModel['id'])) { $file = Files::findOne([ 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, - 'entity_id' => $rowModel['id'] + 'entity_id' => $rowModel['id'], ]); if ($file) { @@ -273,33 +273,45 @@ JS 'type' => 'video', 'caption' => basename($file->url), 'url' => \yii\helpers\Url::to(['delete-video', 'id' => $rowModel['id']]), + // Убрал confirm и метод, можно добавить при необходимости ]]; } } return [ + 'options' => [ + 'style' => 'width: 250px; white-space: normal;', // уменьшаем ширину колонки + ], + 'attribute' => 'videoFiles', 'options' => [ 'multiple' => false, 'accept' => 'video/*', - 'name' => 'video_name' + 'name' => 'video_name', + 'class' => 'file', // как у фото ], 'pluginOptions' => [ 'showPreview' => true, 'showCaption' => true, 'showRemove' => true, - 'showUpload' => true, + 'showUpload' => false, // как у фото — не показываем кнопку загрузки + 'browseClass' => 'btn btn-primary btn-sm', // кнопка как у фото (синий маленький btn) + 'browseIcon' => '', + 'browseLabel' => 'Выбрать видео', 'previewFileType' => 'video', - 'allowedFileTypes' => ['video'], 'allowedFileExtensions' => ['mp4', 'mov', 'avi'], 'maxFileSize' => 10240, 'initialPreview' => $initialPreview, 'initialPreviewAsData' => true, 'initialPreviewConfig' => $initialPreviewConfig, + 'fileActionSettings' => [ + 'showUpload' => false, // не показываем кнопку загрузки возле файла + 'showZoom' => true, + 'showRemove' => true, + ], ], ]; }, ], - [ 'name' => 'comment', 'type' => 'textInput', -- 2.39.5