Flatten nested repos
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_left.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_patient_page: 0,
|
||||
curr_patient_page: 1,
|
||||
selected_patient: { }
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_patients(state, data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_patient_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_patient_page(state, data) {
|
||||
state.curr_patient_page = data
|
||||
},
|
||||
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_patient(context.state.sdate, context.state.edate, context.state.search, context.state.curr_patient_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_left.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
px_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
pxs: [],
|
||||
total_px: 0,
|
||||
total_px_page: 0,
|
||||
curr_px_page: 1,
|
||||
selected_px: { },
|
||||
|
||||
selected_px_ids: [],
|
||||
selected_px_names: []
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_pxs(state, data) {
|
||||
state.pxs= data.records
|
||||
state.total_px = data.total
|
||||
state.total_px_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_px_page(state, data) {
|
||||
state.curr_px_page = data
|
||||
},
|
||||
|
||||
update_selected_px(state, val) {
|
||||
state.selected_px = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.px_id = id
|
||||
},
|
||||
|
||||
update_selected_px_ids(state, ids) {
|
||||
state.selected_px_ids = ids
|
||||
},
|
||||
|
||||
update_selected_px_names(state, names) {
|
||||
state.selected_px_names = names
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_px(context.state.sdate, context.state.edate, context.state.search, context.state.curr_px_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_pxs", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_left.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
worklist_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
worklists: [],
|
||||
total_worklist: 0,
|
||||
total_worklist_page: 0,
|
||||
curr_worklist_page: 1,
|
||||
selected_worklist: { }
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_worklists(state, data) {
|
||||
state.worklists= data.records
|
||||
state.total_worklist = data.total
|
||||
state.total_worklist_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_worklist_page(state, data) {
|
||||
state.curr_worklist_page = data
|
||||
},
|
||||
|
||||
update_selected_worklist(state, val) {
|
||||
state.selected_worklist = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.worklist_id = id
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_worklist(context.state.search, context.state.curr_worklist_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_worklists", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_right.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
instrument_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_patient_page: 0,
|
||||
curr_patient_page: 1,
|
||||
selected_patient: { },
|
||||
|
||||
snackbar: false
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_patients(state, data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_patient_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_patient_page(state, data) {
|
||||
state.curr_patient_page = data
|
||||
},
|
||||
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_snackbar(state, v) {
|
||||
state.snackbar = v
|
||||
},
|
||||
|
||||
update_instrument_id(state, id) {
|
||||
state.instrument_id = id
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_patient(context.rootState.io_left_px_list.sdate,
|
||||
context.rootState.io_left_px_list.edate,
|
||||
JSON.stringify(context.rootState.io_left_px_list.selected_px_ids),
|
||||
context.state.curr_patient_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records) {
|
||||
resp.data.records[i].send = "N"
|
||||
resp.data.records[i].send_disabled = resp.data.records[i].instrument_id == 0 ? true : false
|
||||
resp.data.records[i].persistent = resp.data.records[i].instrument_id == 0 ? false : true
|
||||
}
|
||||
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
context.commit("update_instrument_id", 0)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async send_orders(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let data = []
|
||||
let pts = context.state.patients
|
||||
for (let i in pts) {
|
||||
if (pts[i].instrument_id != 0 && pts[i].send == "Y") {
|
||||
for(let j in pts[i].detail_id)
|
||||
data.push({instrument_id:pts[i].instrument_id, detail_id:pts[i].detail_id[j]})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (data.length < 1) {
|
||||
alert('Tidak ada data yang dipilih !')
|
||||
return
|
||||
}
|
||||
|
||||
let resp= await api.send_orders(one_token(), JSON.stringify(data))
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records)
|
||||
resp.data.records[i].send = "N"
|
||||
|
||||
// let data = {
|
||||
// records : resp.data.records,
|
||||
// total: resp.data.total,
|
||||
// total_page: resp.data.total_page
|
||||
// }
|
||||
// context.commit("update_patients", data)
|
||||
context.dispatch('search')
|
||||
context.commit('update_snackbar', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_right.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_patient_page: 0,
|
||||
curr_patient_page: 1,
|
||||
selected_patient: { },
|
||||
|
||||
snackbar: false
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_patients(state, data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_patient_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_patient_page(state, data) {
|
||||
state.curr_patient_page = data
|
||||
},
|
||||
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_snackbar(state, v) {
|
||||
state.snackbar = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_patient(context.rootState.io_left_px_list.sdate, context.rootState.io_left_px_list.edate, context.rootState.io_left_px_list.px_id, context.state.curr_patient_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records) {
|
||||
resp.data.records[i].send = "N"
|
||||
resp.data.records[i].send_disabled = resp.data.records[i].instrument_id == 0 ? true : false
|
||||
}
|
||||
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async send_orders(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let data = []
|
||||
let pts = context.state.patients
|
||||
for (let i in pts) {
|
||||
if (pts[i].instrument_id != 0 && pts[i].send == "Y")
|
||||
data.push({instrument_id:pts[i].instrument_id, detail_id:pts[i].detail_id})
|
||||
}
|
||||
|
||||
if (data.length < 1) {
|
||||
alert('Tidak ada data yang dipilih !')
|
||||
return
|
||||
}
|
||||
|
||||
let resp= await api.send_orders(one_token(), JSON.stringify(data))
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records)
|
||||
resp.data.records[i].send = "N"
|
||||
|
||||
// let data = {
|
||||
// records : resp.data.records,
|
||||
// total: resp.data.total,
|
||||
// total_page: resp.data.total_page
|
||||
// }
|
||||
// context.commit("update_patients", data)
|
||||
context.dispatch('search')
|
||||
context.commit('update_snackbar', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_right.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
pxs: [],
|
||||
total_px: 0,
|
||||
total_px_page: 0,
|
||||
curr_px_page: 1,
|
||||
selected_px: { },
|
||||
|
||||
snackbar: false
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_pxs(state, data) {
|
||||
state.pxs= data.records
|
||||
state.total_px = data.total
|
||||
state.total_px_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_px_page(state, data) {
|
||||
state.curr_px_page = data
|
||||
},
|
||||
|
||||
update_selected_px(state, val) {
|
||||
state.selected_px = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_snackbar(state, v) {
|
||||
state.snackbar = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_px(context.rootState.io_left_patient_list.order_id, context.state.curr_px_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records) {
|
||||
resp.data.records[i].send = "N"
|
||||
resp.data.records[i].send_disabled = resp.data.records[i].instrument_id == 0 ? true : false
|
||||
}
|
||||
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_pxs", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async send_orders(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let data = []
|
||||
let pts = context.state.pxs
|
||||
for (let i in pts) {
|
||||
if (pts[i].instrument_id != 0 && pts[i].send == "Y")
|
||||
data.push({instrument_id:pts[i].instrument_id, detail_id:pts[i].detail_id})
|
||||
}
|
||||
|
||||
if (data.length < 1) {
|
||||
alert('Tidak ada data yang dipilih !')
|
||||
return
|
||||
}
|
||||
|
||||
let resp= await api.send_orders(one_token(), JSON.stringify(data))
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records)
|
||||
resp.data.records[i].send = "N"
|
||||
|
||||
// let data = {
|
||||
// records : resp.data.records,
|
||||
// total: resp.data.total,
|
||||
// total_page: resp.data.total_page
|
||||
// }
|
||||
// context.commit("update_pxs", data)
|
||||
context.dispatch('search')
|
||||
context.commit('update_snackbar', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/io_right.js"
|
||||
window.api = api
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
order_id:0,
|
||||
|
||||
search: '',
|
||||
sdate: null,
|
||||
edate: null,
|
||||
|
||||
search_status:0,
|
||||
search_error_message:'',
|
||||
search_dialog_is_active: false,
|
||||
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
total_patient_page: 0,
|
||||
curr_patient_page: 1,
|
||||
selected_patient: { },
|
||||
|
||||
snackbar: false
|
||||
},
|
||||
mutations: {
|
||||
update_search_dialog_is_active(state,status) {
|
||||
state.search_dialog_is_active = status
|
||||
},
|
||||
update_search_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
|
||||
update_search(state,val) {
|
||||
state.search = val
|
||||
},
|
||||
|
||||
update_sdate(state, val) {
|
||||
state.sdate = val
|
||||
},
|
||||
|
||||
update_edate(state, val) {
|
||||
state.edate = val
|
||||
},
|
||||
|
||||
update_search_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
|
||||
update_patients(state, data) {
|
||||
state.patients= data.records
|
||||
state.total_patient = data.total
|
||||
state.total_patient_page = data.total_page
|
||||
},
|
||||
|
||||
update_curr_patient_page(state, data) {
|
||||
state.curr_patient_page = data
|
||||
},
|
||||
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
|
||||
update_id(state, id) {
|
||||
state.order_id = id
|
||||
},
|
||||
|
||||
update_snackbar(state, v) {
|
||||
state.snackbar = v
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp= await api.search_worklist_patient(context.rootState.io_left_worklist_list.sdate, context.rootState.io_left_worklist_list.edate, context.rootState.io_left_worklist_list.worklist_id, context.state.curr_patient_page)
|
||||
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records) {
|
||||
resp.data.records[i].send = "N"
|
||||
resp.data.records[i].send_disabled = resp.data.records[i].instrument_id == 0 ? true : false
|
||||
}
|
||||
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
},
|
||||
|
||||
async send_orders(context) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let data = []
|
||||
let pts = context.state.patients
|
||||
for (let i in pts) {
|
||||
if (pts[i].instrument_id != 0 && pts[i].send == "Y")
|
||||
data.push({instrument_id:pts[i].instrument_id, detail_id:pts[i].detail_id})
|
||||
}
|
||||
|
||||
if (data.length < 1) {
|
||||
alert('Tidak ada data yang dipilih !')
|
||||
return
|
||||
}
|
||||
|
||||
let resp= await api.send_orders(one_token(), JSON.stringify(data))
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_status",2)
|
||||
context.commit("update_search_error_message","")
|
||||
|
||||
for (let i in resp.data.records)
|
||||
resp.data.records[i].send = "N"
|
||||
|
||||
// let data = {
|
||||
// records : resp.data.records,
|
||||
// total: resp.data.total,
|
||||
// total_page: resp.data.total_page
|
||||
// }
|
||||
// context.commit("update_patients", data)
|
||||
context.dispatch('search')
|
||||
context.commit('update_snackbar', true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_search_status",3)
|
||||
context.commit("update_search_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user