corrects the display of links to attachments of a profil update request

This commit is contained in:
SimonGschnell
2024-02-09 14:41:29 +01:00
parent 43492add0b
commit bbf6616cd9
6 changed files with 27 additions and 15 deletions
+2 -3
View File
@@ -178,7 +178,6 @@ class ProfilUpdate extends Auth_Controller
return json_encode(error("Error loading DmsVersion resource"));
}
$attachment = hasData($attachment) ? getData($attachment) : null;
//? returns {name:..., dms_id:...}
echo json_encode($attachment);
}
@@ -353,11 +352,11 @@ class ProfilUpdate extends Auth_Controller
}
private function updateRequestedChange($id, $requested_change){
return $this->update([$id], ['requested_change'=>json_encode($requested_change)]);
return $this->ProfilUpdateModel->update([$id], ['requested_change'=>json_encode($requested_change)]);
}
private function setStatusOnUpdateRequest($id, $status, $status_message ){
return $this->update([$id], ["status"=>$status,"status_timestamp"=>"NOW()","status_message"=>$status_message]);
return $this->ProfilUpdateModel->update([$id], ["status"=>$status,"status_timestamp"=>"NOW()","status_message"=>$status_message]);
}
@@ -84,7 +84,9 @@ class Profil_update_model extends DB_Model
//? Nur wenn der/die AssistentIn auch die Berechtigung in der gleichen Organisationseinheit des Studenten hat
$parameters = [];
$query="
SELECT * FROM public.tbl_profil_update
SELECT
profil_update_id, uid, name, topic, requested_change, tbl_profil_update.updateamum, tbl_profil_update.updatevon, tbl_profil_update.insertamum, tbl_profil_update.insertvon, status, status_timestamp, status_message, attachment_id
FROM public.tbl_profil_update
JOIN public.tbl_student ON public.tbl_student.student_uid=public.tbl_profil_update.uid
JOIN public.tbl_prestudent ON public.tbl_prestudent.prestudent_id=public.tbl_student.prestudent_id
JOIN public.tbl_studiengang ON public.tbl_studiengang.studiengang_kz=public.tbl_prestudent.studiengang_kz
@@ -107,7 +109,7 @@ class Profil_update_model extends DB_Model
}
}
if($mitarbeiterBerechtigung) {
$this->addSelect(["profil_update_id", "uid", "name", "topic", "requested_change", "tbl_profil_update.updateamum", "tbl_profil_update.updatevon", "tbl_profil_update.insertamum", "tbl_profil_update.insertvon", "status", "status_timestamp", "status_message", "attachment_id"]);
$this->addJoin('tbl_mitarbeiter','tbl_mitarbeiter.mitarbeiter_uid=tbl_profil_update.uid');
$mitarbeiterRequests = $this->loadWhere($whereClause);
if(isError($mitarbeiterRequests)) return error("db error: ". getData($mitarbeiterRequests));
@@ -88,7 +88,6 @@ const app = Vue.createApp({
action: (e, column) => {
Vue.$fhcapi.ProfilUpdate.acceptProfilRequest(column.getData())
.then((res) => {
console.log("here");
this.$refs.UpdatesTable.tabulator.setData();
})
.catch((e) => {
@@ -131,7 +131,7 @@ export default {
<tr v-for="item in data" :style="item.status=='accepted'?'background-color:lightgreen':item.status==='rejected'?'background-color:lightcoral':''">
<td class="align-middle text-wrap ">{{item.topic}}</td>
<td class="align-middle " >{{item.status}}</td>
<td class="align-middle">{{item.change_timestamp}}</td>
<td class="align-middle">{{item.status_timestamp}}</td>
<template v-if="item.status === 'pending'">
<td>
@@ -7,7 +7,9 @@ export default {
Kontakt,
},
data() {
return {};
return {
files:null,
};
},
methods:{
getDocumentLink: function(dms_id){
@@ -39,7 +41,11 @@ export default {
updateID: { type: Number },
topic: { type: String },
},
created() {},
created() {
Vue.$fhcapi.ProfilUpdate.getProfilRequestFiles(this.updateID).then((res) =>{
this.files = res.data;
})
},
template: `
<div class="row">
@@ -79,9 +85,9 @@ export default {
<div class="form-underline-titel">{{topic}}</div>
<span class="form-underline-content">{{data.value}} </span>
</div>
<div v-if="data.files?.length" class="ms-2">
<div v-if="files?.length" class="ms-2">
<a target="_blank" :href="getDocumentLink(file.dms_id)" v-for="file in data.files">{{file.name}}</a>
<a target="_blank" :href="getDocumentLink(file.dms_id)" v-for="file in files">{{file.name}}</a>
</div>
</template>
<component v-else :is="getComponentView" :data="data"></component>
@@ -37,6 +37,7 @@ export default {
//? result is returned from the Promise when the modal is closed
result: false,
info: null,
files:null,
};
},
@@ -78,7 +79,12 @@ export default {
}
},
},
created() {},
created() {
Vue.$fhcapi.ProfilUpdate.getProfilRequestFiles(this.data.profil_update_id).then((res) =>{
this.files=res.data;
})
},
mounted() {
this.modal = this.$refs.modalContainer.modal;
},
@@ -170,9 +176,9 @@ export default {
<span class="form-underline-content" >{{data.requested_change.value}}</span>
</div>
<div v-if="data.requested_change.files?.length" class="ms-2">
<!--<p>files:</p>-->
<a v-for="file in data.requested_change.files" target="_blank" :href="getDocumentLink(file.dms_id)" >{{file.name}}</a>
<div v-if="files?.length" class="ms-2">
<a v-for="file in files" target="_blank" :href="getDocumentLink(file.dms_id)" >{{file.name}}</a>
</div>
</template>