WIP Изменила отправку документов

This commit is contained in:
Daria Golova
2023-08-23 19:16:19 +03:00
parent 4987a3ae09
commit cb41a00ae1
6 changed files with 162 additions and 143 deletions

View File

@@ -34,20 +34,20 @@ const state = () => ({
house: null,
flat: null,
},
insuranceDMS: {
series: null,
number: null,
photo: null,
id: null,
organization: null,
},
insuranceOMS: {
series: null,
number: null,
photo: null,
id: null,
organization: null,
},
// insuranceDMS: {
// series: null,
// number: null,
// photo: null,
// id: null,
// organization: null,
// },
// insuranceOMS: {
// series: null,
// number: null,
// photo: null,
// id: null,
// organization: null,
// },
benefit: {
id: null,
discount: null,
@@ -142,8 +142,6 @@ const getters = {
(el) => el.category === "CURRENT_ADDRESS"
) || {};
let person = state.medicalCard.person;
let OMS = person?.insurance_policy?.find((e) => e.title === "OMS");
let DMS = person?.insurance_policy?.find((e) => e.title === "DMS");
return {
personalData: {
last_name: person?.last_name || "",
@@ -176,30 +174,6 @@ const getters = {
house: residenceAddress?.house || "",
flat: residenceAddress?.flat || "",
},
insuranceDMS: {
series: DMS?.series,
number: DMS?.number,
photo: DMS?.photo
? {
photo: rootState.getUrl + DMS?.photo,
file: null,
}
: {},
id: DMS?.id,
organization: DMS?.organization,
},
insuranceOMS: {
series: OMS?.series,
number: OMS?.number,
photo: OMS?.photo
? {
photo: rootState.getUrl + OMS?.photo,
file: null,
}
: {},
id: OMS?.id,
organization: OMS?.organization,
},
benefit: {
name: person?.benefit?.name,
id: person?.benefit?.id,
@@ -214,27 +188,25 @@ const getters = {
};
},
getDocumentsData(state, rootState) {
const person = state.medicalCard?.person,
passport = person?.documents?.find(
({ category }) => category === "passport"
),
insurance_number = person?.documents?.find(
const documents = state.medicalCard?.person?.documents,
passport = documents?.find(({ category }) => category === "passport"),
insurance_number = documents?.find(
({ category }) => category === "insurance_number"
),
tax_identification_number = person?.documents?.find(
tax_identification_number = documents?.find(
({ category }) => category === "tax_identification_number"
);
),
OMS = documents?.find(({ category }) => category === "OMS"),
DMS = documents?.find(({ category }) => category === "DMS");
return {
passport: {
category: passport?.category || "",
category: "passport",
id: passport?.id || "",
series: passport?.series || "",
number: passport?.number || "",
issued_by: passport?.issued_by || "",
issued_by_org_code: passport?.issued_by_org_code || "",
issued_at: passport?.issued_at
? passport?.issued_at?.split("-")?.reverse()?.join(".")
: "",
issued_at: passport?.issued_at ? passport?.issued_at : "",
attachments: passport?.attachments?.length
? {
photo: rootState.getUrl + passport?.attachments?.[0],
@@ -243,7 +215,7 @@ const getters = {
: {},
},
insurance_number: {
category: insurance_number?.category || "",
category: "insurance_number",
id: insurance_number?.id || "",
number: insurance_number?.number || "",
attachments: insurance_number?.attachments?.length
@@ -254,7 +226,7 @@ const getters = {
: {},
},
tax_identification_number: {
category: tax_identification_number?.category || "",
category: "tax_identification_number",
id: tax_identification_number?.id || "",
number: tax_identification_number?.number || "",
attachments: tax_identification_number?.attachments?.length
@@ -265,6 +237,28 @@ const getters = {
}
: {},
},
OMS: {
category: OMS?.category || "",
id: OMS?.id || "",
number: OMS?.number || "",
attachments: OMS?.attachments?.length
? {
photo: rootState.getUrl + OMS?.attachments?.[0],
file: null,
}
: {},
},
DMS: {
category: DMS?.category || "",
id: DMS?.id || "",
number: DMS?.number || "",
attachments: OMS?.attachments?.length
? {
photo: rootState.getUrl + DMS?.attachments?.[0],
file: null,
}
: {},
},
};
},
getContactsData(state) {