source: main/trunk/model-interfaces-dev/atea/macron-restoration/src/components/FileInput.vue@ 35724

Last change on this file since 35724 was 35724, checked in by cstephen, 2 years ago

Add footer information

File size: 2.2 KB
Line 
1<template>
2<file-upload />
3
4<div class="file-info-list">
5 <div v-for="(fileInfo, index) in fileInfos" :key="fileInfo.id">
6 <div class="info-container">
7 <img class="icon-l" src="img/word_icon.ico" v-if="fileInfo.fileType === '.docx'" />
8 <span class="material-icons mdi-override" v-else>description</span>
9
10 {{ fileInfo.fileName }}
11
12 <button @click="download(fileInfo)" type="button" class="btn-primary theme-flat">
13 <span class="material-icons">download</span>
14 <span>{{ translations.get("FileInput_Download") }}</span>
15 </button>
16 </div>
17
18 <hr class="divider-s" v-if="index !== fileInfos.length - 1" />
19 </div>
20</div>
21
22<form ref="formDownload" method="post" target="_blank">
23 <input ref="inputFilePath" type="hidden" name="filepath" />
24 <input ref="inputFileName" type="hidden" name="filename" />
25</form>
26
27</template>
28
29<style scoped lang="scss">
30.info-container {
31 display: grid;
32 grid-template-columns: auto 1fr auto;
33 align-items: center;
34
35 gap: 0.5em;
36 padding: 0.5em;
37 transition-duration: var(--transition-duration);
38
39 &:hover {
40 background-color: #DDD;
41 }
42}
43
44.file-info-list {
45 border: 1px solid #BBB;
46 margin-top: 1em;
47}
48
49.mdi-override {
50 @extend .mdi-l;
51
52 color: var(--bg-color);
53}
54
55.icon-l {
56 height: 36px;
57}
58</style>
59
60<script>
61import { mapState } from "vuex";
62import MacronRestorationService from "../js/MacronRestorationModule"
63import FileUpload from "./FileUpload.vue"
64
65const macronRestorer = new MacronRestorationService();
66
67export default {
68 name: "FileInput",
69 components: {
70 FileUpload
71 },
72 computed: {
73 ...mapState({
74 translations: state => state.translations,
75 fileInfos: state => state.macronisedFileInfos
76 })
77 },
78 methods: {
79 download(fileInfo) {
80 this.$refs.inputFilePath.value = fileInfo.filePath;
81 this.$refs.inputFileName.value = fileInfo.fileName;
82 this.$refs.formDownload.submit();
83 }
84 },
85 mounted() {
86 this.$refs.formDownload.setAttribute("action", macronRestorer.queryUrl + "Download");
87 }
88}
89</script>
Note: See TracBrowser for help on using the repository browser.