Merge branch 'ASTRA-46' into 'master'
[WIP] Добавил delete photo See merge request andrusyakka/urban-couscous!337
This commit is contained in:
@@ -195,6 +195,7 @@ export default {
|
|||||||
this.showModal = false;
|
this.showModal = false;
|
||||||
this.isCheckChange = true;
|
this.isCheckChange = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateBasicData() {
|
updateBasicData() {
|
||||||
let insuranceDMS = this.basic.insuranceDMS;
|
let insuranceDMS = this.basic.insuranceDMS;
|
||||||
let insuranceOMS = this.basic.insuranceOMS;
|
let insuranceOMS = this.basic.insuranceOMS;
|
||||||
@@ -261,6 +262,12 @@ export default {
|
|||||||
key === "insuranceDMS" &&
|
key === "insuranceDMS" &&
|
||||||
insuranceDMS.id
|
insuranceDMS.id
|
||||||
) {
|
) {
|
||||||
|
this.checkedPhoto(
|
||||||
|
insuranceDMS.photo,
|
||||||
|
insuranceDMS.id,
|
||||||
|
"insurance_policy",
|
||||||
|
"delete_photo"
|
||||||
|
);
|
||||||
insuranceFormDataDMS.append("title", "DMS");
|
insuranceFormDataDMS.append("title", "DMS");
|
||||||
return this.sendData(
|
return this.sendData(
|
||||||
`general/insurance_policy/${insuranceDMS.id}/update/`,
|
`general/insurance_policy/${insuranceDMS.id}/update/`,
|
||||||
@@ -280,6 +287,12 @@ export default {
|
|||||||
key === "insuranceOMS" &&
|
key === "insuranceOMS" &&
|
||||||
insuranceOMS.id
|
insuranceOMS.id
|
||||||
) {
|
) {
|
||||||
|
this.checkedPhoto(
|
||||||
|
insuranceOMS.photo,
|
||||||
|
insuranceOMS.id,
|
||||||
|
"insurance_policy",
|
||||||
|
"delete_photo"
|
||||||
|
);
|
||||||
insuranceFormDataOMS.append("title", "OMS");
|
insuranceFormDataOMS.append("title", "OMS");
|
||||||
return this.sendData(
|
return this.sendData(
|
||||||
`general/insurance_policy/${insuranceOMS.id}/update/`,
|
`general/insurance_policy/${insuranceOMS.id}/update/`,
|
||||||
@@ -298,6 +311,12 @@ export default {
|
|||||||
checkChangeData(this.initDataBasic.benefit, benefit) &&
|
checkChangeData(this.initDataBasic.benefit, benefit) &&
|
||||||
key === "benefit"
|
key === "benefit"
|
||||||
) {
|
) {
|
||||||
|
this.checkedPhoto(
|
||||||
|
benefit.photo,
|
||||||
|
personal.id,
|
||||||
|
"person",
|
||||||
|
"delete_photo_benefit"
|
||||||
|
);
|
||||||
fetchWrapper.post(`general/person/${personal.id}/update/`, {
|
fetchWrapper.post(`general/person/${personal.id}/update/`, {
|
||||||
benefit: benefit.id,
|
benefit: benefit.id,
|
||||||
});
|
});
|
||||||
@@ -315,6 +334,11 @@ export default {
|
|||||||
});
|
});
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
checkedPhoto(photo, id, key, title) {
|
||||||
|
if (!photo?.photo) {
|
||||||
|
return this.delPhoto(`general/${key}/${id}/${title}/`);
|
||||||
|
}
|
||||||
|
},
|
||||||
addErrorNotification(title, message) {
|
addErrorNotification(title, message) {
|
||||||
addNotification(title + message, title, message, "error", 5000);
|
addNotification(title + message, title, message, "error", 5000);
|
||||||
},
|
},
|
||||||
@@ -322,6 +346,9 @@ export default {
|
|||||||
async sendData(url, body) {
|
async sendData(url, body) {
|
||||||
return await fetchWrapper.post(url, body, "formData");
|
return await fetchWrapper.post(url, body, "formData");
|
||||||
},
|
},
|
||||||
|
async delPhoto(url) {
|
||||||
|
return await fetchWrapper.del(url);
|
||||||
|
},
|
||||||
cancelEdit() {
|
cancelEdit() {
|
||||||
this.$store.dispatch("returnInitData");
|
this.$store.dispatch("returnInitData");
|
||||||
this.isEdit = false;
|
this.isEdit = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user