]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-417
authormarina <m.zozirova@gmail.com>
Wed, 21 May 2025 07:13:15 +0000 (10:13 +0300)
committermarina <m.zozirova@gmail.com>
Wed, 21 May 2025 07:13:15 +0000 (10:13 +0300)
erp24/views/write_offs_erp/_form.php

index 5b02d84fc1bdb4def1d8f1b57436a94164a24535..41afe87d81587cee52b7d7e1747af0ba76625787 100644 (file)
@@ -100,7 +100,7 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
     ?>
     <div style="overflow-x: scroll;">
     <?= $form->field($model, 'modelsProducts')->widget(MultipleInput::className(), [
-        'min' => 1,
+        'min' => 0,
         'max' => 100,
         'columns' => [
             [
@@ -158,6 +158,45 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
                             ]);
 
 
+                        $query->joinWith(['imagesWriteOffsErp']);
+
+                        $action = $query->createCommand()->getRawSql();
+
+                        $modelWriteOffsProductsErp = $query->All();
+                        $productImagesList = [];
+                        $forWidget = false;
+                        foreach ($modelWriteOffsProductsErp as $item) {
+                            $productImagesList = WriteOffsErp::getImagesList($item->imagesWriteOffsErp, $forWidget);
+                        }
+                        if (!empty($productImagesList)) {
+//                            $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
+                            if ($forWidget) {
+                                $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
+                            } else {
+                                $dataTable = implode('', $productImagesList);
+                            }
+                        }
+                    }
+                    $test = 33;
+                    return $dataTable ?? '';
+                },
+                'headerOptions' => [
+//                    'style' => 'width: 70px;',
+                ]
+            ],
+            [
+                'name'  => 'images_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(['imagesWriteOffsErp']);
 
                         $action = $query->createCommand()->getRawSql();
@@ -235,6 +274,40 @@ $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View
                     'class' => 'custom_css_class_file_input'
                 ]
             ],
+            [
+                'name'  => 'videoFiles',
+                'title' => 'Видео: mp4, webm, ogg, mov',
+                'type'  => FileInput::className(),
+                'options' => [
+                    'options' => [
+                        'multiple' => true,
+                        'accept' => 'video/*',
+                        'name'  => 'video_name',
+                        'capture' => '',
+                        'class' => 'file'
+                    ],
+                    'pluginOptions' => [
+                        'showPreview' => false, // отключено, т.к. видео превью не поддерживаются по умолчанию
+                        'showCaption' => true,
+                        'showRemove' => true,
+                        'showUpload' => false,
+                        'overwriteInitial' => true,
+                        'browseIcon' => '+',
+                        'cancelIcon' => 'x',
+                        'removeIcon' => '-',
+                        'buttonLabelClass' => 'hidden',
+                        'fileActionSettings' => ['showUpload' => false],
+                        'maxFileCount' => 10,
+                        'allowedFileExtensions' => ['mp4', 'webm', 'ogg', 'mov'],
+                        'multiple' => true
+                    ],
+                    'model' => $multipleUploadForm,
+                ],
+                'columnOptions' => [
+                    'class' => 'custom_css_class_file_input'
+                ]
+            ],
+
             [
                 'name'  => 'comment',
                 'type'  => 'textInput',