mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
delete cms app and move dom magic to respective components; profil vue router integration; profil component reloads with watcher on uid property; profiLUpdateRequest app->comp TODO; deleted profil app;
This commit is contained in:
@@ -55,7 +55,10 @@ class Profil extends Auth_Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('Cis/Profil');
|
||||
$viewData = array(
|
||||
|
||||
);
|
||||
$this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'profilIndex']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +68,9 @@ class Profil extends Auth_Controller
|
||||
*/
|
||||
public function View($uid)
|
||||
{
|
||||
$this->load->view('Cis/Profil');
|
||||
$viewData = array ('uid' => $uid);
|
||||
|
||||
$this->load->view('CisRouterView/CisRouterView.php',['viewData' => $viewData, 'route' => 'profilViewUid']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,6 @@ class Cms extends Auth_Controller
|
||||
);
|
||||
|
||||
$this->load->view('CisRouterView/CisRouterView.php', ['viewData' => $viewData, 'route' => 'Content']);
|
||||
// $this->load->view('CisVue/Cms/Content', ['content_id' => $content_id, 'template_kurzbz' => $content->template_kurzbz, 'version' => $version, 'sprache' => $sprache, 'sichtbar' => $sichtbar]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
import BsConfirm from "../../components/Bootstrap/Confirm.js";
|
||||
import CmsNews from "../../components/Cis/Cms/News.js";
|
||||
import CmsContent from "../../components/Cis/Cms/Content.js";
|
||||
import Phrasen from "../../plugin/Phrasen.js";
|
||||
import fhcapifactory from "../api/fhcapifactory.js";
|
||||
Vue.$fhcapi = fhcapifactory;
|
||||
import {setScrollbarWidth} from "../../helpers/CssVarCalcHelpers";
|
||||
import FhcApi from "../../plugin/FhcApi";
|
||||
|
||||
// const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*?\/)/g, '') + FHC_JS_DATA_STORAGE_OBJECT.ci_router;
|
||||
// const router = VueRouter.createRouter({
|
||||
// history: VueRouter.createWebHistory(`/${ciPath}/CisVue/Cms/`),
|
||||
// routes: [
|
||||
// {
|
||||
// path: `/content/:content_id`,
|
||||
// name: 'Content',
|
||||
// component: CmsContent,
|
||||
// props: (route) => ({ content_id: route.params.content_id })
|
||||
// },
|
||||
// {
|
||||
// path: `/news`,
|
||||
// name: 'News',
|
||||
// component: CmsNews,
|
||||
// }
|
||||
// ]
|
||||
// })
|
||||
|
||||
|
||||
const app = Vue.createApp({
|
||||
name: 'CmsApp',
|
||||
components: {
|
||||
CmsNews,
|
||||
CmsContent,
|
||||
},
|
||||
mounted() {
|
||||
|
||||
// TODO: warum ist das hier? Content? News?
|
||||
document.querySelectorAll("#cms [data-confirm]").forEach((el) => {
|
||||
el.addEventListener("click", (evt) => {
|
||||
evt.preventDefault();
|
||||
BsConfirm.popup(el.dataset.confirm)
|
||||
.then(() => {
|
||||
Axios.get(el.href)
|
||||
.then((res) => {
|
||||
// TODO(chris): check for success then show message and/or reload
|
||||
location = location;
|
||||
})
|
||||
.catch((err) => console.error("ERROR:", err));
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
document.querySelectorAll("#cms [data-href]").forEach((el) => {
|
||||
el.href = el.dataset.href.replace(
|
||||
/^ROOT\//,
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
setScrollbarWidth();
|
||||
|
||||
app.use(FhcApi);
|
||||
app.use(primevue.config.default, { zIndex: { overlay: 9999 } });
|
||||
app.use(Phrasen);
|
||||
app.mount("#cms");
|
||||
@@ -1,403 +0,0 @@
|
||||
import StudentProfil from "../../components/Cis/Profil/StudentProfil.js";
|
||||
import MitarbeiterProfil from "../../components/Cis/Profil/MitarbeiterProfil.js";
|
||||
import ViewStudentProfil from "../../components/Cis/Profil/StudentViewProfil.js";
|
||||
import ViewMitarbeiterProfil from "../../components/Cis/Profil/MitarbeiterViewProfil.js";
|
||||
import Loading from "../../components/Loader.js";
|
||||
import Phrasen from "../../plugin/Phrasen.js";
|
||||
import {setScrollbarWidth} from "../../helpers/CssVarCalcHelpers";
|
||||
|
||||
|
||||
Vue.$collapseFormatter = function (data) {
|
||||
//data - an array of objects containing the column title and value for each cell
|
||||
var container = document.createElement("div");
|
||||
container.classList.add("tabulator-collapsed-row");
|
||||
container.classList.add("text-break");
|
||||
|
||||
var list = document.createElement("div");
|
||||
list.classList.add("row");
|
||||
|
||||
container.appendChild(list);
|
||||
|
||||
data.forEach(function (col) {
|
||||
let item = document.createElement("div");
|
||||
item.classList.add("col-6");
|
||||
let item2 = document.createElement("div");
|
||||
item2.classList.add("col-6");
|
||||
|
||||
item.innerHTML = "<strong>" + col.title + "</strong>";
|
||||
item2.innerHTML = col.value ? col.value : "-";
|
||||
|
||||
list.appendChild(item);
|
||||
list.appendChild(item2);
|
||||
});
|
||||
|
||||
return Object.keys(data).length ? container : "";
|
||||
};
|
||||
|
||||
const profilApp = Vue.createApp({
|
||||
name: 'ProfilApp',
|
||||
components: {
|
||||
StudentProfil,
|
||||
MitarbeiterProfil,
|
||||
ViewStudentProfil,
|
||||
ViewMitarbeiterProfil,
|
||||
Loading,
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
//? loading property is used for showing/hiding the loading modal
|
||||
loading: false,
|
||||
profilUpdateStates: null,
|
||||
profilUpdateTopic: null,
|
||||
view: null,
|
||||
data: null,
|
||||
// notfound is null by default, but contains an UID if no user exists with that UID
|
||||
notFoundUID: null,
|
||||
};
|
||||
},
|
||||
|
||||
//? use function syntax for provide so that we can access `this`
|
||||
provide() {
|
||||
return {
|
||||
profilUpdateStates: Vue.computed(() =>
|
||||
this.profilUpdateStates ? this.profilUpdateStates : false
|
||||
),
|
||||
profilUpdateTopic: Vue.computed(() =>
|
||||
this.profilUpdateTopic ? this.profilUpdateTopic : false
|
||||
),
|
||||
setLoading: (newValue) => {
|
||||
this.loading = newValue;
|
||||
},
|
||||
getZustellkontakteCount: this.zustellKontakteCount,
|
||||
getZustelladressenCount: this.zustellAdressenCount,
|
||||
collapseFunction: (e, column) => {
|
||||
//* check if property doesn't exist already and add it to the reactive this properties
|
||||
if (this[e.target.id] === undefined) {
|
||||
this[e.target.id] = true;
|
||||
}
|
||||
this[e.target.id] = !this[e.target.id];
|
||||
|
||||
//* gets all event icons of the different rows to use the onClick event later
|
||||
let allClickableIcons = column._column.cells.map((row) => {
|
||||
return row.element.children[0];
|
||||
});
|
||||
|
||||
//* changes the icon that shows or hides all the collapsed columns
|
||||
//* if the replace function does not find the class to replace, it just simply returns false
|
||||
if (this[e.target.id]) {
|
||||
e.target.classList.replace("fa-angle-up", "fa-angle-down");
|
||||
} else {
|
||||
e.target.classList.replace("fa-angle-down", "fa-angle-up");
|
||||
}
|
||||
|
||||
//* changes the icon for every collapsed column to open or closed
|
||||
if (this[e.target.id]) {
|
||||
allClickableIcons
|
||||
.filter((column) => {
|
||||
return !column.classList.contains("open");
|
||||
})
|
||||
.forEach((col) => {
|
||||
col.click();
|
||||
});
|
||||
} else {
|
||||
allClickableIcons
|
||||
.filter((column) => {
|
||||
return column.classList.contains("open");
|
||||
})
|
||||
.forEach((col) => {
|
||||
col.click();
|
||||
});
|
||||
}
|
||||
},
|
||||
sortProfilUpdates: (ele1, ele2) => {
|
||||
let result = 0;
|
||||
if (ele1.status === "pending") {
|
||||
result = -1;
|
||||
} else if (ele1.status === "accepted") {
|
||||
result = ele2.status === "rejected" ? -1 : 1;
|
||||
} else {
|
||||
result = 1;
|
||||
}
|
||||
//? if they have the same status the insert date is used for ordering
|
||||
if (ele1.status === ele2.status) {
|
||||
result =
|
||||
new Date(ele2.insertamum.split(".").reverse().join("-")) -
|
||||
new Date(ele1.insertamum.split(".").reverse().join("-"));
|
||||
}
|
||||
return result;
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
zustellAdressenCount() {
|
||||
if (!this.data || !this.data.adressen) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let adressenArray = [];
|
||||
if (this.data.profilUpdates?.length) {
|
||||
adressenArray = adressenArray.concat(
|
||||
this.data.profilUpdates
|
||||
.filter((update) => {
|
||||
return update.requested_change.zustelladresse;
|
||||
})
|
||||
.map((adresse) => {
|
||||
return adresse.requested_change.adresse_id;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!this.data.profilUpdates?.length ||
|
||||
!this.data.adressen
|
||||
.filter((adresse) => adresse.zustelladresse)
|
||||
.every((adresse) =>
|
||||
this.data.profilUpdates.some(
|
||||
(update) =>
|
||||
update.requested_change.adresse_id == adresse.adresse_id
|
||||
)
|
||||
)
|
||||
) {
|
||||
adressenArray = adressenArray.concat(
|
||||
this.data.adressen
|
||||
.filter((adresse) => {
|
||||
return adresse.zustelladresse;
|
||||
})
|
||||
.map((adr) => {
|
||||
return adr.adresse_id;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return [...new Set(adressenArray)];
|
||||
|
||||
// OLD version
|
||||
// return this.data.adressen.filter(adresse => {
|
||||
// return adresse.zustelladresse;
|
||||
// }).map(adr => {
|
||||
|
||||
// return adr.adresse_id;
|
||||
// });
|
||||
},
|
||||
|
||||
zustellKontakteCount() {
|
||||
if (!this.data || !this.data.kontakte) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//TODO: not sure if how it is implemented is the best way
|
||||
let kontakteArray = [];
|
||||
|
||||
if (this.data.profilUpdates?.length) {
|
||||
kontakteArray = kontakteArray.concat(
|
||||
this.data.profilUpdates
|
||||
.filter((update) => {
|
||||
return update.requested_change.zustellung;
|
||||
})
|
||||
.map((kontant) => {
|
||||
return kontant.requested_change.kontakt_id;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!this.data.profilUpdates?.length ||
|
||||
!this.data.kontakte
|
||||
.filter((kontakt) => kontakt.zustellung)
|
||||
.every((kontakt) =>
|
||||
this.data.profilUpdates.some(
|
||||
(update) =>
|
||||
update.requested_change.kontakt_id == kontakt.kontakt_id
|
||||
)
|
||||
)
|
||||
) {
|
||||
kontakteArray = kontakteArray.concat(
|
||||
this.data.kontakte
|
||||
.filter((kontakt) => {
|
||||
return kontakt.zustellung;
|
||||
})
|
||||
.map((kon) => {
|
||||
return kon.kontakt_id;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return [...new Set(kontakteArray)];
|
||||
|
||||
// OLD version
|
||||
// return this.data.kontakte.filter(kontakt => {
|
||||
// return kontakt.zustellung;
|
||||
// }).map(kon =>{
|
||||
// return kon.kontakt_id;
|
||||
// });
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
filteredEditData() {
|
||||
if (!this.data) {
|
||||
return;
|
||||
}
|
||||
|
||||
return {
|
||||
view: null,
|
||||
data: {
|
||||
Personen_Informationen: {
|
||||
title: this.$p.t("profil", "personenInformationen"),
|
||||
topic: "Personen_informationen",
|
||||
view: null,
|
||||
data: {
|
||||
vorname: {
|
||||
title: this.$p.t("person", "vorname"),
|
||||
topic: this.profilUpdateTopic?.["Vorname"],
|
||||
view: "TextInputDokument",
|
||||
withFiles: true,
|
||||
data: {
|
||||
titel: "vorname",
|
||||
value: this.data.vorname,
|
||||
},
|
||||
},
|
||||
nachname: {
|
||||
title: this.$p.t("person", "nachname"),
|
||||
topic: this.profilUpdateTopic?.["Nachname"],
|
||||
view: "TextInputDokument",
|
||||
withFiles: true,
|
||||
data: {
|
||||
titel: "nachname",
|
||||
value: this.data.nachname,
|
||||
},
|
||||
},
|
||||
titel: {
|
||||
title: this.$p.t("global", "titel"),
|
||||
topic: this.profilUpdateTopic?.["Titel"],
|
||||
view: "TextInputDokument",
|
||||
withFiles: true,
|
||||
data: {
|
||||
titel: "titel",
|
||||
value: this.data.titel,
|
||||
},
|
||||
},
|
||||
postnomen: {
|
||||
title: this.$p.t("profil", "postnomen"),
|
||||
topic: this.profilUpdateTopic?.["Postnomen"],
|
||||
view: "TextInputDokument",
|
||||
withFiles: true,
|
||||
data: {
|
||||
titel: "postnomen",
|
||||
value: this.data.postnomen,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Private_Kontakte: {
|
||||
title: this.$p.t("profil", "privateKontakte"),
|
||||
topic: this.profilUpdateTopic?.["Private Kontakte"],
|
||||
data: this.data.kontakte
|
||||
?.filter((item) => {
|
||||
// excludes all contacts that are already used in pending profil update requests
|
||||
return !this.data.profilUpdates?.some(
|
||||
(update) =>
|
||||
update.status === this.profilUpdateStates["Pending"] &&
|
||||
update.requested_change?.kontakt_id === item.kontakt_id
|
||||
);
|
||||
})
|
||||
.map((kontakt) => {
|
||||
return {
|
||||
listview: "Kontakt",
|
||||
view: "EditKontakt",
|
||||
data: kontakt,
|
||||
};
|
||||
}),
|
||||
},
|
||||
Private_Adressen: {
|
||||
title: this.$p.t("profil", "privateAdressen"),
|
||||
topic: this.profilUpdateTopic?.["Private Adressen"],
|
||||
data: this.data.adressen
|
||||
?.filter((item) => {
|
||||
return !this.data.profilUpdates?.some((update) => {
|
||||
return (
|
||||
update.status === this.profilUpdateStates["Pending"] &&
|
||||
update.requested_change?.adresse_id == item.adresse_id
|
||||
);
|
||||
});
|
||||
})
|
||||
.map((adresse) => {
|
||||
return {
|
||||
listview: "Adresse",
|
||||
view: "EditAdresse",
|
||||
data: adresse,
|
||||
};
|
||||
}),
|
||||
},
|
||||
// Password_Change : {
|
||||
// title:"Passwort Ändern",
|
||||
// view:"ChangePassword",
|
||||
// data:{
|
||||
// test:"testvalue",
|
||||
// }
|
||||
// },
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
loading: function (newValue, oldValue) {
|
||||
if (newValue) {
|
||||
this.$refs.loadingModalRef.show();
|
||||
} else {
|
||||
this.$refs.loadingModalRef.hide();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
async created() {
|
||||
// fetch profilUpdateStates to provide them to children components
|
||||
|
||||
await this.$fhcApi.factory.profilUpdate.getStatus()
|
||||
.then((response) => {
|
||||
this.profilUpdateStates = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
this.$fhcApi.factory.profilUpdate.getTopic()
|
||||
.then((response) => {
|
||||
this.profilUpdateTopic = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
//? uid contains the last part of the uri
|
||||
let uid = location.pathname.split("/").pop();
|
||||
|
||||
this.$fhcApi.factory.profil.getView(uid).then((res) => {
|
||||
if (!res.data) {
|
||||
this.notFoundUID = uid;
|
||||
} else {
|
||||
this.view = res.data?.view;
|
||||
this.data = res.data?.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
template: `
|
||||
<div>
|
||||
<div v-if="notFoundUID">
|
||||
<h3>Es wurde keine Person mit der UID {{this.notFoundUID}} gefunden</h3>
|
||||
</div>
|
||||
<div v-else>
|
||||
<loading ref="loadingModalRef" :timeout="0"></loading>
|
||||
<component :is="view" :data="data" :editData="filteredEditData" ></component>
|
||||
</div>
|
||||
</div>`,
|
||||
});
|
||||
setScrollbarWidth();
|
||||
profilApp
|
||||
.use(primevue.config.default, {zIndex: {overlay: 9999}})
|
||||
.use(Phrasen)
|
||||
.mount("#content");
|
||||
@@ -1,6 +1,8 @@
|
||||
import ProfilUpdateView from "../../components/Cis/ProfilUpdate/ProfilUpdateView.js";
|
||||
import Phrasen from "../../plugin/Phrasen.js";
|
||||
|
||||
|
||||
// TODO: sobald in verwendung den vue router pfad zu ProfilUpdateView definieren und diese app in component auslagern
|
||||
const app = Vue.createApp({
|
||||
name: 'ProfilUpdateRequestsApp',
|
||||
components: {
|
||||
|
||||
@@ -14,18 +14,19 @@ const ciPath = FHC_JS_DATA_STORAGE_OBJECT.app_root.replace(/(https:|)(^|\/\/)(.*
|
||||
const router = VueRouter.createRouter({
|
||||
history: VueRouter.createWebHistory(`/${ciPath}`),
|
||||
routes: [
|
||||
// {
|
||||
// path: `/Cis/Profil`,
|
||||
// name: 'Profil',
|
||||
// component: Profil,
|
||||
// props: true
|
||||
// },
|
||||
// {
|
||||
// path: `/Cis/Profil/View/`,
|
||||
// name: 'Profil',
|
||||
// component: Profil,
|
||||
// props: true
|
||||
// },
|
||||
{
|
||||
path: `/Cis/Profil/View/:uid`,
|
||||
name: 'ProfilView',
|
||||
component: Profil,
|
||||
props: true
|
||||
},
|
||||
{
|
||||
path: `/Cis/Profil`,
|
||||
name: 'Profil',
|
||||
component: Profil,
|
||||
props: true
|
||||
},
|
||||
|
||||
{
|
||||
path: `/CisVue/Cms/Content/:content_id`,
|
||||
name: 'Content',
|
||||
@@ -77,6 +78,11 @@ const router = VueRouter.createRouter({
|
||||
]
|
||||
})
|
||||
|
||||
router.beforeEach((to, from) => {
|
||||
console.log('from', from)
|
||||
console.log('to', to)
|
||||
})
|
||||
|
||||
const app = Vue.createApp({
|
||||
name: 'FhcApp',
|
||||
data: () => ({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import raum_contentmittitel from './Content_types/Raum_contentmittitel.js'
|
||||
import general from './Content_types/General.js'
|
||||
import BsConfirm from "../../Bootstrap/Confirm";
|
||||
|
||||
export default {
|
||||
name: "ContentComponent",
|
||||
@@ -32,6 +33,29 @@ export default {
|
||||
return this.$fhcApi.factory.cms.content(this.content_id_internal, this.version, this.sprache, this.sichtbar).then(res => {
|
||||
this.content = res.data.content;
|
||||
this.content_type = res.data.type;
|
||||
|
||||
document.querySelectorAll("#cms [data-confirm]").forEach((el) => {
|
||||
el.addEventListener("click", (evt) => {
|
||||
evt.preventDefault();
|
||||
BsConfirm.popup(el.dataset.confirm)
|
||||
.then(() => {
|
||||
Axios.get(el.href)
|
||||
.then((res) => {
|
||||
// TODO(chris): check for success then show message and/or reload
|
||||
location = location;
|
||||
})
|
||||
.catch((err) => console.error("ERROR:", err));
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
document.querySelectorAll("#cms [data-href]").forEach((el) => {
|
||||
el.href = el.dataset.href.replace(
|
||||
/^ROOT\//,
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
);
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import Pagination from "../../Pagination/Pagination.js";
|
||||
import StudiengangInformation from "./StudiengangInformation/StudiengangInformation.js";
|
||||
import BsConfirm from "../../Bootstrap/Confirm";
|
||||
|
||||
export default {
|
||||
name: "NewsComponent",
|
||||
@@ -31,6 +32,29 @@ export default {
|
||||
.then(res => res.data)
|
||||
.then(result => {
|
||||
this.content = result;
|
||||
|
||||
document.querySelectorAll("#cms [data-confirm]").forEach((el) => {
|
||||
el.addEventListener("click", (evt) => {
|
||||
evt.preventDefault();
|
||||
BsConfirm.popup(el.dataset.confirm)
|
||||
.then(() => {
|
||||
Axios.get(el.href)
|
||||
.then((res) => {
|
||||
// TODO(chris): check for success then show message and/or reload
|
||||
location = location;
|
||||
})
|
||||
.catch((err) => console.error("ERROR:", err));
|
||||
})
|
||||
.catch(() => {
|
||||
});
|
||||
});
|
||||
});
|
||||
document.querySelectorAll("#cms [data-href]").forEach((el) => {
|
||||
el.href = el.dataset.href.replace(
|
||||
/^ROOT\//,
|
||||
FHC_JS_DATA_STORAGE_OBJECT.app_root
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
loadNewPageContent: function (data) {
|
||||
|
||||
@@ -40,6 +40,12 @@ export const Profil = {
|
||||
ViewMitarbeiterProfil,
|
||||
Loading,
|
||||
},
|
||||
props: {
|
||||
uid: {
|
||||
type: String,
|
||||
default: 'Profil'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//? loading property is used for showing/hiding the loading modal
|
||||
@@ -124,6 +130,35 @@ export const Profil = {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async load() {
|
||||
// fetch profilUpdateStates to provide them to children components
|
||||
await this.$fhcApi.factory.profilUpdate.getStatus()
|
||||
.then((response) => {
|
||||
this.profilUpdateStates = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
this.$fhcApi.factory.profilUpdate.getTopic()
|
||||
.then((response) => {
|
||||
this.profilUpdateTopic = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
let uid = this.uid ?? location.pathname.split("/").pop();
|
||||
|
||||
this.$fhcApi.factory.profil.getView(uid).then((res) => {
|
||||
if (!res.data) {
|
||||
this.notFoundUID = uid;
|
||||
} else {
|
||||
this.view = res.data?.view;
|
||||
this.data = res.data?.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
zustellAdressenCount() {
|
||||
if (!this.data || !this.data.adressen) {
|
||||
return null;
|
||||
@@ -319,39 +354,14 @@ export const Profil = {
|
||||
this.$refs.loadingModalRef.hide();
|
||||
}
|
||||
},
|
||||
uid (newVal, oldVal) {
|
||||
console.log('watch uid', newVal)
|
||||
this.load()
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
// fetch profilUpdateStates to provide them to children components
|
||||
|
||||
await this.$fhcApi.factory.profilUpdate.getStatus()
|
||||
.then((response) => {
|
||||
this.profilUpdateStates = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
this.$fhcApi.factory.profilUpdate.getTopic()
|
||||
.then((response) => {
|
||||
this.profilUpdateTopic = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
//? uid contains the last part of the uri
|
||||
let uid = location.pathname.split("/").pop();
|
||||
|
||||
this.$fhcApi.factory.profil.getView(uid).then((res) => {
|
||||
if (!res.data) {
|
||||
this.notFoundUID = uid;
|
||||
} else {
|
||||
this.view = res.data?.view;
|
||||
this.data = res.data?.data;
|
||||
}
|
||||
});
|
||||
this.load()
|
||||
},
|
||||
|
||||
template: `
|
||||
<div>
|
||||
<div v-if="notFoundUID">
|
||||
|
||||
Reference in New Issue
Block a user