Initial import
This commit is contained in:
880
one-ui/masterdata/one-req-rerun-marketing/modules/reqrerun.js
Normal file
880
one-ui/masterdata/one-req-rerun-marketing/modules/reqrerun.js
Normal file
@@ -0,0 +1,880 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/reqrerun.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id:-1,
|
||||
last_saved_id:-1,
|
||||
x_addr_id:0,
|
||||
btn_hide:false,
|
||||
act:'edit',
|
||||
act_addr:'new',
|
||||
act_search:false,
|
||||
get_data_status:0,
|
||||
search_patient: 0,
|
||||
search_status: 0,
|
||||
search_error_message: '',
|
||||
preffix:'',
|
||||
patient_name:'',
|
||||
suffix:'',
|
||||
reqreruns: [],
|
||||
selected_patient: [],
|
||||
branchs:[],
|
||||
selected_branch:{},
|
||||
total_reqreruns:0,
|
||||
patient_address: [],
|
||||
stations:[],
|
||||
selected_station:{},
|
||||
statuses:[],
|
||||
selected_status:{},
|
||||
transaction_date:moment(new Date()).format('DD-MM-YYYY'),
|
||||
transaction_time:moment(new Date()).format("hh:mm"),
|
||||
phone:'',
|
||||
hp:'',
|
||||
email:'',
|
||||
pj:'N',
|
||||
dpj:'N',
|
||||
clinic:'N',
|
||||
is_default:'N',
|
||||
marketing_confirm:'N',
|
||||
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_delete_addr: false,
|
||||
msg_confirmation_delete_addr: "",
|
||||
autocomplete_status:0,
|
||||
dialog_form_address: false,
|
||||
label_address:'',
|
||||
addresses:[],
|
||||
cities:[],
|
||||
city_address:{},
|
||||
districts:[],
|
||||
district_address:{},
|
||||
kelurahans:[],
|
||||
kelurahan_address:{},
|
||||
description_address:'',
|
||||
errors:[],
|
||||
dialog_action:false,
|
||||
msg_action:'',
|
||||
current_page:1,
|
||||
total_page:1,
|
||||
dialog_reqrerun:false,
|
||||
requirements:[],
|
||||
selected_sample:{},
|
||||
open_dialog_info:false,
|
||||
msg_info:'',
|
||||
name:'',
|
||||
nolab:'',
|
||||
information_bahan:[],
|
||||
staff:{id:0,code:'',name:'BELUM ADA STAF',code:'',userid:''},
|
||||
bar_chx_all:false,
|
||||
indeterminatex:false,
|
||||
filter_branch:[],
|
||||
selected_filter_branch:{},
|
||||
filter_staff:[],
|
||||
selected_filter_staff:{},
|
||||
filter_type:[],
|
||||
selected_filter_type:{},
|
||||
filter_status:[],
|
||||
selected_filter_status:{},
|
||||
timererun:[],
|
||||
selected_timererun:{},
|
||||
maxtimererun:{},
|
||||
dialog_alert_verif: false,
|
||||
xdate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
xscheduledate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
startdate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
xscheduletime:'21:00',
|
||||
msgalertverif: '',
|
||||
dialog_form_reqrerun: false,
|
||||
},
|
||||
mutations: {
|
||||
update_startdate(state,val){
|
||||
state.startdate = val
|
||||
},
|
||||
update_dialog_form_reqrerun(state, val) {
|
||||
state.dialog_form_reqrerun = val
|
||||
},
|
||||
update_xdate(state,val){
|
||||
state.xdate = val
|
||||
},
|
||||
update_xscheduledate(state,val){
|
||||
state.xscheduledate = val
|
||||
},
|
||||
update_xscheduletime(state,val){
|
||||
state.xscheduletime = val
|
||||
},
|
||||
update_dialog_alert_verif(state, val) {
|
||||
state.dialog_alert_verif = val
|
||||
},
|
||||
update_msgalertverif(state, val) {
|
||||
state.msgalertverif = val
|
||||
},
|
||||
update_filter_branch(state, val) {
|
||||
state.filter_branch = val
|
||||
},
|
||||
update_selected_filter_branch(state, val) {
|
||||
console.log(val)
|
||||
state.selected_filter_branch = val
|
||||
},
|
||||
update_filter_staff(state, val) {
|
||||
state.filter_staff = val
|
||||
},
|
||||
update_selected_filter_staff(state, val) {
|
||||
console.log(val)
|
||||
state.selected_filter_staff = val
|
||||
},
|
||||
update_filter_type(state, val) {
|
||||
state.filter_type = val
|
||||
},
|
||||
update_selected_filter_type(state, val) {
|
||||
console.log(val)
|
||||
state.selected_filter_type = val
|
||||
},
|
||||
update_filter_status(state, val) {
|
||||
state.filter_status= val
|
||||
},
|
||||
update_selected_filter_status(state, val) {
|
||||
console.log(val)
|
||||
state.selected_filter_status = val
|
||||
},
|
||||
update_timererun(state, val) {
|
||||
state.timererun= val
|
||||
},
|
||||
update_selected_timererun(state, val) {
|
||||
console.log(val)
|
||||
state.selected_timererun = val
|
||||
},
|
||||
update_maxtimererun(state, val) {
|
||||
console.log(val)
|
||||
state.maxtimererun = val
|
||||
},
|
||||
update_act_search(state, val) {
|
||||
state.act_search = val
|
||||
},
|
||||
update_bar_chx_all(state, val) {
|
||||
state.bar_chx_all = val
|
||||
},
|
||||
update_indeterminatex(state, val) {
|
||||
state.indeterminatex = val
|
||||
},
|
||||
update_btn_hide(state, val) {
|
||||
state.btn_hide = val
|
||||
},
|
||||
update_staff(state, val) {
|
||||
state.staff = val
|
||||
},
|
||||
update_information_bahan(state, val) {
|
||||
state.information_bahan = val
|
||||
},
|
||||
update_name(state, val) {
|
||||
state.name = val
|
||||
},
|
||||
update_nolab(state, val) {
|
||||
state.nolab = val
|
||||
},
|
||||
update_open_dialog_info(state, val) {
|
||||
state.open_dialog_info = val
|
||||
},
|
||||
update_msg_info(state, val) {
|
||||
state.msg_info = val
|
||||
},
|
||||
update_selected_sample(state, val) {
|
||||
state.selected_sample = val
|
||||
},
|
||||
update_requirements(state, val) {
|
||||
state.requirements = val
|
||||
},
|
||||
update_dialog_reqrerun(state, val) {
|
||||
state.dialog_reqrerun = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_x_addr_id(state, val) {
|
||||
state.x_addr_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_addr(state, val) {
|
||||
state.act_addr = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_preffix(state, val) {
|
||||
state.preffix = val
|
||||
},
|
||||
update_patient_name(state, val) {
|
||||
state.patient_name = val
|
||||
},
|
||||
update_suffix(state, val) {
|
||||
state.suffix = val
|
||||
},
|
||||
update_reqreruns(state, data) {
|
||||
state.reqreruns = data
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
update_branchs(state, data) {
|
||||
state.branchs = data
|
||||
},
|
||||
update_selected_branch(state, val) {
|
||||
state.selected_branch = val
|
||||
},
|
||||
update_stations(state, val) {
|
||||
state.stations = val
|
||||
},
|
||||
update_selected_station(state, val) {
|
||||
state.selected_station = val
|
||||
},
|
||||
update_statuses(state, val) {
|
||||
state.statuses = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_phone(state, val) {
|
||||
state.phone = val
|
||||
},
|
||||
update_email(state, val) {
|
||||
state.email = val
|
||||
},
|
||||
update_hp(state, val) {
|
||||
state.hp = val
|
||||
},
|
||||
update_pj(state, val) {
|
||||
state.pj = val
|
||||
},
|
||||
update_dpj(state, val) {
|
||||
state.dpj = val
|
||||
},
|
||||
update_clinic(state, val) {
|
||||
state.clinic = val
|
||||
},
|
||||
update_marketing_confirm(state, val) {
|
||||
state.marketing_confirm = val
|
||||
},
|
||||
update_is_default(state, val) {
|
||||
state.is_default = 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_delete_addr(state, val) {
|
||||
state.dialog_confirmation_delete_addr = val
|
||||
},
|
||||
update_msg_confirmation_delete_addr(state, val) {
|
||||
state.msg_confirmation_delete_addr = val
|
||||
},
|
||||
update_addresses(state, val) {
|
||||
state.addresses = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_dialog_form_address(state, val) {
|
||||
state.dialog_form_address = val
|
||||
},
|
||||
update_label_address(state, val) {
|
||||
state.label_address = val
|
||||
},
|
||||
update_cities(state, val) {
|
||||
state.cities = val
|
||||
},
|
||||
update_city_address(state, val) {
|
||||
state.city_address = val
|
||||
},
|
||||
update_districts(state, val) {
|
||||
state.districts = val
|
||||
},
|
||||
update_district_address(state, val) {
|
||||
state.district_address = val
|
||||
},
|
||||
update_kelurahans(state, val) {
|
||||
state.kelurahans = val
|
||||
},
|
||||
update_kelurahan_address(state, val) {
|
||||
state.kelurahan_address = val
|
||||
},
|
||||
update_description_address(state, val) {
|
||||
state.description_address = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_total_reqreruns(state, val) {
|
||||
state.total_reqreruns = val
|
||||
},
|
||||
update_dialog_action(state, val) {
|
||||
state.dialog_action = val
|
||||
},
|
||||
update_msg_action(state, val) {
|
||||
state.msg_action = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
var prm = {
|
||||
nolab: context.state.nolab,
|
||||
date: context.state.startdate,
|
||||
branchid: context.state.selected_filter_branch.id,
|
||||
staffid: context.state.selected_filter_staff.id,
|
||||
typeid: context.state.selected_filter_type.id,
|
||||
statusid: context.state.selected_filter_status.id,
|
||||
lastid: -1
|
||||
}
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_selected_patient", [])
|
||||
context.commit("update_bar_chx_all",false)
|
||||
context.commit("update_indeterminatex",false)
|
||||
context.commit("update_reqreruns", data.records)
|
||||
context.commit("update_total_reqreruns", data.total)
|
||||
if(data.records.length > 0 && context.state.act_search){
|
||||
context.commit("update_bar_chx_all",true)
|
||||
context.commit("update_indeterminatex",false)
|
||||
var reqreruns = data.records
|
||||
reqreruns.forEach((el)=>{el.chex = true})
|
||||
context.commit("update_reqreruns", reqreruns)
|
||||
context.commit("update_act_search",false)
|
||||
context.commit("update_selected_patient",reqreruns)
|
||||
}
|
||||
//context.commit("update_total_page", data.total)
|
||||
context.commit("update_no_save", 0)
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getstationstatus(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getstationstatus(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_filter_branch",data.records.branchs)
|
||||
context.commit("update_selected_filter_branch",data.records.branchs[0])
|
||||
context.commit("update_filter_staff",data.records.staffs)
|
||||
context.commit("update_selected_filter_staff",data.records.staffs[0])
|
||||
context.commit("update_filter_type",data.records.types)
|
||||
context.commit("update_selected_filter_type",data.records.types[0])
|
||||
context.commit("update_filter_status",data.records.statuss)
|
||||
context.commit("update_selected_filter_status",data.records.statuss[0])
|
||||
//prm.stationid = data.records.stations[0].id
|
||||
//prm.statusid = data.records.statuses[0].id
|
||||
|
||||
prm.nolab = ''
|
||||
prm.branchid = data.records.branchs[0].id
|
||||
prm.staffid = data.records.staffs[0].id
|
||||
prm.typeid = data.records.types[0].id
|
||||
prm.statusid = data.records.statuss[0].id
|
||||
//prm.branchid = -1
|
||||
/*if(data.records.branchs.length > 0){
|
||||
var idx_branchid = _.findIndex(data.records.branchs, function(o) { return o.id === prm.branchid })
|
||||
console.log(idx_branchid)
|
||||
if(idx_branchid === -1){
|
||||
prm.branchid = data.records.branchs[0].id
|
||||
context.commit("update_selected_filter_branch",data.records.branchs[0])
|
||||
}
|
||||
else
|
||||
context.commit("update_selected_filter_branch",data.records.branchs[idx_branchid])
|
||||
}
|
||||
*/
|
||||
context.dispatch("search",prm)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async getdatetimererun(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getdatetimererun(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_timererun",data.records.datetimereruns)
|
||||
context.commit("update_selected_timererun",data.records.datetimereruns[0])
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async getmaxtimererun(context) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getmaxtimererun(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_maxtimererun",data.records.datetimereruns[0])
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async getrequirements(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getrequirements(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_requirements",data.records)
|
||||
context.commit("update_dialog_reqrerun",true)
|
||||
}
|
||||
} 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_dialog_success", true)
|
||||
var msg = "Data permintaan running ulang sudah tersimpang dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_dialog_form_reqrerun", false)
|
||||
context.dispatch("search")
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async receivesample(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.doaction(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
prm.search.lastid = -1
|
||||
context.dispatch("search",prm.search)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async saverequirement(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.saverequirement(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_reqrerun", false)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async newpatient(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.newpatient(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 dokter " + prm.M_patientName + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},async searchcity(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchcity(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_cities",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async getaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getaddress(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_addresses",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async getdistrict(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getdistrict(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_districts",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async search_staff(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.search_staff(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
|
||||
}
|
||||
if(data.records)
|
||||
context.commit("update_staff",resp.data.records)
|
||||
else{
|
||||
context.commit("update_staff",{id:0,code:'',name:'STAF TIDAK DITEMUKAN',code:'',userid:''})
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
/*async search_patient(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
prm.stationid = context.state.selected_station.id
|
||||
prm.statusid = context.state.selected_status.id
|
||||
let resp= await api.search_patient(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.rootState.px.req_status
|
||||
var rst = data.records
|
||||
if(rst){
|
||||
console.log(rst)
|
||||
context.commit("update_nolab",prm.search)
|
||||
context.commit("update_reqreruns",rst)
|
||||
context.commit("update_bar_chx_all",true)
|
||||
context.commit("update_indeterminatex",false)
|
||||
context.commit("update_selected_patient",rst)
|
||||
}
|
||||
else{
|
||||
var msg = "Naik angkot ketemu si marni, <span class='mono' style='color:red;font-weight:bold'>"+prm.search+"</span> maaf sample-nya belum sampai di sini"
|
||||
context.commit("update_msg_info",msg)
|
||||
context.commit("update_open_dialog_info",true)
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},*/
|
||||
search_patient(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
context.commit("update_act_search",true)
|
||||
//context.commit("update_get_data_status",1)
|
||||
prm.token = one_token()
|
||||
context.commit("update_nolab",prm.search)
|
||||
var serach = prm.search
|
||||
prm.stationid = context.state.selected_station.id
|
||||
//prm.statusid = context.state.selected_status.id
|
||||
prm.nolab = serach
|
||||
prm.searchx = serach
|
||||
prm.lastid = -1
|
||||
window.key_enter = ''
|
||||
|
||||
console.log(prm)
|
||||
context.dispatch("search",prm)
|
||||
},
|
||||
async getkelurahan(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
let resp= await api.getkelurahan(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_kelurahans",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async savenewaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.savenewaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_form_address",false)
|
||||
context.commit("update_last_id", prm.M_patientAddressM_patientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penambahan data alamat dokter " + prm.M_patientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async saveeditaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.saveeditaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_form_address",false)
|
||||
context.commit("update_last_id", prm.M_patientAddressM_patientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Perubahan data alamat dokter " + prm.M_patientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async deleteaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.deleteaddress(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
context.commit("update_dialog_confirmation_delete_addr",false)
|
||||
context.commit("update_last_id", prm.M_patientAddressM_patientID)
|
||||
context.commit("update_dialog_success", true)
|
||||
var msg = "Penghapusan data alamat "+prm.M_patientAddressNote+" dari dokter " + prm.M_patientName + " sudah berhasil dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async getbranchs(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getbranchs(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_branchs",data.records['branchs'])
|
||||
context.commit("update_information_bahan",data.records['information_bahan'])
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async gettypes(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.gettypes(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_types",data.records['types'])
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async doaction(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.doaction(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
var msg = resp.message
|
||||
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
|
||||
// var note = str.replace('\\n)\\n\"}"', '')
|
||||
var note = 'Error Send Data'
|
||||
console.log(note)
|
||||
context.commit("update_msgalertverif", note)
|
||||
context.commit("update_dialog_alert_verif", true)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_act",'-')
|
||||
context.commit("update_btn_hide",false)
|
||||
context.dispatch("search")
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user