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

index 85f9ea48c301ec2626e698ab49fdfeecb76694de..9f35aa2e725921d562c557c7daa3cbda57f7a507 100644 (file)
@@ -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' => '<i class="glyphicon glyphicon-plus"></i>',
+                                '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',