Flatten nested repos
This commit is contained in:
187
test/vuex/cpone-process-resultentry-v21/modules/helper.js
Normal file
187
test/vuex/cpone-process-resultentry-v21/modules/helper.js
Normal file
@@ -0,0 +1,187 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/helper.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
loading:false,
|
||||
error:'',
|
||||
open_print: false,
|
||||
status_print: '',
|
||||
dialog_status: false,
|
||||
urlprint: "",
|
||||
printtitle: '',
|
||||
printwidth: '100%',
|
||||
test_not_yet: '',
|
||||
dialog_print_new: false
|
||||
},
|
||||
mutations: {
|
||||
update_dialog_print_new(state,value) {
|
||||
state.dialog_print_new= value
|
||||
},
|
||||
update_test_not_yet(state,value) {
|
||||
state.test_not_yet= value
|
||||
},
|
||||
update_urlprint(state,value) {
|
||||
state.urlprint= value
|
||||
},
|
||||
update_printtitle(state,value) {
|
||||
state.printtitle= value
|
||||
},
|
||||
update_printwidth(state,value) {
|
||||
state.printwidth= value
|
||||
},
|
||||
update_calc_age_status(state,value) {
|
||||
state.loading= value
|
||||
},
|
||||
update_error(state,value) {
|
||||
state.error= value
|
||||
},
|
||||
update_loading(state,value) {
|
||||
state.loading = value
|
||||
},
|
||||
update_open_print(state, value) {
|
||||
state.open_print = value
|
||||
},
|
||||
update_status_print(state, value) {
|
||||
state.status_print = value
|
||||
},
|
||||
update_dialog_status(state, value) {
|
||||
state.dialog_status = value
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async calc_age(context,orderID) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = { orderID }
|
||||
prm["token"] = one_token()
|
||||
let resp = await api.calc_age(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error", resp.message)
|
||||
} else {
|
||||
context.commit("update_error", "")
|
||||
let patient = context.rootState.re_patient.selected_patient
|
||||
let dob = resp.data.M_PatientDOB
|
||||
let age = resp.data.T_OrderHeaderM_PatientAge
|
||||
patient.M_PatientDOB = dob
|
||||
patient.T_OrderHeaderM_PatientAge = age
|
||||
context.rootState.commit("re_patient/update_selected_patient", patient)
|
||||
let patients = context.rootState.patients
|
||||
for( let idx =0; idx < patients.length ; idx++) {
|
||||
if (patients[idx].M_PatientID = patient.M_PatientID ) {
|
||||
patients[idx] = patient
|
||||
}
|
||||
}
|
||||
context.rootState.commit('re_patient/update_patients',patients)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error", e.message)
|
||||
}
|
||||
},
|
||||
async check_status_print(context,orderID) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = { orderID }
|
||||
prm["token"] = one_token()
|
||||
let resp = await api.check_status_print(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error", resp.message)
|
||||
} else {
|
||||
context.commit("update_error", "")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
let xstatus = context.rootState.re_patient.T_OrderHeaderAddOnValidationDone
|
||||
if(data.records[0].testname != null){
|
||||
context.commit("update_status_print",'Terdapat pemeriksaan yang belum selesai : ' + data.records[0].testname)
|
||||
context.commit("update_dialog_status", true)
|
||||
context.commit("update_test_not_yet", data.records[0].testall)
|
||||
}else{
|
||||
context.commit("update_dialog_print_new", false)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error", e.message)
|
||||
}
|
||||
},
|
||||
async check_status_printold(context,orderID) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = { orderID }
|
||||
prm["token"] = one_token()
|
||||
let resp = await api.check_status_print(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error", resp.message)
|
||||
} else {
|
||||
context.commit("update_error", "")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if(data.records[0].testname != null){
|
||||
context.commit("update_status_print",'Terdapat pemeriksaan yang belum selesai : ' + data.records[0].testname)
|
||||
context.commit("update_dialog_status", true)
|
||||
context.commit("update_test_not_yet", data.records[0].testall)
|
||||
}else{
|
||||
let id = context.rootState.re_patient.selected_patient.T_OrderHeaderID
|
||||
let tm = Date.now()
|
||||
let user = one_user()
|
||||
context.commit("update_printwidth","1700")
|
||||
context.commit("update_printtitle", "")
|
||||
let rpt = 'rpt_test'
|
||||
let url = "/birt/run?__report=report/one/lab/" + rpt + ".rptdesign&__format=pdf&PID=" + id + "&username=" + user.M_StaffName + "&tm=" + tm
|
||||
context.commit("update_urlprint", url)
|
||||
context.commit("update_open_print", true)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error", e.message)
|
||||
}
|
||||
},
|
||||
async insertlogprint(context,prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.insertlogprint(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error", resp.message)
|
||||
} else {
|
||||
context.commit("update_error", "")
|
||||
context.commit("update_dialog_status", false)
|
||||
context.commit("update_dialog_print_new", false)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error", e.message)
|
||||
}
|
||||
},
|
||||
async insertlogprintold(context,prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.insertlogprint(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error", resp.message)
|
||||
} else {
|
||||
context.commit("update_error", "")
|
||||
let id = context.rootState.re_patient.selected_patient.T_OrderHeaderID
|
||||
let tm = Date.now()
|
||||
let user = one_user()
|
||||
context.commit("update_printwidth","1700")
|
||||
context.commit("update_printtitle", "")
|
||||
let rpt = 'rpt_test'
|
||||
let url = "/birt/run?__report=report/one/lab/" + rpt + ".rptdesign&__format=pdf&PID=" + id + "&username=" + user.M_StaffName + "&tm=" + tm
|
||||
context.commit("update_urlprint", url)
|
||||
context.commit("update_dialog_status", false)
|
||||
context.commit("update_open_print", true)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error", e.message)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user