update(Profil Profilbild): changes styling layout and polishment

This commit is contained in:
SimonGschnell
2025-06-27 11:36:40 +02:00
parent 9610ca55f7
commit e3fe20831e
5 changed files with 101 additions and 69 deletions
@@ -515,68 +515,58 @@ class ProfilUpdate extends FHCAPI_Controller
$this->terminateWithError("No file available for upload");
}
//? if replace is set it contains the profil_update_id in which the attachment_id has to be replaced
$files = $_FILES['files'];
$file_count = count($files['name']);
$count = 0;
for ($i = 0; $i < $file_count; $i++) {
$count++;
$_FILES['files']['name'] = $files['name'][$i];
$_FILES['files']['type'] = $files['type'][$i];
$_FILES['files']['tmp_name'] = $files['tmp_name'][$i];
$_FILES['files']['error'] = $files['error'][$i];
$_FILES['files']['size'] = $files['size'][$i];
$_FILES['files']['tmp_name'] = $files['tmp_name'][$i];
$_FILES['files']['name'] = current($files['name']);
$_FILES['files']['type'] = current($files['type']);
$_FILES['files']['tmp_name'] = current($files['tmp_name']);
$_FILES['files']['error'] = current($files['error']);
$_FILES['files']['size'] = current($files['size']);
$_FILES['files']['tmp_name'] = current($files['tmp_name']);
$filename = $_FILES['files']['tmp_name'];
$ext = substr($files['name'][$i], strrpos($files['name'][$i], '.') + 1);
if($ext!='jpg' && $ext!='jpeg'){
$this->terminateWithError("Only jpg and jpeg files are allowed for profilbild upload");
}
$width = 827;
$height = 1063;
// resize
$resize($filename, $width, $height);
//akte
$fp = fopen($filename,'r');
//auslesen
$content = fread($fp, filesize($filename));
$base64_content = base64_encode($content);
$this->load->library('AkteLib');
$aktenInsertResult = $this->aktelib->add($this->pid,'Lichtbil',"Lichtbild_".$this->pid.".jpg","image/jpg",$fp,"Lichtbild gross");
fclose($fp);
if (isError($aktenInsertResult)) {
$this->terminateWithError(getError($aktenInsertResult));
}
// in person abspeichern
$resize($filename, 101, 130);
$fp = fopen($filename,'r');
$content = fread($fp, filesize($filename));
fclose($fp);
$base64_content = base64_encode($content);
$this->load->model('person/Person_model','PersonModel');
$personUpdate = $this->PersonModel->update($this->pid, ["foto"=>$base64_content]);
if(isError($personUpdate)){
$this->terminateWithError(getError($personUpdate));
}
// update foto status
$this->load->model('person/Fotostatusperson_model','FotostatusModel');
$fotoInsert = $this->FotostatusModel->insert(["person_id"=>$this->pid,"fotostatus_kurzbz"=>"hochgeladen","datum"=>date('Y-m-d'),"insertamum"=>date('Y-m-d H:i:s'),"insertvon"=>$this->uid,"updateamum"=>date('Y-m-d H:i:s'),"updatevon"=>$this->uid]);
if(isError($fotoInsert)){
$this->terminateWithError(getError($fotoInsert));
}
$filename = $_FILES['files']['tmp_name'];
$ext = substr(current($files['name']), strrpos(current($files['name']), '.') + 1);
if($ext!='jpg' && $ext!='jpeg'){
$this->terminateWithError("Only jpg and jpeg files are allowed for profilbild upload");
}
// resize
$resize($filename, 827, 1063);
//akte
$fp = fopen($filename,'r');
//auslesen
$content = fread($fp, filesize($filename));
$base64_content = base64_encode($content);
$this->load->library('AkteLib');
$aktenInsertResult = $this->aktelib->add($this->pid,'Lichtbil',"Lichtbild_".$this->pid.".jpg","image/jpg",$fp,"Lichtbild gross");
fclose($fp);
if (isError($aktenInsertResult)) {
$this->terminateWithError(getError($aktenInsertResult));
}
// in person abspeichern
$resize($filename, 101, 130);
$fp = fopen($filename,'r');
$content = fread($fp, filesize($filename));
fclose($fp);
$base64_content = base64_encode($content);
$this->load->model('person/Person_model','PersonModel');
$personUpdate = $this->PersonModel->update($this->pid, ["foto"=>$base64_content]);
if(isError($personUpdate)){
$this->terminateWithError(getError($personUpdate));
}
// update foto status
$this->load->model('person/Fotostatusperson_model','FotostatusModel');
$fotoInsert = $this->FotostatusModel->insert(["person_id"=>$this->pid,"fotostatus_kurzbz"=>"hochgeladen","datum"=>date('Y-m-d'),"insertamum"=>date('Y-m-d H:i:s'),"insertvon"=>$this->uid,"updateamum"=>date('Y-m-d H:i:s'),"updatevon"=>$this->uid]);
if(isError($fotoInsert)){
$this->terminateWithError(getError($fotoInsert));
}
$this->terminateWithSuccess(["fotoStatus"=>getData($fotoInsert),"personUpdate"=>getData($personUpdate),"akteInsert"=>getData($aktenInsertResult)]);
$this->terminateWithSuccess();
}
public function getProfilUpdateWithPermission($status = null)
+8 -5
View File
@@ -138,14 +138,17 @@
position: relative;
}
.dashboard-item-overlay{
background-color: var(--fhc-dashboard-item-overlay-background);
}
.dashboard-item-overlay::before{
position:absolute;
content:"";
top:0;
left:0;
right:0;
bottom:0;
background-color:var(--fhc-dashboard-item-overlay-background);
top:0.25rem;
left:0.25rem;
right:0.25rem;
bottom:0.25rem;
border:4px dashed var(--fhc-dashboard-item-overly-border-color);
opacity: 0.5;
}
@@ -73,7 +73,7 @@ export default {
template: /*html*/ `
<div class="card h-100">
<image-upload ref="imageUpload" titel="test"></image-upload>
<image-upload ref="imageUpload" :titel="$p.t('profilUpdate','profilBild')"></image-upload>
<div class="card-header">
<div class="row">
<div v-if="editable" @click="$emit('showEditProfilModal','Personen_Informationen')" class="col-auto" type="button">
@@ -38,7 +38,8 @@ export default {
await this.$api
.call(ApiProfilUpdate.updateProfilbild(formData))
.then((res) => {
console.log("here", res.data?.map((file) => file.dms_id)) ;
this.$fhcAlert.alertSuccess(this.$p.t('global','hochgeladen'));
this.modal.hide();
});
}
@@ -58,7 +59,7 @@ export default {
<bs-modal v-show="!loading" ref="modalContainer" v-bind="$props" body-class="" dialog-class="modal-lg" class="bootstrap-alert" :backdrop="false">
<template #title>
<p style="opacity:0.8" class="ms-2" v-if="!updateID">{{$p.t('profilUpdate','profilUpdateInformationMessage',[titel])}}</p>
<p style="opacity:0.8" class="ms-2" v-if="!updateID">{{$p.t('profilUpdate','profilBildUpdateMessage',[titel])}}</p>
</template>
<template #default>
<div class="form-underline">
@@ -66,18 +67,16 @@ export default {
</div>
<div class="row gx-2">
<div class="col">
<dms ref="update" id="files" name="files" :multiple="false" v-model="dmsData" @update:model-value="didFilesChange" ></dms>
<dms ref="update" id="files" name="files" :multiple="false" v-model="dmsData" ></dms>
</div>
<div class="col-auto">
<button @click="dmsData=[]" class="btn btn-danger"><i style="color:white" class="fa fa-trash"></i></button>
</div>
</div>
<div class="d-flex" style="margin-left:auto;">
<button @click="uploadImage" class="btn btn-primary">upload</button>
<div class="d-flex" >
<button @click="uploadImage" class="btn fhc-primary-bg mt-4 text-light" style="margin-left:auto;">{{$p.t('global','upload')}}</button>
</div>
</template>
<template #footer>
</template>
</bs-modal>
`,
};
+40
View File
@@ -28138,6 +28138,26 @@ array(
),
//Profil Phrasen ende
//ProfilUpdate Phrasen start
array(
'app' => 'core',
'category' => 'profilUpdate',
'phrase' => 'profilBild',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Profilbild',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Profile picture',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'profilUpdate',
@@ -28459,6 +28479,26 @@ array(
)
)
),
array(
'app' => 'core',
'category' => 'profilUpdate',
'phrase' => 'profilBildUpdateMessage',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Bitte laden Sie ihr {0} hoch',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Please upload your {0}',
'description' => '',
'insertvon' => 'system'
)
)
),
array(
'app' => 'core',
'category' => 'profilUpdate',