diff --git a/application/controllers/api/frontend/v1/ProfilUpdate.php b/application/controllers/api/frontend/v1/ProfilUpdate.php index 4a26e5bf8..929ea49d6 100644 --- a/application/controllers/api/frontend/v1/ProfilUpdate.php +++ b/application/controllers/api/frontend/v1/ProfilUpdate.php @@ -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) diff --git a/public/css/components/dashboard.css b/public/css/components/dashboard.css index 78567be2b..d030e80cd 100644 --- a/public/css/components/dashboard.css +++ b/public/css/components/dashboard.css @@ -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; } diff --git a/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js b/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js index e0ed7da5b..50399edf5 100644 --- a/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js +++ b/public/js/components/Cis/Profil/ProfilComponents/ProfilInformation.js @@ -73,7 +73,7 @@ export default { template: /*html*/ `
- +
diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/ImageUpload.js b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/ImageUpload.js index b7ab16755..672b4ce4a 100644 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/ImageUpload.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/ImageUpload.js @@ -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 { - `, }; diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 26c9d7bee..43913661a 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -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',