diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue index 9d63d1b..4c78f28 100644 --- a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue +++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierSearch.vue @@ -85,7 +85,13 @@ return-object v-model="status" label="Status" outline hide-details> - + + + @@ -183,6 +189,16 @@ module.exports = { this.searchPatient() } }, + stemcell_filters() { + return this.$store.state.patient.stemcell_filters + }, + selected_stemcell_filter: { + get() { return this.$store.state.patient.selected_stemcell_filter }, + set(val) { + this.$store.commit("patient/update_selected_stemcell_filter", val) + this.searchPatient() + } + }, startDateFormatted () { return this.formatDate(this.xstartdate) }, @@ -223,6 +239,10 @@ module.exports = { params.ais_status = this.status.value; } + if (this.selected_stemcell_filter.value !== 'A') { + params.is_stemcell = this.selected_stemcell_filter.value; + } + this.$store.dispatch("patient/monitoring_transaction", params); }, backToFoReceiver(){ @@ -234,25 +254,35 @@ module.exports = { }, async uploadData() { this.loadingUpload = true; + const filterVal = this.selected_stemcell_filter.value; + const endpoints = []; + + if (filterVal === 'A' || filterVal === 'N') { + endpoints.push('/one-api/ais/transactionv4/post_transaction_daily_by_date/' + this.xstartdate + '/' + this.xenddate); + } + if (filterVal === 'A' || filterVal === 'Y') { + endpoints.push('/one-api/ais/transactionv5/post_transaction_daily_by_date/' + this.xstartdate + '/' + this.xenddate); + } + try { - console.log('in uploadData'); - var resp = await axios.get('/one-api/ais/transactionv4/post_transaction_daily_by_date/'+this.xstartdate+'/'+this.xenddate); - console.log(resp); - if (resp.status == 'OK') { - alert(resp.data.message); - } else { - let errors = resp.data.errors; - console.log(errors); - let error_message = ''; - if(!errors || errors.length == 0){ - error_message = resp.data.message; + const results = await Promise.all(endpoints.map(url => axios.get(url))); + let messages = []; + results.forEach((resp, idx) => { + const label = endpoints[idx].includes('transactionv5') ? '[Stemcell]' : '[Reguler]'; + if (resp.data && resp.data.status == 'OK') { + messages.push(label + ' ' + resp.data.message); } else { - for(let i = 0; i < errors.length; i++){ - error_message += errors[i].RegID + ' : ' + errors[i].error + '\n'; + let errors = resp.data && resp.data.errors; + if (!errors || errors.length == 0) { + messages.push(label + ' ' + (resp.data ? resp.data.message : 'Error')); + } else { + errors.forEach(e => { + messages.push(label + ' ' + e.RegID + ' : ' + e.error); + }); } } - alert(error_message); - } + }); + alert(messages.join('\n')); } catch (e) { alert(e.message); } finally { @@ -261,4 +291,4 @@ module.exports = { } } } - + diff --git a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue index 9f8ce2a..6115293 100644 --- a/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue +++ b/test/vuex/ais-monitoring-transaction-v4/components/oneFoCashierTable.vue @@ -23,6 +23,9 @@ >

{{ props.item.patient_name }}

{{ props.item.lab_number }}

+ + {{ props.item.is_stemcell === 'Y' ? 'Stemcell' : 'Reguler' }} + + diff --git a/test/vuex/ais-monitoring-transaction-v4/modules/patient.js b/test/vuex/ais-monitoring-transaction-v4/modules/patient.js index ad8e81f..3ddeb2b 100644 --- a/test/vuex/ais-monitoring-transaction-v4/modules/patient.js +++ b/test/vuex/ais-monitoring-transaction-v4/modules/patient.js @@ -19,6 +19,8 @@ export default { save_error_message: '', statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}], selected_status:{name:'Semua',value:'A'}, + stemcell_filters:[{name:'Semua',value:'A'},{name:'Stemcell',value:'Y'},{name:'Reguler',value:'N'}], + selected_stemcell_filter:{name:'Semua',value:'A'}, open_alert_no_pay: false, msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?", current_page:1, @@ -102,6 +104,9 @@ export default { update_selected_status(state, val) { state.selected_status = val }, + update_selected_stemcell_filter(state, val) { + state.selected_stemcell_filter = val + }, update_open_alert_no_pay(state, val) { state.open_alert_no_pay = val },