Flatten nested repos
This commit is contained in:
245
test/vuex/cpone-queue-ticket/modules/patient.js
Normal file
245
test/vuex/cpone-queue-ticket/modules/patient.js
Normal file
@@ -0,0 +1,245 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
startDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
endDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
loading: false,
|
||||
search: "",
|
||||
setupList: [],
|
||||
selectedSetup: {},
|
||||
orderList: [],
|
||||
url: '',
|
||||
errorMsg: '',
|
||||
snackbarSuccess: false,
|
||||
snackbarError: false,
|
||||
successMsg: '',
|
||||
total: 0,
|
||||
page: 1,
|
||||
url: "",
|
||||
dialogConfirmation: false,
|
||||
note: "",
|
||||
selectedPatient: {},
|
||||
status: [
|
||||
"Semua", 'Aktif', 'Void'
|
||||
],
|
||||
selectedStatus: 'Semua',
|
||||
type: [
|
||||
'cpone', 'log'
|
||||
],
|
||||
selectedType: 'cpone',
|
||||
tmpListData: [],
|
||||
listData: [],
|
||||
|
||||
},
|
||||
mutations: {
|
||||
update_listData(state, val) {
|
||||
state.listData = val
|
||||
},
|
||||
update_tmpListData(state, val) {
|
||||
state.tmpListData = val
|
||||
},
|
||||
update_selectedType(state, val) {
|
||||
state.selectedType = val
|
||||
},
|
||||
update_type(state, val) {
|
||||
state.type = val
|
||||
},
|
||||
update_selectedStatus(state, val) {
|
||||
state.selectedStatus = val
|
||||
},
|
||||
update_selectedPatient(state, val) {
|
||||
state.selectedPatient = val
|
||||
},
|
||||
update_dialogConfirmation(state, val) {
|
||||
state.dialogConfirmation = val
|
||||
},
|
||||
update_note(state, val) {
|
||||
state.note = val
|
||||
},
|
||||
update_url(state, val) {
|
||||
state.url = val
|
||||
},
|
||||
update_startDate(state, val) {
|
||||
state.startDate = val
|
||||
},
|
||||
update_endDate(state, val) {
|
||||
state.endDate = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_search(state, val) {
|
||||
state.search = val
|
||||
},
|
||||
update_orderList(state, val) {
|
||||
state.orderList = val
|
||||
},
|
||||
update_url(state, val) {
|
||||
state.url = val
|
||||
},
|
||||
update_setupList(state, val) {
|
||||
state.setupList = val
|
||||
},
|
||||
update_selectedSetup(state, val) {
|
||||
state.selectedSetup = val
|
||||
},
|
||||
update_errorMsg(state, val) {
|
||||
state.errorMsg = val
|
||||
},
|
||||
update_snackbarSuccess(state, val) {
|
||||
state.snackbarSuccess = val
|
||||
},
|
||||
update_snackbarError(state, val) {
|
||||
state.snackbarError = val
|
||||
},
|
||||
update_successMsg(state, val) {
|
||||
state.successMsg = val
|
||||
},
|
||||
update_total(state, val) {
|
||||
state.total = val
|
||||
},
|
||||
update_page(state, val) {
|
||||
state.page = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async getListData(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.token = one_token()
|
||||
let resp = await api.getListData(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", true)
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
context.commit("update_tmpListData", resp.data ?? [])
|
||||
context.commit("update_listData", resp.data.cpone ?? [])
|
||||
context.commit("update_selectedType", 'cpone')
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e.message)
|
||||
context.commit("update_snackbarError", true)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getsetup(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.token = one_token()
|
||||
|
||||
let resp = await api.getsetup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_setupList", resp.data.records)
|
||||
if (resp.data.records.length > 0) {
|
||||
context.commit("update_selectedSetup", resp.data.records[0])
|
||||
context.dispatch("search");
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.token = one_token()
|
||||
prm.startDate = context.state.startDate
|
||||
prm.endDate = context.state.endDate
|
||||
prm.search = context.state.search
|
||||
prm.setup = context.state.selectedSetup.Mgm_McuID
|
||||
prm.page = context.state.page
|
||||
prm.status = context.state.selectedStatus
|
||||
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", true)
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
context.commit("update_orderList", resp.data.records)
|
||||
context.commit("update_total", resp.data.total)
|
||||
context.commit("update_url", resp.data.url)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e.message)
|
||||
context.commit("update_snackbarError", true)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async voidOrder(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.token = one_token()
|
||||
prm.id = context.state.selectedPatient.orderID
|
||||
prm.reason = context.state.note
|
||||
|
||||
|
||||
let resp = await api.voidOrder(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", true)
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
await context.dispatch("search")
|
||||
context.commit("update_dialogConfirmation", false)
|
||||
context.commit("update_note", "")
|
||||
context.commit("update_successMsg", "Berhasil void order")
|
||||
context.commit("update_snackbarSuccess", true)
|
||||
context.commit("update_selectedPatient", {})
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e.message)
|
||||
context.commit("update_snackbarError", true)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
149
test/vuex/cpone-queue-ticket/modules/payment.js
Normal file
149
test/vuex/cpone-queue-ticket/modules/payment.js
Normal file
@@ -0,0 +1,149 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/payment.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status:0,
|
||||
lookup_error_message:'',
|
||||
types: [],
|
||||
total_payment:0,
|
||||
reload_after_save: false,
|
||||
dialog_pay_success:false,
|
||||
paynumber :'',
|
||||
notes :[],
|
||||
dialog_delete:false,
|
||||
msg_delete:'',
|
||||
note_delete:'',
|
||||
nota_delete:{},
|
||||
open_print_note:false,
|
||||
idx:0,
|
||||
last_payments:{}
|
||||
},
|
||||
mutations: {
|
||||
update_lookup_error_message(state,val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_lookup_status(state,status) {
|
||||
state.lookup_status = status
|
||||
},
|
||||
update_types(state,data) {
|
||||
state.types = data.records
|
||||
state.total_type = data.total
|
||||
},
|
||||
update_selected_status(state,val) {
|
||||
state.selected_status=val
|
||||
},
|
||||
update_total_payment(state,val) {
|
||||
state.total_payment=val
|
||||
},
|
||||
update_reload_after_save(state,val) {
|
||||
state.reload_after_save=val
|
||||
},
|
||||
update_dialog_pay_success(state,val) {
|
||||
state.dialog_pay_success=val
|
||||
},
|
||||
update_paynumber(state,val) {
|
||||
state.paynumber=val
|
||||
},
|
||||
update_notes(state,val) {
|
||||
state.notes=val
|
||||
},
|
||||
update_dialog_delete(state,val) {
|
||||
state.dialog_delete=val
|
||||
},
|
||||
update_note_delete(state,val) {
|
||||
state.note_delete=val
|
||||
},
|
||||
update_msg_delete(state,val) {
|
||||
state.msg_delete=val
|
||||
},
|
||||
update_nota_delete(state,val) {
|
||||
state.nota_delete=val
|
||||
},
|
||||
update_open_print_note(state,val) {
|
||||
state.open_print_note=val
|
||||
},
|
||||
update_idx(state,val) {
|
||||
state.idx=val
|
||||
},
|
||||
update_last_payments(state,val) {
|
||||
state.last_payments=val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup_type(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_type(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_types",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async pay(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.pay(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records.types,
|
||||
total: resp.data.total
|
||||
}
|
||||
let xnumber = resp.data.records.data.numberx
|
||||
let id = resp.data.records.data.idx
|
||||
context.commit("update_types",data)
|
||||
context.commit("update_last_payments",prm.payments)
|
||||
context.commit("update_idx",id)
|
||||
context.commit("update_total_payment",0)
|
||||
context.commit("update_paynumber","Pembayaran nomor <span style='color:red'>"+xnumber+"</span> telah berhasil")
|
||||
context.commit("update_dialog_pay_success",true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async delete_note(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.delete_note(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let xmsg = "Nota nomor <span style='color:red'>"+prm.nota.note_number+"</span> telah dihapus"
|
||||
context.commit("update_msg_delete",xmsg)
|
||||
context.commit("update_note_delete",'')
|
||||
context.commit("update_nota_delete",{})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
475
test/vuex/cpone-queue-ticket/modules/price.js
Normal file
475
test/vuex/cpone-queue-ticket/modules/price.js
Normal file
@@ -0,0 +1,475 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/price.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status: 0,
|
||||
searchPrice: "",
|
||||
priceHeaderList: [],
|
||||
loading: false,
|
||||
page: 1,
|
||||
totalPageHeader: 0,
|
||||
errorMsg: '',
|
||||
snackbarSuccess: false,
|
||||
snackbarError: false,
|
||||
successMsg: '',
|
||||
selectedPriceHeader: {
|
||||
"headerID": "0",
|
||||
"headerName": "",
|
||||
"headerStartDate": "",
|
||||
"headerEndDate": "",
|
||||
"headerCode": "CODE"
|
||||
},
|
||||
dialogPriceHeader: false,
|
||||
dialogDeleteHeader: false,
|
||||
startDateHeader: moment(new Date()).format('YYYY-MM-DD'),
|
||||
endDateHeader: moment(new Date()).format('YYYY-MM-DD'),
|
||||
nameHeader: "",
|
||||
filterName: "",
|
||||
filterSubGroup: [],
|
||||
filterStatus: [],
|
||||
selectedFilterSubGroup: {
|
||||
"id": "0",
|
||||
'name': 'Semua'
|
||||
},
|
||||
selectedFilterStatus: {
|
||||
"id": "A",
|
||||
'name': 'Semua'
|
||||
},
|
||||
priceTestList: [],
|
||||
priceTestPageTotal: 0,
|
||||
priceTestPage: 1,
|
||||
priceHeaderCopyList: [],
|
||||
selectedPriceHeaderCopy: {},
|
||||
dialogCopyHarga: false,
|
||||
copyPacket: false,
|
||||
dialogValidasi: false,
|
||||
},
|
||||
mutations: {
|
||||
update_lookup_status(state, val) {
|
||||
state.lookup_status = val
|
||||
},
|
||||
update_searchPrice(state, val) {
|
||||
state.searchPrice = val
|
||||
},
|
||||
update_priceHeaderList(state, val) {
|
||||
state.priceHeaderList = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_page(state, val) {
|
||||
state.page = val
|
||||
},
|
||||
update_totalPageHeader(state, val) {
|
||||
state.totalPageHeader = val
|
||||
},
|
||||
update_errorMsg(state, val) {
|
||||
state.errorMsg = val
|
||||
},
|
||||
update_snackbarSuccess(state, val) {
|
||||
state.snackbarSuccess = val
|
||||
},
|
||||
update_snackbarError(state, val) {
|
||||
state.snackbarError = val
|
||||
},
|
||||
update_successMsg(state, val) {
|
||||
state.successMsg = val
|
||||
},
|
||||
update_selectedPriceHeader(state, val) {
|
||||
state.selectedPriceHeader = val
|
||||
},
|
||||
update_dialogPriceHeader(state, val) {
|
||||
state.dialogPriceHeader = val
|
||||
},
|
||||
update_startDateHeader(state, val) {
|
||||
state.startDateHeader = val
|
||||
},
|
||||
update_endDateHeader(state, val) {
|
||||
state.endDateHeader = val
|
||||
},
|
||||
update_nameHeader(state, val) {
|
||||
state.nameHeader = val
|
||||
},
|
||||
update_dialogDeleteHeader(state, val) {
|
||||
state.dialogDeleteHeader = val
|
||||
},
|
||||
update_filterName(state, val) {
|
||||
state.filterName = val
|
||||
},
|
||||
update_filterStatus(state, val) {
|
||||
state.filterStatus = val
|
||||
},
|
||||
update_filterSubGroup(state, val) {
|
||||
state.filterSubGroup = val
|
||||
},
|
||||
update_selectedFilterStatus(state, val) {
|
||||
state.selectedFilterStatus = val
|
||||
},
|
||||
update_selectedFilterSubGroup(state, val) {
|
||||
state.selectedFilterSubGroup = val
|
||||
},
|
||||
update_priceTestList(state, val) {
|
||||
state.priceTestList = val
|
||||
},
|
||||
update_priceTestPageTotal(state, val) {
|
||||
state.priceTestPageTotal = val
|
||||
},
|
||||
update_priceTestPage(state, val) {
|
||||
state.priceTestPage = val
|
||||
},
|
||||
update_priceHeaderCopyList(state, val) {
|
||||
state.priceHeaderCopyList = val
|
||||
},
|
||||
update_selectedPriceHeaderCopy(state, val) {
|
||||
state.selectedPriceHeaderCopy = val
|
||||
},
|
||||
update_dialogCopyHarga(state, val) {
|
||||
state.dialogCopyHarga = val
|
||||
},
|
||||
update_copyPacket(state, val) {
|
||||
state.copyPacket = val
|
||||
},
|
||||
update_dialogValidasi(state, val) {
|
||||
state.dialogValidasi = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async searchPriceHeader(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
page: context.state.page,
|
||||
search: context.state.searchPrice
|
||||
}
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_priceHeaderList", resp.data.records)
|
||||
if (resp.data.records.length > 0 && context.state.selectedPriceHeader.headerID === "0") {
|
||||
context.commit("update_selectedPriceHeader", resp.data.records[0])
|
||||
context.dispatch("searchpricetest")
|
||||
// this.$store.dispatch("price/searchpricetest");
|
||||
|
||||
} else if (resp.data.records.length > 0 && context.state.selectedPriceHeader.headerID !== "0") {
|
||||
for (let i = 0; i < resp.data.records.length; i++) {
|
||||
const e = resp.data.records[i];
|
||||
if (e.headerID === context.state.selectedPriceHeader.headerID) {
|
||||
context.commit("update_selectedPriceHeader", e)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
context.commit("update_totalPageHeader", resp.data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
async insertPriceHeader(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
name: context.state.nameHeader,
|
||||
sd: context.state.startDateHeader,
|
||||
ed: context.state.endDateHeader
|
||||
}
|
||||
let resp = await api.insertheader(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", true)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_successMsg", 'Berhasil Membuat Harga ' + context.state.nameHeader)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarSuccess", true)
|
||||
context.commit("update_dialogPriceHeader", false)
|
||||
context.commit("update_nameHeader", '')
|
||||
context.dispatch("searchPriceHeader")
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", true)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async editPriceHeader(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
id: context.state.selectedPriceHeader.headerID,
|
||||
token: one_token(),
|
||||
name: context.state.nameHeader,
|
||||
sd: context.state.startDateHeader,
|
||||
ed: context.state.endDateHeader
|
||||
}
|
||||
let resp = await api.editheader(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", true)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_successMsg", 'Berhasil Edit Harga ' + context.state.nameHeader)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarSuccess", true)
|
||||
context.commit("update_dialogPriceHeader", false)
|
||||
context.commit("update_nameHeader", '')
|
||||
context.dispatch("searchPriceHeader")
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", true)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async deletePriceHeader(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
id: context.state.selectedPriceHeader.headerID,
|
||||
token: one_token(),
|
||||
}
|
||||
let resp = await api.deleteheader(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", true)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_successMsg", 'Berhasil Hapus Harga ' + context.state.nameHeader)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarSuccess", true)
|
||||
context.commit("update_dialogDeleteHeader", false)
|
||||
context.commit("update_nameHeader", '')
|
||||
context.dispatch("searchPriceHeader")
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", true)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async getpricefilter(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
}
|
||||
let resp = await api.getfilterprice(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
|
||||
context.commit("update_filterStatus", resp.data.status)
|
||||
context.commit("update_filterSubGroup", resp.data.subgroup)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async searchpricetest(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
search: context.state.filterName,
|
||||
subgroup: context.state.selectedFilterSubGroup.id,
|
||||
status: context.state.selectedFilterStatus.id,
|
||||
headerid: context.state.selectedPriceHeader.headerID,
|
||||
page: context.state.priceTestPage,
|
||||
}
|
||||
let resp = await api.searchpricetest(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_priceTestList", resp.data.records)
|
||||
context.commit("update_priceTestPageTotal", resp.data.total)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async savetest(context, prm) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
prm.token = one_token();
|
||||
prm.headerid = context.state.selectedPriceHeader.headerID
|
||||
|
||||
let resp = await api.savetest(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_snackbarError", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_successMsg", 'Berhasil simpan harga')
|
||||
context.commit("update_snackbarSuccess", false)
|
||||
context.commit("update_loading", false)
|
||||
context.dispatch("searchpricetest");
|
||||
context.dispatch("searchPriceHeader");
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async copyharga(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
headerid: context.state.selectedPriceHeaderCopy.headerID,
|
||||
name: context.state.nameHeader,
|
||||
copypacket: context.state.copyPacket
|
||||
}
|
||||
|
||||
let resp = await api.copyharga(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_successMsg", 'Berhasil copy harga')
|
||||
context.commit("update_snackbarSuccess", false)
|
||||
context.dispatch("searchPriceHeader");
|
||||
context.commit("update_dialogCopyHarga", false)
|
||||
context.commit("update_nameHeader", '')
|
||||
context.commit("update_selectedPriceHeaderCopy", {})
|
||||
context.commit("update_copyPacket", false)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async validateheader(context) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
id: context.state.selectedPriceHeader.headerID,
|
||||
}
|
||||
|
||||
let resp = await api.validateheader(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_successMsg", 'Berhasil validasi price header')
|
||||
context.commit("update_snackbarSuccess", false)
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_dialogValidasi", false)
|
||||
context.dispatch("searchPriceHeader");
|
||||
context.dispatch("searchpricetest");
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
async searchPriceHeaderAutocomplete(context, prm) {
|
||||
context.commit("update_lookup_status", 1)
|
||||
try {
|
||||
prm.token = one_token();
|
||||
prm.headerid = context.state.selectedPriceHeader.headerID
|
||||
|
||||
let resp = await api.searchpricetestautocomplete(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status", 3)
|
||||
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status", 2)
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_priceHeaderCopyList", resp.data.records)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_lookup_status", 3)
|
||||
|
||||
context.commit("update_errorMsg", e)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
352
test/vuex/cpone-queue-ticket/modules/queue.js
Normal file
352
test/vuex/cpone-queue-ticket/modules/queue.js
Normal file
@@ -0,0 +1,352 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/queue.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
screen: 'setting',
|
||||
loading: false,
|
||||
stationList: [],
|
||||
selectedStation: [],
|
||||
branchList: [],
|
||||
selectedBranch: {},
|
||||
title: '',
|
||||
errorMsg: '',
|
||||
snackbarError: false,
|
||||
queueList: [],
|
||||
setupList: [],
|
||||
selectedSetup: {},
|
||||
onSite: false,
|
||||
onSiteMcuID: [],
|
||||
statusFO: [],
|
||||
dataTicket: {},
|
||||
dataPatient: {},
|
||||
statusStation: [],
|
||||
selectedStatusStation: {},
|
||||
statusDone: 'N'
|
||||
},
|
||||
mutations: {
|
||||
update_statusDone(state, val) {
|
||||
state.statusDone = val;
|
||||
},
|
||||
update_dataPatient(state, val) {
|
||||
state.dataPatient = val;
|
||||
},
|
||||
update_selectedStatusStation(state, val) {
|
||||
state.selectedStatusStation = val;
|
||||
},
|
||||
update_statusStation(state, val) {
|
||||
state.statusStation = val;
|
||||
},
|
||||
update_statusFO(state, val) {
|
||||
state.statusFO = val;
|
||||
},
|
||||
update_dataTicket(state, val) {
|
||||
state.dataTicket = val;
|
||||
},
|
||||
update_onSiteMcuID(state, val) {
|
||||
state.onSiteMcuID = val;
|
||||
},
|
||||
update_onSite(state, val) {
|
||||
state.onSite = val;
|
||||
},
|
||||
update_setupList(state, val) {
|
||||
state.setupList = val;
|
||||
},
|
||||
update_selectedSetup(state, val) {
|
||||
state.selectedSetup = val;
|
||||
},
|
||||
update_screen(state, val) {
|
||||
state.screen = val;
|
||||
},
|
||||
update_queueList(state, val) {
|
||||
state.queueList = val;
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val;
|
||||
},
|
||||
update_stationList(state, val) {
|
||||
state.stationList = val;
|
||||
},
|
||||
update_selectedStation(state, val) {
|
||||
state.selectedStation = val;
|
||||
},
|
||||
update_branchList(state, val) {
|
||||
state.branchList = val;
|
||||
},
|
||||
update_selectedBranch(state, val) {
|
||||
state.selectedBranch = val;
|
||||
},
|
||||
update_title(state, val) {
|
||||
state.title = val;
|
||||
},
|
||||
update_errorMsg(state, val) {
|
||||
state.errorMsg = val;
|
||||
},
|
||||
update_snackbarError(state, val) {
|
||||
state.snackbarError = val;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async getStation(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
let resp = await api.getStation()
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
let dataLocal = localStorage.getItem("queue-west");
|
||||
let local = JSON.parse(dataLocal);
|
||||
if (dataLocal != null) {
|
||||
context.commit("update_title", local.title)
|
||||
context.commit("update_selectedStation", local.station)
|
||||
context.commit("update_onSite", local.onSite)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
context.commit("update_stationList", resp.data.records)
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
async getbranch(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
let resp = await api.getbranch()
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
let dataLocal = localStorage.getItem("queue-west");
|
||||
let local = JSON.parse(dataLocal);
|
||||
if (dataLocal != null) {
|
||||
|
||||
context.commit("update_selectedBranch", local.branch)
|
||||
}
|
||||
|
||||
context.commit("update_branchList", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
async getAntrian(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
;
|
||||
let selectedStation = context.state.selectedStation;
|
||||
|
||||
let arrStationID = [];
|
||||
|
||||
selectedStation.forEach(element => {
|
||||
arrStationID.push(element.stationID);
|
||||
});
|
||||
|
||||
let station = arrStationID.join(',')
|
||||
// "arrStationID": "7",
|
||||
// "branchID": "3",
|
||||
// "onSite": "Y",
|
||||
// "setupID": "201"
|
||||
let prm = {
|
||||
arrStationID: station,
|
||||
branchID: context.state.selectedBranch.M_BranchID,
|
||||
onSite: context.state.onSite ? 'Y' : 'N',
|
||||
setupID: context.state.onSite ? context.state.selectedSetup.Mgm_McuID : '0'
|
||||
};
|
||||
|
||||
|
||||
let resp = await api.getAntrian(prm)
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
console.log('Call api result')
|
||||
console.log(prm)
|
||||
context.commit("update_queueList", resp.data)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
async getTicket(context, code) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
|
||||
|
||||
|
||||
let resp = await api.getTicket(code)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
if (resp.data) {
|
||||
context.commit("update_dataTicket", resp.data)
|
||||
context.commit("update_statusFO", resp.data.statusFO)
|
||||
context.commit("update_statusStation", resp.data.statusStation)
|
||||
context.commit("update_statusDone", 'N')
|
||||
context.commit("update_selectedStatusStation", {})
|
||||
if (resp.data.statusStation.length > 0) {
|
||||
context.commit("update_dataPatient", resp.data.statusStation[0])
|
||||
let countDone = 0;
|
||||
resp.data.statusStation.forEach(element => {
|
||||
if (element.T_SamplingQueueStatusName === 'Call' ||
|
||||
element.T_SamplingQueueStatusName === 'Process'
|
||||
) {
|
||||
context.commit("update_selectedStatusStation", element)
|
||||
}
|
||||
if (element.T_SamplingQueueStatusName === 'Done') {
|
||||
countDone = countDone + 1;
|
||||
}
|
||||
});
|
||||
if (countDone === resp.data.statusStation.length) {
|
||||
context.commit("update_statusDone", 'Y')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
async getSetup(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let branchID = context.state.selectedBranch.M_BranchID;
|
||||
|
||||
let resp = await api.getSetup(branchID)
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
let dataLocal = localStorage.getItem("queue-west");
|
||||
let local = JSON.parse(dataLocal);
|
||||
context.commit("update_setupList", resp.data.records)
|
||||
if (dataLocal != null) {
|
||||
context.commit("update_selectedSetup", local.setup)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
async getsetuponsite(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
|
||||
let resp = await api.getsetuponsite()
|
||||
if (resp.status != "OK") {
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", resp.message)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
} else {
|
||||
|
||||
context.commit("update_errorMsg", '')
|
||||
context.commit("update_loading", false)
|
||||
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
let strMcuID = resp.data.records.mcuID
|
||||
|
||||
let arrMcuID = strMcuID.split(',')
|
||||
context.commit("update_onSiteMcuID", arrMcuID)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_errorMsg", e)
|
||||
context.commit("update_snackbarError", false)
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user