Initial import
This commit is contained in:
661
one-ui/masterdata/one-md-province/modules/city.js
Normal file
661
one-ui/masterdata/one-md-province/modules/city.js
Normal file
@@ -0,0 +1,661 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/city.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
citys: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_city: false,
|
||||
dialog_status_order: false,
|
||||
lookup_city: 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: {},
|
||||
citytypes: [],
|
||||
citytype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
autoprovinces:[],
|
||||
autoprovince:{},
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
total_data: 0,
|
||||
selected_city: {
|
||||
name: ""
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
update_selected_city(state, val) {
|
||||
state.selected_city = 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_autoprovinces(state,data){
|
||||
state.autoprovinces = data
|
||||
},
|
||||
update_autoprovince(state,val){
|
||||
state.autoprovince = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_citys(state, data) {
|
||||
state.citys = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_city(state, val) {
|
||||
state.dialog_form_city = val
|
||||
},
|
||||
update_lookup_city(state, val) {
|
||||
state.lookup_city = 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_citytypes(state, data) {
|
||||
state.citytypes = data
|
||||
},
|
||||
update_citytype(state, val) {
|
||||
state.citytype = 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
|
||||
}
|
||||
},
|
||||
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("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_city", false)
|
||||
var msg = "Kota " + prm.name + " provinsi " + prm.provincename + " sudah disimpan dong"
|
||||
context.commit("province/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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 lookupx(context, prm) {
|
||||
context.commit("update_lookup_city", 1)
|
||||
try {
|
||||
let resp = await api.lookupx(one_token(), prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_city", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_city", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_citys", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_city", 3)
|
||||
}
|
||||
},
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookup(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_citys", 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 lookupbyprovince(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyprovince(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_citys", 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_citys", data.records)
|
||||
console.log('status')
|
||||
console.log(data.records.statuss)
|
||||
context.commit("update_statuss", data.records.statuss)
|
||||
context.commit("update_total_data", data.total)
|
||||
var pat = data.records[0]
|
||||
if(prm.city != ""){
|
||||
context.commit("district/update_autocitys", [{
|
||||
M_CityID: pat.M_CityID,
|
||||
M_CityName: pat.M_CityName
|
||||
}], { root: true })
|
||||
context.commit("district/update_autocity", {
|
||||
M_CityID: pat.M_CityID,
|
||||
M_CityName: pat.M_CityName
|
||||
},{ root: true })
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async lookupbydistrict(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydistrict(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_citys", 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 lookupbykelurahan(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbykelurahan(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_citys", 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 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("province/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Kota " + prm.name + " dari provinsi " + prm.provincename + " sudah dihapus dong"
|
||||
context.commit("province/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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 searchprovince(context,prm) {
|
||||
context.commit("province/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
let resp= await api.searchprovince(one_token(), prm.tes)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("province/update_autocomplete_status",2,{root: true})
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_autoprovinces",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("province/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async verify(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xverify(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari province " + prm.provincename + " sudah diverifikasi"
|
||||
context.commit("province/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.provinceid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async unverify(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xunverify(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Verifikasi Agreement " + prm.name + " dari province " + prm.provincename + " sudah dibatalkan"
|
||||
context.commit("province/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.provinceid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async release(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xrelease(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari province " + prm.provincename + " sudah dirilis"
|
||||
context.commit("province/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.provinceid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async unrelease(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xunrelease(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Rilis Agreement " + prm.name + " dari province " + prm.provincename + " sudah dibatalkan"
|
||||
context.commit("province/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.provinceid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectbase(context) {
|
||||
context.commit("province/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectbase(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_bases", resp.data.records.bases)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectomzettype(context) {
|
||||
context.commit("province/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectomzettype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_omzettypes", resp.data.records.omzettypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectcitytype(context) {
|
||||
context.commit("province/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectcitytype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_citytypes", resp.data.records.citytypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectagingtype(context) {
|
||||
context.commit("province/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectagingtype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("province/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_agingtypes", resp.data.records.agingtypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("province/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("province/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
663
one-ui/masterdata/one-md-province/modules/district.js
Normal file
663
one-ui/masterdata/one-md-province/modules/district.js
Normal file
@@ -0,0 +1,663 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/district.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
districts: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_district: false,
|
||||
dialog_status_order: false,
|
||||
lookup_district: 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: {},
|
||||
districttypes: [],
|
||||
districttype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
autocitys:[],
|
||||
autocity:{},
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
total_data: 0,
|
||||
selected_district: {
|
||||
name: ""
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
update_selected_district(state, val) {
|
||||
state.selected_district = 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_autocitys(state,data){
|
||||
state.autocitys = data
|
||||
},
|
||||
update_autocity(state,val){
|
||||
state.autocity = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_districts(state, data) {
|
||||
state.districts = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_district(state, val) {
|
||||
state.dialog_form_district = val
|
||||
},
|
||||
update_lookup_district(state, val) {
|
||||
state.lookup_district = 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_districttypes(state, data) {
|
||||
state.districttypes = data
|
||||
},
|
||||
update_districttype(state, val) {
|
||||
state.districttype = 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
|
||||
}
|
||||
},
|
||||
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("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_district", false)
|
||||
var msg = "Kecamatan " + prm.name + " kota " + prm.cityname + " sudah disimpan dong"
|
||||
context.commit("city/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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 lookupx(context, prm) {
|
||||
context.commit("update_lookup_district", 1)
|
||||
try {
|
||||
let resp = await api.lookupx(one_token(), prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_district", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_district", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_districts", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_district", 3)
|
||||
}
|
||||
},
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookup(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_districts", 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 lookupbyprovince(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyprovince(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_districts", 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 lookupbycity(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbycity(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_districts", 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 lookupbykelurahan(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbykelurahan(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_districts", 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_districts", data.records)
|
||||
console.log('status')
|
||||
console.log(data.records.statuss)
|
||||
context.commit("update_statuss", data.records.statuss)
|
||||
context.commit("update_total_data", data.total)
|
||||
var pat = data.records[0]
|
||||
console.log(pat)
|
||||
if(prm.district != ""){
|
||||
context.commit("kelurahan/update_autodistricts", [{
|
||||
M_DistrictID: pat.M_DistrictID,
|
||||
M_DistrictName: pat.M_DistrictName
|
||||
}], { root: true })
|
||||
context.commit("kelurahan/update_autodistrict", {
|
||||
M_DistrictID: pat.M_DistrictID,
|
||||
M_DistrictName: pat.M_DistrictName
|
||||
},{ root: true })
|
||||
}
|
||||
|
||||
}
|
||||
} 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("city/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Kecamatan " + prm.name + " dari kota " + prm.cityname + " sudah dihapus dong"
|
||||
context.commit("city/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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 searchcity(context,prm) {
|
||||
context.commit("province/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
let resp= await api.searchcity(one_token(), prm.tes)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("province/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("province/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async verify(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xverify(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari city " + prm.cityname + " sudah diverifikasi"
|
||||
context.commit("city/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.cityid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async unverify(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xunverify(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Verifikasi Agreement " + prm.name + " dari city " + prm.cityname + " sudah dibatalkan"
|
||||
context.commit("city/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.cityid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async release(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xrelease(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari city " + prm.cityname + " sudah dirilis"
|
||||
context.commit("city/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.cityid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async unrelease(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xunrelease(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Rilis Agreement " + prm.name + " dari city " + prm.cityname + " sudah dibatalkan"
|
||||
context.commit("city/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.cityid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectbase(context) {
|
||||
context.commit("city/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectbase(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_bases", resp.data.records.bases)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectomzettype(context) {
|
||||
context.commit("city/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectomzettype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_omzettypes", resp.data.records.omzettypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectdistricttype(context) {
|
||||
context.commit("city/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectdistricttype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_districttypes", resp.data.records.districttypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectagingtype(context) {
|
||||
context.commit("city/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectagingtype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("city/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_agingtypes", resp.data.records.agingtypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("city/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("city/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
651
one-ui/masterdata/one-md-province/modules/kelurahan.js
Normal file
651
one-ui/masterdata/one-md-province/modules/kelurahan.js
Normal file
@@ -0,0 +1,651 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/kelurahan.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
kelurahans: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_kelurahan: false,
|
||||
dialog_status_order: false,
|
||||
lookup_kelurahan: 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: {},
|
||||
kelurahantypes: [],
|
||||
kelurahantype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
autodistricts:[],
|
||||
autodistrict:{},
|
||||
current_page:1,
|
||||
x_search: '',
|
||||
total_data: 0,
|
||||
selected_kelurahan: {
|
||||
name: ""
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
update_selected_kelurahan(state, val) {
|
||||
state.selected_kelurahan = 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_autodistricts(state,data){
|
||||
state.autodistricts = data
|
||||
},
|
||||
update_autodistrict(state,val){
|
||||
state.autodistrict = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_kelurahans(state, data) {
|
||||
state.kelurahans = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_kelurahan(state, val) {
|
||||
state.dialog_form_kelurahan = val
|
||||
},
|
||||
update_lookup_kelurahan(state, val) {
|
||||
state.lookup_kelurahan = 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_kelurahantypes(state, data) {
|
||||
state.kelurahantypes = data
|
||||
},
|
||||
update_kelurahantype(state, val) {
|
||||
state.kelurahantype = 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
|
||||
}
|
||||
},
|
||||
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("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_kelurahan", false)
|
||||
var msg = "Kecamatan " + prm.name + " kota " + prm.districtname + " sudah disimpan dong"
|
||||
context.commit("district/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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 lookupx(context, prm) {
|
||||
context.commit("update_lookup_kelurahan", 1)
|
||||
try {
|
||||
let resp = await api.lookupx(one_token(), prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_kelurahan", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_kelurahan", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_kelurahans", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_kelurahan", 3)
|
||||
}
|
||||
},
|
||||
async lookup(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookup(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_kelurahans", 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 lookupbydistrict(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydistrict(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_kelurahans", 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 lookupbycity(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbycity(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_kelurahans", 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 lookupbyprovince(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyprovince(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_kelurahans", 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_kelurahans", 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 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("district/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Kelurahan " + prm.name + " dari kecamatan " + prm.districtname + " sudah dihapus dong"
|
||||
context.commit("district/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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 searchdistrict(context,prm) {
|
||||
context.commit("province/update_autocomplete_status",1,{root: true})
|
||||
try {
|
||||
let resp= await api.searchdistrict(one_token(), prm.tes)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("province/update_autocomplete_status",3,{root: true})
|
||||
} else {
|
||||
context.commit("province/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("province/update_autocomplete_status",3,{root: true})
|
||||
}
|
||||
},
|
||||
async verify(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xverify(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari district " + prm.districtname + " sudah diverifikasi"
|
||||
context.commit("district/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.districtid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async unverify(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xunverify(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Verifikasi Agreement " + prm.name + " dari district " + prm.districtname + " sudah dibatalkan"
|
||||
context.commit("district/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.districtid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async release(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xrelease(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari district " + prm.districtname + " sudah dirilis"
|
||||
context.commit("district/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.districtid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async unrelease(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.xunrelease(one_token(), prm.xid)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Rilis Agreement " + prm.name + " dari district " + prm.districtname + " sudah dibatalkan"
|
||||
context.commit("district/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.districtid
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectbase(context) {
|
||||
context.commit("district/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectbase(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_bases", resp.data.records.bases)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectomzettype(context) {
|
||||
context.commit("district/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectomzettype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_omzettypes", resp.data.records.omzettypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectkelurahantype(context) {
|
||||
context.commit("district/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectkelurahantype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_kelurahantypes", resp.data.records.kelurahantypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectagingtype(context) {
|
||||
context.commit("district/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectagingtype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("district/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_agingtypes", resp.data.records.agingtypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("district/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("district/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
549
one-ui/masterdata/one-md-province/modules/province.js
Normal file
549
one-ui/masterdata/one-md-province/modules/province.js
Normal file
@@ -0,0 +1,549 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/province.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
act: 'new',
|
||||
lookup_province: 0,
|
||||
lookup_error_message: '',
|
||||
provinces: [],
|
||||
total_provinces: 0,
|
||||
total_filter_provinces: 0,
|
||||
selected_province: {
|
||||
name: ""
|
||||
},
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_province: false,
|
||||
dialog_edit_form_province: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
show_all: 'N',
|
||||
errors: [],
|
||||
provincetypes: [],
|
||||
provincetype: {},
|
||||
doctors: [],
|
||||
doctor: {},
|
||||
get_data_status: 0,
|
||||
get_data_error_message: '',
|
||||
cities: [],
|
||||
city_address: {},
|
||||
autocomplete_status: 0,
|
||||
search_status: 0,
|
||||
districts: [],
|
||||
district_address: {},
|
||||
kelurahans: [],
|
||||
kelurahan_address: {},
|
||||
instruments: [],
|
||||
instrument: {},
|
||||
autotemplates: [],
|
||||
autotemplate: {},
|
||||
nonlabs: [],
|
||||
selected_nonlab: {},
|
||||
current_page:1,
|
||||
x_search: ''
|
||||
},
|
||||
mutations: {
|
||||
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_province(state, status) {
|
||||
state.lookup_province = status
|
||||
},
|
||||
update_provinces(state, data) {
|
||||
state.provinces = data.records
|
||||
state.total_provinces = data.total
|
||||
state.total_filter_provinces = data.total_filter
|
||||
},
|
||||
update_selected_province(state, val) {
|
||||
state.selected_province = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_province(state, val) {
|
||||
state.dialog_form_province = val
|
||||
},
|
||||
update_dialog_edit_form_province(state, val) {
|
||||
state.dialog_edit_form_province = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_provincetypes(state, data) {
|
||||
state.provincetypes = data
|
||||
},
|
||||
update_provincetype(state, val) {
|
||||
state.provincetype = 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_city_address(state, val) {
|
||||
state.city_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_province", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_province", 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_provinces", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbycity(context, prm) {
|
||||
context.commit("update_lookup_province", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbycity(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_province", 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_provinces", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbydistrict(context, prm) {
|
||||
context.commit("update_lookup_province", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbydistrict(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_province", 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_provinces", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbykelurahan(context, prm) {
|
||||
context.commit("update_lookup_province", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbykelurahan(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_province", 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_provinces", data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", e.message)
|
||||
}
|
||||
},
|
||||
async lookupbyname(context, prm) {
|
||||
context.commit("update_lookup_province", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.lookupbyname(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_province", 3)
|
||||
context.commit("update_lookup_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_province", 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_provinces", data)
|
||||
var pat = data.records[0]
|
||||
if(prm.province != ""){
|
||||
context.commit("city/update_autoprovinces", [{
|
||||
M_ProvinceID: pat.M_ProvinceID,
|
||||
M_ProvinceName: pat.M_ProvinceName
|
||||
}], { root: true })
|
||||
context.commit("city/update_autoprovince", {
|
||||
M_ProvinceID: pat.M_ProvinceID,
|
||||
M_ProvinceName: pat.M_ProvinceName
|
||||
},{ root: true })
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_province", 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_province", false)
|
||||
var msg =" Provinsi " + prm.name + " sudah tersimpan dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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_province", false)
|
||||
var msg = " Provinsi " + prm.name + " sudah terupdate dong ..."
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
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.provinceid)
|
||||
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 = " Provinsi " + prm.name + " sudah dihapus dong"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.commit("update_alert_success", true)
|
||||
context.commit("update_selected_province", {})
|
||||
context.dispatch("lookupbyname", {
|
||||
province: prm.sprovince,
|
||||
city: prm.scity,
|
||||
district: prm.sdistrict,
|
||||
kelurahan: prm.skelurahan,
|
||||
current_page: 1,
|
||||
lastid: -1
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
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 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 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user