Mercurial > gemma
comparison client/src/lib/mixins.js @ 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 | 660147046ddd |
children | a857d6ae1264 |
comparison
equal
deleted
inserted
replaced
5435:351d38269e4e | 5437:eeee1c411576 |
---|---|
438 }, | 438 }, |
439 replacePlaceholders(text) { | 439 replacePlaceholders(text) { |
440 if (text.includes("{date}")) { | 440 if (text.includes("{date}")) { |
441 text = text.replace("{date}", new Date().toLocaleString(locale2)); | 441 text = text.replace("{date}", new Date().toLocaleString(locale2)); |
442 } | 442 } |
443 const hasVisibleSurvey = | |
444 this.soundingInfo && | |
445 this.bottleneckForPrint && | |
446 this.selectedSurvey && | |
447 this.openLayersMap() | |
448 .getLayer("BOTTLENECKISOLINE") | |
449 .getVisible(); | |
443 // get only day,month and year from the Date object | 450 // get only day,month and year from the Date object |
444 if (text.includes("{date-minor}")) { | 451 if (text.includes("{date-minor}")) { |
445 var date = new Date(); | 452 var date; |
453 if (hasVisibleSurvey) { | |
454 date = new Date(this.selectedSurvey["date_info"]); | |
455 } else { | |
456 date = new Date(); | |
457 } | |
458 | |
446 var dt = | 459 var dt = |
447 (date.getDate() < 10 ? "0" : "") + | 460 (date.getDate() < 10 ? "0" : "") + |
448 date.getDate() + | 461 date.getDate() + |
449 "." + | 462 "." + |
450 (date.getMonth() + 1 < 10 ? "0" : "") + | 463 (date.getMonth() + 1 < 10 ? "0" : "") + |