]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-417
authormarina <m.zozirova@gmail.com>
Tue, 27 May 2025 06:20:09 +0000 (09:20 +0300)
committermarina <m.zozirova@gmail.com>
Tue, 27 May 2025 06:20:09 +0000 (09:20 +0300)
erp24/views/write_offs_erp/_form.php

index b6e4f8a4ee4d8ffcc05bf81bf0f489f6793a41ae..54480c20ed178fe874a0125255d020755575f4e3 100644 (file)
@@ -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',