From: fomichev Date: Mon, 31 Mar 2025 08:39:32 +0000 (+0300) Subject: Merge branch 'refs/heads/develop' into feature_fomichev_erp-380_add_lightbox_to_image... X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=c253a176705705fed733b38a8cc91ce906dff220;p=erp24_rep%2Fyii-erp24%2F.git Merge branch 'refs/heads/develop' into feature_fomichev_erp-380_add_lightbox_to_image_bouquetr # Conflicts: # erp24/views/bouquet/index.php --- c253a176705705fed733b38a8cc91ce906dff220 diff --cc erp24/views/bouquet/index.php index 7371ed1c,587401ae..c46ae151 --- a/erp24/views/bouquet/index.php +++ b/erp24/views/bouquet/index.php @@@ -75,177 -71,159 +75,188 @@@ $this->title = 'Содержание м
$dataProvider, - 'layout' => "{items}\n{pager}", + 'layout' => "{items}\n{pager}", 'tableOptions' => ['class' => 'table'], - 'columns' => [ + 'columns' => [ [ - 'attribute' => 'name', - 'format' => 'raw', - 'value' => function ($model) { + 'attribute' => 'name', + 'format' => 'raw', + 'value' => function ($model) { $compositionHtml = "
"; - if (is_array($model->bouquetCompositionProducts)) { foreach ($model->bouquetCompositionProducts as $item) { - $product = Products1c::findOne($item->product_guid); + $product = Products1c::findOne($item->product_guid); $productName = $product ? $product->name : 'Неизвестный продукт'; - $compositionHtml .= " -
-
{$productName}
-
{$item->count}
-
"; +
+
{$productName}
+
{$item->count}
+
"; } } + $compositionHtml .= "
"; - $images = Files::find() - ->where(['entity_id' => $model->id, 'entity' => \yii_app\records\BouquetComposition::PHOTO_BOUQUET]) - ->limit(3) + $images = Files::find() + ->where([ + 'entity_id' => $model->id, + 'entity' => BouquetComposition::PHOTO_BOUQUET + ]) ->all(); - $imageUrls = array_map(fn($file) => Url::to($file->url), $images); - $imageUrls += array_fill(0, 3 - count($imageUrls), null); - $compositionHtml .= "
"; + $allImageUrls = array_map(fn($file) => Url::to($file->url), $images); + $previewImageUrls = array_slice($allImageUrls, 0, 3); + $previewImageUrls += array_fill(0, 3 - count($previewImageUrls), null); - return " -
-
-
-

{$model->name}

-
- {$compositionHtml} -
-
+ $galleryId = 'gallery-' . $model->id; + + $hiddenLinks = ""; + if (count($allImageUrls) > 3) { + foreach (array_slice($allImageUrls, 3) as $url) { + $hiddenLinks .= Html::a('', $url, [ + 'data-lightbox' => $galleryId, + 'style' => 'display:none;' + ]); + } + } + + $html = " +
+
+
+

{$model->name}

+
+ {$compositionHtml} +
-
- Себестоимость: " . $model->getSelfCost() . "
- Наценка: " . $model->getMarkUp() . "
- Цена: " . $model->getCost() . "
++
+
Нижегородская обл.
+
- Себестоимость: " . round($model->getSelfCost()) . "₽
- Наценка: +30% / +" . round(BouquetComposition::PROCENT_30 * $model->getSelfCost()) . "₽
- Цена: " . round($model->getBouquetCost(BouquetComposition::REGION_NN)) . "₽. +" . round($model->getBouquetCostMarkup(BouquetComposition::REGION_NN), 2) . "%
++ Себестоимость: " . round($model->getSelfCost()) . "₽
++ Наценка: +30% / +" . round(BouquetComposition::PROCENT_30 * $model->getSelfCost()) . "₽
++ Цена: " . round($model->getBouquetCost(BouquetComposition::REGION_NN)) . "₽. +" . round($model->getBouquetCostMarkup(BouquetComposition::REGION_NN), 2) . "%
+
+
+
+
Московская обл.
+
+ Себестоимость: " . round($model->getSelfCost()) . "₽
+ Наценка: +30% / +" . round(BouquetComposition::PROCENT_30 * $model->getSelfCost()) . "₽
+ Цена: " . round($model->getBouquetCost(BouquetComposition::REGIONO_MSK)) . "₽. +" . round($model->getBouquetCostMarkup(BouquetComposition::REGIONO_MSK), 2) . "%
+
-
+
+
+ +
+
+
"; + if (isset($previewImageUrls[0])) { + $html .= Html::a( + Html::img($previewImageUrls[0], [ + 'style' => 'width: 100%; height: 100%; object-fit: cover;', + ]), + $previewImageUrls[0], + ['data-lightbox' => $galleryId] + ); + } + $html .= "
- -
-
-
" . - Html::img(Url::to($imageUrls[0]), [ - 'style' => 'width: 100%; height: 100%; object-fit: cover;' - ]) . " -
-
- -
-
+
+ +
+
" . Html::tag('video', '', [ - 'class' => 'video-preview', - 'src' => Url::to($model->presentation->url ?? null), - 'style' => 'width: 100%; height: 100%; object-fit: cover;', - 'autoplay' => true, - 'muted' => true, - 'loop' => true, - 'playsinline' => true + 'class' => 'video-preview', + 'src' => Url::to($model->presentation->url ?? null), + 'style' => 'width: 100%; height: 100%; object-fit: cover;', + 'autoplay' => true, + 'muted' => true, + 'loop' => true, + 'playsinline' => true, ]) . " -
Презентация
-
-
" . - Html::img(Url::to($imageUrls[1]), [ - 'style' => 'width: 100%; height: 100%; object-fit: cover;' - ]) . " -
-
- -
-
" . - Html::tag('video', '', [ - 'class' => 'video-preview', - 'src' => Url::to($model->buildProcess->url ?? null), - 'style' => 'width: 100%; height: 100%; object-fit: cover;', - 'autoplay' => true, - 'muted' => true, - 'loop' => true, - 'playsinline' => true +
Презентация
+
+
"; + if (isset($previewImageUrls[1])) { + $html .= Html::a( + Html::img($previewImageUrls[1], [ + 'style' => 'width: 100%; height: 100%; object-fit: cover;', + ]), + $previewImageUrls[1], + ['data-lightbox' => $galleryId] + ); + } + $html .= " +
+
+ +
+
+ " . Html::tag('video', '', [ + 'class' => 'video-preview', + 'src' => Url::to($model->buildProcess->url ?? null), + 'style' => 'width: 100%; height: 100%; object-fit: cover;', + 'autoplay' => true, + 'muted' => true, + 'loop' => true, + 'playsinline' => true, ]) . " -
Процесс сборки
-
-
" . - Html::img(is_array($imageUrls) && isset($imageUrls[2]) ? Url::to($imageUrls[2]) : null, - ['style' => 'width: 100%; height: 100%; object-fit: cover;']) . " -
-
-
-
- " . (!empty($model->status) ? " - - 'bg-success', - WriteOffsErp::STATUS_SEND => 'bg-warning', - WriteOffsErp::STATUS_DISABLE, - WriteOffsErp::STATUS_ERROR_1С => 'bg-danger', - default => 'bg-secondary', - } . - " fs-6 text-white px-7 w-100 mb-4 d-block'> - " . Html::encode(\yii_app\records\WriteOffsErp::STATUSES[$model->status] ?? '') . " - - " : "") . " -
- " . (!empty($model->error_text) ? " -
- - - " . Html::encode($model->error_text) . " - -
- " : "") . " -
-
-
-
- " . - Html::a('Редактировать', Url::to(['/bouquet/view', 'id' => $model['id']]), [ +
Процесс сборки
+
+
"; + if (isset($previewImageUrls[2])) { + $html .= Html::a( + Html::img($previewImageUrls[2], [ + 'style' => 'width: 100%; height: 100%; object-fit: cover;' + ]), + $previewImageUrls[2], + ['data-lightbox' => $galleryId] + ); + } + $html .= " +
+
+
+
+ " . (!empty($model->status) ? " + + 'bg-success', + WriteOffsErp::STATUS_SEND => 'bg-warning', + WriteOffsErp::STATUS_DISABLE, + WriteOffsErp::STATUS_ERROR_1С => 'bg-danger', + default => 'bg-secondary', + } . + " fs-6 text-white px-7 w-100 mb-4 d-block'> + " . Html::encode(WriteOffsErp::STATUSES[$model->status] ?? '') . " + + " : "") . " +
+ " . (!empty($model->error_text) ? " +
+ + + " . Html::encode($model->error_text) . " + +
+ " : "") . " +
+
+
+
+ " . Html::a('Редактировать', Url::to(['/bouquet/view', 'id' => $model['id']]), [ 'class' => 'btn btn-warning btn-edit' -// . -// ((Yii::$app->request->get('year') < date('Y') || // Если год в прошлом → disabled -// (Yii::$app->request->get('year') == date('Y') && Yii::$app->request->get('month') < date('m')) || -// (Yii::$app->request->get('year') == date('Y') && Yii::$app->request->get('month') == date('m') && BouquetComposition::disabledButtons()) || -// (Yii::$app->request->get('year') == date('Y') && Yii::$app->request->get('month') == date('m') + 1 &&BouquetComposition::disabledButtons()) -// ) ? ' disabled' : ''), - ]) - . " -
-
+ ]) . "
-
"; +
+
+ " . $hiddenLinks . " +
"; + return $html; }, 'contentOptions' => ['class' => 'align-top'], - 'headerOptions' => ['style' => 'display:none'], + 'headerOptions' => ['style' => 'display:none'], ], ], ]) ?>