549 lines
21 KiB
JavaScript
549 lines
21 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/methodepriority.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
last_id: -1,
|
|
last_saved_id: -1,
|
|
x_meth_id: 0,
|
|
act: 'edit',
|
|
act_comp: 'new',
|
|
act_meth: 'new',
|
|
act_send: 'N',
|
|
get_data_status: 0,
|
|
search_methodepriority: 0,
|
|
search_status: 0,
|
|
search_error_message: '',
|
|
dialog_form_order: false,
|
|
dialog_edit_form_order:false,
|
|
dialog_status_order: false,
|
|
norm: '',
|
|
methodepriority_name: '',
|
|
methodeprioritys: [],
|
|
total_methodeprioritys: 0,
|
|
methodepriority_methode: [],
|
|
date: '',
|
|
note: '',
|
|
sdate:moment(new Date()).format('YYYY-MM-DD'),
|
|
companies: [],
|
|
company: {},
|
|
mous: [],
|
|
mou: {},
|
|
total_methodepriority: 0,
|
|
selected_methodepriority: {},
|
|
save_status: 0,
|
|
btn_save_seen: true,
|
|
pgrs_save: false,
|
|
save_error_message: '',
|
|
no_save: 0,
|
|
open_alert_confirmation: false,
|
|
alert_success: false,
|
|
msg_success: "",
|
|
dialog_success: false,
|
|
dialog_confirmation_delete: false,
|
|
msg_confirmation_delete: "",
|
|
dialog_confirmation_send: false,
|
|
msg_confirmation_send: "",
|
|
dialog_confirmation_delete_meth: false,
|
|
msg_confirmation_delete_meth: "",
|
|
autocomplete_status: 0,
|
|
dialog_form_methode: false,
|
|
errors: [],
|
|
methodes: [],
|
|
noref: '',
|
|
namamethode: '',
|
|
dob: '',
|
|
methodees: [],
|
|
selected_methode: {},
|
|
subcategoryes: [],
|
|
selected_subcategory: {},
|
|
orderautoregtimes:[],
|
|
orderautoregtime:{},
|
|
orderregtimes:[],
|
|
deleted_orderregtimes:[],
|
|
statuss:[],
|
|
in_saving: false
|
|
},
|
|
mutations: {
|
|
update_in_saving(state, val) {
|
|
state.in_saving = val
|
|
},
|
|
update_x_meth_id(state, val) {
|
|
state.x_meth_id = val
|
|
},
|
|
update_last_id(state, val) {
|
|
state.last_id = val
|
|
},
|
|
update_last_saved_id(state, val) {
|
|
state.last_saved_id = val
|
|
},
|
|
update_act(state, val) {
|
|
state.act = val
|
|
},
|
|
update_act_comp(state, val) {
|
|
state.act_comp = val
|
|
},
|
|
update_act_meth(state, val) {
|
|
state.act_meth = val
|
|
},
|
|
update_act_send(state, val) {
|
|
state.act_send = val
|
|
},
|
|
update_get_data_status(state, val) {
|
|
state.get_data_status = val
|
|
},
|
|
update_search_error_message(state, methodepriority) {
|
|
state.search_error_message = methodepriority
|
|
},
|
|
update_search_methodepriority(state, methodepriority) {
|
|
state.search_methodepriority = methodepriority
|
|
},
|
|
update_dialog_form_order(state, val) {
|
|
state.dialog_form_order = val
|
|
},
|
|
update_dialog_edit_form_order(state, val) {
|
|
state.dialog_edit_form_order = val
|
|
},
|
|
update_dialog_status_order(state, val) {
|
|
state.dialog_status_order = val
|
|
},
|
|
update_methodepriority_name(state, val) {
|
|
state.methodepriority_name = val
|
|
},
|
|
update_date(state, val) {
|
|
state.date = val
|
|
},
|
|
update_sdate(state,val){
|
|
state.sdate = val
|
|
},
|
|
update_note(state, val) {
|
|
state.note = val
|
|
},
|
|
update_methodeprioritys(state, data) {
|
|
state.methodeprioritys = data
|
|
},
|
|
update_selected_methodepriority(state, val) {
|
|
state.selected_methodepriority = val
|
|
},
|
|
update_save_status(state, val) {
|
|
state.save_status = val
|
|
},
|
|
update_btn_save_seen(state, val) {
|
|
state.btn_save_seen = val
|
|
},
|
|
update_pgrs_save(state, val) {
|
|
state.pgrs_save = val
|
|
},
|
|
update_save_error_message(state, msg) {
|
|
state.save_error_message = ''
|
|
},
|
|
update_no_save(state, val) {
|
|
state.no_save = val
|
|
},
|
|
update_open_alert_confirmation(state, val) {
|
|
state.open_alert_confirmation = val
|
|
},
|
|
update_alert_success(state, val) {
|
|
state.alert_success = val
|
|
},
|
|
update_msg_success(state, val) {
|
|
state.msg_success = val
|
|
},
|
|
update_dialog_success(state, val) {
|
|
state.dialog_success = val
|
|
},
|
|
update_dialog_confirmation_delete(state, val) {
|
|
state.dialog_confirmation_delete = val
|
|
},
|
|
update_msg_confirmation_delete(state, val) {
|
|
state.msg_confirmation_delete = val
|
|
},
|
|
update_dialog_confirmation_send(state, val) {
|
|
state.dialog_confirmation_send = val
|
|
},
|
|
update_msg_confirmation_send(state, val) {
|
|
state.msg_confirmation_send = val
|
|
},
|
|
update_dialog_confirmation_delete_meth(state, val) {
|
|
state.dialog_confirmation_delete_meth = val
|
|
},
|
|
update_msg_confirmation_delete_meth(state, val) {
|
|
state.msg_confirmation_delete_meth = val
|
|
},
|
|
update_methodes(state, val) {
|
|
state.methodes = val
|
|
},
|
|
update_autocomplete_status(state, val) {
|
|
state.autocomplete_status = val
|
|
},
|
|
update_dialog_form_methode(state, val) {
|
|
state.dialog_form_methode = val
|
|
},
|
|
update_label_methode(state, val) {
|
|
state.label_methode = val
|
|
},
|
|
update_companies(state, val) {
|
|
state.companies = val
|
|
},
|
|
update_company(state, val) {
|
|
state.company = val
|
|
},
|
|
update_mous(state, val) {
|
|
state.mous = val
|
|
},
|
|
update_mou(state, val) {
|
|
state.mou = val
|
|
},
|
|
update_search_status(state, val) {
|
|
state.search_status = val
|
|
},
|
|
update_errors(state, val) {
|
|
state.errors = val
|
|
},
|
|
update_total_methodeprioritys(state, val) {
|
|
state.total_methodeprioritys = val
|
|
},
|
|
update_dob(state, val) {
|
|
state.dob = val
|
|
},
|
|
update_noref(state, val) {
|
|
state.noref = val
|
|
},
|
|
update_nama_methode(state, val) {
|
|
state.namamethode = val
|
|
},
|
|
update_methodees(state, val) {
|
|
state.methodees = val
|
|
},
|
|
update_selected_methode(state, val) {
|
|
state.selected_methode = val
|
|
},
|
|
update_subcategoryes(state, val) {
|
|
state.subcategoryes = val
|
|
},
|
|
update_selected_subcategory(state, val) {
|
|
state.selected_subcategory = val
|
|
},
|
|
update_orderautoregtimes(state,data){
|
|
state.orderautoregtimes = data
|
|
},
|
|
update_orderautoregtime(state,val){
|
|
state.orderautoregtime = val
|
|
},
|
|
update_orderregtimes(state,data){
|
|
state.orderregtimes = data
|
|
},
|
|
update_deleted_orderregtimes(state,data){
|
|
state.deleted_orderregtimes = data
|
|
},
|
|
update_statuss(state,data){
|
|
state.statuss = data
|
|
}
|
|
},
|
|
actions: {
|
|
async search(context, prm) {
|
|
context.commit("update_search_methodepriority", 1)
|
|
try {
|
|
let resp = await api.search(one_token(),prm.code, prm.name)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_search_methodepriority", 3)
|
|
context.commit("update_search_error_message", resp.message)
|
|
} else {
|
|
context.commit("update_search_methodepriority", 2)
|
|
context.commit("update_search_error_message", "")
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_methodeprioritys", data.records)
|
|
context.commit("update_total_methodeprioritys", data.total)
|
|
context.commit("update_no_save", 0)
|
|
if (prm.lastid === -1) {
|
|
context.commit("update_selected_methodepriority", data.records[0])
|
|
var pat = data.records[0]
|
|
context.commit("update_methodepriority_name", pat.Nat_MethodeName)
|
|
context.dispatch("getschedule")
|
|
} else {
|
|
context.commit("update_selected_methodepriority", data.records[prm.lastid])
|
|
var pat = data.records[prm.lastid]
|
|
context.commit("update_methodepriority_name", pat.M_PatientName)
|
|
context.dispatch("getschedule")
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_search_methodepriority", 3)
|
|
context.commit("update_search_error_message", e.message)
|
|
console.log(e)
|
|
}
|
|
},
|
|
async getday(context) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getday(one_token())
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_methodees", data.records.days)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getsubcategory(context) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getsubcategory(one_token())
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_subcategoryes", data.records.subcategorys)
|
|
context.commit("update_selected_subcategory", data.records.subcategorys[0])
|
|
console.log(data.records.subcategorys[0].T_SubCategoryID)
|
|
context.dispatch("getschedule",{idsubcategory:data.records.subcategorys[0].T_SubCategoryID})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async save(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", prm.Nat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data methode " + prm.M_PatientName + " sudah terupdate dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async newmethodepriority(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.newmethodepriority(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data berhasil disimpan"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async delete(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.xdelete(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", 0)
|
|
context.commit("update_dialog_confirmation_delete", false)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data methode " + prm.M_PatientName + " sudah dihapus dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_methodepriority_name", '')
|
|
context.commit("update_selected_title", {})
|
|
context.commit("update_selected_methode", {})
|
|
context.commit("update_selected_religion", {})
|
|
context.commit("update_dob", '')
|
|
context.commit("update_hp", '')
|
|
context.commit("update_phone", '')
|
|
context.commit("update_email", '')
|
|
context.commit("update_selected_kartuidentitas", {})
|
|
context.commit("update_noidentitas", '')
|
|
context.commit("update_note", '')
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async sendorder(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.sendorder(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_confirmation_send", false)
|
|
context.commit("update_last_id", prm.Nat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Permintaan nomor " + prm.T_ReceiveReferenceHeaderNumber + " sudah berhasil dikirim ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async getschedule(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getschedule(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_methodes", data.records)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async searchcompany(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
let resp = await api.searchcompany(one_token(), prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_autocomplete_status", 3)
|
|
} else {
|
|
context.commit("update_autocomplete_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_companies", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_autocomplete_status", 3)
|
|
}
|
|
},
|
|
async getmou(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getmou(one_token(), prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_get_data_status", 3)
|
|
} else {
|
|
context.commit("update_get_data_status", 2)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_mous", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async searchregtime(context,prm) {
|
|
context.commit("update_autocomplete_status",1)
|
|
try {
|
|
let resp= await api.searchregtime(one_token(), prm.tes, prm.mouid)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_autocomplete_status",3)
|
|
} else {
|
|
context.commit("update_autocomplete_status",2)
|
|
let data = {
|
|
records : resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_orderautoregtimes",resp.data.records)
|
|
}
|
|
} catch(e) {
|
|
context.commit("update_autocomplete_status",3)
|
|
}
|
|
},
|
|
async savenewmethode(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savenewmethode(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_methode", false)
|
|
context.commit("update_last_id", prm.M_MethodePriorityNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data methode " + prm.Nat_MethodeName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async saveeditmethode(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.saveeditmethode(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_methode", false)
|
|
context.commit("update_last_id", prm.M_MethodePriorityNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Simpan Data sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
context.dispatch("getschedule",{idsubcategory:prm.M_RegScheduleT_SubCategoryID})
|
|
context.commit("update_in_saving", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async deletemethode(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deletemethode(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_confirmation_delete_meth", false)
|
|
context.commit("update_last_id", prm.M_MethodePriorityNat_TestID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penghapusan data methode " + prm.T_ReceiveReferencePatientName + " dari pemeriksaan " + prm.Nat_MethodeName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
}
|
|
}
|
|
} |