Tab Archive: Documentdropdown for Printing

- define structure for single print array
- fill array with documents according to Fas Dropdown Drucken
- event for adding documents from extension/addons
This commit is contained in:
ma0068
2025-08-27 14:11:03 +02:00
parent 6d7429eb8e
commit 3a5c4444cb
8 changed files with 754 additions and 8 deletions
+1 -1
View File
@@ -39,5 +39,5 @@ export default {
url: 'api/frontend/v1/stv/archiv/delete',
params: {akte_id, studiengang_kz}
};
}
},
};
+14
View File
@@ -73,4 +73,18 @@ export default {
params
};
},
getDocumentDropdown(params){
console.log(params);
return {
method: 'get',
url: 'api/frontend/v1/stv/dokumente/getDocumentDropDown/' + params.prestudent_id + '/' + params.studiensemester_kurzbz + '/' + params.studiengang_kz,
};
},
getDocumentDropdownMulti(studentUids){
return {
method: 'get',
url: 'api/frontend/v1/stv/dokumente/getDocumentDropDownMulti/',
params: {studentUids}
};
}
}
@@ -7,7 +7,6 @@ import AbschlusspruefungDropdown from "./AbschlusspruefungDropdown.js";
import ApiStudiengang from '../../../../../api/factory/studiengang.js';
import ApiStvAbschlusspruefung from '../../../../../api/factory/stv/abschlusspruefung.js';
import ApiStvAddress from "../../../../../api/factory/stv/kontakt/address.js";
export default {
components: {
@@ -3,18 +3,29 @@ import FormInput from "../../../Form/Input.js";
import AkteEdit from "./Archiv/Edit.js";
import ApiStvArchiv from '../../../../api/factory/stv/archiv.js';
import ApiStvDocuments from '../../../../api/factory/stv/documents.js';
import DocumentDropdown from "../Details/Archiv/DocumentDropdown";
export default {
name: 'Archiv',
components: {
CoreFilterCmpt,
FormInput,
AkteEdit
AkteEdit,
DocumentDropdown
},
inject: {
currentSemester: {
from: 'currentSemester'
}
},
/* isBerechtigtDocAndOdt: {
from: 'hasPermissionOutputformat',
default: false
},*/
cisRoot: {
from: 'cisRoot'
},
},
props: {
modelValue: Object,
@@ -64,7 +75,8 @@ export default {
'abschlussdokument_lehrgaenge.xml.php': [
'AbschlussdokumentLehrgaenge'
]
}
},
documentDropdownObject: {}
};
},
computed: {
@@ -184,7 +196,42 @@ export default {
];
return events;
},
studentUids() {
if (this.modelValue.uid)
{
return [this.modelValue.uid];
}
return this.modelValue.map(e => e.uid);
},
studentKzs(){
if (this.modelValue.uid)
{
return [this.modelValue.studiengang_kz];
}
return this.modelValue.map(e => e.studiengang_kz);
},
stg_kz(){
return this.studentKzs[0];
},
showAllFormats() {
if( this.isBerechtigtDocAndOdt === false
|| !Array.isArray(this.isBerechtigtDocAndOdt) )
{
return false;
}
let retval = this.isBerechtigtDocAndOdt.includes(this.stgInfo.oe_kurzbz);
return retval;
},
showDropDownMulti(){
if (this.modelValue.length) {
console.log("started comp property showDropdown Multi " + this.modelValue.length);
return true;
}
return false;
}
},
watch: {
modelValue() {
@@ -252,14 +299,44 @@ export default {
}
},
created() {
this.$api
.call(ApiStvArchiv.getArchivVorlagen())
.then(result => {
this.vorlagenArchiv = result.data;
this.selectedVorlage = result.data.filter(o => o.vorlage_kurzbz == 'Zeugnis')[0];
})
.catch(this.$fhcAlert.handleSystemError);
if (this.modelValue.length) {
console.log("multi" + this.modelValue.length);
console.log(this.studentUids);
this.$api
.call(ApiStvArchiv.getArchivVorlagen())
.then(result => {this.vorlagenArchiv = result.data; this.selectedVorlage = result.data.filter(o => o.vorlage_kurzbz == 'Zeugnis')[0];})
.call(ApiStvDocuments.getDocumentDropdownMulti(this.studentUids))
.then(result => {
console.log(result);
this.documentDropdownObject = result;
})
.catch(this.$fhcAlert.handleSystemError);
} else {
console.log("single");
const params = {
prestudent_id: this.modelValue.prestudent_id,
studiensemester_kurzbz: this.currentSemester,
studiengang_kz: this.modelValue.studiengang_kz
};
this.$api
.call(ApiStvDocuments.getDocumentDropdown(params))
.then(result => {
console.log(result);
this.documentDropdownObject = result;
})
.catch(this.$fhcAlert.handleSystemError);
}
},
template: `
<div class="stv-details-archiv h-100 d-flex flex-column">
<core-filter-cmpt
ref="table"
table-only
@@ -270,6 +347,7 @@ export default {
:reload-btn-infotext="this.$p.t('table', 'reload')"
>
<template #actions>
<div class="input-group w-auto">
<select class="form-select" v-model="selectedVorlage">
<option v-for="vorlage in vorlagenArchiv" :key="vorlage.vorlage_kurzbz" :value="vorlage">
@@ -285,6 +363,17 @@ export default {
{{ $p.t('stv/archiv_dokument_archivieren') }}
</button>
</div>
<document-dropdown
v-if="documentDropdownObject.data"
:documents="documentDropdownObject.data"
:showAllFormats='true'
:studentUids="studentUids"
:showDropDownMulti="showDropDownMulti"
:cisRoot="cisRoot"
:stgKz="stg_kz"
></document-dropdown>
</template>
</core-filter-cmpt>
<akte-edit ref="edit" :config="config" @saved="updateData"></akte-edit>
@@ -0,0 +1,116 @@
export default {
name: "DocumentDropdown",
props: {
documents: {
type: [Object, Array],
required: true,
},
studentUids: {
type: [Array, String],
required: true,
default: () => []
},
showDropDownMulti: {
type: Boolean,
required: true
},
cisRoot: {
type: String,
required: true
},
stgKz: {
type: Number,
required: true
},
showAllFormats: {
type: Boolean,
required: true
}
},
data() {
return {};
},
methods: {
printDokument(url, scope){
//TODO Manu(check if logic not in content (Zutrittkarte also in content folder))
let linkToPdf = this.cisRoot + 'content/' + url;
console.log("in print " + linkToPdf + " scope" + scope);
window.open(linkToPdf, '_blank');
}
},
template: `
<div class="stv-document-dropdown">
<div class="btn-group">
<button
v-if="!showDropDownMulti"
ref="toolbarButton"
type="button"
class="btn btn-secondary dropdown-toggle"
data-bs-toggle="dropdown"
data-bs-auto-close="outside"
aria-expanded="false"
@[\`show.bs.dropdown\`]="event => { if (event.target.closest('.tabulator-row')) event.target.closest('.tabulator-row').style.zIndex = 12 }"
@[\`hidden.bs.dropdown\`]="event => { if (event.target.closest('.tabulator-row')) event.target.closest('.tabulator-row').style.zIndex = '' }"
>
{{this.$p.t('dokumente','dokument_erstellen')}}
</button>
<button
v-else
ref="toolbarButton"
type="button"
class="btn btn-secondary dropdown-toggle"
data-bs-toggle="dropdown"
data-bs-auto-close="outside"
aria-expanded="false"
>
multi: {{this.$p.t('tools','dokument_erstellen')}}
</button>
<ul class="dropdown-menu dropdown-menu-right">
<template v-for="doc in documents" :key="doc.id">
<li v-if="doc.type === 'documenturl'">
<button class="dropdown-item" type="button" @click="printDokument(doc.url, doc.scope)">
{{ doc.name }}
</button>
</li>
<li v-else-if="doc.type === 'submenu'" class="dropend">
<a
class="dropdown-item dropdown-toggle"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
{{ doc.name }}
</a>
<ul class="dropdown-menu">
<template v-for="child in doc.data" :key="child.id">
<li v-if="child.type === 'documenturl'">
<button class="dropdown-item" type="button" @click="printDokument(child.url, child.scope)">
{{ child.name }}
</button>
</li>
<li v-else-if="child.type === 'submenu'" class="dropend">
<a
class="dropdown-item dropdown-toggle"
href="#"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
{{ child.name }}
</a>
</li>
</template>
</ul>
</li>
</template>
</ul>
</div>
</div>`
};