]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-417
authormarina <m.zozirova@gmail.com>
Fri, 23 May 2025 13:57:17 +0000 (16:57 +0300)
committermarina <m.zozirova@gmail.com>
Fri, 23 May 2025 13:57:17 +0000 (16:57 +0300)
erp24/views/write_offs_erp/view.php

index f1391b4c3d97ab7e503807dfba09bb5687d64636..d52c3d1aa8718ade292f546a6944d0e16cfe9536 100644 (file)
@@ -23,24 +23,7 @@ $this->params['breadcrumbs'][] = ['label' => 'Write Offs Erps', 'url' => ['index
 $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 {
@@ -160,28 +143,24 @@ JS, \yii\web\View::POS_READY);
                                 }
                                 $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>';