Merged in bugfix/PMCORE-2617 (pull request #7670)

PMCORE-2617

Approved-by: Henry Jonathan Quispe Quispe <jonathan.quispe@processmaker.com>
This commit is contained in:
Rodrigo Quelca
2020-12-23 19:30:35 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 45 additions and 16 deletions

View File

@@ -74,13 +74,21 @@
</b-button> </b-button>
</div> </div>
<div class="p-2"> <div class="p-2">
<input <form ref="jump" @submit.stop.prevent="handleJumpTo">
<b-form-group
:state="caseNumberState"
:invalid-feedback="$t('ID_INVALID_APPLICATION_NUMBER')"
>
<b-form-input
id="case-number-input"
v-model="caseNumber" v-model="caseNumber"
size="1" :state="caseNumberState"
class="form-control"
:placeholder="$t('ID_CASE_NUMBER_CAPITALIZED')" :placeholder="$t('ID_CASE_NUMBER_CAPITALIZED')"
required
type="number" type="number"
/> ></b-form-input>
</b-form-group>
</form>
</div> </div>
</div> </div>
</b-col> </b-col>
@@ -352,6 +360,7 @@ export default {
saveModalTitle: this.$i18n.t('ID_SAVE_SEARCH'), saveModalTitle: this.$i18n.t('ID_SAVE_SEARCH'),
localName: "", localName: "",
nameState: null, nameState: null,
caseNumberState: null
}; };
}, },
watch: { watch: {
@@ -361,12 +370,11 @@ export default {
this.searchTags = []; this.searchTags = [];
this.selected = []; this.selected = [];
this.setFilters(newVal); this.setFilters(newVal);
}, }
} }
}, },
methods: { methods: {
/** /**
* Set Filters and make the tag labels * Set Filters and make the tag labels
* @param {object} filters json to manage the query * @param {object} filters json to manage the query
@@ -468,8 +476,25 @@ export default {
temp = [...new Set([...this.filters,...params])] temp = [...new Set([...this.filters,...params])]
this.$emit("onUpdateFilters", temp); this.$emit("onUpdateFilters", temp);
}, },
onJumpCase() { /**
* Jump To action handler
* Validates the form input
*/
handleJumpTo() {
const valid = this.$refs.jump.checkValidity() && parseInt(this.caseNumber) > 0;
this.caseNumberState = valid;
if (!valid) {
return;
}
this.$nextTick(() => {
this.$emit("onJumpCase", this.caseNumber); this.$emit("onJumpCase", this.caseNumber);
});
},
/**
* Click evemt hamdler for "Jump To" button
*/
onJumpCase() {
this.handleJumpTo();
}, },
onClick() { onClick() {
if (this.id) { if (this.id) {

View File

@@ -423,12 +423,16 @@ export default {
let self = this; let self = this;
api.cases api.cases
.jump(params) .jump(params)
.then(function(data) { .then(function(response) {
if (response.data.exists) {
self.$parent.dataCase = params; self.$parent.dataCase = params;
self.$parent.page = "XCase"; self.$parent.page = "XCase";
} else {
self.showAlert(response.data.message, "danger");
}
}) })
.catch((err) => { .catch((err) => {
throw new Error(err); self.showAlert(err.message, "danger");
}); });
}, },
/** /**