diff client/src/components/fairway/AvailableFairwayDepthLNWL.vue @ 3437:6a044d6c2cdc

afd: csv download
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 24 May 2019 10:21:06 +0200
parents ecd45c950430
children 213b703bdd85
line wrap: on
line diff
--- a/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri May 24 10:01:40 2019 +0200
+++ b/client/src/components/fairway/AvailableFairwayDepthLNWL.vue	Fri May 24 10:21:06 2019 +0200
@@ -28,6 +28,9 @@
           >
             <translate>Export to PDF</translate>
           </button>
+          <a href="#" :download="csvFileName" class="mt-1 btn btn-sm btn-info"
+            >Download CSV</a
+          >
         </div>
       </DiagramLegend>
       <div
@@ -166,8 +169,19 @@
       "from",
       "to",
       "frequency",
-      "legendLNWL"
+      "legendLNWL",
+      "csv"
     ]),
+    dataLink() {
+      return `data:text/csv;charset=utf-8, ${encodeURIComponent(this.csv)}`;
+    },
+    csvFileName() {
+      return `${this.$gettext("fairwayavailabilityLNWL")}-${
+        this.selectedFairwayAvailabilityFeature.properties.name
+      }-${filters.surveyDate(this.fromDate)}-${filters.surveyDate(
+        this.toDate
+      )}-${this.$gettext(this.frequency)}-.csv`;
+    },
     fromDate() {
       return this.from;
     },