Merge branch 'ASTRA-48' into 'master'
Сделано удаление фото See merge request andrusyakka/urban-couscous!336
This commit is contained in:
@@ -139,7 +139,7 @@ export default {
|
|||||||
checkPassportFields(val, defaultRule) {
|
checkPassportFields(val, defaultRule) {
|
||||||
if (
|
if (
|
||||||
this.passportFields.every((elem) => !this.docData.passport[elem]) &&
|
this.passportFields.every((elem) => !this.docData.passport[elem]) &&
|
||||||
!this.initialDocData.passport.series
|
!this.initialDocData.passport?.id
|
||||||
) {
|
) {
|
||||||
this.$refs.documentForm
|
this.$refs.documentForm
|
||||||
.getValidationComponents()
|
.getValidationComponents()
|
||||||
@@ -200,12 +200,10 @@ export default {
|
|||||||
let documentsFormData = new FormData();
|
let documentsFormData = new FormData();
|
||||||
form.getValidationComponents().forEach((elem) => {
|
form.getValidationComponents().forEach((elem) => {
|
||||||
if (!this.personDataField.includes(elem.name)) {
|
if (!this.personDataField.includes(elem.name)) {
|
||||||
if (!this.approvedPassportData)
|
passportFormData.append(elem.name, elem.modelValue ?? "");
|
||||||
passportFormData.append(elem.name, elem.modelValue ?? "");
|
|
||||||
} else documentsFormData.append(elem.name, elem.modelValue ?? "");
|
} else documentsFormData.append(elem.name, elem.modelValue ?? "");
|
||||||
});
|
});
|
||||||
if (!this.approvedPassportData)
|
this.checkChengePhoto("passport", "photo", passportFormData);
|
||||||
this.checkChengePhoto("passport", "photo", passportFormData);
|
|
||||||
this.checkChengePhoto(
|
this.checkChengePhoto(
|
||||||
"insurance_number",
|
"insurance_number",
|
||||||
"photo_insurance_number",
|
"photo_insurance_number",
|
||||||
@@ -230,14 +228,43 @@ export default {
|
|||||||
passportFormData
|
passportFormData
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else
|
} else {
|
||||||
|
if (this.checkPhotoDeletion("passport", "photo"))
|
||||||
|
request.push(
|
||||||
|
this.deletePhoto(
|
||||||
|
`general/identity_document/${this.initialDocData.passport?.id}/delete_photo/`
|
||||||
|
)
|
||||||
|
);
|
||||||
request.push(
|
request.push(
|
||||||
this.sendData(
|
this.sendData(
|
||||||
`general/identity_document/${this.initialDocData.passport?.id}/update/`,
|
`general/identity_document/${this.initialDocData.passport?.id}/update/`,
|
||||||
passportFormData
|
passportFormData
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
this.checkPhotoDeletion(
|
||||||
|
"insurance_number",
|
||||||
|
"photo_insurance_number"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
request.push(
|
||||||
|
this.deletePhoto(
|
||||||
|
`general/person/${this.$store.state.medical?.basicData?.personalData?.id}/delete_photo_insurance_number/`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
this.checkPhotoDeletion(
|
||||||
|
"tax_identification_number",
|
||||||
|
"photo_tax_identification_number"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
request.push(
|
||||||
|
this.deletePhoto(
|
||||||
|
`general/person/${this.$store.state.medical?.basicData?.personalData?.id}/delete_photo_tax_identification_number/`
|
||||||
|
)
|
||||||
|
);
|
||||||
request.push(
|
request.push(
|
||||||
this.sendData(
|
this.sendData(
|
||||||
`general/person/${this.$store.state.medical?.basicData?.personalData?.id}/update/`,
|
`general/person/${this.$store.state.medical?.basicData?.personalData?.id}/update/`,
|
||||||
@@ -257,9 +284,18 @@ export default {
|
|||||||
if (this.docData[updatedObjId][field]?.file)
|
if (this.docData[updatedObjId][field]?.file)
|
||||||
formData.append(field, this.docData[updatedObjId][field]?.file[0]);
|
formData.append(field, this.docData[updatedObjId][field]?.file[0]);
|
||||||
},
|
},
|
||||||
|
checkPhotoDeletion(updatedObjId, field) {
|
||||||
|
return (
|
||||||
|
!Object.keys(this.docData[updatedObjId][field]).length &&
|
||||||
|
this.initialDocData[updatedObjId][field]?.photo
|
||||||
|
);
|
||||||
|
},
|
||||||
async sendData(url, body) {
|
async sendData(url, body) {
|
||||||
return await fetchWrapper.post(url, body, "formData");
|
return await fetchWrapper.post(url, body, "formData");
|
||||||
},
|
},
|
||||||
|
async deletePhoto(url) {
|
||||||
|
return await fetchWrapper.del(url);
|
||||||
|
},
|
||||||
addErrorNotification(title, message) {
|
addErrorNotification(title, message) {
|
||||||
addNotification(title + message, title, message, "error", 5000);
|
addNotification(title + message, title, message, "error", 5000);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user