Přidáno generování pdfka.

This commit is contained in:
Greenscreener 2021-01-23 02:50:29 +01:00
parent deee73612d
commit 76e7f3c0ae
8 changed files with 837 additions and 199 deletions

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

8
.idea/modules.xml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/res-judicata.iml" filepath="$PROJECT_DIR$/.idea/res-judicata.iml" />
</modules>
</component>
</project>

8
.idea/res-judicata.iml generated Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

63
.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="39abb422-f003-441e-be66-ff0b3a9f69a8" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/res-judicata.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/form/res-judicata/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/form/res-judicata/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/form/res-judicata/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/form/res-judicata/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/form/res-judicata/src/views/Edit.vue" beforeDir="false" afterPath="$PROJECT_DIR$/form/res-judicata/src/views/Edit.vue" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ComposerSettings">
<execution />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1nRQWL0kirrMXepvPDtnE06Zdzy" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="settings.editor.selected.configurable" value="preferences.keymap" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="39abb422-f003-441e-be66-ff0b3a9f69a8" name="Default Changelist" comment="" />
<created>1611350461599</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1611350461599</updated>
<<<<<<< Updated upstream
<workItem from="1611350465569" duration="12951000" />
=======
<workItem from="1611350465569" duration="7407000" />
>>>>>>> Stashed changes
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"serve": "vue-cli-service serve --host 0.0.0.0",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
@ -12,6 +12,7 @@
"core-js": "^3.6.5",
"jspdf": "^2.3.0",
"v-click-outside": "^3.1.2",
"pdfmake": "^0.1.70",
"vue": "^2.6.11",
"vue-router": "^3.2.0"
},

View File

@ -63,6 +63,8 @@
</div>
</div>
</div>
<button v-on:click="createPdf">Generate a PDF</button>
<iframe :src="pdfSrc" width="1000" height="1000" frameborder="0"></iframe>
</div>
</template>
@ -85,6 +87,10 @@
import NavBar from '@/components/edit/NavBar.vue'
import Hlava from '@/components/edit/Hlava.vue'
import pdfMake from "pdfmake/build/pdfmake";
import pdfFonts from "pdfmake/build/vfs_fonts";
pdfMake.vfs = pdfFonts.pdfMake.vfs;
export default {
name: 'Edit',
components: {
@ -101,6 +107,7 @@ export default {
},
data: () => {
return {
pdfSrc: "",
zaloba: {
soud: {
nazev: "Obvodní soudu pro Prahu 4",
@ -166,6 +173,164 @@ export default {
title: "Žaloba"
}
}
},
methods: {
createPdf: function () {
const dd = {
content: [
{
text: this.zaloba.soud.nazev,
style: 'adresa'
},
{
text: this.zaloba.soud.sidlo.uliceacislopopisne,
style: "adresa"
},
{
text: this.zaloba.soud.sidlo.psc + " " + this.zaloba.soud.sidlo.mesto,
style: "adresa"
},
{
text: this.zaloba.title,
style: "bigtitle"
},
{
text: this.zaloba.zalobci.length === 1 ? "Žalobce: " : "Žalobci: "
},
...this.zaloba.zalobci.map(e => [
{
text: `${e.jmeno} ${e.prijmeni}, rč.: ${e.rodnecisloneboico}`,
style: "zalobce"
},
{
text: `${e.sidlo.uliceacislopopisne}, ${e.sidlo.psc}, ${e.sidlo.mesto}`,
style: "zalobce"
},
...typeof e.zastoupen !== "undefined" ? [
{
text: "Zastoupen: ",
style: "zalobce"
},
{
text: `${e.zastoupen.jmeno} ${e.zastoupen.prijmeni}, IČO: ${e.rodnecisloneboico}`,
style: "zastupce"
},
{
text: `${e.zastoupen.sidlo.uliceacislopopisne}, ${e.zastoupen.sidlo.psc}, ${e.zastoupen.sidlo.mesto}`,
style: "zastupce"
}
] : [{}],
{
text: "",
style: "separator"
}
]).flat(),
{
text: this.zaloba.zalobci.length === 1 ? "Žalovaný: " : "Žalovaní: "
},
...this.zaloba.zalovani.map(e => [
{
text: `${e.jmeno} ${e.prijmeni}, rč.: ${e.rodnecisloneboico}`,
style: "zalobce"
},
{
text: `${e.sidlo.uliceacislopopisne}, ${e.sidlo.psc}, ${e.sidlo.mesto}`,
style: "zalobce"
},
...typeof e.zastoupen !== "undefined" ? [
{
text: "Zastoupen: ",
style: "zalobce"
},
{
text: `${e.zastoupen.jmeno} ${e.zastoupen.prijmeni}, IČO: ${e.rodnecisloneboico}`,
style: "zastupce"
},
{
text: `${e.zastoupen.sidlo.uliceacislopopisne}, ${e.zastoupen.sidlo.psc}, ${e.zastoupen.sidlo.mesto}`,
style: "zastupce"
}
] : [{}],
{
text: "",
style: "separator"
}
]).flat(),
{
text: this.zaloba.title,
style: "smalltitle"
},
...this.zaloba.hlavy.map(e => [
{
text: e.nazev,
style: "smalltitle"
},
{
text: e.text
}
]).flat(),
{
text: `Dne ${this.zaloba.datum} v České republice`,
alignment: "right",
margin: [0, 30, 0, 0]
},
{
text: "__________________________",
alignment: "right",
margin: [0, 30, 0, 0]
}
],
defaultStyle: {
font: 'SourceSerifPro'
},
styles: {
adresa: {
bold: true,
alignment: "right"
},
zalobce: {
margin: [15, 0, 0, 0]
},
zastupce: {
margin: [20, 0, 0, 0]
},
separator: {
margin: [0,16,0,0]
},
bigtitle: {
fontSize: 20,
bold: true,
alignment: "center",
margin: [0,16,0,16]
},
smalltitle: {
bold: true,
alignment: "center",
margin: [0, 10, 0, 10]
}
}
}
pdfMake.fonts = {
SourceSerifPro: {
normal: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-Regular.ttf",
bold: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-Bold.ttf",
italics: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-Italic.ttf",
bolditalics: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-BoldItalic.ttf",
}
}
pdfMake.createPdf(dd).getDataUrl((dataUrl) => {
this.pdfSrc = dataUrl;
});
}
}
}
</script>