update(Profil Profilbild): adds button to upload new profil foto if foto is not yet acepted

This commit is contained in:
SimonGschnell
2025-06-25 11:22:14 +02:00
parent c3ec34a038
commit cbc9a87a47
7 changed files with 66 additions and 11 deletions
@@ -108,6 +108,7 @@ class Profil extends FHCAPI_Controller
$res->data = $this->viewStudentProfil($uid);
}
}
$res->data->fotoStatus=$this->isFotoAkzeptiert($this->pid);
$res->data->editAllowed = $editAllowed;
$this->terminateWithSuccess($res);
}
@@ -648,5 +649,28 @@ class Profil extends FHCAPI_Controller
$zutrittskarte_ausgegebenam = str_replace("-", ".", $zutrittskarte_ausgegebenam);
return $zutrittskarte_ausgegebenam;
}
/**
* checks whether the foto of a user is accepted or not
* @access private
* @param integer $pid the personId of the student or mitarbeiter
* @return bool whether the foto is accepted or not
*/
private function isFotoAkzeptiert($pid)
{
$this->load->model('person/Fotostatusperson_model','FotostatusModel');
$fotostatus = $this->FotostatusModel->execReadOnlyQuery("
select distinct on (person_id) person_id, insertamum, fotostatus_kurzbz
from public.tbl_person_fotostatus
where person_id = ?
order by person_id, insertamum desc",[$pid]);
$fotostatus = $this->getDataOrTerminateWithError($fotostatus);
if(is_array($fotostatus) && count($fotostatus) > 0){
$fotostatus = current($fotostatus)->fotostatus_kurzbz == 'akzeptiert';
}
else
$fotostatus = false;
return $fotostatus;
}
}
+13 -1
View File
@@ -9,7 +9,6 @@
width:21px;
background-color:var(--fhc-profil-border);
position:absolute;
/* top: 1px is important, otherwise it goes over the border of the thumbnail*/
top:1px;
right:12px;
display:flex;
@@ -18,6 +17,19 @@
border-radius:3px;
}
.image-upload {
height: 22px;
width: 21px;
background-color: var(--fhc-profil-border);
position: absolute;
bottom: 4.5px;
left: 14.5px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 3px 3px 3px 0;
}
.tabulator-collapsed-row{
padding:15px;
background-color: var(--fhc-profil-tabulator-shadow);
@@ -218,6 +218,9 @@ export default {
editable() {
return this.data?.editAllowed ?? false;
},
fotoStatus() {
return this.data?.fotoStatus ?? false;
},
getTelefonValue() {
if(this.data.standort_telefon?.kontakt) {
return this.data.standort_telefon.kontakt + " " + this.data.telefonklappe
@@ -337,7 +340,7 @@ export default {
<div class="row mb-4">
<div class="col">
<!-- PROFIL INFORMATION -->
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation" :editable="editable"></profil-information>
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation" :editable="editable" :fotoStatus="fotoStatus"></profil-information>
</div>
</div>
<div class="row mb-4">
@@ -113,6 +113,9 @@ export default {
editable() {
return this.data?.editAllowed ?? false;
},
fotoStatus() {
return this.data?.fotoStatus ?? false;
},
personEmails() {
return this.data?.emails ? this.data.emails : [];
@@ -189,7 +192,7 @@ export default {
<div class="row mb-4">
<div class="col">
<!-- Profil Informationen -->
<profil-information :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation" :editable="editable"></profil-information>
<profil-information :title="$p.t('profil','mitarbeiterIn')" :data="profilInformation" :editable="editable" :fotoStatus="fotoStatus"></profil-information>
</div>
</div>
<!-- START OF SECOND PROFIL INFORMATION COLUMN -->
@@ -11,6 +11,10 @@ export default {
editable: {
type: Boolean,
default: false
},
fotoStatus:{
type: Boolean,
default: true
}
},
data() {
@@ -83,6 +87,9 @@ export default {
<!-- LOCKING IMAGE FUNCTIONALITY -->
<div v-if="editable" role="button" @click.prevent="sperre_foto_function" class="image-lock">
<i :class="{'fa':true, ...(FotoSperre?{'fa-lock':true}:{'fa-lock-open':true})} "></i>
</div>
<div v-if="!fotoStatus" role="button" @click.prevent="" class="image-upload">
<i class="fa fa-upload"></i>
</div>
</div>
</div>
@@ -166,6 +166,9 @@ export default {
editable() {
return this.data?.editAllowed ?? false;
},
fotoStatus() {
return this.data?.fotoStatus ?? false;
},
filteredEditData() {
return this.editDataFilter
@@ -239,9 +242,9 @@ export default {
},
template: /*html*/ `
<div class="container-fluid text-break fhc-form">
<edit-profil v-if="showModal" ref="editModal" @hideBsModal="hideEditProfilModal"
<edit-profil v-if="showModal" ref="editModal" @hideBsModal="hideEditProfilModal"
:value="JSON.parse(JSON.stringify(filteredEditData))" :title="$p.t('profil','profilBearbeiten')"></edit-profil>
<!-- ROW -->
<!-- ROW -->
<div class="row">
<!-- HIDDEN QUICK LINKS -->
<div class="d-md-none col-12 ">
@@ -251,7 +254,7 @@ export default {
<quick-links :title="$p.t('profil','quickLinks')" :mobile="true"></quick-links>
</div>
</div>-->
<!-- Bearbeiten Button -->
<div v-if="editable" class="row ">
<div class="col mb-3">
@@ -267,24 +270,24 @@ export default {
</div>
<div v-if="data.profilUpdates" class="row mb-3">
<div class="col">
<!-- MOBILE PROFIL UPDATES -->
<!-- MOBILE PROFIL UPDATES -->
<fetch-profil-updates v-if="data.profilUpdates && data.profilUpdates.length" @fetchUpdates="fetchProfilUpdates" :data="data.profilUpdates"></fetch-profil-updates>
</div>
</div>
</div>
<!-- END OF HIDDEN QUCK LINKS -->
<!-- MAIN PANNEL -->
<div class="col-sm-12 col-md-8 col-xxl-9 ">
<!-- ROW WITH PROFIL IMAGE AND INFORMATION -->
<!-- INFORMATION CONTENT START -->
<!-- ROW WITH THE PROFIL INFORMATION -->
<!-- ROW WITH THE PROFIL INFORMATION -->
<div class="row mb-4 ">
<div class="col-lg-12 col-xl-6 ">
<div class="row mb-4">
<div class="col">
<!-- PROFIL INFORMATION -->
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','studentIn')" :data="profilInformation" :editable="editable"></profil-information>
<profil-information @showEditProfilModal="showEditProfilModal" :title="$p.t('profil','studentIn')" :data="profilInformation" :editable="editable" :fotoStatus="fotoStatus"></profil-information>
</div>
</div>
<div class="row mb-4">
@@ -29,6 +29,9 @@ export default {
editable() {
return this.data?.editAllowed ?? false;
},
fotoStatus() {
return this.data?.fotoStatus ?? false;
},
profilInformation() {
if (!this.data) {
return {};
@@ -115,7 +118,7 @@ export default {
<div class="col-lg-12 col-xl-6 ">
<div class="row mb-4">
<div class="col">
<profil-information :data="profilInformation" :title="$p.t('profil','studentIn')" :editable="editable"></profil-information>
<profil-information :data="profilInformation" :title="$p.t('profil','studentIn')" :editable="editable" :fotoStatus="fotoStatus"></profil-information>
</div>
</div>
<!-- START OF SECOND PROFIL INFORMATION COLUMN -->