From 09dc34a038ef54fe2f28307de01108ab6851c34e Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 27 May 2025 09:29:37 +0300 Subject: [PATCH] ERP-417 --- erp24/views/write_offs_erp/_form.php | 89 ++++++++++++++++------------ 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index b6e4f8a4..385862e0 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -214,44 +214,55 @@ JS ] ], [ - 'name' => 'imageFiles', - 'title' => 'Фотографии: jpg и png', - 'type' => FileInput::className(), - 'options' => [ - 'options' => [ - 'multiple' => true, - 'accept' => 'image/*', - 'name' => 'image_name', - 'capture' => '', - 'class' => 'file' - ], - 'pluginOptions' => [ -// 'previewFileType' => ['jpg','png'], -// 'allowedFileExtensions'=>['jpg','png'], - 'showPreview' => false, - 'showCaption' => true, - 'showRemove' => true, - 'showUpload' => false, - //'uploadClass' => 'hide', -// 'initialPreview'=> $initalImages, - 'overwriteInitial' => true, - -// 'initialPreviewAsData'=>true, - //initialPreviewAsData: false, -// 'bsColCssPrefixes'=>3, - // 'uploadUrl' => Url::to(['/site/image-manager-upload']), - 'browseIcon' => '+', - 'cancelIcon' => 'x', - 'removeIcon' => '-', - 'buttonLabelClass' => 'hidden', -// 'browseIcon' => '', - 'fileActionSettings' => ['showUpload' => false], - 'maxFileCount' => 10, - 'multiple' => true - ], - 'model' => $multipleUploadForm, - ] - ], + 'name' => 'videoFiles', + 'title' => 'Видео: mp4, mov, avi', + 'type' => FileInput::class, + 'options' => [ + 'options' => [ + 'multiple' => false, + 'accept' => 'video/*', + 'name' => 'video_name', + ], + 'pluginOptions' => [ + 'showPreview' => true, + 'showCaption' => false, // 👈 убираем надпись "1 file selected" + 'showRemove' => true, + 'showUpload' => false, + 'browseIcon' => '+', // 👈 как у фото + 'cancelIcon' => 'x', + 'removeIcon' => '-', + 'buttonLabelClass' => 'hidden', // 👈 убираем текст на кнопке + 'fileActionSettings' => [ + 'showUpload' => false + ], + 'previewFileType' => 'video', + 'allowedFileExtensions' => ['mp4', 'mov', 'avi'], + 'initialPreview' => isset($model->id) ? [ + Files::find() + ->select('url') + ->where([ + 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, + 'entity_id' => $model->id + ]) + ->scalar() + ] : [], + 'initialPreviewAsData' => true, + 'initialPreviewConfig' => isset($model->id) ? [[ + 'type' => 'video', + 'caption' => basename( + Files::find() + ->select('url') + ->where([ + 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, + 'entity_id' => $model->id + ]) + ->scalar() + ), + 'url' => Url::to(['delete-video', 'id' => $model->id]), + ]] : [], + ] + ] +], [ 'name' => 'videoFiles', 'title' => 'Видео: mp4, mov, avi', @@ -266,7 +277,7 @@ JS return $file ? $file->url : null; }, - 'columnOptions' => function ($rowModel, $index, $context) { + 'columnOptions' => function($rowModel, $index, $context) { $file = null; $initialPreview = []; $initialPreviewConfig = []; -- 2.39.5