WIP Сделала валидацию на страховках
This commit is contained in:
@@ -188,78 +188,46 @@ const getters = {
|
||||
};
|
||||
},
|
||||
getDocumentsData(state, rootState) {
|
||||
const documents = state.medicalCard?.person?.documents,
|
||||
passport = documents?.find(({ category }) => category === "passport"),
|
||||
insurance_number = documents?.find(
|
||||
({ category }) => category === "insurance_number"
|
||||
),
|
||||
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",
|
||||
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 : "",
|
||||
attachments: passport?.attachments?.length
|
||||
const fields = [
|
||||
"passport",
|
||||
"insurance_number",
|
||||
"tax_identification_number",
|
||||
"OMS",
|
||||
"DMS",
|
||||
];
|
||||
let result = {};
|
||||
fields.forEach((elem) => {
|
||||
const document = state.medicalCard?.person?.documents?.find(
|
||||
({ category }) => category === elem
|
||||
);
|
||||
const isPassport = elem === "passport";
|
||||
const isPolicy = elem === "OMS" || elem === "DMS";
|
||||
result[elem] = {
|
||||
category: elem,
|
||||
id: document?.id || "",
|
||||
series: document?.series || (isPolicy || isPassport ? "" : "000"),
|
||||
number: document?.number || "",
|
||||
issued_by: document?.issued_by || (isPassport ? "" : "000"),
|
||||
issued_by_org_code: document?.issued_by_org_code || "",
|
||||
issued_at: document?.issued_at || "",
|
||||
attachments: document?.attachments?.length
|
||||
? {
|
||||
photo: rootState.getUrl + passport?.attachments?.[0],
|
||||
photo: rootState.getUrl + document?.attachments?.[0],
|
||||
file: null,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
insurance_number: {
|
||||
category: "insurance_number",
|
||||
id: insurance_number?.id || "",
|
||||
number: insurance_number?.number || "",
|
||||
attachments: insurance_number?.attachments?.length
|
||||
? {
|
||||
photo: rootState.getUrl + insurance_number.attachments?.[0],
|
||||
file: null,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
tax_identification_number: {
|
||||
category: "tax_identification_number",
|
||||
id: tax_identification_number?.id || "",
|
||||
number: tax_identification_number?.number || "",
|
||||
attachments: tax_identification_number?.attachments?.length
|
||||
? {
|
||||
photo:
|
||||
rootState.getUrl + tax_identification_number?.attachments?.[0],
|
||||
file: null,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
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,
|
||||
}
|
||||
: {},
|
||||
},
|
||||
};
|
||||
};
|
||||
});
|
||||
// passport = documents?.find(({ category }) => category === "passport"),
|
||||
// insurance_number = documents?.find(
|
||||
// ({ category }) => category === "insurance_number"
|
||||
// ),
|
||||
// tax_identification_number = documents?.find(
|
||||
// ({ category }) => category === "tax_identification_number"
|
||||
// ),
|
||||
// OMS = documents?.find(({ category }) => category === "OMS"),
|
||||
// DMS = documents?.find(({ category }) => category === "DMS");
|
||||
return result;
|
||||
},
|
||||
getContactsData(state) {
|
||||
let phones =
|
||||
|
||||
Reference in New Issue
Block a user