Merged in bugfix/PMCORE-3790 (pull request #8483)

PMCORE-3790

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Henry Jonathan Quispe Quispe
2022-06-14 19:07:58 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -89,6 +89,7 @@
ref="modal-comments"
@postNotes="onPostNotes"
></ModalComments>
<ModalClaimCase ref="modal-claim-case" @claimCatch="claimCatch"></ModalClaimCase>
</div>
</template>
<script>
@@ -99,6 +100,7 @@ import TaskCell from "../../components/vuetable/TaskCell.vue";
import CurrentUserCell from "../../components/vuetable/CurrentUserCell.vue";
import ModalComments from "../modal/ModalComments.vue";
import ThreadTitleCell from "../../components/vuetable/ThreadTitleCell.vue"
import ModalClaimCase from "../modal/ModalClaimCase.vue";
import api from "../../api/index";
import utils from "../../utils/utils";
import defaultMixin from "./defaultMixins.js";
@@ -114,6 +116,7 @@ export default {
ModalNewRequest,
TaskCell,
CurrentUserCell,
ModalClaimCase,
ModalComments,
ThreadTitleCell,
},
@@ -487,13 +490,31 @@ export default {
});
this.$emit("onUpdatePage", "case-detail");
},
/**
* Method to validate if the case is unassigned
*/
onJumpCase(caseNumber) {
api.cases.pendingtask({APP_NUMBER:caseNumber}).then((response) => {
if (response.data && response.data[0] && response.data[0]['USR_ID'] == 0) {
this.claimCase(response.data[0]);
} else {
this.jump(caseNumber);
}
}).catch((e)=>{
this.jump(caseNumber);
});
},
/**
* Method to jump case based in APP_NUMBER
*/
jump (caseNumber) {
let self = this;
const params = {
APP_NUMBER: caseNumber,
ACTION: "jump",
ACTION_FROM_LIST: "search",
};
let self = this;
api.cases
.jump(params)
.then(function(response) {
@@ -612,6 +633,26 @@ export default {
this.$refs['vueTable'].setOrder(false);
}
},
/**
* Claim case
*
* @param {object} item
*/
claimCase(item) {
let that = this;
api.cases.open(_.extend({ ACTION: "unassigned" }, item)).then(() => {
api.cases.cases_open(_.extend({ ACTION: "todo" }, item)).then(() => {
that.$refs["modal-claim-case"].data = item;
that.$refs["modal-claim-case"].show();
});
});
},
/**
* Claim catch error handler message
*/
claimCatch(message) {
this.showAlert(message, "danger");
}
},
};
</script>