Flatten nested repos

This commit is contained in:
sas.fajri
2026-04-27 10:13:31 +07:00
parent 01c2963a43
commit 8347aef8f4
17935 changed files with 5015229 additions and 3 deletions

View File

@@ -0,0 +1,103 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/listclose.js"
export default {
namespaced: true,
state: {
search_close: 0,
search_error_message: '',
start_date:moment(new Date()).format('YYYY-MM-DD'),
end_date:moment(new Date()).format('YYYY-MM-DD'),
search:'',
closes: [],
total_close: 0,
selected_close: {totalbill:0},
save_error_message: '',
statuses:[{name:'Belum Diterima',value:'N'},{name:'Sudah Diterima',value:'Y'}],
selected_status:{name:'Belum Diterima',value:'N'},
open_alert_no_pay: false,
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
current_page:1,
total_page:0
},
mutations: {
update_total_page(state, val) {
state.total_page = val
},
update_current_page(state, val) {
state.current_page = val
},
update_search_error_message(state, close) {
state.search_error_message = close
},
update_search_close(state, close) {
state.search_close = close
},
update_closes(state, data) {
state.closes = data.records
state.total_close = data.total
state.total_page = data.total
},
update_selected_close(state, val) {
state.selected_close = val
},
update_start_date(state, val) {
state.start_date = val
},
update_end_date(state, val) {
state.end_date = val
},
update_search(state, val) {
state.search = val
},
update_selected_status(state, val) {
state.selected_status = val
},
update_open_alert_no_pay(state, val) {
state.open_alert_no_pay = val
},
update_msg_alert_no_pay(state, val) {
state.msg_alert_no_pay = val
}
},
actions: {
async search(context, prm) {
context.commit("update_search_close", 1)
try {
prm.token = one_token()
let resp = await api.search(prm)
if (resp.status != "OK") {
context.commit("update_search_close", 3)
context.commit("update_search_error_message", resp.message)
} else {
context.commit("update_search_close", 2)
context.commit("update_search_error_message", "")
let data = {
records: resp.data.records,
total: resp.data.total
}
context.commit("update_closes", data)
context.commit("update_total_page", data.total)
if(prm.lastidx === 0){
context.commit("update_selected_close", data.records[0])
if(!_.isEmpty(data.records[0]))
context.commit("payment/update_notes",data.records[0].notes,{root:true})
else
context.commit("payment/update_notes",[],{root:true})
}
else{
context.commit("update_selected_close", data.records[prm.lastidx])
context.commit("payment/update_notes",data.records[prm.lastidx].notes,{root:true})
}
}
} catch (e) {
context.commit("update_search_close", 3)
context.commit("update_search_error_message", e.message)
console.log(e)
}
}
}
}

View 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 )
}
}
}
}