From 526ea33f8c3c2b939e05bdb8f488ea823c6fb088 Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 27 May 2025 15:14:06 +0300 Subject: [PATCH] ERP-417 --- erp24/views/write_offs_erp/_form.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/erp24/views/write_offs_erp/_form.php b/erp24/views/write_offs_erp/_form.php index 30ec400a..c0fb4d20 100644 --- a/erp24/views/write_offs_erp/_form.php +++ b/erp24/views/write_offs_erp/_form.php @@ -35,21 +35,22 @@ $this->registerJsFile('/js/validate/validateForm.js', ['position' => \yii\web\Vi $this->registerJsFile('/js/heic2any.min.js', ['position' => \yii\web\View::POS_END]); $this->registerJsFile('/js/heic_to_jpg_replace.js', ['position' => \yii\web\View::POS_END]); -$this->registerJs(<< 0; + let fileInput = $('.list-cell__imageFiles input[type="file"]'); + let hasFilesSelected = fileInput.length && fileInput[0].files.length > 0; + + if (!hasImageInRow && !hasFilesSelected) { e.preventDefault(); + alert('Пожалуйста, добавьте хотя бы одно фото перед сохранением.'); + return false; } }); }); -JS -); - +JS; +$this->registerJs($js, \yii\web\View::POS_READY); ?>