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

index 451cb1ee06acaaeb951c8bfbecc01791e1a3b479..66825fe5785920027349e040ae3960e6410ab949 100644 (file)
@@ -175,71 +175,72 @@ JS
 //                'items' => [0,1],
                 ],
                 [
-                    'name' => 'images_row',
+                    'name' => 'video_row',
                     'type' => BaseColumn::TYPE_STATIC,
                     'value' => function ($data) {
-//                    $images = WriteOffsErp::getImagesList($product->imagesWriteOffsErp);
                         if (!empty($data['id'])) {
                             $query = WriteOffsProductsErp::find()
                                 ->andWhere([
                                     'write_offs_products_erp.id' => $data['id'],
                                     'write_offs_products_erp.active_product' => 1,
                                 ]);
+                            $query->joinWith(['videosWriteOffsErp']); // связанная связь для видео
 
-
-                            $query->joinWith(['imagesWriteOffsErp']);
-
-                            $action = $query->createCommand()->getRawSql();
-
-                            $modelWriteOffsProductsErp = $query->All();
-                            $productImagesList = [];
-                            $forWidget = false;
-                            foreach ($modelWriteOffsProductsErp as $item) {
-                                $productImagesList = WriteOffsErp::getImagesList($item->imagesWriteOffsErp, $forWidget);
+                            $models = $query->all();
+                            $videoList = [];
+                            foreach ($models as $item) {
+                                // Предположим, getVideosList возвращает массив html тегов видео или ссылок
+                                $videoList = WriteOffsErp::getVideosList($item->videosWriteOffsErp, false);
                             }
-                            if (!empty($productImagesList)) {
-//                            $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
-                                if ($forWidget) {
-                                    $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
-                                } else {
-                                    $dataTable = implode('', $productImagesList);
-                                }
+                            if (!empty($videoList)) {
+                                return implode('', $videoList);
                             }
                         }
-                        $test = 33;
-                        return $dataTable ?? '';
+                        return '';
                     },
                     'headerOptions' => [
-//                    'style' => 'width: 70px;',
-                    ]
+                        //'style' => 'width: 150px;', // при необходимости задайте ширину
+                    ],
                 ],
                 [
-                    'name' => 'imageFiles',
-                    'title' => 'ФоÑ\82огÑ\80аÑ\84ии: jpg Ð¸ png',
+                    'name' => 'videoFiles',
+                    'title' => 'Ð\92идео: mp4, mov, avi',
                     'type' => FileInput::className(),
                     'options' => [
                         'options' => [
-                            'multiple' => true,
-                            'accept' => 'image/*',
-                            'name' => 'image_name',
-                            'capture' => '',
-                            'class' => 'file'
+                            'multiple' => false,
+                            'accept' => 'video/*',
+                            'name' => 'video_name',
+                            'class' => 'file',
                         ],
                         'pluginOptions' => [
-                            'showPreview' => false,
+                            'showPreview' => true,
                             'showCaption' => true,
                             'showRemove' => true,
                             'showUpload' => false,
-                            'overwriteInitial' => true,
-                            'browseIcon' => '+',
-                            'cancelIcon' => 'x',
-                            'removeIcon' => '-',
-                            'buttonLabelClass' => 'hidden',
-                            'fileActionSettings' => ['showUpload' => false],
-                            'maxFileCount' => 10,
-                            'multiple' => true
+                            'previewFileType' => 'video',
+                            'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
+                            'maxFileSize' => 10240,
+                            'previewSettings' => [
+                                'video' => ['width' => '120px', 'height' => 'auto'],
+                            ],
+                            'browseLabel' => '+',
+                            'removeLabel' => '-',
+                            'cancelLabel' => 'x',
+                            'layoutTemplates' => [
+                                'actions' => '<div class="file-actions">{remove} {upload} {cancel}</div>',
+                                'actionUpload' => '<button type="button" title="{uploadTitle}" class="kv-file-upload {uploadClass}" style="margin-left:5px">{uploadIcon}</button>',
+                                'actionRemove' => '<button type="button" title="{removeTitle}" class="kv-file-remove {removeClass}">{removeIcon}</button>',
+                                'actionCancel' => '<button type="button" title="{cancelTitle}" class="kv-file-cancel {cancelClass}">{cancelIcon}</button>',
+                            ],
+                            'fileActionSettings' => [
+                                'showUpload' => false,
+                                'showRemove' => true,
+                                'showZoom' => false,
+                                'showDrag' => false,
+                            ],
                         ],
-                        'model' => $multipleUploadForm,
+                        'model' => $multipleUploadForm, // модель загрузки
                     ],
                 ],
                 [