3Z4LPN - add stemcell/reguler filter and conditional upload endpoint
This commit is contained in:
@@ -85,7 +85,13 @@
|
|||||||
return-object
|
return-object
|
||||||
v-model="status"
|
v-model="status"
|
||||||
label="Status" outline hide-details>
|
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>
|
<span @click="searchPatient" class="icon-medium-fill-base xs1 white--text warning iconsearch-search"></span>
|
||||||
<v-divider vertical></v-divider>
|
<v-divider vertical></v-divider>
|
||||||
<v-btn title="Upload Data ke AIS" @click="uploadData" style="min-width: 25px!important; height: 30px!important;" color="primary">
|
<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()
|
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 () {
|
startDateFormatted () {
|
||||||
return this.formatDate(this.xstartdate)
|
return this.formatDate(this.xstartdate)
|
||||||
},
|
},
|
||||||
@@ -223,6 +239,10 @@ module.exports = {
|
|||||||
params.ais_status = this.status.value;
|
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);
|
this.$store.dispatch("patient/monitoring_transaction", params);
|
||||||
},
|
},
|
||||||
backToFoReceiver(){
|
backToFoReceiver(){
|
||||||
@@ -234,25 +254,35 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
async uploadData() {
|
async uploadData() {
|
||||||
this.loadingUpload = true;
|
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 {
|
try {
|
||||||
console.log('in uploadData');
|
const results = await Promise.all(endpoints.map(url => axios.get(url)));
|
||||||
var resp = await axios.get('/one-api/ais/transactionv4/post_transaction_daily_by_date/'+this.xstartdate+'/'+this.xenddate);
|
let messages = [];
|
||||||
console.log(resp);
|
results.forEach((resp, idx) => {
|
||||||
if (resp.status == 'OK') {
|
const label = endpoints[idx].includes('transactionv5') ? '[Stemcell]' : '[Reguler]';
|
||||||
alert(resp.data.message);
|
if (resp.data && resp.data.status == 'OK') {
|
||||||
} else {
|
messages.push(label + ' ' + resp.data.message);
|
||||||
let errors = resp.data.errors;
|
|
||||||
console.log(errors);
|
|
||||||
let error_message = '';
|
|
||||||
if(!errors || errors.length == 0){
|
|
||||||
error_message = resp.data.message;
|
|
||||||
} else {
|
} else {
|
||||||
for(let i = 0; i < errors.length; i++){
|
let errors = resp.data && resp.data.errors;
|
||||||
error_message += errors[i].RegID + ' : ' + errors[i].error + '\n';
|
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) {
|
} catch (e) {
|
||||||
alert(e.message);
|
alert(e.message);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -261,4 +291,4 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -23,6 +23,9 @@
|
|||||||
>
|
>
|
||||||
<p class="mb-0">{{ props.item.patient_name }}</p>
|
<p class="mb-0">{{ props.item.patient_name }}</p>
|
||||||
<p class="font-weight-black caption mb-0">{{ props.item.lab_number }}</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>
|
||||||
|
|
||||||
<td
|
<td
|
||||||
@@ -320,13 +323,13 @@ module.exports = {
|
|||||||
return this.$store.state.patient.dialog_info_message
|
return this.$store.state.patient.dialog_info_message
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
deleteTransaction(item) {
|
deleteTransaction(item) {
|
||||||
this.$store.dispatch("patient/delete_transaction_by_labnumber", {
|
this.$store.dispatch("patient/delete_transaction_by_labnumber", {
|
||||||
labnumber: item.lab_number,
|
labnumber: item.lab_number,
|
||||||
is_stemcell: item.is_stemcell
|
is_stemcell: item.is_stemcell
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// ===== FIX: TAMBAHKAN METHOD isSelected =====
|
// ===== FIX: TAMBAHKAN METHOD isSelected =====
|
||||||
isSelected(item) {
|
isSelected(item) {
|
||||||
if (!this.selected_patient || !item) return false;
|
if (!this.selected_patient || !item) return false;
|
||||||
@@ -345,18 +348,18 @@ module.exports = {
|
|||||||
this.$store.dispatch("patient/get_json_response");
|
this.$store.dispatch("patient/get_json_response");
|
||||||
await this.$store.dispatch("patient/check_exist_transaction", { labnumber: patient.lab_number });
|
await this.$store.dispatch("patient/check_exist_transaction", { labnumber: patient.lab_number });
|
||||||
},
|
},
|
||||||
sendTransaction(item) {
|
sendTransaction(item) {
|
||||||
this.$store.dispatch("patient/post_transaction_by_labnumber", {
|
this.$store.dispatch("patient/post_transaction_by_labnumber", {
|
||||||
labnumber: item.lab_number,
|
labnumber: item.lab_number,
|
||||||
is_stemcell: item.is_stemcell
|
is_stemcell: item.is_stemcell
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
reSendTransaction(item) {
|
reSendTransaction(item) {
|
||||||
this.$store.dispatch("patient/re_post_transaction_by_labnumber", {
|
this.$store.dispatch("patient/re_post_transaction_by_labnumber", {
|
||||||
labnumber: item.lab_number,
|
labnumber: item.lab_number,
|
||||||
is_stemcell: item.is_stemcell
|
is_stemcell: item.is_stemcell
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changePage(page) {
|
changePage(page) {
|
||||||
this.$store.commit("patient/update_current_page", page);
|
this.$store.commit("patient/update_current_page", page);
|
||||||
|
|
||||||
@@ -368,6 +371,11 @@ module.exports = {
|
|||||||
page: page
|
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();
|
const searchVal = this.$store.state.patient.search.trim();
|
||||||
if (searchVal) {
|
if (searchVal) {
|
||||||
// Cek jika input kemungkinan adalah nomor lab (mengandung huruf dan angka)
|
// 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);
|
console.log('Store state:', this.$store.state.patient);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ export default {
|
|||||||
save_error_message: '',
|
save_error_message: '',
|
||||||
statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}],
|
statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}],
|
||||||
selected_status:{name:'Semua',value:'A'},
|
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,
|
open_alert_no_pay: false,
|
||||||
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
|
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
|
||||||
current_page:1,
|
current_page:1,
|
||||||
@@ -102,6 +104,9 @@ export default {
|
|||||||
update_selected_status(state, val) {
|
update_selected_status(state, val) {
|
||||||
state.selected_status = val
|
state.selected_status = val
|
||||||
},
|
},
|
||||||
|
update_selected_stemcell_filter(state, val) {
|
||||||
|
state.selected_stemcell_filter = val
|
||||||
|
},
|
||||||
update_open_alert_no_pay(state, val) {
|
update_open_alert_no_pay(state, val) {
|
||||||
state.open_alert_no_pay = val
|
state.open_alert_no_pay = val
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user