$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
-
-$this->registerCssFile('@web/css/fancybox.css');
-$this->registerJsFile('@web/js/fancybox.umd.js', ['position' => View::POS_END]);
-
$this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::POS_HEAD]);
-
-$this->registerJs(<<<JS
-document.addEventListener('DOMContentLoaded', function() {
- if (typeof Fancybox !== 'undefined') {
- Fancybox.bind('[data-fancybox="gallery"]', {
- Toolbar: true,
- closeButton: "top",
- dragToClose: true,
- animated: true
- });
- }
-});
-JS, \yii\web\View::POS_READY);
?>
<style>
.tumb img {
}
$dataTable .= '<td>' . $causeName . '</td>';
$dataTable .= '<td>' . $product['comment'] . '</td>';
- $dataTable .= '<td>'; ?>
+ $dataTable .= '<td>';?>
<?php $images = $model->imagesWriteOffsErp; ?>
-
<?php if (!empty($images)): ?>
<div class="gallery-container">
<?php foreach ($images as $link): ?>
<?php
- $image = \yii_app\records\Images::findOne(['id' => $link->image_id]);
+ $image = \yii_app\records\Images::findOne($link->image_id);
if (!$image || empty($image->filename)) continue;
-
- $url = $image->filename;
- $caption = $image->original_name ?? '';
+ $url = Url::to($image->filename, true);
+ $caption = htmlspecialchars($image->original_name ?? '', ENT_QUOTES);
?>
- <a href="<?= Html::encode($url) ?>" data-fancybox="gallery"
- data-caption="<?= Html::encode($caption) ?>">
- <img src="<?= Html::encode($url) ?>" alt="<?= Html::encode($caption) ?>"
- style="max-width: 150px; margin: 5px; cursor: pointer;">
+ <a href="<?= $url ?>" data-fancybox="gallery" data-caption="<?= $caption ?>">
+ <img src="<?= $url ?>" alt="<?= $caption ?>" style="max-width: 150px; margin: 5px; cursor: pointer;">
</a>
<?php endforeach; ?>
</div>
- <?php endif; ?>
- <?
+ <?php endif;
+
$dataTable .= '</td>';
$dataTable .= '<td>';