Flatten nested repos
This commit is contained in:
@@ -0,0 +1,786 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/deliveryorder.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
act: 'new',
|
||||
lookup_deliveryorder: 0,
|
||||
lookup_error_message: '',
|
||||
deliveryorders: [],
|
||||
total_deliveryorders: 0,
|
||||
total_filter_deliveryorders: 0,
|
||||
startdate: moment(new Date()).format('DD-MM-YYYY'),
|
||||
selected_deliveryorder: {},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_deliveryorder: false,
|
||||
dialog_edit_form_deliveryorder: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all: 'N',
|
||||
errors: [],
|
||||
deliveryordertypes: [],
|
||||
deliveryordertype: {},
|
||||
branchs: [],
|
||||
branch: {},
|
||||
destinations: [],
|
||||
destination: {},
|
||||
samples: [],
|
||||
sample: {},
|
||||
couriers: [],
|
||||
courier: {},
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
cities: [],
|
||||
deliveryorderdetail_address: {},
|
||||
autocomplete_status: 0,
|
||||
search_status: 0,
|
||||
autocitys: [],
|
||||
autocity: {},
|
||||
autodistricts: [],
|
||||
autodistrict: {},
|
||||
autokelurahans: [],
|
||||
autokelurahan: {},
|
||||
nonlabs: [],
|
||||
selected_nonlab: {},
|
||||
current_page: 1,
|
||||
x_search: '',
|
||||
isexternal: 'N',
|
||||
init_date: moment().format("Y-M-D"),
|
||||
xcek: 0
|
||||
},
|
||||
mutations: {
|
||||
update_xcek(state, val) {
|
||||
state.xcek = val
|
||||
},
|
||||
update_init_date(state, val) {
|
||||
state.init_date = val
|
||||
},
|
||||
update_isexternal(state, val) {
|
||||
state.isexternal = 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_startdate(state, val) {
|
||||
state.startdate = val
|
||||
},
|
||||
update_lookup_error_message(state, status) {
|
||||
state.lookup_error_message = status
|
||||
},
|
||||
update_lookup_deliveryorder(state, status) {
|
||||
state.lookup_deliveryorder = status
|
||||
},
|
||||
update_deliveryorders(state, data) {
|
||||
state.deliveryorders = data.records
|
||||
state.total_deliveryorders = data.total
|
||||
state.total_filter_deliveryorders = data.total_filter
|
||||
},
|
||||
update_selected_deliveryorder(state, val) {
|
||||
state.selected_deliveryorder = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_deliveryorder(state, val) {
|
||||
state.dialog_form_deliveryorder = val
|
||||
},
|
||||
update_dialog_edit_form_deliveryorder(state, val) {
|
||||
state.dialog_edit_form_deliveryorder = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_deliveryordertypes(state, data) {
|
||||
state.deliveryordertypes = data
|
||||
},
|
||||
update_deliveryordertype(state, val) {
|
||||
state.deliveryordertype = val
|
||||
},
|
||||
update_branchs(state, data) {
|
||||
state.branchs = data
|
||||
},
|
||||
update_branch(state, val) {
|
||||
state.branch = val
|
||||
},
|
||||
update_destinations(state, data) {
|
||||
state.destinations = data
|
||||
},
|
||||
update_destination(state, val) {
|
||||
state.destination = val
|
||||
},
|
||||
update_samples(state, data) {
|
||||
state.samples = data
|
||||
},
|
||||
update_sample(state, val) {
|
||||
state.sample = val
|
||||
},
|
||||
update_couriers(state, data) {
|
||||
state.couriers = data
|
||||
},
|
||||
update_courier(state, val) {
|
||||
state.courier = val
|
||||
},
|
||||
update_autocitys(state, data) {
|
||||
state.autocitys = data
|
||||
},
|
||||
update_autocity(state, val) {
|
||||
state.autocity = 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_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_deliveryorderdetail_address(state, val) {
|
||||
state.deliveryorderdetail_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 lookup(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 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_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbydeliveryorderdetail(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydeliveryorderdetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 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_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbydistrict(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 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_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbykelurahan(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbykelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 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_deliveryorders", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter,
|
||||
branchid: resp.data.branchid,
|
||||
branchname: resp.data.branchname
|
||||
}
|
||||
context.commit("update_deliveryorders", data)
|
||||
console.log(data.branchname)
|
||||
context.commit("update_branchs", [{
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
}])
|
||||
context.commit("update_branch", {
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
})
|
||||
//context.dispatch("sample/selected", null,{ root: true })
|
||||
if (prm.lastid === -1) {
|
||||
context.commit("update_selected_deliveryorder", data.records[0])
|
||||
var pat = data.records[0]
|
||||
if(data.total !== 0){
|
||||
context.dispatch("sample/selected", {
|
||||
id: pat.id
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
context.commit("update_selected_deliveryorder", data.records[prm.lastid])
|
||||
var pat = data.records[prm.lastid]
|
||||
if(data.total !== 0){
|
||||
context.dispatch("sample/selected", {
|
||||
id: pat.id
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbybarcode(context, prm) {
|
||||
context.commit("update_lookup_deliveryorder", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbybarcode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_deliveryorder", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_deliveryorder", 2)
|
||||
context.commit("update_lookup_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
total_filter: resp.data.total_filter,
|
||||
branchid: resp.data.branchid,
|
||||
branchname: resp.data.branchname
|
||||
}
|
||||
console.log(data.branchname)
|
||||
context.commit("update_branchs", [{
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
}])
|
||||
context.commit("update_branch", {
|
||||
M_BranchID: data.branchid,
|
||||
M_BranchName: data.branchname
|
||||
})
|
||||
//context.dispatch("sample/selected", null,{ root: true })
|
||||
if (prm.lastid === -1) {
|
||||
context.commit("update_selected_deliveryorder", data.records[0])
|
||||
var pat = data.records[0]
|
||||
if(data.total !== 0){
|
||||
var cek = context.state.xcek
|
||||
console.log('cek di modules')
|
||||
console.log(cek)
|
||||
if(cek === 0){
|
||||
context.dispatch("sample/selectedbybarcode", {
|
||||
id: pat.id,
|
||||
barcode: prm.search,
|
||||
detail: prm.detail
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
context.commit("update_selected_deliveryorder", data.records[prm.lastid])
|
||||
var pat = data.records[prm.lastid]
|
||||
if(data.total !== 0){
|
||||
context.dispatch("sample/selected", {
|
||||
id: pat.id,
|
||||
barcode: prm.search
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [{
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {
|
||||
M_CourierID: pat.M_CourierID,
|
||||
M_StaffName: pat.M_StaffName
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
}else{
|
||||
context.dispatch("sample/selected", {
|
||||
id: 0
|
||||
}, {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_couriers", [], {
|
||||
root: true
|
||||
})
|
||||
context.commit("sample/update_courier", {}, {
|
||||
root: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_deliveryorder", 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)
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_dialog_form_deliveryorder", false)
|
||||
var msg = " Surat Jalan sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
// context.dispatch("sample/selected", null, { 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 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_deliveryorder", false)
|
||||
var msg = " Surat Jalan sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
// context.dispatch("sample/selected", null, { root: true })
|
||||
context.dispatch("lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
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 delete(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xdelete(one_token(), prm.deliveryorderid)
|
||||
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 = " Surat Jalan sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_deliveryorder", {})
|
||||
// context.dispatch("sample/selected", null, { root: true })
|
||||
context.dispatch("lookupbyname", {
|
||||
deliveryorder: prm.sdeliveryorder,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchdeliveryorderdetail(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchdeliveryorderdetail(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 searchbranch(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchbranch(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_branchs", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchdestination(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchdestination(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_destinations", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchsample(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchsample(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_samples", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchcourier(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchcourier(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_couriers", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchcity(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchcity(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_autocitys", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchdistrict(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchdistrict(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_autodistricts", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
},
|
||||
async searchkelurahan(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchkelurahan(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_autokelurahans", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user