diff client/src/store/application.js @ 2212:733cfc3db48a pdf-export

started pdf template administration moved templates to vuex store, to have them available in pdf box and systen configuration.
author Markus Kottlaender <markus@intevation.de>
date Wed, 06 Feb 2019 16:19:16 +0100
parents 4235fa8f59d7
children 585373d33f8f
line wrap: on
line diff
--- a/client/src/store/application.js	Wed Feb 06 15:53:24 2019 +0100
+++ b/client/src/store/application.js	Wed Feb 06 16:19:16 2019 +0100
@@ -15,6 +15,7 @@
  */
 
 import { version } from "../../package.json";
+// import { HTTP } from "../lib/http";
 
 // initial state
 const init = () => {
@@ -22,6 +23,7 @@
     appTitle: process.env.VUE_APP_TITLE,
     secondaryLogo: process.env.VUE_APP_SECONDARY_LOGO_URL,
     logoForPDF: process.env.VUE_APP_LOGO_FOR_PDF_URL,
+    pdfTemplates: [],
     showSidebar: false,
     showUsermenu: false,
     showSplitscreen: false,
@@ -103,6 +105,113 @@
     },
     searchQuery: (state, searchQuery) => {
       state.searchQuery = searchQuery;
+    },
+    pdfTemplates: (state, pdfTemplates) => {
+      state.pdfTemplates = pdfTemplates;
+    }
+  },
+  actions: {
+    loadPdfTemplates({ commit }) {
+      return new Promise(resolve => {
+        // pretend we do something async
+        setTimeout(function() {
+          commit("pdfTemplates", [
+            {
+              name: "Default",
+              properties: {
+                format: "landscape",
+                resolution: "80",
+                paperSize: "a4"
+              },
+              elements: [
+                {
+                  type: "docinfo",
+                  x_coordinate: 0,
+                  y_coordinate: 0,
+                  elementWidth: 118,
+                  elementHeight: 8,
+                  textSize: 9
+                },
+                {
+                  type: "image",
+                  imageType: "PNG",
+                  imageUrl: "",
+                  x_coordinate: 30,
+                  y_coordinate: 297,
+                  imageWidth: 50,
+                  imageHeight: 23
+                },
+                {
+                  type: "scalebar",
+                  x_coordinate: 226.5,
+                  y_coordinate: 204
+                  //elementsize: 50
+                },
+                {
+                  type: "textbox",
+                  x_coordinate: 50,
+                  y_coordinate: 190,
+                  elementSize: 8,
+                  text: "textfrom template",
+                  color: "black"
+                },
+                {
+                  type: "aboutbox"
+                  //x_coordinate: 0,
+                  //y_coordinate: 210 - 20
+                }
+              ]
+            },
+            {
+              name: "DE Querformat, groß",
+              properties: {
+                format: "landscape",
+                resolution: "120",
+                paperSize: "a3"
+              },
+              elements: [
+                {
+                  type: "docinfo",
+                  x_coordinate: 0,
+                  y_coordinate: 0,
+                  elementWidth: 118,
+                  elementHeight: 8,
+                  textSize: 9
+                },
+                {
+                  type: "image",
+                  imageType: "PNG",
+                  imageUrl: "",
+                  x_coordinate: 30,
+                  y_coordinate: 297,
+                  imageWidth: 50,
+                  imageHeight: 23
+                },
+                {
+                  type: "scalebar",
+                  x_coordinate: 247.3,
+                  y_coordinate: 414
+                  //elementsize: 50
+                },
+                {
+                  type: "textbox",
+                  x_coordinate: 50,
+                  y_coordinate: 50,
+                  elementSize: 22,
+                  text: "from template",
+                  color: "black"
+                },
+                {
+                  type: "aboutbox"
+                  //x_coordinate: 0,
+                  //y_coordinate: 210 - 20
+                }
+              ]
+            }
+          ]);
+          resolve();
+        }, 500);
+      });
     }
   }
 };