PMCORE-2628 Message of Delete attribute does not display correctly

This commit is contained in:
Roly Rudy Gutierrez Pinto
2021-01-04 11:08:21 -04:00
parent 8e080147b7
commit ee456c4eb3
4 changed files with 72 additions and 26 deletions

View File

@@ -137,33 +137,52 @@
this.$emit("editAttribute", row);
},
deleteAttribute(row) {
this.$bvModal.msgBoxConfirm(this.$root.translation('ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM', [row.name]), {
title: " ", //is important because title disappear
hideHeaderClose: false,
okTitle: this.$root.translation('ID_CONFIRM'),
okVariant: "success",
cancelTitle: this.$root.translation('ID_CANCEL'),
cancelVariant: "danger"
}).then(value => {
if (value === false) {
return;
}
let formData = new FormData();
formData.append("option", "delete");
formData.append("id", row.id);
axios.post(this.$root.baseUrl() + "userExtendedAttributes/index", formData)
.then(response => {
response;
this.refresh();
})
.catch(error => {
error;
})
.finally(() => {
let formData = new FormData();
formData.append("option", "verifyAttributeUse");
formData.append("name", row.name);
formData.append("attributeId", row.attributeId);
axios.post(this.$root.baseUrl() + "userExtendedAttributes/index", formData)
.then(response => {
response;
let message = this.$root.translation('ID_THE_ATTRIBUTE_WILL_BE_DELETED_PLEASE_CONFIRM', [row.name]);
if ("isUsed" in response.data && "message" in response.data) {
if (response.data.isUsed === true) {
message = response.data.message;
}
}
this.$bvModal.msgBoxConfirm(message, {
title: " ", //is important because title disappear
hideHeaderClose: false,
okTitle: this.$root.translation('ID_CONFIRM'),
okVariant: "success",
cancelTitle: this.$root.translation('ID_CANCEL'),
cancelVariant: "danger"
}).then(value => {
if (value === false) {
return;
}
let formData = new FormData();
formData.append("option", "delete");
formData.append("id", row.id);
axios.post(this.$root.baseUrl() + "userExtendedAttributes/index", formData)
.then(response => {
response;
this.refresh();
})
.catch(error => {
error;
})
.finally(() => {
});
}).catch(err => {
err;
});
}).catch(err => {
err;
});
})
.catch(error => {
error;
})
.finally(() => {
});
},
refresh() {
this.$refs.vServerTable1.refresh();