only improves

This commit is contained in:
kandrusyak
2023-08-02 01:54:50 +03:00
parent a9b4a7e185
commit e682136ed8
12 changed files with 191 additions and 72 deletions

View File

@@ -255,26 +255,34 @@ const getters = {
};
},
getContactsData(state) {
let phones = state.medicalCard.person.contacts
.filter((el) => el.kind === "PHONE")
.map((el) => ({ ...el }));
let emails = state.medicalCard.person.contacts
.filter((el) => el.kind === "EMAIL")
.map((el) => ({ ...el }));
let networks = state.medicalCard.person.contacts
.filter((el) => el.kind !== "PHONE" && el.kind !== "EMAIL")
.map((el) => ({ ...el }));
let phones =
state.medicalCard?.person?.contacts
?.filter((el) => el.kind === "PHONE")
?.map((el) => ({ ...el })) || [];
let emails =
state.medicalCard?.person?.contacts
?.filter((el) => el.kind === "EMAIL")
?.map((el) => ({ ...el })) || [];
let networks =
state.medicalCard?.person?.contacts
?.filter((el) => el.kind !== "PHONE" && el.kind !== "EMAIL")
?.map((el) => ({ ...el })) || [];
return {
phones: [...phones],
emails: [...emails],
networks: [...networks],
phones,
emails,
networks,
};
},
getAllergiesData(state) {
return [...state.medicalCard.person.allergic.map((el) => ({ ...el }))];
return [
...(state.medicalCard?.person?.allergic?.map((el) => ({ ...el })) || []),
];
},
getConfidantData(state) {
return [...state.medicalCard.confidant.map((el) => getConfidantObject(el))];
return [
...(state.medicalCard?.confidant?.map((el) => getConfidantObject(el)) ||
[]),
];
},
getAvatar(state) {
let lastName = state?.medicalCard?.person?.last_name;
@@ -454,7 +462,7 @@ const actions = {
commit("setAllergiesData");
commit("setConfidantData");
commit("setHealthStateData");
commit("setEventsPersonData", res.person.id);
commit("setEventsPersonData", res?.person?.id);
});
},
getPersonsFiltredList() {
@@ -491,6 +499,12 @@ const actions = {
getProtocolData({ commit }, props) {
commit("setProtocolData", props);
},
setMedicalCardData({ commit }, props) {
commit("setMedicalCard", props);
},
setBasicData({ commit }, props) {
commit("setBasicData", props);
},
};
const mutations = {