diff --git a/application/controllers/api/frontend/v1/Profil.php b/application/controllers/api/frontend/v1/Profil.php index 401c0b791..00e2b9219 100644 --- a/application/controllers/api/frontend/v1/Profil.php +++ b/application/controllers/api/frontend/v1/Profil.php @@ -35,6 +35,7 @@ class Profil extends FHCAPI_Controller 'getView' => self::PERM_LOGGED, 'fotoSperre' => self::PERM_LOGGED, 'getGemeinden' => self::PERM_LOGGED, + 'getAllNationen' => self::PERM_LOGGED, ]); @@ -145,6 +146,28 @@ class Profil extends FHCAPI_Controller $this->terminateWithSuccess(current($res)); } + /** + * gets all nations in the table bis.tbl_nation + * + * @access public + * @return array all the nations in table bis.tbl_nation + */ + public function getAllNationen() + { + // load the nationen from the database + $this->load->model('codex/Nation_model', "NationModel"); + $this->NationModel->addSelect(["nation_code as code", "langtext"]); + $nation_res = $this->NationModel->load(); + + if (isError($nation_res)) { + show_error("error while trying to query table codex.tbl_nation"); + } + + $nation_res = $this->getDataOrTerminateWithError($nation_res); + + $this->terminateWithSuccess($nation_res); + } + public function getGemeinden($nation, $zip) { if(!isset($nation) || !isset($zip)){ diff --git a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js index e51bef24c..c3f194958 100755 --- a/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js +++ b/public/js/components/Cis/Profil/ProfilModal/EditProfilComponents/EditAdresse.js @@ -60,7 +60,6 @@ export default { .getGemeinden(this.data.nation, this.data.plz) .then((res) => { if (res.data.length) { - console.log(res.data, "this is the data from the gemeinden"); this.gemeinden = [ ...new Set( res.data.map((element) => { @@ -119,11 +118,12 @@ export default { }, created() { - Vue.$fhcapi.UserData.getAllNationen().then((res) => { + // get all available nationen + this.$fhcApi.factory.profil.getAllNationen().then((res)=>{ this.nationenList = res.data; this.getGemeinde(); - }); - + }) + this.originalValue = JSON.stringify(this.data); this.zustellAdressenCount = this.getZustelladressenCount(); },