Initial import
This commit is contained in:
620
one-ui/test_x_old/vuex/one-home-service/modules/form.js
Normal file
620
one-ui/test_x_old/vuex/one-home-service/modules/form.js
Normal file
@@ -0,0 +1,620 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/form.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
form_act:'new',
|
||||
step:'order',
|
||||
btn_confirm:'hide',
|
||||
btn_order:'hide',
|
||||
do_btn_order:'hide',
|
||||
disabled_register:false,
|
||||
status_now:{id:1,code:'NEW'},
|
||||
get_data_status:0,
|
||||
get_data_error_message:'',
|
||||
save_status:0,
|
||||
save_error_message:'',
|
||||
autocomplete_status:0,
|
||||
dialog_form:false,
|
||||
dialog_ordernumber:false,
|
||||
msg_ordernumber:'',
|
||||
title_ordernumber:'',
|
||||
titles:[],
|
||||
title:{},
|
||||
patientname:'',
|
||||
dob:'',
|
||||
hp:'',
|
||||
email:'',
|
||||
phone:'',
|
||||
sexs:[],
|
||||
sex:{},
|
||||
religions:[],
|
||||
religion:{},
|
||||
cities:[],
|
||||
new_cities:[],
|
||||
city:{},
|
||||
new_city:{},
|
||||
districts:[],
|
||||
new_districts:[],
|
||||
new_district:[],
|
||||
district:{},
|
||||
kelurahans:[],
|
||||
new_kelurahans:[],
|
||||
kelurahan:{},
|
||||
new_kelurahan:{},
|
||||
address:'',
|
||||
new_address:'',
|
||||
orderid:0,
|
||||
orderpatients:[],
|
||||
orderpatient:{},
|
||||
orderadresss:[],
|
||||
orderadress:{},
|
||||
doctoradresss:[],
|
||||
doctoradress:{},
|
||||
ordertypes:[],
|
||||
ordertype:{},
|
||||
orderdate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
mindate:moment().subtract(1, 'days').toISOString(),
|
||||
ordertimes:[],
|
||||
ordertime:{},
|
||||
orderphone:'',
|
||||
orderautotests:[],
|
||||
orderautotest:{},
|
||||
ordertests:[],
|
||||
deleted_ordertests:[],
|
||||
staffs:[],
|
||||
orderstaff:{},
|
||||
orderdeliverytipes:[],
|
||||
orderdeliverytype:{},
|
||||
orderdeliveryaddress:'',
|
||||
orderpatientdeliveryaddress:{},
|
||||
orderdoctors:[],
|
||||
orderdoctor:{},
|
||||
patient_dob:'',
|
||||
ordernote:'',
|
||||
supplies_trx_id:0
|
||||
},
|
||||
mutations: {
|
||||
update_step(state,val){
|
||||
state.step = val
|
||||
},
|
||||
update_status_now(state,val){
|
||||
state.status_now = val
|
||||
},
|
||||
update_disabled_register(state,val){
|
||||
state.disabled_register = val
|
||||
},
|
||||
update_btn_confirm(state,val){
|
||||
state.btn_confirm = val
|
||||
},
|
||||
update_do_btn_order(state,val){
|
||||
state.do_btn_order = val
|
||||
},
|
||||
update_btn_order(state,val){
|
||||
state.btn_order = val
|
||||
},
|
||||
update_form_act(state,val){
|
||||
state.form_act = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_search_city(state,val){
|
||||
state.search_city = val
|
||||
},
|
||||
update_get_data_status(state,val){
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_save_status(state,val){
|
||||
state.save_status = val
|
||||
},
|
||||
update_get_data_error_message(state,val){
|
||||
state.get_data_error_message = val
|
||||
},
|
||||
update_save_error_message(state,val){
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form(state,val) {
|
||||
state.dialog_form = val
|
||||
},
|
||||
update_dialog_ordernumber(state,val) {
|
||||
state.dialog_ordernumber = val
|
||||
},
|
||||
update_msg_ordernumber(state,val) {
|
||||
state.msg_ordernumber = val
|
||||
},
|
||||
update_title_ordernumber(state,val) {
|
||||
state.title_ordernumber = val
|
||||
},
|
||||
update_titles(state,data){
|
||||
state.titles = data
|
||||
},
|
||||
update_title(state,val){
|
||||
state.title = val
|
||||
},
|
||||
update_patientname(state,val){
|
||||
state.patientname = val
|
||||
},
|
||||
update_dob(state,val){
|
||||
state.dob = val
|
||||
},
|
||||
update_hp(state,val){
|
||||
state.hp = val
|
||||
},
|
||||
update_phone(state,val){
|
||||
state.phone = val
|
||||
},
|
||||
update_email(state,val){
|
||||
state.email = val
|
||||
},
|
||||
update_sexs(state,data){
|
||||
state.sexs = data
|
||||
},
|
||||
update_sex(state,val){
|
||||
state.sex = val
|
||||
},
|
||||
update_religions(state,data){
|
||||
state.religions = data
|
||||
},
|
||||
update_religion(state,val){
|
||||
state.religion = val
|
||||
},
|
||||
update_cities(state,data){
|
||||
state.cities = data
|
||||
},
|
||||
update_new_cities(state,data){
|
||||
state.new_cities = data
|
||||
},
|
||||
update_city(state,val){
|
||||
state.city = val
|
||||
},
|
||||
update_new_city(state,val){
|
||||
state.new_city = val
|
||||
},
|
||||
update_districts(state,data){
|
||||
state.districts = data
|
||||
},
|
||||
update_new_districts(state,data){
|
||||
state.new_districts = data
|
||||
},
|
||||
update_district(state,val){
|
||||
state.district = val
|
||||
},
|
||||
update_new_district(state,val){
|
||||
state.new_district = val
|
||||
},
|
||||
update_kelurahans(state,data){
|
||||
state.kelurahans = data
|
||||
},
|
||||
update_new_kelurahans(state,data){
|
||||
state.new_kelurahans = data
|
||||
},
|
||||
update_kelurahan(state,val){
|
||||
state.kelurahan = val
|
||||
},
|
||||
update_new_kelurahan(state,val){
|
||||
state.new_kelurahan = val
|
||||
},
|
||||
update_address(state,val){
|
||||
state.address = val
|
||||
},
|
||||
update_new_address(state,val){
|
||||
state.new_address = val
|
||||
},
|
||||
update_orderid(state,val){
|
||||
state.orderid = val
|
||||
},
|
||||
update_ordernote(state,val){
|
||||
state.ordernote = val
|
||||
},
|
||||
update_orderpatients(state,data){
|
||||
state.orderpatients = data
|
||||
},
|
||||
update_orderpatient(state,val){
|
||||
state.orderpatient = val
|
||||
},
|
||||
update_orderadresss(state,data){
|
||||
state.orderadresss = data
|
||||
},
|
||||
update_orderadress(state,data){
|
||||
state.orderadress = data
|
||||
},
|
||||
update_doctoradresss(state,data){
|
||||
state.doctoradresss = data
|
||||
},
|
||||
update_doctoradress(state,data){
|
||||
state.doctoradress = data
|
||||
},
|
||||
update_ordertypes(state,data){
|
||||
state.ordertypes = data
|
||||
},
|
||||
update_ordertype(state,val){
|
||||
state.ordertype = val
|
||||
},
|
||||
update_orderdate(state,val){
|
||||
state.orderdate = val
|
||||
},
|
||||
update_ordertimes(state,data){
|
||||
state.ordertimes = data
|
||||
},
|
||||
update_ordertime(state,val){
|
||||
state.ordertime = val
|
||||
//console.log(state.ordertime)
|
||||
},
|
||||
update_orderphone(state,val){
|
||||
state.orderphone = val
|
||||
},
|
||||
update_orderautotests(state,data){
|
||||
state.orderautotests = data
|
||||
},
|
||||
update_orderautotest(state,val){
|
||||
state.orderautotest = val
|
||||
},
|
||||
update_ordertests(state,data){
|
||||
state.ordertests = data
|
||||
},
|
||||
update_deleted_ordertests(state,data){
|
||||
state.deleted_ordertests = data
|
||||
},
|
||||
update_staffs(state,data){
|
||||
state.staffs = data
|
||||
},
|
||||
update_orderstaff(state,val){
|
||||
state.orderstaff = val
|
||||
},
|
||||
update_orderdeliverytipes(state,data){
|
||||
state.orderdeliverytipes = data
|
||||
},
|
||||
update_orderdeliverytype(state,val){
|
||||
state.orderdeliverytype = val
|
||||
},
|
||||
update_orderdeliveryaddress(state,val){
|
||||
state.orderdeliveryaddress = val
|
||||
},
|
||||
update_orderpatientdeliveryaddress(state,val){
|
||||
state.orderpatientdeliveryaddress = val
|
||||
},
|
||||
update_orderdoctors(state,data){
|
||||
state.orderdoctors = data
|
||||
},
|
||||
update_orderdoctor(state,val){
|
||||
state.orderdoctor = val
|
||||
},
|
||||
update_patient_dob(state,val){
|
||||
state.patient_dob = val
|
||||
},
|
||||
update_supplies_trx_id(state,val){
|
||||
state.supplies_trx_id = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async titsexreg(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.titsexreg(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_titles", resp.data.records.titles)
|
||||
context.commit("update_sexs", resp.data.records.sexs)
|
||||
context.commit("update_religions", resp.data.records.religions)
|
||||
context.commit("update_ordertypes", resp.data.records.ordertypes)
|
||||
context.commit("update_staffs", resp.data.records.staffs)
|
||||
context.commit("update_orderdeliverytipes", resp.data.records.deliverytipes)
|
||||
context.commit("update_ordertimes", resp.data.records.times)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
context.commit("update_get_data_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
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 searchnewcity(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_new_cities",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 getnewdistrict(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_new_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)
|
||||
}
|
||||
},
|
||||
async getnewkelurahan(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_new_kelurahans",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async savenewpatient(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.savenewpatient(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
|
||||
}
|
||||
console.log(data.records[0])
|
||||
context.commit("update_title",{})
|
||||
context.commit("update_sex",{})
|
||||
context.commit("update_religion",{})
|
||||
context.commit("update_cities",[])
|
||||
context.commit("update_city",{})
|
||||
context.commit("update_districts",[])
|
||||
context.commit("update_district",{})
|
||||
context.commit("update_kelurahans",[])
|
||||
context.commit("update_kelurahan",{})
|
||||
context.commit("update_patientname","")
|
||||
context.commit("update_dob","")
|
||||
context.commit("update_hp","")
|
||||
context.commit("update_phone","")
|
||||
context.commit("update_email","")
|
||||
context.commit("update_address","")
|
||||
|
||||
context.commit("update_orderpatients",data.records)
|
||||
context.commit("update_orderpatient",data.records[0])
|
||||
context.dispatch("getaddress",data.records[0])
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async getaddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
let resp= await api.getaddress(one_token(),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_orderadresss",resp.data.records)
|
||||
context.commit("update_orderadress",resp.data.records[0])
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async getdoctoraddress(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
let resp= await api.getdoctoraddress(one_token(),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_doctoradresss",resp.data.records)
|
||||
context.commit("update_doctoradress",resp.data.records[0])
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async searchpatient(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchpatient(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_orderpatients",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async searchtest(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchtest(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_orderautotests",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_orderdoctors",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async saveorder(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.saveorder(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
|
||||
}
|
||||
|
||||
let msg = "Order dengan nomor "+data.records[0].numberx+" berhasil dibuat"
|
||||
|
||||
context.commit("update_dialog_form",false)
|
||||
context.commit("update_msg_ordernumber",msg)
|
||||
context.commit("update_title_ordernumber",'Berhasil !')
|
||||
context.commit("update_dialog_ordernumber",true)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async updateorder(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.updateorder(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
|
||||
}
|
||||
if(prm.act === 'update'){
|
||||
|
||||
let msg = 'Perubahan order '+data.records[0].numberx+' telah tersimpan'
|
||||
|
||||
context.commit("update_dialog_form",false)
|
||||
context.commit("update_title_ordernumber",'Berhasil !')
|
||||
context.commit("update_msg_ordernumber",msg)
|
||||
context.commit("update_dialog_ordernumber",true)
|
||||
|
||||
//var prm = {fdate:prm.fdate,fstatus:prm.fstatus,ftype:prm.ftype}
|
||||
}else{
|
||||
let msg = "Order dengan nomor "+data.records.numberx+" berhasil dibuat"
|
||||
context.commit("update_title_ordernumber",'Berhasil !')
|
||||
context.commit("update_msg_ordernumber",msg)
|
||||
context.commit("update_dialog_ordernumber",true)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
46
one-ui/test_x_old/vuex/one-home-service/modules/listing.js
Normal file
46
one-ui/test_x_old/vuex/one-home-service/modules/listing.js
Normal file
@@ -0,0 +1,46 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
//import * as api from "../api/schedulepromise.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
home_services: [],
|
||||
listing_status: 0,
|
||||
listing_error_message: ''
|
||||
},
|
||||
mutations: {
|
||||
update_home_service(state, data) {
|
||||
state.home_services = data
|
||||
},
|
||||
update_listing_status(state, val) {
|
||||
state.listing_status = val
|
||||
},
|
||||
update_listing_error_message(state, val) {
|
||||
state.listing_error_message = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_listing_status", 1)
|
||||
try {
|
||||
let resp = await api.lookup(prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_listing_status", 3)
|
||||
context.commit("update_listing_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_listing_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("home_services", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_listing_status", 3)
|
||||
context.commit("update_listing_error_message", resp.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
213
one-ui/test_x_old/vuex/one-home-service/modules/order.js
Normal file
213
one-ui/test_x_old/vuex/one-home-service/modules/order.js
Normal file
@@ -0,0 +1,213 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/order.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
orders: [],
|
||||
total_order:0,
|
||||
selected_order:{},
|
||||
listing_status: 0,
|
||||
listing_error_message: '',
|
||||
fdate:moment(new Date()).format('YYYY-MM-DD'),
|
||||
search_order:0,
|
||||
save_status:0,
|
||||
search_error_message:'',
|
||||
lookup_staff:0,
|
||||
lookup_staff_error_message:'',
|
||||
staffs:[],
|
||||
disabled_button :false
|
||||
},
|
||||
mutations: {
|
||||
update_disabled_button(state, data) {
|
||||
state.disabled_button = data
|
||||
},
|
||||
update_home_service(state, data) {
|
||||
state.home_services = data
|
||||
},
|
||||
update_listing_status(state, val) {
|
||||
state.listing_status = val
|
||||
},
|
||||
update_listing_error_message(state, val) {
|
||||
state.listing_error_message = val
|
||||
},
|
||||
update_fdate(state,val){
|
||||
state.fdate = val
|
||||
console.log(state.fdate)
|
||||
},
|
||||
update_search_order(state,val){
|
||||
state.search_order = val
|
||||
},
|
||||
update_search_error_message(state,val){
|
||||
state.search_error_message = val
|
||||
},
|
||||
update_orders(state,data){
|
||||
state.orders = data.records
|
||||
state.total_order = data.total
|
||||
},
|
||||
update_save_status(state,val){
|
||||
state.save_status = val
|
||||
},
|
||||
update_orders_commit(state,data){
|
||||
state.orders = data
|
||||
},
|
||||
update_lookup_staff(state,val){
|
||||
state.lookup_staff = val
|
||||
},
|
||||
update_lookup_staff_error_message(state,val){
|
||||
state.lookup_staff_error_message = val
|
||||
},
|
||||
update_staffs(state,data){
|
||||
state.staffs = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_order", 1)
|
||||
try {
|
||||
let resp = await api.search(prm.fdate, prm.fstatus, prm.ftype, one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_order", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_order", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_orders", data)
|
||||
//context.commit("update_selected_order", data.records[0])
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_order", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async lookup_staff(context, prm) {
|
||||
context.commit("update_lookup_staff", 1)
|
||||
try {
|
||||
let resp = await api.lookup_staff(prm.fdate, prm.fstatus,one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_staff", 3)
|
||||
context.commit("update_lookup_staff_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_staff", 2)
|
||||
context.commit("update_lookup_staff_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_staffs", data.records)
|
||||
//context.commit("update_selected_order", data.records[0])
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_staff", 3)
|
||||
context.commit("update_lookup_staff_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async doconfirm(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.doconfirm(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
var prm = {fdate:prm.fdate,fstatus:prm.fstatus,ftype:prm.ftype}
|
||||
//console.log(prm)
|
||||
|
||||
//context.commit("px/update_moucompany", data.records[0], { root: true })
|
||||
context.commit("form/update_ordertype",{},{ root: true })
|
||||
context.commit("form/update_orderdate","",{ root: true })
|
||||
context.commit("form/update_orderphone","",{ root: true })
|
||||
context.commit("form/update_orderpatient",{},{ root: true })
|
||||
context.commit("form/update_orderadress",{},{ root: true })
|
||||
context.commit("form/update_orderautotest",{},{ root: true })
|
||||
context.commit("form/update_ordertests",[],{ root: true })
|
||||
context.commit("form/update_orderstaff",{},{ root: true })
|
||||
context.commit("form/update_orderpatients",[],{ root: true })
|
||||
context.commit("form/update_orderadresss",[],{ root: true })
|
||||
context.commit("form/update_orderdeliverytype",{},{ root: true })
|
||||
context.commit("form/update_orderpatientdeliveryaddress",{},{ root: true })
|
||||
context.commit("form/update_btn_confirm",'hide',{ root: true })
|
||||
context.dispatch("search",prm)
|
||||
context.dispatch("lookup_staff",prm)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async doorderlab(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.doorderlab(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
|
||||
}
|
||||
|
||||
let msg = "Order dengan nomor "+data.records.numberx+" berhasil dibuat"
|
||||
// var prm = {fdate:prm.fdate,fstatus:prm.fstatus,ftype:prm.ftype}
|
||||
//console.log(prm)
|
||||
// context.commit("form/update_dialog_form",false,{ root: true })
|
||||
context.commit("form/update_title_ordernumber",'Berhasil !',{ root: true })
|
||||
context.commit("form/update_msg_ordernumber",msg,{ root: true })
|
||||
context.commit("form/update_dialog_ordernumber",true,{ root: true })
|
||||
//context.commit("px/update_moucompany", data.records[0], { root: true })
|
||||
/*context.commit("form/update_ordertype",{},{ root: true })
|
||||
context.commit("form/update_orderdate","",{ root: true })
|
||||
context.commit("form/update_orderphone","",{ root: true })
|
||||
context.commit("form/update_orderpatient",{},{ root: true })
|
||||
context.commit("form/update_orderadress",{},{ root: true })
|
||||
context.commit("form/update_orderautotest",{},{ root: true })
|
||||
context.commit("form/update_ordertests",[],{ root: true })
|
||||
context.commit("form/update_orderstaff",{},{ root: true })
|
||||
context.commit("form/update_orderpatients",[],{ root: true })
|
||||
context.commit("form/update_orderadresss",[],{ root: true })
|
||||
context.commit("form/update_orderdeliverytype",{},{ root: true })
|
||||
context.commit("form/update_orderpatientdeliveryaddress",{},{ root: true })
|
||||
context.commit("form/update_btn_confirm",'hide',{ root: true })
|
||||
context.commit("form/update_do_btn_order",'hide',{ root: true })*/
|
||||
//context.dispatch("search",prm)
|
||||
//context.dispatch("lookup_staff",prm)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async docancel(context,prm) {
|
||||
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.docancel(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
var prm = {fdate:prm.fdate,fstatus:prm.fstatus,ftype:prm.ftype}
|
||||
console.log(prm)
|
||||
context.dispatch("search",prm)
|
||||
context.dispatch("lookup_staff",prm)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
one-ui/test_x_old/vuex/one-home-service/modules/status.js
Normal file
53
one-ui/test_x_old/vuex/one-home-service/modules/status.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/status.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status:0,
|
||||
lookup_error_message:'',
|
||||
statuses: [],
|
||||
total_status: 0,
|
||||
selected_status: {"id":1,"name":"NEW","color":"secondary"}
|
||||
},
|
||||
mutations: {
|
||||
update_lookup_error_message(state,status) {
|
||||
state.search_error_message = status
|
||||
},
|
||||
update_lookup_status(state,status) {
|
||||
state.search_status = status
|
||||
},
|
||||
update_statuses(state,data) {
|
||||
state.statuses= data.records
|
||||
state.total_status= data.total
|
||||
},
|
||||
update_selected_status(state,val) {
|
||||
state.selected_status=val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_statuses",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
one-ui/test_x_old/vuex/one-home-service/modules/type.js
Normal file
55
one-ui/test_x_old/vuex/one-home-service/modules/type.js
Normal file
@@ -0,0 +1,55 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/type.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_type:0,
|
||||
lookup_error_message:'',
|
||||
types: [],
|
||||
total_type: 0,
|
||||
selected_type: {"id":1,"name":"Telepon"}
|
||||
},
|
||||
mutations: {
|
||||
update_lookup_error_message(state,type) {
|
||||
state.search_error_message = type
|
||||
},
|
||||
update_lookup_type(state,type) {
|
||||
state.search_type = type
|
||||
},
|
||||
update_types(state,data) {
|
||||
state.types= data.records
|
||||
//console.log(state.types)
|
||||
state.total_type= data.total
|
||||
},
|
||||
update_selected_type(state,val) {
|
||||
state.selected_type=val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup(context) {
|
||||
context.commit("update_lookup_type",1)
|
||||
try {
|
||||
let resp= await api.lookup()
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_type",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_type",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
//console.log(data)
|
||||
context.commit("update_types",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_type",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user