add modules folder based on s_menu
This commit is contained in:
229
test/vuex/acc-one-presentase-fa-cabang/api/api-presentase.js
Normal file
229
test/vuex/acc-one-presentase-fa-cabang/api/api-presentase.js
Normal file
@@ -0,0 +1,229 @@
|
||||
const URL = "/one-api/mockup/masterdata/accounting/";
|
||||
|
||||
export async function get_listing_type(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/listpresentasecabang', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_list_detail_type(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/detailpresentasecabang', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function insert_type_presentase(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/inserttypepresentase', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function edit_type_presentase(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/edittypepresentase', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function delete_type_presentase(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/deletetypepresentase', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_list_regional(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/getlistregional', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_regional_branch(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/getregionalbranch', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function insert_detail_precab(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/insertdetailprecab', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_current_value_detail(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/getvaluedetailprecab', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function edit_detail_precab(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/editdetailprecab', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function delete_detail_precab(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/deletedetailprecab', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function search_coa(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'presentasefacabang/searchcoa', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-card>
|
||||
<v-layout row wrap class="pa-2">
|
||||
<v-flex xs12 class="text-xs-right">
|
||||
<v-btn flat icon color="primary" @click="openAddPresentase()" :disabled="Object.keys(selected_precab).length === 0">
|
||||
<v-icon medium>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-divider></v-divider>
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="detail_headers"
|
||||
:loading="loading_detail"
|
||||
:items="tabel_detail.records"
|
||||
class="elevation-1"
|
||||
hide-actions
|
||||
xs12
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td>{{ props.index + 1 }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.S_RegionalName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.DetailCabang }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon
|
||||
small
|
||||
class="mr-2"
|
||||
@click="openEditPresentase(props.item)"
|
||||
>edit</v-icon>
|
||||
<v-icon
|
||||
small
|
||||
@click="openDelPresentase(props.item)"
|
||||
>delete</v-icon>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="text-xs-center pt-2">
|
||||
<v-pagination v-model="pagination_detail" :length="det_pages" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-dialog persistent width="500" v-model="dialogFormDet">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
{{ crud_state == "delete" ? 'DELETE DETAIL PRESENTASE CABANG' : 'FORM PRESENTASE CABANG'}}
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-subheader v-if="crud_state == 'delete'">Apa anda yakin akan menghapus detail presentase cabang berikut: </v-subheader>
|
||||
<v-autocomplete
|
||||
outline
|
||||
v-model="selected_input_reg"
|
||||
:items="regional_list.records"
|
||||
label="Regional"
|
||||
item-text="S_RegionalName"
|
||||
return-object
|
||||
:disabled="crud_state != 'add'"
|
||||
@input="changeRegional"
|
||||
></v-autocomplete>
|
||||
<v-layout row wrap v-for="item in regional_branches.records" :key="item.M_BranchID">
|
||||
<v-flex xs6 pr-1>
|
||||
<v-text-field
|
||||
:label="item.M_BranchName"
|
||||
outline
|
||||
suffix="%"
|
||||
type="number"
|
||||
v-model.number="item.branchValue"
|
||||
:disabled="crud_state == 'delete'"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 pl-1>
|
||||
<v-autocomplete
|
||||
outline
|
||||
v-model="item.accountNumber"
|
||||
:items="item.listCoa"
|
||||
label="Account Number"
|
||||
item-text="display"
|
||||
item-value="number"
|
||||
no-filter
|
||||
:search-input.sync="selected_coa[item.M_BranchCode]"
|
||||
:disabled="crud_state == 'delete'"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="error"
|
||||
flat
|
||||
@click="dialogFormDet = false"
|
||||
>Batal</v-btn>
|
||||
<v-btn
|
||||
color="primary"
|
||||
@click="crudDetail()"
|
||||
>{{ crud_state == "delete" ? "Yakin" : "Simpan" }}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detail_headers: [
|
||||
{
|
||||
text: "NO",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "REGIONAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "type",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "PRESENTASE",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "type",
|
||||
width: "50%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "type",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
}
|
||||
],
|
||||
crud_state: "add",
|
||||
delete_ids: "",
|
||||
check_msg: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
tabel_detail() {
|
||||
return this.$store.state.presentase.tabel_detail;
|
||||
},
|
||||
loading_detail() {
|
||||
return this.$store.state.presentase.loading_detail;
|
||||
},
|
||||
selected_precab() {
|
||||
return this.$store.state.presentase.selected_precab;
|
||||
},
|
||||
list_coa() {
|
||||
return this.$store.state.presentase.list_coa;
|
||||
},
|
||||
pagination_detail: {
|
||||
get() {
|
||||
return this.$store.state.presentase.pagination_detail
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_pagination_detail", data)
|
||||
this.$store.dispatch("presentase/get_listing_reg", {currpages: data, presentasecabangid: this.selected_precab.BranchFaPercentID})
|
||||
}
|
||||
},
|
||||
det_pages() {
|
||||
let total_data = this.tabel_detail.total;
|
||||
if (total_data == undefined) {
|
||||
return 1
|
||||
}
|
||||
|
||||
return Math.ceil(total_data / 10);
|
||||
},
|
||||
selected_coa: {
|
||||
get() {
|
||||
return this.$store.state.presentase.selected_coa
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_selected_coa", data)
|
||||
}
|
||||
},
|
||||
dialogFormDet: {
|
||||
get() {
|
||||
return this.$store.state.presentase.dialogFormDet
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_dialog_form_det", data)
|
||||
}
|
||||
},
|
||||
regional_list: {
|
||||
get() {
|
||||
return this.$store.state.presentase.list_regional
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_list_regional", data)
|
||||
}
|
||||
},
|
||||
selected_input_reg: {
|
||||
get() {
|
||||
return this.$store.state.presentase.selected_input_reg
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_selected_input_reg", data)
|
||||
}
|
||||
},
|
||||
regional_branches: {
|
||||
get() {
|
||||
return this.$store.state.presentase.regional_branches
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_regional_branches", data)
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.presentase.snackbar
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_snackbar", data)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openAddPresentase() {
|
||||
this.selected_input_reg = {};
|
||||
this.regional_branches = {};
|
||||
this.selected_coa = {};
|
||||
this.crud_state = "add";
|
||||
this.$store.dispatch("presentase/get_regional_input");
|
||||
this.dialogFormDet = true;
|
||||
},
|
||||
async openEditPresentase(data) {
|
||||
console.log('data',data)
|
||||
this.crud_state = "edit";
|
||||
|
||||
this.selected_coa = {};
|
||||
// this.$store.commit("presentase/update_selected_coa", data)
|
||||
this.selected_input_reg = { S_RegionalID: data.S_RegionalID, S_RegionalName: data.S_RegionalName }
|
||||
await this.$store.dispatch("presentase/get_current_value_detail", { regionalid: data.S_RegionalID, branchpercentid: this.selected_precab.BranchFaPercentID })
|
||||
let sel = {
|
||||
records: [{ S_RegionalID: data.S_RegionalID, S_RegionalName: data.S_RegionalName }],
|
||||
total: 1
|
||||
}
|
||||
this.regional_list = sel
|
||||
|
||||
this.setCoaStates("edit")
|
||||
this.setupCoaWatcher()
|
||||
|
||||
this.dialogFormDet = true
|
||||
},
|
||||
async openDelPresentase(data) {
|
||||
this.crud_state = "delete";
|
||||
|
||||
this.selected_coa = {};
|
||||
this.selected_input_reg = { S_RegionalID: data.S_RegionalID, S_RegionalName: data.S_RegionalName }
|
||||
await this.$store.dispatch("presentase/get_current_value_detail", { regionalid: data.S_RegionalID, branchpercentid: this.selected_precab.BranchFaPercentID })
|
||||
let sel = {
|
||||
records: [{ S_RegionalID: data.S_RegionalID, S_RegionalName: data.S_RegionalName }],
|
||||
total: 1
|
||||
}
|
||||
this.regional_list = sel
|
||||
this.delete_ids = data.ListBranchFaPercentDetailID
|
||||
|
||||
this.setCoaStates("delete")
|
||||
this.setupCoaWatcher()
|
||||
|
||||
this.dialogFormDet = true;
|
||||
},
|
||||
async changeRegional(selectedItem) {
|
||||
this.selected_coa = {};
|
||||
let params = {
|
||||
regionalid: selectedItem.S_RegionalID
|
||||
}
|
||||
await this.$store.dispatch("presentase/get_regional_branches", params)
|
||||
// this.$store.dispatch("presentase/get_list_coa", { keyword: "" })
|
||||
this.setCoaStates("")
|
||||
this.setupCoaWatcher()
|
||||
},
|
||||
crudDetail() {
|
||||
if (this.loading_api) {
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "warning",
|
||||
msg: "Loading proses lain ...."
|
||||
};
|
||||
this.snackbar = snac;
|
||||
return;
|
||||
}
|
||||
|
||||
if (! this.checkTotal()) {
|
||||
console.log("msg", this.check_msg)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "warning",
|
||||
msg: this.check_msg
|
||||
};
|
||||
this.snackbar = snac;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.crud_state == "add") {
|
||||
console.log('add')
|
||||
this.$store.dispatch("presentase/insert_detail_precab");
|
||||
} else if (this.crud_state == "edit") {
|
||||
this.$store.dispatch("presentase/edit_detail_precab");
|
||||
} else if (this.crud_state == "delete") {
|
||||
let del_id = this.delete_ids
|
||||
console.log("delete_id", del_id)
|
||||
this.$store.dispatch("presentase/delete_detail_precab", { precabdetailid: del_id });
|
||||
}
|
||||
},
|
||||
setCoaStates(data) {
|
||||
// if (Object.keys(this.regional_branches).length == 0) return;
|
||||
let regional = this.regional_branches.records
|
||||
regional.forEach( item => {
|
||||
// console.log("created: ", item.M_BranchCode)
|
||||
this.$set(this.selected_coa, item.M_BranchCode, "")
|
||||
})
|
||||
|
||||
if (data == "edit" || data == "delete") {
|
||||
regional.forEach( item => {
|
||||
this.$store.dispatch("presentase/get_list_coa", {keyword: "", code: item.M_BranchCode});
|
||||
})
|
||||
}
|
||||
},
|
||||
setupCoaWatcher() {
|
||||
// if (Object.keys(this.regional_branches).length == 0) return;
|
||||
// let regional = this.regional_branches.records
|
||||
// regional.forEach(item => {
|
||||
// this.$watch(() => this.selected_coa[item.M_BranchCode], _.debounce((newVal, oldVal) => {
|
||||
// console.log("val", newVal)
|
||||
// if (newVal == oldVal) return;
|
||||
// if (!newVal) return;
|
||||
// if (newVal.length < 1) return;
|
||||
// this.$store.dispatch("presentase/get_list_coa", {keyword: newVal, code: item.M_BranchCode});
|
||||
// }, 1000), {deep: true, immediate: true})
|
||||
// })
|
||||
let regional = this.regional_branches.records
|
||||
regional.forEach(item => {
|
||||
this.$watch(
|
||||
() => this.selected_coa[item.M_BranchCode],
|
||||
_.debounce((newVal, oldVal) => {
|
||||
// Gunakan item.accountNumber atau item.listCoa[0].number sebagai default keyword
|
||||
const defaultKeyword = item.accountNumber || (item.listCoa[0] ? item.listCoa[0].number : '')
|
||||
|
||||
const keyword = newVal || defaultKeyword
|
||||
|
||||
// console.log("val", keyword)
|
||||
|
||||
if (!keyword || keyword.length < 1) return;
|
||||
|
||||
this.$store.dispatch("presentase/get_list_coa", {
|
||||
keyword: keyword,
|
||||
code: item.M_BranchCode
|
||||
});
|
||||
}, 1000),
|
||||
{deep: true, immediate: true}
|
||||
)
|
||||
})
|
||||
},
|
||||
checkTotal() {
|
||||
let total = 0
|
||||
let acc_msg = 0
|
||||
let regional = this.regional_branches.records
|
||||
regional.forEach( item => {
|
||||
if (item.branchValue != '') {
|
||||
total += item.branchValue
|
||||
}
|
||||
|
||||
if (item.accountNumber == '') {
|
||||
acc_msg = 1
|
||||
}
|
||||
});
|
||||
|
||||
let totall= 0
|
||||
totall = Math.round(total)
|
||||
|
||||
if (totall > 100) {
|
||||
this.check_msg = "Total presentase cabang lebih dari 100%"
|
||||
return false
|
||||
}
|
||||
|
||||
if (acc_msg > 0) {
|
||||
this.check_msg = "Nomor akun belum terisi"
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<v-snackbar v-model="snackbar.isOpen" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="snackbar.color">
|
||||
{{ snackbar.msg }}
|
||||
<v-btn flat @click="closeSnackbar(false)">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
<v-card>
|
||||
<v-layout row wrap class="pa-2">
|
||||
<v-flex xs12 class="text-xs-right pr-0">
|
||||
<v-btn flat icon color="primary" @click="openDialogAdd()">
|
||||
<v-icon medium>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-divider></v-divider>
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="headers_precab"
|
||||
:loading="loading_precab"
|
||||
:items="tabel_precab.records"
|
||||
class="elevation-1"
|
||||
hide-actions
|
||||
xs12
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr @click="selectPrecab(props.item)" :class="{'yellow lighten-4':isTypeSelected(props.item.BranchFaPercentID)}">
|
||||
<td>{{ props.index + 1 }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.BranchFaPercentType }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon
|
||||
small
|
||||
class="mr-2"
|
||||
@click="openDialogEdit(props.item)"
|
||||
>edit</v-icon>
|
||||
<v-icon
|
||||
small
|
||||
@click="openDialogDel(props.item)"
|
||||
>delete</v-icon>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="text-xs-center pt-2">
|
||||
<v-pagination v-model="pagination_precab" :length="pages" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-dialog persistent width="500" v-model="dialogFormType">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
{{ simpan_state == "delete" ? "DELETE TIPE" : "FORM TIPE"}}
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-subheader v-if="simpan_state == 'delete'">Apa anda yakin akan menghapus tipe berikut: </v-subheader>
|
||||
<v-text-field
|
||||
v-model="input_precab.typename"
|
||||
label="Nama Tipe"
|
||||
outline
|
||||
:disabled="simpan_state == 'delete'"
|
||||
></v-text-field>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="error"
|
||||
flat
|
||||
@click="dialogFormType = false"
|
||||
>Batal</v-btn>
|
||||
<v-btn
|
||||
color="primary"
|
||||
@click="crudType()"
|
||||
:disabled="input_precab.typename == ''"
|
||||
>{{ simpan_state == "delete" ? "Yakin" : "Simpan"}}</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("presentase/get_listing_type", {currpages: 1})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers_precab: [
|
||||
{
|
||||
text: "NO",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TIPE",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "type",
|
||||
width: "60%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "aksi",
|
||||
width: "30%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
simpan_state: 'add'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
loading_api() {
|
||||
return this.$store.state.presentase.loading_api;
|
||||
},
|
||||
tabel_precab() {
|
||||
return this.$store.state.presentase.tabel_precab;
|
||||
},
|
||||
loading_precab() {
|
||||
return this.$store.state.presentase.loading_precab;
|
||||
},
|
||||
selected_precab: {
|
||||
get() {
|
||||
return this.$store.state.presentase.selected_precab;
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_selected_precab", data)
|
||||
}
|
||||
},
|
||||
pages() {
|
||||
let total_data = this.tabel_precab.total;
|
||||
if (total_data == undefined) {
|
||||
return 1
|
||||
}
|
||||
|
||||
return Math.ceil(total_data / 10);
|
||||
},
|
||||
pagination_precab: {
|
||||
get() {
|
||||
return this.$store.state.presentase.pagination_precab
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_pagination_precab", data)
|
||||
this.$store.dispatch("presentase/get_listing_type", {currpages: data})
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.presentase.snackbar
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_snackbar", data)
|
||||
}
|
||||
},
|
||||
input_precab: {
|
||||
get() {
|
||||
return this.$store.state.presentase.input_precab
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_input_precab", data)
|
||||
}
|
||||
},
|
||||
dialogFormType: {
|
||||
get() {
|
||||
return this.$store.state.presentase.dialogFormType
|
||||
},
|
||||
set(data) {
|
||||
this.$store.commit("presentase/update_dialog_form", data)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openDialogAdd() {
|
||||
this.input_precab = {typeid: 0, typename: ''};
|
||||
this.simpan_state = "add";
|
||||
this.dialogFormType = true;
|
||||
},
|
||||
openDialogEdit(data) {
|
||||
this.input_precab = {typeid: data.BranchFaPercentID, typename:data.BranchFaPercentType};
|
||||
this.simpan_state = "edit";
|
||||
this.dialogFormType = true;
|
||||
},
|
||||
openDialogDel(data) {
|
||||
this.input_precab = {typeid: data.BranchFaPercentID, typename:data.BranchFaPercentType};
|
||||
this.simpan_state = "delete";
|
||||
this.dialogFormType = true;
|
||||
},
|
||||
selectPrecab(data) {
|
||||
this.selected_precab = data;
|
||||
this.$store.dispatch("presentase/get_listing_reg", { presentasecabangid: data.BranchFaPercentID, currpages: 1 });
|
||||
},
|
||||
isTypeSelected(id) {
|
||||
return id == this.$store.state.presentase.selected_precab.BranchFaPercentID;
|
||||
},
|
||||
closeSnackbar(bool) {
|
||||
let snac = {
|
||||
isOpen: bool,
|
||||
color: "error",
|
||||
msg: ""
|
||||
};
|
||||
this.snackbar = snac;
|
||||
},
|
||||
crudType() {
|
||||
if (this.loading_api) {
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "warning",
|
||||
msg: "Loading proses lain ...."
|
||||
};
|
||||
this.snackbar = snac;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.simpan_state == "add") {
|
||||
let params = { typename: this.input_precab.typename };
|
||||
this.$store.dispatch("presentase/insert_type_presentase", params);
|
||||
} else if (this.simpan_state == "edit") {
|
||||
let params = { typename: this.input_precab.typename, typeid: this.input_precab.typeid};
|
||||
this.$store.dispatch("presentase/edit_type_presentase", params);
|
||||
} else if (this.simpan_state == "delete") {
|
||||
let params = { typeid: this.input_precab.typeid};
|
||||
this.$store.dispatch("presentase/delete_type_presentase", params);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
68
test/vuex/acc-one-presentase-fa-cabang/index.php
Normal file
68
test/vuex/acc-one-presentase-fa-cabang/index.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
<title>Presentase Cabang</title>
|
||||
</head>
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background: #F5E8DF!important;">
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs4 class="left" fill-height pa-1>
|
||||
<one-listing-type></one-listing-type>
|
||||
</v-flex>
|
||||
<v-flex xs8 class="right" fill-height pa-1>
|
||||
<one-listing-regional></one-listing-regional>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer></one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
|
||||
<!-- App Script -->
|
||||
<script type="module">
|
||||
import { store } from './store.js';
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: "#app",
|
||||
methods: {
|
||||
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-listing-type': httpVueLoader('./components/listing-tipe.vue'),
|
||||
'one-listing-regional': httpVueLoader('./components/listing-regional.vue'),
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
535
test/vuex/acc-one-presentase-fa-cabang/modules/presentase.js
Normal file
535
test/vuex/acc-one-presentase-fa-cabang/modules/presentase.js
Normal file
@@ -0,0 +1,535 @@
|
||||
import * as api from '../api/api-presentase.js';
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
tabel_precab: {},
|
||||
pagination_precab: 1,
|
||||
loading_precab: false,
|
||||
selected_precab: {},
|
||||
input_precab: {
|
||||
typeid: 0,
|
||||
typename: ''
|
||||
},
|
||||
tabel_detail: {},
|
||||
pagination_detail: 1,
|
||||
loading_detail: false,
|
||||
loading_api: false,
|
||||
snackbar: {
|
||||
isOpen: false,
|
||||
color: "error",
|
||||
msg: ""
|
||||
},
|
||||
dialogFormType: false,
|
||||
dialogFormDet: false,
|
||||
list_regional: {},
|
||||
selected_input_reg: {},
|
||||
regional_branches: {},
|
||||
list_coa: {},
|
||||
selected_coa: {},
|
||||
},
|
||||
mutations: {
|
||||
update_tabel_precab(state, data) {
|
||||
state.tabel_precab = data
|
||||
},
|
||||
update_pagination_precab(state, data) {
|
||||
state.pagination_precab = data
|
||||
},
|
||||
update_loading_precab(state, data) {
|
||||
state.loading_precab = data
|
||||
},
|
||||
update_selected_precab(state, data) {
|
||||
state.selected_precab = data
|
||||
},
|
||||
update_tabel_detail(state, data) {
|
||||
state.tabel_detail = data
|
||||
},
|
||||
update_pagination_detail(state, data) {
|
||||
state.pagination_detail = data
|
||||
},
|
||||
update_loading_detail(state, data) {
|
||||
state.loading_detail = data
|
||||
},
|
||||
update_input_precab(state, data) {
|
||||
state.input_precab = data
|
||||
},
|
||||
update_loading_api(state, data) {
|
||||
state.loading_api = data
|
||||
},
|
||||
update_snackbar(state, data) {
|
||||
state.snackbar = data
|
||||
},
|
||||
update_dialog_form(state, data) {
|
||||
state.dialogFormType = data
|
||||
},
|
||||
update_dialog_form_det(state, data) {
|
||||
state.dialogFormDet = data
|
||||
},
|
||||
update_list_regional(state, data) {
|
||||
state.list_regional = data
|
||||
},
|
||||
update_selected_input_reg(state, data) {
|
||||
state.selected_input_reg = data
|
||||
},
|
||||
update_regional_branches(state, data) {
|
||||
state.regional_branches = data
|
||||
},
|
||||
update_list_coa(state, data) {
|
||||
state.list_coa = data
|
||||
},
|
||||
update_selected_coa(state, data) {
|
||||
state.selected_coa = data
|
||||
},
|
||||
update_item_listcoa(state, data) {
|
||||
state.regional_branches.records = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async get_listing_type(context, params) {
|
||||
context.commit("update_loading_precab", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.get_listing_type(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_precab", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.commit("update_tabel_precab", resp.data)
|
||||
context.commit("update_loading_precab", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_precab", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async get_listing_reg(context, params) {
|
||||
context.commit("update_loading_detail", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.get_list_detail_type(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_detail", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.commit("update_tabel_detail", resp.data)
|
||||
context.commit("update_loading_detail", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_detail", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async insert_type_presentase(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.insert_type_presentase(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.commit("update_loading_api", false)
|
||||
context.dispatch("get_listing_type", {currpages: context.state.pagination_precab})
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "success",
|
||||
msg: "Sukses"
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_dialog_form", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_dialog_form", false)
|
||||
}
|
||||
},
|
||||
async edit_type_presentase(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.edit_type_presentase(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.commit("update_loading_api", false)
|
||||
context.dispatch("get_listing_type", {currpages: context.state.pagination_precab})
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "success",
|
||||
msg: "Sukses"
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_dialog_form", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async delete_type_presentase(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.delete_type_presentase(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.commit("update_loading_api", false)
|
||||
context.dispatch("get_listing_type", {currpages: context.state.pagination_precab})
|
||||
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "success",
|
||||
msg: "Sukses"
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_dialog_form", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async get_regional_input(context) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
let resp = await api.get_list_regional({ token: one_token() })
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
let ndata = resp.data.records
|
||||
let exist = context.state.tabel_detail.records
|
||||
let set_exist = new Set(exist.map(item => item.S_RegionalID))
|
||||
let res = ndata.filter(item => !set_exist.has(item.S_RegionalID))
|
||||
|
||||
let data = {
|
||||
total: resp.data.total,
|
||||
records: res
|
||||
}
|
||||
context.commit("update_loading_api", false)
|
||||
context.commit("update_list_regional", data)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async get_regional_branches(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.get_regional_branch(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
resp.data.records.forEach(item => {
|
||||
item.listCoa = []
|
||||
});
|
||||
|
||||
context.commit("update_loading_api", false)
|
||||
context.commit("update_regional_branches", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async insert_detail_precab(context) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
let precab = context.state.selected_precab
|
||||
let input_reg = context.state.selected_input_reg
|
||||
let input_branch = context.state.regional_branches.records
|
||||
|
||||
let final_input = []
|
||||
input_branch.forEach( item => {
|
||||
let a = {
|
||||
branchpercentid: precab.BranchFaPercentID,
|
||||
regionalid: input_reg.S_RegionalID,
|
||||
branchid: item.M_BranchID,
|
||||
value: item.branchValue,
|
||||
noacc: item.accountNumber
|
||||
}
|
||||
final_input.push(a)
|
||||
});
|
||||
|
||||
let params = {
|
||||
branchvalue: final_input,
|
||||
token: one_token()
|
||||
}
|
||||
|
||||
let resp = await api.insert_detail_precab(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_loading_api", false)
|
||||
} else {
|
||||
let page = context.state.pagination_detail
|
||||
context.dispatch("get_listing_reg", {currpages: page, presentasecabangid: precab.BranchFaPercentID, token: one_token()})
|
||||
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "success",
|
||||
msg: "Sukses"
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_loading_api", false)
|
||||
context.commit("update_dialog_form_det", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_dialog_form_det", false)
|
||||
}
|
||||
},
|
||||
async edit_detail_precab(context) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
let precab = context.state.selected_precab
|
||||
let input_branch = context.state.regional_branches.records
|
||||
|
||||
let final_input = []
|
||||
input_branch.forEach( item => {
|
||||
let a = {
|
||||
precabdetailid: item.BranchFaPercentDetailID,
|
||||
value: item.branchValue,
|
||||
noacc: item.accountNumber
|
||||
}
|
||||
final_input.push(a)
|
||||
})
|
||||
|
||||
let params = {
|
||||
branchvalue: final_input,
|
||||
token: one_token()
|
||||
}
|
||||
|
||||
let resp = await api.edit_detail_precab(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_loading_api", false)
|
||||
} else {
|
||||
let page = context.state.pagination_detail
|
||||
context.dispatch("get_listing_reg", {currpages: page, presentasecabangid: precab.BranchFaPercentID, token: one_token()})
|
||||
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "success",
|
||||
msg: "Sukses"
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_loading_api", false)
|
||||
context.commit("update_dialog_form_det", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_dialog_form_det", false)
|
||||
}
|
||||
},
|
||||
async get_current_value_detail(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.get_current_value_detail(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
resp.data.records.forEach(item => {
|
||||
item.branchValue = parseFloat(item.branchValue)
|
||||
item.listCoa = []
|
||||
});
|
||||
|
||||
|
||||
context.commit("update_regional_branches", resp.data)
|
||||
context.commit("update_loading_api", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async get_list_coa(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.search_coa(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
let branc = context.state.regional_branches.records
|
||||
if (branc) {
|
||||
// let data = {
|
||||
// data: resp.data.records,
|
||||
// code: params.code
|
||||
// }
|
||||
|
||||
branc.forEach(item => {
|
||||
if (item.M_BranchCode == params.code) {
|
||||
item.listCoa = resp.data.records
|
||||
}
|
||||
});
|
||||
context.commit("update_item_listcoa", branc)
|
||||
}
|
||||
|
||||
context.commit("update_loading_api", false)
|
||||
// context.commit("update_list_coa", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async delete_detail_precab(context, params) {
|
||||
context.commit("update_loading_api", true)
|
||||
try {
|
||||
let precab = context.state.selected_precab
|
||||
params.token = one_token()
|
||||
let resp = await api.delete_detail_precab(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
let page = context.state.pagination_detail
|
||||
context.dispatch("get_listing_reg", {currpages: page, presentasecabangid: precab.BranchFaPercentID, token: one_token()})
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "success",
|
||||
msg: "Sukses"
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
context.commit("update_loading_api", false)
|
||||
context.commit("update_dialog_form_det", false)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_loading_api", false)
|
||||
let snac = {
|
||||
isOpen: true,
|
||||
color: "error",
|
||||
msg: error.message
|
||||
}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
11
test/vuex/acc-one-presentase-fa-cabang/store.js
Normal file
11
test/vuex/acc-one-presentase-fa-cabang/store.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
import presentase from "./modules/presentase.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
presentase: presentase
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {}
|
||||
})
|
||||
Reference in New Issue
Block a user