WIP Подтянула картинки из стора
This commit is contained in:
@@ -131,6 +131,48 @@ const getters = {
|
||||
},
|
||||
};
|
||||
},
|
||||
getDocumentsData(state, rootState) {
|
||||
let person = state.medicalCard?.person;
|
||||
const passport = person?.identity_document.find(
|
||||
(el) => el.kind === "PASSPORT"
|
||||
);
|
||||
return {
|
||||
passport: {
|
||||
id: passport?.id,
|
||||
series: passport?.series,
|
||||
number: passport?.number,
|
||||
issued_by_org: passport?.issued_by_org,
|
||||
issued_by_org_code: passport?.issued_by_org_code,
|
||||
issued_by_date: passport?.issued_by_date
|
||||
? new Date(passport?.issued_by_date)
|
||||
: null,
|
||||
photo: passport?.photo
|
||||
? {
|
||||
photo: rootState.getUrl + passport.photo,
|
||||
file: null,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
insurance_number: {
|
||||
insurance_number: person?.insurance_number,
|
||||
photo_insurance_number: person?.photo_insurance_number
|
||||
? {
|
||||
photo: rootState.getUrl + person.photo_insurance_number,
|
||||
file: null,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
tax_identification_number: {
|
||||
tax_identification_number: person?.tax_identification_number,
|
||||
photo_tax_identification_number: person?.photo_tax_identification_number
|
||||
? {
|
||||
photo: rootState.getUrl + person?.photo_tax_identification_number,
|
||||
file: null,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
};
|
||||
},
|
||||
getContactsData(state) {
|
||||
let phones = state.medicalCard.person.contacts
|
||||
.filter((el) => el.kind === "PHONE")
|
||||
@@ -171,7 +213,7 @@ const actions = {
|
||||
commit("setMedicalCard", res);
|
||||
commit("setBasicData");
|
||||
commit("setContactsData");
|
||||
commit("setDocumentData", res.person);
|
||||
commit("setDocumentsData");
|
||||
});
|
||||
},
|
||||
returnInitData({ commit }) {
|
||||
@@ -241,33 +283,8 @@ const mutations = {
|
||||
setContactsData(state) {
|
||||
state.contactsData = { ...this.getters.getContactsData };
|
||||
},
|
||||
setDocumentData(state, data, rootState) {
|
||||
const passport = data?.identity_document.find(
|
||||
(el) => el.kind === "PASSPORT"
|
||||
);
|
||||
state.documents = {
|
||||
passport: {
|
||||
id: passport?.id,
|
||||
series: passport?.series,
|
||||
number: passport?.number,
|
||||
issued_by_org: passport?.issued_by_org,
|
||||
issued_by_org_code: passport?.issued_by_org_code,
|
||||
issued_by_date: passport?.issued_by_date,
|
||||
photo: passport?.photo ? rootState.getUrl + passport.photo : "",
|
||||
},
|
||||
insurance_number: {
|
||||
insurance_number: data?.insurance_number,
|
||||
photo_insurance_number: data?.photo_insurance_number
|
||||
? rootState.getUrl + data.photo_insurance_number
|
||||
: "",
|
||||
},
|
||||
tax_identification_number: {
|
||||
tax_identification_number: data?.tax_identification_number,
|
||||
photo_tax_identification_number: data?.photo_tax_identification_number
|
||||
? rootState.getUrl + data?.photo_tax_identification_number
|
||||
: "",
|
||||
},
|
||||
};
|
||||
setDocumentsData(state) {
|
||||
state.documents = { ...this.getters.getDocumentsData };
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user