3Z4LPN - add stemcell/reguler filter and conditional upload endpoint
This commit is contained in:
@@ -85,7 +85,13 @@
|
||||
return-object
|
||||
v-model="status"
|
||||
label="Status" outline hide-details>
|
||||
</v-select>
|
||||
</v-select>
|
||||
<v-select class="xs3 mini-select ma-1" :items="stemcell_filters"
|
||||
item-text="name"
|
||||
return-object
|
||||
v-model="selected_stemcell_filter"
|
||||
label="Tipe Transaksi" outline hide-details>
|
||||
</v-select>
|
||||
<span @click="searchPatient" class="icon-medium-fill-base xs1 white--text warning iconsearch-search"></span>
|
||||
<v-divider vertical></v-divider>
|
||||
<v-btn title="Upload Data ke AIS" @click="uploadData" style="min-width: 25px!important; height: 30px!important;" color="primary">
|
||||
@@ -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 = {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
>
|
||||
<p class="mb-0">{{ props.item.patient_name }}</p>
|
||||
<p class="font-weight-black caption mb-0">{{ props.item.lab_number }}</p>
|
||||
<v-chip small :color="props.item.is_stemcell === 'Y' ? 'purple' : 'teal'" dark class="ma-0 mt-1" style="height:18px; font-size:10px;">
|
||||
{{ props.item.is_stemcell === 'Y' ? 'Stemcell' : 'Reguler' }}
|
||||
</v-chip>
|
||||
</td>
|
||||
|
||||
<td
|
||||
@@ -320,13 +323,13 @@ module.exports = {
|
||||
return this.$store.state.patient.dialog_info_message
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteTransaction(item) {
|
||||
this.$store.dispatch("patient/delete_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
deleteTransaction(item) {
|
||||
this.$store.dispatch("patient/delete_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
// ===== FIX: TAMBAHKAN METHOD isSelected =====
|
||||
isSelected(item) {
|
||||
if (!this.selected_patient || !item) return false;
|
||||
@@ -345,18 +348,18 @@ module.exports = {
|
||||
this.$store.dispatch("patient/get_json_response");
|
||||
await this.$store.dispatch("patient/check_exist_transaction", { labnumber: patient.lab_number });
|
||||
},
|
||||
sendTransaction(item) {
|
||||
this.$store.dispatch("patient/post_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
reSendTransaction(item) {
|
||||
this.$store.dispatch("patient/re_post_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
sendTransaction(item) {
|
||||
this.$store.dispatch("patient/post_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
reSendTransaction(item) {
|
||||
this.$store.dispatch("patient/re_post_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
changePage(page) {
|
||||
this.$store.commit("patient/update_current_page", page);
|
||||
|
||||
@@ -368,6 +371,11 @@ module.exports = {
|
||||
page: page
|
||||
};
|
||||
|
||||
const stemcellFilter = this.$store.state.patient.selected_stemcell_filter;
|
||||
if (stemcellFilter && stemcellFilter.value !== 'A') {
|
||||
params.is_stemcell = stemcellFilter.value;
|
||||
}
|
||||
|
||||
const searchVal = this.$store.state.patient.search.trim();
|
||||
if (searchVal) {
|
||||
// Cek jika input kemungkinan adalah nomor lab (mengandung huruf dan angka)
|
||||
@@ -421,4 +429,4 @@ module.exports = {
|
||||
console.log('Store state:', this.$store.state.patient);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user