// 'items' => [0,1],
],
[
- 'name' => 'video_row',
+ '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(['videosWriteOffsErp']); // связанная связь для видео
- $models = $query->all();
- $videoList = [];
- foreach ($models as $item) {
- // Предположим, getVideosList возвращает массив html тегов видео или ссылок
- $videoList = WriteOffsErp::getVideosList($item->videosWriteOffsErp, false);
+
+ $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($videoList)) {
- return implode('', $videoList);
+ if (!empty($productImagesList)) {
+// $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
+ if ($forWidget) {
+ $dataTable = dosamigos\gallery\Gallery::widget(['items' => $productImagesList]);
+ } else {
+ $dataTable = implode('', $productImagesList);
+ }
}
}
- return '';
+ $test = 33;
+ return $dataTable ?? '';
},
'headerOptions' => [
- //'style' => 'width: 150px;', // при необходимости задайте ширину
- ],
+// 'style' => 'width: 70px;',
+ ]
],
[
- 'name' => 'videoFiles',
- 'title' => 'Ð\92идео: mp4, mov, avi',
+ 'name' => 'imageFiles',
+ 'title' => 'ФоÑ\82огÑ\80аÑ\84ии: jpg и png',
'type' => FileInput::className(),
'options' => [
'options' => [
- 'multiple' => false,
- 'accept' => 'video/*',
- 'name' => 'video_name',
- 'class' => 'file',
+ 'multiple' => true,
+ 'accept' => 'image/*',
+ 'name' => 'image_name',
+ 'capture' => '',
+ 'class' => 'file'
],
'pluginOptions' => [
- 'showPreview' => true,
+ 'showPreview' => false,
'showCaption' => true,
'showRemove' => true,
'showUpload' => false,
- '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,
- ],
+ 'overwriteInitial' => true,
+ 'browseIcon' => '+',
+ 'cancelIcon' => 'x',
+ 'removeIcon' => '-',
+ 'buttonLabelClass' => 'hidden',
+ 'fileActionSettings' => ['showUpload' => false],
+ 'maxFileCount' => 10,
+ 'multiple' => true
],
- 'model' => $multipleUploadForm, // модель загрузки
+ 'model' => $multipleUploadForm,
],
],
[
},
'columnOptions' => function ($rowModel, $index, $context) {
$file = null;
- $initialPreview = [];
$initialPreviewConfig = [];
if (isset($rowModel['id'])) {
]);
if ($file) {
- $initialPreview = [$file->url];
$initialPreviewConfig = [[
- 'type' => 'video',
'caption' => basename($file->url),
'url' => \yii\helpers\Url::to(['delete-video', 'id' => $rowModel['id']]),
- // Убрал confirm и метод, можно добавить при необходимости
]];
}
}
'multiple' => false,
'accept' => 'video/*',
'name' => 'video_name',
- 'class' => 'file', // как у фото
+ 'class' => 'file',
],
'pluginOptions' => [
- 'showPreview' => true,
- 'showCaption' => true,
+ 'showPreview' => false, // отключаем превью видео
+ 'showCaption' => true, // показываем название файла
'showRemove' => true,
'showUpload' => true,
- 'previewFileType' => 'video',
- 'allowedFileExtensions' => ['mp4', 'mov', 'avi'],
- 'maxFileSize' => 10240,
- 'initialPreview' => $initialPreview,
- 'initialPreviewAsData' => true,
+ 'initialPreview' => [], // без превью
+ 'initialPreviewAsData' => false, // без превью как данные
'initialPreviewConfig' => $initialPreviewConfig,
- // вот ключевые опции:
- 'previewSettings' => [
- 'video' => ['width' => '120px', 'height' => 'auto'],
- ],
'browseLabel' => '+',
'removeLabel' => '-',
'cancelLabel' => 'x',