changeset 5437:eeee1c411576 marking-single-beam

Pdf-Template: Use survey-date for {date-minor} when bottleneck survey is visible.
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 13 Jul 2021 12:24:29 +0200
parents 351d38269e4e
children 4d1b1df61f71
files client/src/lib/mixins.js
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/lib/mixins.js	Tue Jul 13 10:59:22 2021 +0200
+++ b/client/src/lib/mixins.js	Tue Jul 13 12:24:29 2021 +0200
@@ -440,9 +440,22 @@
       if (text.includes("{date}")) {
         text = text.replace("{date}", new Date().toLocaleString(locale2));
       }
+      const hasVisibleSurvey =
+        this.soundingInfo &&
+        this.bottleneckForPrint &&
+        this.selectedSurvey &&
+        this.openLayersMap()
+          .getLayer("BOTTLENECKISOLINE")
+          .getVisible();
       // get only day,month and year from the Date object
       if (text.includes("{date-minor}")) {
-        var date = new Date();
+        var date;
+        if (hasVisibleSurvey) {
+          date = new Date(this.selectedSurvey["date_info"]);
+        } else {
+          date = new Date();
+        }
+
         var dt =
           (date.getDate() < 10 ? "0" : "") +
           date.getDate() +