Flatten nested repos
This commit is contained in:
622
test/vuex/one-futurefix/modules/control.js
Normal file
622
test/vuex/one-futurefix/modules/control.js
Normal file
@@ -0,0 +1,622 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/control.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
act: 'new',
|
||||
lookup_control: 0,
|
||||
lookup_error_message: '',
|
||||
controls: [],
|
||||
total_controls: 0,
|
||||
total_filter_controls: 0,
|
||||
selected_control: {
|
||||
name: "Belum Pilih Instrument"
|
||||
},
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_control: false,
|
||||
dialog_edit_form_control: false,
|
||||
dialogafterfix: false,
|
||||
pesan:"",
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all: 'N',
|
||||
errors: [],
|
||||
controltypes: [],
|
||||
controltype: {},
|
||||
doctors: [],
|
||||
doctor: {},
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
cities: [],
|
||||
qc_address: {},
|
||||
autocomplete_status: 0,
|
||||
search_status: 0,
|
||||
districts: [],
|
||||
district_address: {},
|
||||
kelurahans: [],
|
||||
kelurahan_address: {},
|
||||
instruments: [],
|
||||
instrument: {},
|
||||
autotemplates: [],
|
||||
autotemplate: {},
|
||||
nonlabs: [],
|
||||
selected_nonlab: {},
|
||||
current_page:1,
|
||||
xexpdate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
levels: [],
|
||||
level: {},
|
||||
x_search: '',
|
||||
in_saving: false
|
||||
},
|
||||
mutations: {
|
||||
update_in_saving(state, val) {
|
||||
state.in_saving = val
|
||||
},
|
||||
update_dialogafterfix(state, val) {
|
||||
state.dialogafterfix = val
|
||||
},
|
||||
update_pesan(state, val) {
|
||||
state.pesan = val
|
||||
},
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_levels(state, data) {
|
||||
state.levels = data
|
||||
},
|
||||
update_level(state, val) {
|
||||
state.level = val
|
||||
},
|
||||
update_xexpdate(state,val){
|
||||
state.xexpdate = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_show_all(state, val) {
|
||||
state.show_all = val
|
||||
},
|
||||
update_lookup_error_message(state, status) {
|
||||
state.lookup_error_message = status
|
||||
},
|
||||
update_lookup_control(state, status) {
|
||||
state.lookup_control = status
|
||||
},
|
||||
update_controls(state, data) {
|
||||
state.controls = data.records
|
||||
state.total_controls = data.total
|
||||
state.total_filter_controls = data.total_filter
|
||||
},
|
||||
update_selected_control(state, val) {
|
||||
state.selected_control = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_control(state, val) {
|
||||
state.dialog_form_control = val
|
||||
},
|
||||
update_dialog_edit_form_control(state, val) {
|
||||
state.dialog_edit_form_control = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_controltypes(state, data) {
|
||||
state.controltypes = data
|
||||
},
|
||||
update_controltype(state, val) {
|
||||
state.controltype = val
|
||||
},
|
||||
update_doctors(state, data) {
|
||||
state.doctors = data
|
||||
},
|
||||
update_doctor(state, val) {
|
||||
state.doctor = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_get_data_error_message(state, val) {
|
||||
state.get_data_error_message = val
|
||||
},
|
||||
update_cities(state, val) {
|
||||
state.cities = val
|
||||
},
|
||||
update_qc_address(state, val) {
|
||||
state.qc_address = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.autocomplete_status = 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_instruments(state, data) {
|
||||
state.instruments = data
|
||||
},
|
||||
update_instrument(state, val) {
|
||||
state.instrument = val
|
||||
},
|
||||
update_autotemplates(state, data) {
|
||||
state.autotemplates = data
|
||||
},
|
||||
update_autotemplate(state, val) {
|
||||
state.autotemplate = val
|
||||
},
|
||||
update_nonlabs(state, val) {
|
||||
state.nonlabs = val
|
||||
},
|
||||
update_selected_nonlab(state, val) {
|
||||
state.selected_nonlab = val
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
actions: {
|
||||
async lookupbyid(context, prm) {
|
||||
context.commit("update_lookup_control", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyid(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_control", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_controls", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbyqc(context, prm) {
|
||||
context.commit("update_lookup_control", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyqc(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_control", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_controls", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbydistrict(context, prm) {
|
||||
context.commit("update_lookup_control", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_control", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_controls", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbykelurahan(context, prm) {
|
||||
context.commit("update_lookup_control", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbykelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_control", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_controls", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context, prm) {
|
||||
context.commit("update_lookup_control", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_control", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter
|
||||
}
|
||||
context.commit("update_controls", data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_control", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
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)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_errors", [])
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_control", false)
|
||||
var msg =" Control " + prm.name + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookupbyname", {
|
||||
control: '',
|
||||
instrument: '',
|
||||
qc: '',
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async update(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.update(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_control", false)
|
||||
var msg = " Control " + prm.name + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookupbyname", {
|
||||
control: prm.scontrol,
|
||||
instrument: prm.sinstrument,
|
||||
qc: prm.sqc,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
context.dispatch("instrument/lookupbyid", {
|
||||
id: prm.id,
|
||||
instrument: '',
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(), prm.controlid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_success", true)
|
||||
|
||||
var msg = " Control " + prm.xname + " sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_control", {})
|
||||
context.dispatch("lookupbyname", {
|
||||
control: prm.scontrol,
|
||||
instrument: prm.sinstrument,
|
||||
qc: prm.sqc,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
context.dispatch("instrument/lookupbyid", {
|
||||
id: 0,
|
||||
instrument: '',
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async fix(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.fix(one_token(), prm.id, prm.nomor)
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
|
||||
var msg = resp.data.pesan
|
||||
context.commit("update_pesan", msg)
|
||||
context.commit("update_dialogafterfix", true)
|
||||
context.commit("update_selected_control", {})
|
||||
context.dispatch("lookupbyname", {
|
||||
control: prm.scontrol,
|
||||
instrument: prm.sinstrument,
|
||||
qc: prm.sqc,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
context.commit("update_in_saving", false)
|
||||
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectlevel(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.selectlevel(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
context.commit("update_get_data_error_message", "")
|
||||
context.commit("update_levels", resp.data.records.levels)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectnonlab(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.selectnonlab(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
context.commit("update_get_data_error_message", "")
|
||||
context.commit("update_nonlabs", resp.data.records.nonlabs)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectdoctor(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.selectdoctor(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
context.commit("update_get_data_error_message", "")
|
||||
context.commit("update_doctors", resp.data.records.doctors)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchqc(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchqc(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 searchdoctor(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchdoctor(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_doctors", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchinstrument(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchinstrument(one_token(), prm.tes)
|
||||
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_instruments", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchtemplate(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchtemplate(one_token(), prm.tes)
|
||||
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_autotemplates", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_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 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
568
test/vuex/one-futurefix/modules/instrument.js
Normal file
568
test/vuex/one-futurefix/modules/instrument.js
Normal file
@@ -0,0 +1,568 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/instrument.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
instruments: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_instrument: false,
|
||||
dialog_status_order: false,
|
||||
lookup_instrument: 0,
|
||||
search_status: 0,
|
||||
errors: [],
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
bases: [],
|
||||
base: {},
|
||||
omzettypes: [],
|
||||
omzettype: {},
|
||||
instrumenttypes: [],
|
||||
instrumenttype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
autocategorys:[],
|
||||
autocategory:{},
|
||||
autocitys:[],
|
||||
autocity:{},
|
||||
autodistricts:[],
|
||||
autodistrict:{},
|
||||
autokelurahans:[],
|
||||
autokelurahan:{},
|
||||
autocompanys:[],
|
||||
autocompany:{},
|
||||
automous:[],
|
||||
automou:{},
|
||||
autodoctors:[],
|
||||
autodoctor:{},
|
||||
autocontrols:[],
|
||||
autocontrol:{},
|
||||
addressdoctors:[],
|
||||
addressdoctor:{},
|
||||
orderautoinstruments:[],
|
||||
orderautoinstrument:{},
|
||||
orderinstruments:[],
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
total_data: 0,
|
||||
selected_instrument: {
|
||||
name: "Belum Pilih Control"
|
||||
},
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
deleted_orderinstruments:[],
|
||||
no_save: 0,
|
||||
open_alert_confirmation: false,
|
||||
},
|
||||
mutations: {
|
||||
update_open_alert_confirmation(state, data) {
|
||||
state.open_alert_confirmation = data
|
||||
},
|
||||
update_no_save(state, data) {
|
||||
state.no_save = data
|
||||
},
|
||||
update_deleted_orderinstruments(state,data){
|
||||
state.deleted_orderinstruments = data
|
||||
},
|
||||
update_orderautoinstruments(state,data){
|
||||
state.orderautoinstruments = data
|
||||
},
|
||||
update_orderautoinstrument(state,val){
|
||||
state.orderautoinstrument = val
|
||||
},
|
||||
update_orderinstruments(state,data){
|
||||
state.orderinstruments = data
|
||||
},
|
||||
update_selected_instrument(state, val) {
|
||||
state.selected_instrument = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_total_data(state, val) {
|
||||
state.total_data = val
|
||||
},
|
||||
update_autocategorys(state,data){
|
||||
state.autocategorys = data
|
||||
},
|
||||
update_autocategory(state,val){
|
||||
state.autocategory = val
|
||||
},
|
||||
update_autocitys(state,data){
|
||||
state.autocitys = data
|
||||
},
|
||||
update_autocity(state,val){
|
||||
state.autocity = val
|
||||
},
|
||||
update_autocompanys(state,data){
|
||||
state.autocompanys = data
|
||||
},
|
||||
update_autocompany(state,val){
|
||||
state.autocompany = val
|
||||
},
|
||||
update_automous(state,data){
|
||||
state.automous = data
|
||||
},
|
||||
update_automou(state,val){
|
||||
state.automou = val
|
||||
},
|
||||
update_autodoctors(state,data){
|
||||
state.autodoctors = data
|
||||
},
|
||||
update_autodoctor(state,val){
|
||||
state.autodoctor = val
|
||||
},
|
||||
update_addressdoctors(state,data){
|
||||
state.addressdoctors = data
|
||||
},
|
||||
update_addressdoctor(state,val){
|
||||
state.addressdoctor = val
|
||||
},
|
||||
update_autodistricts(state,data){
|
||||
state.autodistricts = data
|
||||
},
|
||||
update_autodistrict(state,val){
|
||||
state.autodistrict = val
|
||||
},
|
||||
update_autokelurahans(state,data){
|
||||
state.autokelurahans = data
|
||||
},
|
||||
update_autokelurahan(state,val){
|
||||
state.autokelurahan = val
|
||||
},
|
||||
update_autocontrols(state,data){
|
||||
state.autocontrols = data
|
||||
},
|
||||
update_autocontrol(state,val){
|
||||
state.autocontrol = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_instruments(state, data) {
|
||||
state.instruments = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_instrument(state, val) {
|
||||
state.dialog_form_instrument = val
|
||||
},
|
||||
update_lookup_instrument(state, val) {
|
||||
state.lookup_instrument = val
|
||||
},
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_enddate(state, val) {
|
||||
state.enddate = val
|
||||
},
|
||||
update_bases(state, data) {
|
||||
state.bases = data
|
||||
},
|
||||
update_base(state, val) {
|
||||
state.base = val
|
||||
},
|
||||
update_omzettypes(state, data) {
|
||||
state.omzettypes = data
|
||||
},
|
||||
update_omzettype(state, val) {
|
||||
state.omzettype = val
|
||||
},
|
||||
update_instrumenttypes(state, data) {
|
||||
state.instrumenttypes = data
|
||||
},
|
||||
update_instrumenttype(state, val) {
|
||||
state.instrumenttype = val
|
||||
},
|
||||
update_agingtypes(state, data) {
|
||||
state.agingtypes = data
|
||||
},
|
||||
update_agingtype(state, val) {
|
||||
state.agingtype = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_statuss(state, data) {
|
||||
state.statuss = data
|
||||
},
|
||||
update_dialog_status_order(state, val) {
|
||||
state.dialog_status_order = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_get_data_error_message(state, val) {
|
||||
state.get_data_error_message = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
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)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_instrument", false)
|
||||
var msg = "Instrument " + prm.name + " sudah disimpan dong"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyid", {
|
||||
id: prm.controlid,
|
||||
instrument: prm.sinstrument,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async saveall(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveall(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_instrument", false)
|
||||
var msg = "Instrument sudah disimpan dong"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyid", {
|
||||
id: prm.controlid,
|
||||
instrument: prm.sinstrument,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
context.commit("update_no_save", 0)
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async lookupx(context, prm) {
|
||||
context.commit("update_lookup_instrument", 1)
|
||||
try {
|
||||
let resp = await api.lookupx(one_token(), prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_instrument", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_instrument", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_instruments", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_instrument", 3)
|
||||
}
|
||||
},
|
||||
async lookupbyid(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyid(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_instruments", data.records)
|
||||
console.log('status')
|
||||
console.log(data.records.statuss)
|
||||
context.commit("update_statuss", data.records.statuss)
|
||||
context.commit("update_total_data", data.total)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(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_instruments", data.records)
|
||||
console.log(data.records)
|
||||
context.commit("update_total_data", data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(), prm.controlid, prm.instrumentid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("control/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Instrument sudah dihapus dong"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyid", {
|
||||
id: prm.controlid,
|
||||
instrument: prm.sinstrument,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
context.dispatch("qc/lookupbyid", {
|
||||
instrumentid: 0,
|
||||
controlid: prm.controlid,
|
||||
px: '',
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchinstrument(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchinstrument(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_orderautoinstruments",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchcity(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchcity(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autocitys",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchdistrict(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchdistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autodistricts",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchkelurahan(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchkelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autokelurahans",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchcompany(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchcompany(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autocompanys",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchmou(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchmou(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_automous",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchdoctor(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchdoctor(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autodoctors",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async selectaddressdoctor(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.selectaddressdoctor(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
context.commit("update_get_data_error_message", "")
|
||||
context.commit("update_addressdoctors", resp.data.records.addressdoctors)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
632
test/vuex/one-futurefix/modules/qc.js
Normal file
632
test/vuex/one-futurefix/modules/qc.js
Normal file
@@ -0,0 +1,632 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/qc.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
qcs: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_qc: false,
|
||||
dialog_status_order: false,
|
||||
lookup_qc: 0,
|
||||
search_status: 0,
|
||||
errors: [],
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
bases: [],
|
||||
base: {},
|
||||
omzettypes: [],
|
||||
omzettype: {},
|
||||
qctypes: [],
|
||||
qctype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
autocategorys:[],
|
||||
autocategory:{},
|
||||
autocitys:[],
|
||||
autocity:{},
|
||||
autodistricts:[],
|
||||
autodistrict:{},
|
||||
autokelurahans:[],
|
||||
autokelurahan:{},
|
||||
autocompanys:[],
|
||||
autocompany:{},
|
||||
automous:[],
|
||||
automou:{},
|
||||
autodoctors:[],
|
||||
autodoctor:{},
|
||||
addressdoctors:[],
|
||||
addressdoctor:{},
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
total_data: 0,
|
||||
selected_qc: {
|
||||
name: ""
|
||||
},
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
orderautotests:[],
|
||||
orderautotest:{},
|
||||
ordertests:[],
|
||||
deleted_ordertests:[],
|
||||
no_save: 0,
|
||||
open_alert_confirmation: false,
|
||||
xtransaction: '',
|
||||
xref: '',
|
||||
},
|
||||
mutations: {
|
||||
update_xtransaction(state, data) {
|
||||
state.xtransaction = data
|
||||
},
|
||||
update_xref(state, data) {
|
||||
state.xref = data
|
||||
},
|
||||
update_open_alert_confirmation(state, data) {
|
||||
state.open_alert_confirmation = data
|
||||
},
|
||||
update_no_save(state, data) {
|
||||
state.no_save = data
|
||||
},
|
||||
update_deleted_ordertests(state,data){
|
||||
state.deleted_ordertests = data
|
||||
},
|
||||
update_orderautotests(state,data){
|
||||
state.orderautotests = data
|
||||
},
|
||||
update_orderautotest(state,val){
|
||||
state.orderautotest = val
|
||||
},
|
||||
update_ordertests(state,data){
|
||||
state.ordertests = data
|
||||
},
|
||||
update_selected_qc(state, val) {
|
||||
state.selected_qc = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_total_data(state, val) {
|
||||
state.total_data = val
|
||||
},
|
||||
update_autocategorys(state,data){
|
||||
state.autocategorys = data
|
||||
},
|
||||
update_autocategory(state,val){
|
||||
state.autocategory = val
|
||||
},
|
||||
update_autocitys(state,data){
|
||||
state.autocitys = data
|
||||
},
|
||||
update_autocity(state,val){
|
||||
state.autocity = val
|
||||
},
|
||||
update_autocompanys(state,data){
|
||||
state.autocompanys = data
|
||||
},
|
||||
update_autocompany(state,val){
|
||||
state.autocompany = val
|
||||
},
|
||||
update_automous(state,data){
|
||||
state.automous = data
|
||||
},
|
||||
update_automou(state,val){
|
||||
state.automou = val
|
||||
},
|
||||
update_autodoctors(state,data){
|
||||
state.autodoctors = data
|
||||
},
|
||||
update_autodoctor(state,val){
|
||||
state.autodoctor = val
|
||||
},
|
||||
update_addressdoctors(state,data){
|
||||
state.addressdoctors = data
|
||||
},
|
||||
update_addressdoctor(state,val){
|
||||
state.addressdoctor = val
|
||||
},
|
||||
update_autodistricts(state,data){
|
||||
state.autodistricts = data
|
||||
},
|
||||
update_autodistrict(state,val){
|
||||
state.autodistrict = val
|
||||
},
|
||||
update_autokelurahans(state,data){
|
||||
state.autokelurahans = data
|
||||
},
|
||||
update_autokelurahan(state,val){
|
||||
state.autokelurahan = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_qcs(state, data) {
|
||||
state.qcs = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_qc(state, val) {
|
||||
state.dialog_form_qc = val
|
||||
},
|
||||
update_lookup_qc(state, val) {
|
||||
state.lookup_qc = val
|
||||
},
|
||||
update_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_enddate(state, val) {
|
||||
state.enddate = val
|
||||
},
|
||||
update_bases(state, data) {
|
||||
state.bases = data
|
||||
},
|
||||
update_base(state, val) {
|
||||
state.base = val
|
||||
},
|
||||
update_omzettypes(state, data) {
|
||||
state.omzettypes = data
|
||||
},
|
||||
update_omzettype(state, val) {
|
||||
state.omzettype = val
|
||||
},
|
||||
update_qctypes(state, data) {
|
||||
state.qctypes = data
|
||||
},
|
||||
update_qctype(state, val) {
|
||||
state.qctype = val
|
||||
},
|
||||
update_agingtypes(state, data) {
|
||||
state.agingtypes = data
|
||||
},
|
||||
update_agingtype(state, val) {
|
||||
state.agingtype = val
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_statuss(state, data) {
|
||||
state.statuss = data
|
||||
},
|
||||
update_dialog_status_order(state, val) {
|
||||
state.dialog_status_order = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_get_data_error_message(state, val) {
|
||||
state.get_data_error_message = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
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)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_qc", false)
|
||||
var msg = "Transaksi " + prm.notransaction + " telah diproses"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_xtransaction", "")
|
||||
context.commit("update_xref", "")
|
||||
|
||||
context.dispatch("control/lookupbyname", {
|
||||
search: prm.search,
|
||||
sdate: prm.sdate,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async saveall(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveall(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_qc", false)
|
||||
var msg = "Pemeriksaan Qc sudah disimpan dong"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyid", {
|
||||
instrumentid: prm.instrumentid,
|
||||
controlid: prm.controlid,
|
||||
px: prm.sqc,
|
||||
sdate: prm.sdate,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
context.commit("update_no_save", 0)
|
||||
} else {
|
||||
context.commit("update_errors", resp.data.errors)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async lookupx(context, prm) {
|
||||
context.commit("update_lookup_qc", 1)
|
||||
try {
|
||||
let resp = await api.lookupx(one_token(), prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_qc", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_qc", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_qcs", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_qc", 3)
|
||||
}
|
||||
},
|
||||
async lookupbyid(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyid(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_qcs", data.records)
|
||||
console.log('status')
|
||||
console.log(data.records.statuss)
|
||||
context.commit("update_statuss", data.records.statuss)
|
||||
context.commit("update_total_data", data.total)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(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_qcs", data.records)
|
||||
console.log(data.records)
|
||||
context.commit("update_total_data", data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("control/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Pemeriksaan sudah dihapus dong"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyid", {
|
||||
instrumentid: prm.instrumentid,
|
||||
controlid: prm.controlid,
|
||||
px: prm.sqc,
|
||||
sdate: prm.sdate,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async activeqc(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.activeqc(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("control/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Pemeriksaan sudah dihapus dong"
|
||||
context.commit("control/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("control/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyid", {
|
||||
instrumentid: prm.instrumentid,
|
||||
controlid: prm.controlid,
|
||||
px: prm.sqc,
|
||||
sdate: prm.sdate,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchcategory(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchcategory(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autocategorys",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchtest(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchtest(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_orderautotests",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchcity(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchcity(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autocitys",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchdistrict(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchdistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autodistricts",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchkelurahan(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchkelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autokelurahans",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchcompany(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchcompany(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autocompanys",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchmou(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchmou(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_automous",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async searchdoctor(context,prm) {
|
||||
context.commit("control/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchdoctor(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("control/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autodoctors",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("control/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async selectaddressdoctor(context,prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.selectaddressdoctor(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
context.commit("update_get_data_error_message", "")
|
||||
context.commit("update_addressdoctors", resp.data.records.addressdoctors)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user