adds getAllNationen to the new Profil FhcAPIController

This commit is contained in:
SimonGschnell
2024-07-18 08:53:45 +02:00
parent 84029fc729
commit fdd3026212
2 changed files with 27 additions and 4 deletions
@@ -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)){
@@ -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();
},