]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-302 Редактирование букета
authormarina <m.zozirova@gmail.com>
Fri, 21 Feb 2025 14:21:44 +0000 (17:21 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 21 Feb 2025 14:21:44 +0000 (17:21 +0300)
erp24/views/bouquet/_form.php

index ac78847e85998710b2e6b00917a8dd545ed4ec59..8a2971b5018cd9d53e12ddbea590b58d6d2b7ea0 100644 (file)
@@ -105,77 +105,108 @@ $form = ActiveForm::begin([
 
         </div>
 
-            <div class="col-md-6 w-100 w-md-75 w-lg-50">
-                <div class="row mb-2"><?= Html::label("Презентация", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
-                <?= $form->field($model, 'video_presentation')->widget(FileInput::class, [
+        <div class="col-md-5">
+            <div class="row w-100 w-md-75 w-lg-50">
+                <?php $model = new BouquetComposition(); ?>
+                <div class="row mb-2"><?= Html::label("Фото", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
+                <?= $form->field($model, 'photo_bouquet[]')->widget(FileInput::class, [
                     'options' => [
-                        'id' => 'video-file-upload',
-                        'multiple' => false,
-                        'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
+                        'id' => 'bouquet-file-upload',
+                        'multiple' => true,  // Поддержка выбора нескольких файлов
+                        'accept' => 'image/png, image/jpeg, image/jpg',
                     ],
                     'language' => 'ru',
                     'pluginOptions' => [
+                        'initialPreview' => $photoUrls,
+                        'initialPreviewConfig' => $photoConfig,
+                        'initialPreviewAsData' => true,
                         'showPreview' => true,
                         'showUpload' => false,
                         'showCancel' => false,
+                        'removeLabel' => '',
                         'mainClass' => 'input-group-lg',
-                        'initialPreview' => !empty($videoUrls) ? [
-                            Html::tag('video', '', [
-                                'src' => is_array($videoUrls) ? $videoUrls[0] : $videoUrls, // Извлекаем первый элемент, если массив
-                                'controls' => true,
-                                'class' => 'file-preview-video',
-                                'style' => 'max-width: 100%; height: auto;'
-                            ])
-                        ] : [],
-                        'initialPreviewAsData' => false,
-                        'initialPreviewConfig' => !empty($videoUrls) ? [
-                            ['type' => 'video', 'filetype' => 'video/mp4']
-                        ] : [],
-                        'maxFileSize' => 100000,
-                        'dropZoneTitle' => 'Выберите видеофайл',
-                        'browseOnZoneClick' => true,
+                        'maxFileSize' => 2800,  // Максимальный размер файла (в килобайтах)
+                        'dropZoneTitle' => 'Выберите изображение',  // Текст на зоне для перетаскивания
+                        'browseOnZoneClick' => true,  // Разрешить клик по зоне перетаскивания
                         'fileActionSettings' => [
                             'showZoom' => false,
                         ],
                     ],
                 ])->label(false) ?>
             </div>
-            <div class="col-md-6 w-100 w-md-75 w-lg-50">
-                <div class="row mb-2"><?= Html::label("Процесс сборки", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
-                <?= $form->field($model, 'video_build_process')->widget(FileInput::class, [
-                    'options' => [
-                        'id' => 'presentation-file-upload',
-                        'multiple' => false,
-                        'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
-                    ],
-                    'language' => 'ru',
-                    'pluginOptions' => [
-                        'showPreview' => true,
-                        'showUpload' => false,
-                        'showCancel' => false,
-                        'mainClass' => 'input-group-lg',
-                        'initialPreview' => !empty($processUrls) ? [
-                            Html::tag('video', '', [
-                                'src' => is_array($processUrls) ? $processUrls[0] : $processUrls, // Извлекаем первый элемент, если массив
-                                'controls' => true,
-                                'class' => 'file-preview-video',
-                                'style' => 'max-width: 100%; height: auto;'
-                            ])
-                        ] : [],
-                        'initialPreviewAsData' => false,
-                        'initialPreviewConfig' => !empty($processUrls) ? [
-                            ['type' => 'video', 'filetype' => 'video/mp4']
-                        ] : [],
-                        'maxFileSize' => 100000,
-                        'dropZoneTitle' => 'Выберите видеофайл',
-                        'browseOnZoneClick' => true,
-                        'fileActionSettings' => [
-                            'showZoom' => false,
+            <div class="row">
+                <div class="col-md-6 w-100 w-md-75 w-lg-50">
+                    <div class="row mb-2"><?= Html::label("Презентация", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
+                    <?= $form->field($model, 'video_presentation')->widget(FileInput::class, [
+                        'options' => [
+                            'id' => 'video-file-upload',
+                            'multiple' => false,
+                            'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
                         ],
-                    ],
-                ])->label(false) ?>
+                        'language' => 'ru',
+                        'pluginOptions' => [
+                            'showPreview' => true,
+                            'showUpload' => false,
+                            'showCancel' => false,
+                            'mainClass' => 'input-group-lg',
+                            'initialPreview' => !empty($videoUrls) ? [
+                                Html::tag('video', '', [
+                                    'src' => is_array($videoUrls) ? $videoUrls[0] : $videoUrls, // Извлекаем первый элемент, если массив
+                                    'controls' => true,
+                                    'class' => 'file-preview-video',
+                                    'style' => 'max-width: 100%; height: auto;'
+                                ])
+                            ] : [],
+                            'initialPreviewAsData' => false,
+                            'initialPreviewConfig' => !empty($videoUrls) ? [
+                                ['type' => 'video', 'filetype' => 'video/mp4']
+                            ] : [],
+                            'maxFileSize' => 100000,
+                            'dropZoneTitle' => 'Выберите видеофайл',
+                            'browseOnZoneClick' => true,
+                            'fileActionSettings' => [
+                                'showZoom' => false,
+                            ],
+                        ],
+                    ])->label(false) ?>
+                </div>
+                <div class="col-md-6 w-100 w-md-75 w-lg-50">
+                    <div class="row mb-2"><?= Html::label("Процесс сборки", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>
+                    <?= $form->field($model, 'video_build_process')->widget(FileInput::class, [
+                        'options' => [
+                            'id' => 'presentation-file-upload',
+                            'multiple' => false,
+                            'accept' => 'video/mp4, video/avi, video/mov, video/mkv',
+                        ],
+                        'language' => 'ru',
+                        'pluginOptions' => [
+                            'showPreview' => true,
+                            'showUpload' => false,
+                            'showCancel' => false,
+                            'mainClass' => 'input-group-lg',
+                            'initialPreview' => !empty($processUrls) ? [
+                                Html::tag('video', '', [
+                                    'src' => is_array($processUrls) ? $processUrls[0] : $processUrls, // Извлекаем первый элемент, если массив
+                                    'controls' => true,
+                                    'class' => 'file-preview-video',
+                                    'style' => 'max-width: 100%; height: auto;'
+                                ])
+                            ] : [],
+                            'initialPreviewAsData' => false,
+                            'initialPreviewConfig' => !empty($processUrls) ? [
+                                ['type' => 'video', 'filetype' => 'video/mp4']
+                            ] : [],
+                            'maxFileSize' => 100000,
+                            'dropZoneTitle' => 'Выберите видеофайл',
+                            'browseOnZoneClick' => true,
+                            'fileActionSettings' => [
+                                'showZoom' => false,
+                            ],
+                        ],
+                    ])->label(false) ?>
+                </div>
             </div>
-
+        </div>
 
         <div class="col-md-3">
             <div class="row mb-2"><?= Html::label("Прогноз продаж", null, ['class' => 'text-center font-weight-bold pt-5 h5']) ?></div>