Merged in feature/PMCORE-3277 (pull request #8106)

feature/PMCORE-3277

Approved-by: Rodrigo Quelca
This commit is contained in:
Henry Jonathan Quispe Quispe
2021-09-08 14:19:49 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -6,6 +6,15 @@
:title="$t('ID_CANCEL_CASE')" :title="$t('ID_CANCEL_CASE')"
size="md" size="md"
> >
<b-alert
:show="dataAlert.dismissCountDown"
dismissible
:variant="dataAlert.variant"
@dismissed="dataAlert.dismissCountDown = 0"
@dismiss-count-down="countDownChanged"
>
{{ dataAlert.message }}
</b-alert>
<p> <p>
You are tying to cancel the current case. Please be aware this action You are tying to cancel the current case. Please be aware this action
cannot be undone cannot be undone
@@ -47,6 +56,7 @@
<script> <script>
import api from "./../../api/index"; import api from "./../../api/index";
import eventBus from "../EventBus/eventBus";
export default { export default {
name: "ModalCancelCase", name: "ModalCancelCase",
components: {}, components: {},
@@ -56,6 +66,12 @@ export default {
mounted() {}, mounted() {},
data() { data() {
return { return {
dataAlert: {
dismissSecs: 5,
dismissCountDown: 0,
message: "",
variant: "danger",
},
filter: "", filter: "",
categories: [], categories: [],
categoriesFiltered: [], categoriesFiltered: [],
@@ -75,17 +91,42 @@ export default {
cancelCase() { cancelCase() {
let that = this; let that = this;
api.cases api.cases
.cancel(_.extend({}, this.dataCase, { .cancel(
COMMENT: this.$refs["comment"].value, _.extend({}, this.dataCase, {
SEND: this.$refs["send"].checked ? 1 : 0, COMMENT: this.$refs["comment"].value,
})) SEND: this.$refs["send"].checked ? 1 : 0,
})
)
.then((response) => { .then((response) => {
if (response.status === 200) { if (response.status === 200) {
that.$refs["modal-cancel-case"].hide(); that.$refs["modal-cancel-case"].hide();
that.$parent.$parent.page = "todo"; eventBus.$emit("home-update-page", "inbox");
}
})
.catch((e) => {
if(e.response.data && e.response.data.error){
that.showAlert(e.response.data.error.message, "danger");
} }
}); });
}, },
/**
* Show the alert message
* @param {string} message - message to be displayen in the body
* @param {string} type - alert type
*/
showAlert(message, type) {
this.dataAlert.message = message;
this.dataAlert.variant = type || "info";
this.dataAlert.dismissCountDown = this.dataAlert.dismissSecs;
},
/**
* Updates the alert dismiss value to update
* dismissCountDown and decrease
* @param {mumber}
*/
countDownChanged(dismissCountDown) {
this.dataAlert.dismissCountDown = dismissCountDown;
},
}, },
}; };
</script> </script>