]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
Добавление логирования на загрузку файлов в документ списания.
authorAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Tue, 17 Feb 2026 09:40:16 +0000 (12:40 +0300)
committerAleksey Filippov <Aleksey.Filippov@erp-flowers.ru>
Tue, 17 Feb 2026 09:40:16 +0000 (12:40 +0300)
erp24/views/write_offs_erp/view.php
erp24/web/js/notification.js

index 57c4c8c1b0b9bc8206c4b93c457f7b6d17a15c68..0ffe5d5e6f9e329d287692c7438c9242d0823f80 100644 (file)
@@ -144,8 +144,16 @@ $this->registerCssFile('/css/write-offs-erp.css', ['position' => \yii\web\View::
                                 $dataTable .= '<td>';
                                 $video = $product->video;
                                 if (!empty($video)) {
-                                    $dataTable .= '<video controls width="200">';
-                                    $dataTable .= '<source src="' . Html::encode($video->url) . '" type="video/mp4">';
+                                    $videoUrl = Html::encode($video->url);
+                                    $ext = strtolower(pathinfo($video->url, PATHINFO_EXTENSION));
+                                    $mimeTypes = [
+                                        'mp4' => 'video/mp4',
+                                        'mov' => 'video/quicktime',
+                                        'avi' => 'video/x-msvideo',
+                                    ];
+                                    $mimeType = $mimeTypes[$ext] ?? 'video/mp4';
+                                    $dataTable .= '<video controls width="200" preload="none">';
+                                    $dataTable .= '<source src="' . $videoUrl . '" type="' . $mimeType . '">';
                                     $dataTable .= 'Ваш браузер не поддерживает видео.';
                                     $dataTable .= '</video>';
                                 }
index 36846286283dc4b91a745611736db31fa10824db..b3d037f19c1cd069aecd2547e06cd39dfcf3acf3 100644 (file)
@@ -1,12 +1,28 @@
 let pendingAllowed = true;
+let notificationIntervalId = null;
 
 setTimeout(initPendingNotifications, 3000);
 
 function initPendingNotifications() {
     pendingNotifications();
-    setInterval(pendingNotifications, 10000);
+    notificationIntervalId = setInterval(pendingNotifications, 10000);
 }
 
+// Останавливаем polling когда вкладка неактивна — экономим соединения и трафик
+document.addEventListener('visibilitychange', function () {
+    if (document.hidden) {
+        if (notificationIntervalId) {
+            clearInterval(notificationIntervalId);
+            notificationIntervalId = null;
+        }
+    } else {
+        if (!notificationIntervalId) {
+            pendingNotifications();
+            notificationIntervalId = setInterval(pendingNotifications, 10000);
+        }
+    }
+});
+
 // pendingNotifications();
 
 const $counter = $('#kolokolchik-counter');