From dbb7fd2d9e8da7088488b951fe876900434ec55c Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 27 May 2025 09:20:09 +0300 Subject: [PATCH] ERP-417 --- erp24/views/write_offs_erp/_form.php | 64 ++++++++++------------------ 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index b6e4f8a4..54480c20 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -266,48 +266,28 @@ JS return $file ? $file->url : null; }, - 'columnOptions' => function ($rowModel, $index, $context) { - $file = null; - $initialPreview = []; - $initialPreviewConfig = []; - - if (isset($rowModel['id'])) { - $file = Files::findOne([ - 'entity' => WriteOffsProductsErp::WRITE_OFFS_VIDEO, - 'entity_id' => $rowModel['id'] - ]); - - if ($file) { - $initialPreview = [$file->url]; - $initialPreviewConfig = [[ - 'type' => 'video', - 'caption' => basename($file->url), - 'url' => \yii\helpers\Url::to(['delete-video', 'id' => $rowModel['id']]), - ]]; - } - } - - return [ - 'options' => [ - 'multiple' => false, - 'accept' => 'video/*', - 'name' => 'video_name' - ], - 'pluginOptions' => [ - 'showPreview' => true, - 'showCaption' => true, - 'showRemove' => true, - 'showUpload' => true, - 'previewFileType' => 'video', - 'allowedFileTypes' => ['video'], - 'allowedFileExtensions' => ['mp4', 'mov', 'avi'], - 'maxFileSize' => 10240, - 'initialPreview' => $initialPreview, - 'initialPreviewAsData' => true, - 'initialPreviewConfig' => $initialPreviewConfig, - ], - ]; - }, + 'options' => [ + 'options' => [ + 'multiple' => false, + 'accept' => 'video/*', + 'name' => 'video_name', + 'class' => 'file' + ], + 'pluginOptions' => [ + 'showPreview' => false, + 'showCaption' => true, + 'showRemove' => true, + 'showUpload' => false, + 'browseIcon' => '+', + 'cancelIcon' => 'x', + 'removeIcon' => '-', + 'buttonLabelClass' => 'hidden', + 'fileActionSettings' => ['showUpload' => false], + 'allowedFileExtensions' => ['mp4', 'mov', 'avi'], + 'maxFileCount' => 1, + 'overwriteInitial' => true, + ], + ] ], [ 'name' => 'comment', -- 2.39.5