Initial import
This commit is contained in:
874
one-ui/ibl/one-md-company-admin/modules/mou.js
Normal file
874
one-ui/ibl/one-md-company-admin/modules/mou.js
Normal file
@@ -0,0 +1,874 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/mou.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
mous: [],
|
||||
moureleases: [],
|
||||
save_status: 0,
|
||||
save_error_message: '',
|
||||
dialog_form_mou: false,
|
||||
dialog_status_order: false,
|
||||
lookup_mou: 0,
|
||||
search_status: 0,
|
||||
errors: [],
|
||||
startdate: moment(new Date()).format('DD-MM-YYYY'),
|
||||
enddate: moment(new Date()).format('DD-MM-YYYY'),
|
||||
bases: [],
|
||||
base: {},
|
||||
omzettypes: [],
|
||||
omzettype: {},
|
||||
billtypes: [],
|
||||
billtype: {},
|
||||
branchs: [],
|
||||
branch: {},
|
||||
moutypes: [],
|
||||
moutype: {},
|
||||
agingtypes: [],
|
||||
agingtype: {},
|
||||
statuss: [],
|
||||
jpa1_name: '',
|
||||
jpa2_name: '',
|
||||
jpa3_name: '',
|
||||
jpa4_name: '',
|
||||
jpa1_percent: 0,
|
||||
jpa2_percent: 0,
|
||||
jpa3_percent: 0,
|
||||
jpa4_percent: 0,
|
||||
dialog_alert_verif: false,
|
||||
msgalertverif: '',
|
||||
dialog_form_viewrelease: false,
|
||||
xsearch: '',
|
||||
dialog_attachment:false,
|
||||
show_progrees_upload: false,
|
||||
errors_upload:[],
|
||||
dialog_error:false,
|
||||
formData:null,
|
||||
attachment_files:null,
|
||||
urls: [],
|
||||
total_page_mou:0,
|
||||
current_page:1,
|
||||
staffs: [],
|
||||
staff: {},
|
||||
checkacuanharga: '',
|
||||
isacuanharga: false,
|
||||
dialog_acuan_harga: false
|
||||
},
|
||||
mutations: {
|
||||
update_dialog_acuan_harga(state, data) {
|
||||
state.dialog_acuan_harga = data
|
||||
},
|
||||
update_isacuanharga(state, data) {
|
||||
state.isacuanharga = data
|
||||
},
|
||||
update_checkacuanharga(state, data) {
|
||||
state.checkacuanharga = data
|
||||
},
|
||||
update_staffs(state, data) {
|
||||
state.staffs = data
|
||||
},
|
||||
update_staff(state, val) {
|
||||
state.staff = val
|
||||
},
|
||||
update_total_page_mou(state, val) {
|
||||
state.total_page_mou = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_urls(state, val) {
|
||||
state.urls = val
|
||||
},
|
||||
update_attachment_files(state, val) {
|
||||
state.attachment_files = val
|
||||
},
|
||||
update_formData(state, val) {
|
||||
state.formData = val
|
||||
},
|
||||
update_dialog_error(state, val) {
|
||||
state.dialog_error = val
|
||||
},
|
||||
update_dialog_attachment(state, val) {
|
||||
state.dialog_attachment = val
|
||||
},
|
||||
update_show_progrees_upload(state, val) {
|
||||
state.show_progrees_upload = val
|
||||
},
|
||||
update_errors_upload(state, val) {
|
||||
state.errors_upload = val
|
||||
},
|
||||
update_xsearch(state,val) {
|
||||
state.xsearch = val
|
||||
},
|
||||
update_moureleases(state, val) {
|
||||
state.moureleases = val
|
||||
},
|
||||
update_dialog_form_viewrelease(state, val) {
|
||||
state.dialog_form_viewrelease = val
|
||||
},
|
||||
update_dialog_alert_verif(state, val) {
|
||||
state.dialog_alert_verif = val
|
||||
},
|
||||
update_msgalertverif(state, val) {
|
||||
state.msgalertverif = val
|
||||
},
|
||||
update_jpa1_name(state, val) {
|
||||
state.jpa1_name = val
|
||||
},
|
||||
update_jpa2_name(state, val) {
|
||||
state.jpa2_name = val
|
||||
},
|
||||
update_jpa3_name(state, val) {
|
||||
state.jpa3_name = val
|
||||
},
|
||||
update_jpa4_name(state, val) {
|
||||
state.jpa4_name = val
|
||||
},
|
||||
update_jpa1_percent(state, val) {
|
||||
state.jpa1_percent = val
|
||||
},
|
||||
update_jpa2_percent(state, val) {
|
||||
state.jpa2_percent = val
|
||||
},
|
||||
update_jpa3_percent(state, val) {
|
||||
state.jpa3_percent = val
|
||||
},
|
||||
update_jpa4_percent(state, val) {
|
||||
state.jpa4_percent = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_mous(state, data) {
|
||||
state.mous = data
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_dialog_form_mou(state, val) {
|
||||
state.dialog_form_mou = val
|
||||
},
|
||||
update_lookup_mou(state, val) {
|
||||
state.lookup_mou = 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_billtypes(state, data) {
|
||||
state.billtypes = data
|
||||
},
|
||||
update_billtype(state, val) {
|
||||
state.billtype = val
|
||||
},
|
||||
update_branchs(state, data) {
|
||||
state.branchs = data
|
||||
},
|
||||
update_branch(state, val) {
|
||||
state.branch = val
|
||||
},
|
||||
update_moutypes(state, data) {
|
||||
state.moutypes = data
|
||||
},
|
||||
update_moutype(state, val) {
|
||||
state.moutype = 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 uploadattachment(context,prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
//prm.id = context.state.selected_fna.id
|
||||
// prm.token = one_token()
|
||||
let resp = await api.uploadattachment(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_formData", null)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_formData", null)
|
||||
context.commit("update_dialog_attachment", false)
|
||||
|
||||
context.commit("update_attachment_files", data.records)
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
|
||||
if(resp.data.errors && resp.data.errors.length > 0){
|
||||
console.log(resp.data.errors)
|
||||
context.commit("update_errors_upload", resp.data.errors)
|
||||
context.commit("update_dialog_error", true)
|
||||
} else {
|
||||
var number = prm.get('number');
|
||||
|
||||
var msg = "Upload file " + number + " berhasil"
|
||||
context.commit("company/update_msg_success", msg, { root: true })
|
||||
context.commit("company/update_alert_success", true, { root: true })
|
||||
}
|
||||
let xprm = {
|
||||
id: context.state.company.selected_company.id,
|
||||
search: context.state.search,
|
||||
current_page: context.state.current_page
|
||||
}
|
||||
context.dispatch("lookup", xprm)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_show_progrees_upload", false)
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async save(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.save(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
var msg = resp.message
|
||||
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
|
||||
var note = str.replace('\\n)\\n\"}"', '')
|
||||
console.log(note)
|
||||
context.commit("update_msgalertverif", msg)
|
||||
context.commit("update_dialog_alert_verif", true)
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_mou", false)
|
||||
var msg = "Agreement " + prm.companyname + " sudah update dong"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
} 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 saveafterrelease(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveafterrelease(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
var msg = resp.message
|
||||
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
|
||||
var note = str.replace('\\n)\\n\"}"', '')
|
||||
console.log(note)
|
||||
context.commit("update_msgalertverif", msg)
|
||||
context.commit("update_dialog_alert_verif", true)
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
} else {
|
||||
var data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
if (data.total !== -1) {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
context.commit("update_dialog_form_mou", false)
|
||||
var msg = "Agreement " + prm.companyname + " sudah update dong"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
} 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_mou", 1)
|
||||
try {
|
||||
let resp = await api.lookupx(one_token(), prm.id)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_mou", 3)
|
||||
} else {
|
||||
context.commit("update_lookup_mou", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_mous", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_lookup_mou", 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,
|
||||
total_page: resp.data.total_page
|
||||
}
|
||||
context.commit("update_mous", data.records)
|
||||
context.commit("update_total_page_mou", data.total_page)
|
||||
console.log('status')
|
||||
console.log(data.records.statuss)
|
||||
context.commit("update_statuss", data.records.statuss)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
}
|
||||
},
|
||||
async lookupreleasebyid(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
let resp = await api.lookupreleasebyid(one_token(), prm.id)
|
||||
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_moureleases", data.records)
|
||||
|
||||
}
|
||||
} 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("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari company " + prm.companyname + " sudah dihapus dong"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
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("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
var msg = resp.message
|
||||
var str = msg[1].split('[message] =>').splice(1).join('[message] =>')
|
||||
var note = str.replace('\\n)\\n\"}"', '')
|
||||
console.log(note)
|
||||
context.commit("update_msgalertverif", note)
|
||||
context.commit("update_dialog_alert_verif", true)
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
|
||||
} else {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari company " + prm.companyname + " sudah diverifikasi"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
}
|
||||
} 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("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Verifikasi Agreement " + prm.name + " dari company " + prm.companyname + " sudah dibatalkan"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
}
|
||||
} 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("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Agreement " + prm.name + " dari company " + prm.companyname + " sudah dirilis"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
}
|
||||
} 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("company/update_save_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_save_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_save_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
|
||||
//context.commit("update_dialog_form_schedule_promise", false)
|
||||
var msg = "Rilis Agreement " + prm.name + " dari company " + prm.companyname + " sudah dibatalkan"
|
||||
context.commit("company/update_msg_success", msg, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_alert_success", true, {
|
||||
root: true
|
||||
})
|
||||
context.dispatch("lookup", {
|
||||
id: prm.companyid,
|
||||
search: prm.search,
|
||||
current_page: context.state.current_page
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectbase(context) {
|
||||
context.commit("company/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectbase(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_bases", resp.data.records.bases)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectomzettype(context) {
|
||||
context.commit("company/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectomzettype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_omzettypes", resp.data.records.omzettypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectbilltype(context) {
|
||||
context.commit("company/update_get_data_status", 1, { root: true })
|
||||
try {
|
||||
let resp = await api.selectbilltype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_get_data_status", 3, { root: true })
|
||||
context.commit("company/update_get_data_error_message", resp.message, { root: true })
|
||||
} else {
|
||||
context.commit("company/update_get_data_status", 2, { root: true })
|
||||
context.commit("company/update_get_data_error_message", "", { root: true })
|
||||
context.commit("update_billtypes", resp.data.records.billtypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("company/update_get_data_status", 3, { root: true })
|
||||
context.commit("company/update_get_data_error_message", e.message, { root: true })
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getstaff(context, prm) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.getstaff(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_staffs", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async checkacuanharga(context) {
|
||||
context.commit("update_get_data_status", 1)
|
||||
try {
|
||||
let resp = await api.checkacuanharga(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status", 3)
|
||||
} else {
|
||||
context.commit("update_get_data_status", 2)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
console.log(data.records[0].x_count)
|
||||
if(parseInt(data.records[0].x_count) > 0){
|
||||
context.commit("update_dialog_acuan_harga", true)
|
||||
let note = 'Sudah ada acuan harga di ' + data.records[0].note
|
||||
context.commit("update_checkacuanharga", note)
|
||||
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_get_data_status", 3)
|
||||
}
|
||||
},
|
||||
async selectbranch(context) {
|
||||
context.commit("company/update_get_data_status", 1, { root: true })
|
||||
try {
|
||||
let resp = await api.selectbranch(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_get_data_status", 3, { root: true })
|
||||
context.commit("company/update_get_data_error_message", resp.message, { root: true })
|
||||
} else {
|
||||
context.commit("company/update_get_data_status", 2, { root: true })
|
||||
context.commit("company/update_get_data_error_message", "", { root: true })
|
||||
context.commit("update_branchs", resp.data.records.branchs)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("company/update_get_data_status", 3, { root: true })
|
||||
context.commit("company/update_get_data_error_message", e.message, { root: true })
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectmoutype(context) {
|
||||
context.commit("company/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectmoutype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_moutypes", resp.data.records.moutypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async selectagingtype(context) {
|
||||
context.commit("company/update_get_data_status", 1, {
|
||||
root: true
|
||||
})
|
||||
try {
|
||||
let resp = await api.selectagingtype(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", resp.message, {
|
||||
root: true
|
||||
})
|
||||
} else {
|
||||
context.commit("company/update_get_data_status", 2, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", "", {
|
||||
root: true
|
||||
})
|
||||
context.commit("update_agingtypes", resp.data.records.agingtypes)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("company/update_get_data_status", 3, {
|
||||
root: true
|
||||
})
|
||||
context.commit("company/update_get_data_error_message", e.message, {
|
||||
root: true
|
||||
})
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user