add modules folder based on s_menu
This commit is contained in:
344
test/vuex/acc-one-payment-voucher/api/voucher.js
Normal file
344
test/vuex/acc-one-payment-voucher/api/voucher.js
Normal file
@@ -0,0 +1,344 @@
|
||||
const URL = "/one-api/mockup/purchase/cashier/";
|
||||
|
||||
export async function search(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/search", prm);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchBranch(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'purchaseRequestDirect/getbranch',{
|
||||
token: token,
|
||||
search: prm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchAccDana(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'purchaseRequestDirect/getcoa', {
|
||||
token: token,
|
||||
search: prm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchAccBiaya(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'purchaseRequestDirect/getcoa', {
|
||||
token: token,
|
||||
search: prm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchAccTemp(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'purchaseRequestDirect/getcoa', {
|
||||
token: token,
|
||||
search: prm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getPurchase(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/getPurchase", {
|
||||
token: token,
|
||||
branchcode: prm,
|
||||
}
|
||||
);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchdetail(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/searchdetail", {
|
||||
token: token,
|
||||
ID: prm,
|
||||
}
|
||||
);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveDetail(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/save", {
|
||||
token: token,
|
||||
BranchCode: prm.branch,
|
||||
CoaSourceID: prm.accountDana,
|
||||
CoaExpenseID: prm.accountBiaya,
|
||||
CoaTemporaryID: prm.accountTemp,
|
||||
total: prm.total,
|
||||
details: prm.details
|
||||
}
|
||||
);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getTotalApproved(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'purchaseRequestDirect/getTotalApproved', {
|
||||
token: token
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteVoucher(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'purchaseRequestDirect/delete', {
|
||||
token: token,
|
||||
ID: prm.PVID
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function editVoucher(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/update", {
|
||||
token: token,
|
||||
BranchCode: prm.branch,
|
||||
CoaSourceID: prm.accountDana,
|
||||
CoaExpenseID: prm.accountBiaya,
|
||||
CoaTemporaryID: prm.accountTemp,
|
||||
total: prm.total,
|
||||
details: prm.details,
|
||||
ID: prm.voucherID
|
||||
}
|
||||
);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getPurchaseUpdateNew(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/getPurchaseUpdateNew", {
|
||||
token: token,
|
||||
branchcode: prm.branchcode,
|
||||
ID: prm.voucherID
|
||||
}
|
||||
);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getVoucherDetailItem(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/voucherDetailItem", params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveAccountItem(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/saveAccountDetail", params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function moveToKasir(param) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "purchaseRequestDirect/moveToKasir", param)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
}
|
||||
} else {
|
||||
let data = resp.data
|
||||
return data
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_account_item" persistent width="40vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2">PILIH ACCOUNT BIAYA</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout row wrap v-for="(item, index) in list_voucher_detail" :key="index" class="mt-2">
|
||||
<v-flex xs3 class="pr-1">
|
||||
<div class="text-xs-left">
|
||||
<p class="mb-0">{{ item.PurchaseRequestDirectDescription }}</p>
|
||||
<p class="mb-0 font-weight-bold" style="color:#000000">Kategori: {{ item.PurchaseDirectCategoryName }}</p>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="px-1">
|
||||
<div class="text-xs-left">
|
||||
<p class="mb-0">Jumlah: </p>
|
||||
<p class="mb-0 font-weight-bold" style="color:#000000">Rp. {{ item.PurchaseRequestDirectDetailTotalEstimationPrice }}</p>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="pl-1">
|
||||
<v-autocomplete
|
||||
label="Account Biaya" hide-details outline
|
||||
v-model="item.account_number" :items="list_accitem"
|
||||
item-text="coaDescription" item-value="coaAccountNo"
|
||||
></v-autocomplete>
|
||||
<p v-show="item.err_message.length > 0" class="mb-0 text-red-600">{{ item.err_message }}</p>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-divider class="mt-2" v-if="index + 1 < list_voucher_detail.length" :key="`divider-${index}`"></v-divider>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" @click="batalAcc()">BATAL</v-btn>
|
||||
<v-btn color="primary" @click="simpanAcc()">SIMPAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
search_accitem: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_account_item: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dialog_account_item;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dialog_account_item", val)
|
||||
}
|
||||
},
|
||||
list_voucher_detail: {
|
||||
get() {
|
||||
return this.$store.state.voucher.list_voucher_detail;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_list_voucher_detail", val)
|
||||
}
|
||||
},
|
||||
list_accitem() {
|
||||
return this.$store.state.voucher.list_accitem;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
simpanAcc() {
|
||||
let data = this.list_voucher_detail
|
||||
let headerID = 0;
|
||||
let isEmpty = false
|
||||
data.forEach(elem => {
|
||||
if (elem.account_number == '') {
|
||||
elem.err_message = 'account harus diisi'
|
||||
isEmpty = true
|
||||
} else {
|
||||
elem.err_message = ''
|
||||
}
|
||||
headerID = elem.PurchaseRequestDirectDetailPurchaseRequestDirectID
|
||||
});
|
||||
|
||||
if (isEmpty) {
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.dispatch("voucher/saveAccountItem", headerID)
|
||||
},
|
||||
batalAcc() {
|
||||
this.list_voucher_detail = []
|
||||
this.dialog_account_item = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,524 @@
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog v-model="dialogVoucher" persistent max-width="50vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
FORM VOUCHER
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-0">
|
||||
<v-layout wrap>
|
||||
<v-flex xs12 mb-2>
|
||||
<v-autocomplete label="Cabang"
|
||||
:items="branchList" v-model="selectedBranch"
|
||||
:search-input.sync="search_branch"
|
||||
auto-select-first no-filter item-text="M_BranchName" return-object
|
||||
no-data-text="Pilih Cabang"
|
||||
:disabled="xact === 'edit'"
|
||||
hide-details>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.M_BranchName"></v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkErrorForm('requireBranch')" class="error pl-2 pr-2" style="color:#fff">Cabang harus diisi</p>
|
||||
</v-flex>
|
||||
<v-flex xs12 mb-2>
|
||||
<v-autocomplete label="Account Sumber Dana"
|
||||
:items="accountDanaList" v-model="selectedAccountDana"
|
||||
:search-input.sync="search_accountDana"
|
||||
auto-select-first no-filter item-text="coaDescription" return-object
|
||||
no-data-text="Pilih Account Sumber Dana"
|
||||
hide-details>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.coaDescription"></v-list-tile-title>
|
||||
<v-list-tile-sub-title
|
||||
v-text="item.coaAccountNo"
|
||||
></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkErrorForm('requireAccountDana')" class="error pl-2 pr-2" style="color:#fff">Account sumber dana harus diisi</p>
|
||||
</v-flex>
|
||||
|
||||
<!-- <v-flex xs12 mb-2>
|
||||
<v-autocomplete label="Account Biaya"
|
||||
:items="accountBiayaList" v-model="selectedAccountBiaya"
|
||||
:search-input.sync="search_accountBiaya"
|
||||
auto-select-first no-filter item-text="coaDescription" return-object
|
||||
no-data-text="Pilih Account Biaya"
|
||||
hide-details>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.coaDescription"></v-list-tile-title>
|
||||
<v-list-tile-sub-title
|
||||
v-text="item.coaAccountNo"
|
||||
></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkErrorForm('requireAccountBiaya')" class="error pl-2 pr-2" style="color:#fff">Account biaya harus diisi</p>
|
||||
</v-flex> -->
|
||||
<v-flex xs12 mb-2>
|
||||
<v-autocomplete label="Account Tampungan Sementara"
|
||||
:items="accountTempList" v-model="selectedAccountTemp"
|
||||
:search-input.sync="search_accountTemp"
|
||||
auto-select-first no-filter item-text="coaDescription" return-object
|
||||
no-data-text="Pilih Account"
|
||||
hide-details>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.coaDescription"></v-list-tile-title>
|
||||
<v-list-tile-sub-title
|
||||
v-text="item.coaAccountNo"
|
||||
></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkErrorForm('requireAccountTemp')" class="error pl-2 pr-2" style="color:#fff">Account tampungan sementara harus diisi</p>
|
||||
</v-flex>
|
||||
|
||||
<!-- listing -->
|
||||
<v-flex xs12 mt-2>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pt-2 pb-2>
|
||||
<v-card color="cyan ">
|
||||
<v-layout align-center row>
|
||||
<h4 class="subheader pl-3 pt-2 pb-2">DAFTAR REQUEST</h4>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pt-1 pb-2>
|
||||
<v-data-table
|
||||
class="v-table elevation-1 with-vertical-lines"
|
||||
hide-actions
|
||||
:items="purchaseList"
|
||||
:headers="headers"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<td class="table-cell text-xs-left"style="height: 42px">
|
||||
{{ props.item.PurchaseRequestDirectNumber }}
|
||||
</td>
|
||||
<td class="table-cell text-xs-left"
|
||||
style="height: 42px"
|
||||
>
|
||||
{{ props.item.user_request }}
|
||||
</td>
|
||||
<td class="table-cell text-xs-left"
|
||||
style="height: 42px"
|
||||
>
|
||||
{{ props.item.PurchaseRequestDirectDescription }}
|
||||
</td>
|
||||
<td class="table-cell text-xs-left"
|
||||
style="height: 42px"
|
||||
>
|
||||
Rp {{ props.item.PurchaseRequestDirectTotalRealitation.toString().replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
"."
|
||||
) }}
|
||||
</td>
|
||||
<td class="table-cell text-xs-center" style="height: 42px">
|
||||
<v-btn
|
||||
dark
|
||||
@click="addPurchase(props.item)"
|
||||
v-if="purchaseExist(props.item)"
|
||||
style="min-width: 25px; height: 30px"
|
||||
small
|
||||
color="info"
|
||||
>
|
||||
<v-icon style="cursor: pointer; font-size: 18px">
|
||||
add_box
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
dark
|
||||
v-if="!purchaseExist(props.item)"
|
||||
@click="removePurchase(props.item)"
|
||||
style="min-width: 25px; height: 30px"
|
||||
small
|
||||
color="red"
|
||||
>
|
||||
<v-icon style="cursor: pointer; font-size: 18px">
|
||||
delete
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<tr>
|
||||
<td colspan="3" class="font-weight-bold pa-2">TOTAL</td>
|
||||
|
||||
<td class="text-xs-right pa-2 font-weight-bold">
|
||||
Rp {{ resume.totalRealitation.toString().replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
"."
|
||||
) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<!-- end listing -->
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="closeDiallogVoucher()"> Tutup </v-btn>
|
||||
<v-btn v-if="xact === 'new'" color="primary" dark @click="saveVoucher()">Simpan</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" color="primary" dark @click="updateVoucher()">Simpan Perubahan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
name: "DialogFormVoucher",
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "NO",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "USER REQUEST",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "user",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DESKRIPSI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "date",
|
||||
width: "35%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL REALISASI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "supplier",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("voucher/searchBranch", this.search_branch);
|
||||
this.$store.dispatch("voucher/searchAccDana", this.search_accountDana);
|
||||
this.$store.dispatch("voucher/searchAccBiaya", this.search_accountBiaya);
|
||||
this.$store.dispatch("voucher/searchAccTemp", this.search_accountTemp);
|
||||
},
|
||||
computed: {
|
||||
dialogVoucher: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dialog_voucher;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dialog_voucher", val);
|
||||
},
|
||||
},
|
||||
branchList() {
|
||||
return this.$store.state.voucher.branchList;
|
||||
},
|
||||
selectedBranch: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_branch;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_branch", val);
|
||||
this.getPurchaseReq();
|
||||
},
|
||||
},
|
||||
search_branch: {
|
||||
get() {
|
||||
return this.$store.state.voucher.search_branch;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_search_branch", val);
|
||||
},
|
||||
},
|
||||
accountDanaList() {
|
||||
return this.$store.state.voucher.accountDanaList;
|
||||
},
|
||||
selectedAccountDana: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_accountDana;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_accountDana", val);
|
||||
},
|
||||
},
|
||||
search_accountDana: {
|
||||
get() {
|
||||
return this.$store.state.voucher.search_accountDana;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_search_accountDana", val);
|
||||
},
|
||||
},
|
||||
accountBiayaList() {
|
||||
return this.$store.state.voucher.accountBiayaList;
|
||||
},
|
||||
selectedAccountBiaya: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_accountBiaya;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_accountBiaya", val);
|
||||
},
|
||||
},
|
||||
search_accountBiaya: {
|
||||
get() {
|
||||
return this.$store.state.voucher.search_accountBiaya;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_search_accountBiaya", val);
|
||||
},
|
||||
},
|
||||
accountTempList() {
|
||||
return this.$store.state.voucher.accountTempList;
|
||||
},
|
||||
selectedAccountTemp: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_accountTemp;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_accountTemp", val);
|
||||
},
|
||||
},
|
||||
search_accountTemp: {
|
||||
get() {
|
||||
return this.$store.state.voucher.search_accountTemp;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_search_accountTemp", val);
|
||||
},
|
||||
},
|
||||
purchaseList() {
|
||||
return this.$store.state.voucher.purchaseList;
|
||||
},
|
||||
selected_purchase: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_purchase;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_purchase", val);
|
||||
},
|
||||
},
|
||||
resume() {
|
||||
return this.$store.state.voucher.resume_total;
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.voucher.act;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_act", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
thr_search_branch: _.debounce(function() {
|
||||
this.$store.dispatch("voucher/searchBranch", this.search_branch);
|
||||
}, 500),
|
||||
thr_search_accountDana: _.debounce(function() {
|
||||
this.$store.dispatch("voucher/searchAccDana", this.search_accountDana);
|
||||
}, 500),
|
||||
thr_search_accountBiaya: _.debounce(function() {
|
||||
this.$store.dispatch("voucher/searchAccBiaya", this.search_accountBiaya);
|
||||
}, 500),
|
||||
thr_search_accountTemp: _.debounce(function() {
|
||||
this.$store.dispatch("voucher/searchAccTemp", this.search_accountTemp);
|
||||
}, 500),
|
||||
getPurchaseReq() {
|
||||
this.$store.dispatch("voucher/getPurchase", this.selectedBranch === undefined ? "" : this.selectedBranch.M_BranchCode);
|
||||
},
|
||||
formatCurrency(val) {
|
||||
// Format the price above to USD using the locale, style, and currency.
|
||||
let price = parseFloat(val);
|
||||
let USDollar = new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
});
|
||||
|
||||
// console.log(
|
||||
// `The formated version of ${price} is ${USDollar.format(price)}`
|
||||
// );
|
||||
return `${USDollar.format(price)}`;
|
||||
},
|
||||
addPurchase(item) {
|
||||
let selected_purchase = this.$store.state.voucher.selected_purchase;
|
||||
selected_purchase.push(item);
|
||||
|
||||
let totalRealitation = 0;
|
||||
for (let i = 0; i < selected_purchase.length; i++) {
|
||||
const e = selected_purchase[i];
|
||||
totalRealitation += parseFloat(e.PurchaseRequestDirectTotalRealitation);
|
||||
}
|
||||
let xresume = {
|
||||
"totalRealitation": totalRealitation,
|
||||
};
|
||||
this.$store.commit("voucher/update_resume_total", xresume);
|
||||
},
|
||||
purchaseExist(item) {
|
||||
let selected_purchase = this.$store.state.voucher.selected_purchase;
|
||||
let found = selected_purchase.find((el) => el.PurchaseRequestDirectID === item.PurchaseRequestDirectID);
|
||||
if (found) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
removePurchase(item) {
|
||||
let selected_purchase = this.$store.state.voucher.selected_purchase;
|
||||
let found = selected_purchase.find((el) => el.PurchaseRequestDirectID === item.PurchaseRequestDirectID);
|
||||
if (found) {
|
||||
let index = selected_purchase.indexOf(found);
|
||||
selected_purchase.splice(index, 1);
|
||||
}
|
||||
|
||||
let totalRealitation = 0;
|
||||
for (let i = 0; i < selected_purchase.length; i++) {
|
||||
const e = selected_purchase[i];
|
||||
totalRealitation += parseFloat(e.PurchaseRequestDirectTotalRealitation);
|
||||
}
|
||||
let xresume = {
|
||||
"totalRealitation": totalRealitation,
|
||||
};
|
||||
this.$store.commit("voucher/update_resume_total", xresume);
|
||||
},
|
||||
checkErrorForm(val) {
|
||||
let errors = this.$store.state.voucher.errors;
|
||||
if (errors.includes(val)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
closeDiallogVoucher() {
|
||||
this.dialogVoucher = false;
|
||||
this.$store.commit("voucher/update_selected_branch", {});
|
||||
this.$store.commit("voucher/update_selected_accountDana", {});
|
||||
this.$store.commit("voucher/update_selected_accountBiaya", {});
|
||||
this.$store.commit("voucher/update_selected_accountTemp", {});
|
||||
this.$store.commit("voucher/update_selected_purchase", []);
|
||||
this.$store.commit("voucher/update_purchaseList", []);
|
||||
this.$store.commit("voucher/update_resume_total", {"totalRealitation": 0});
|
||||
this.$store.commit("voucher/update_errors", []);
|
||||
},
|
||||
saveVoucher() {
|
||||
this.$store.commit("voucher/update_errors", []);
|
||||
var errors = this.$store.state.voucher.errors;
|
||||
if (_.isEmpty(this.selectedBranch)) {
|
||||
errors.push("requireBranch");
|
||||
}
|
||||
if (_.isEmpty(this.selectedAccountDana)) {
|
||||
errors.push("requireAccountDana");
|
||||
}
|
||||
// if (_.isEmpty(this.selectedAccountBiaya)) {
|
||||
// errors.push("requireAccountBiaya");
|
||||
// }
|
||||
if (_.isEmpty(this.selectedAccountTemp)) {
|
||||
errors.push("requireAccountTemp");
|
||||
}
|
||||
if (errors.length === 0) {
|
||||
let prm = {
|
||||
"branch": this.selectedBranch.M_BranchCode,
|
||||
"accountDana": this.selectedAccountDana.coaID,
|
||||
"accountBiaya": this.selectedAccountBiaya.coaID,
|
||||
"accountTemp": this.selectedAccountTemp.coaID,
|
||||
"total": this.$store.state.voucher.resume_total.totalRealitation,
|
||||
"details": this.$store.state.voucher.selected_purchase,
|
||||
};
|
||||
this.$store.dispatch("voucher/save", prm);
|
||||
}
|
||||
},
|
||||
updateVoucher() {
|
||||
this.$store.commit("voucher/update_errors", []);
|
||||
var errors = this.$store.state.voucher.errors;
|
||||
if (_.isEmpty(this.selectedBranch)) {
|
||||
errors.push("requireBranch");
|
||||
}
|
||||
if (_.isEmpty(this.selectedAccountDana)) {
|
||||
errors.push("requireAccountDana");
|
||||
}
|
||||
// if (_.isEmpty(this.selectedAccountBiaya)) {
|
||||
// errors.push("requireAccountBiaya");
|
||||
// }
|
||||
if (_.isEmpty(this.selectedAccountTemp)) {
|
||||
errors.push("requireAccountTemp");
|
||||
}
|
||||
if (errors.length === 0) {
|
||||
let prm = {
|
||||
"voucherID": this.$store.state.voucher.selected_voucher.PaymentVoucherID,
|
||||
"branch": this.selectedBranch.M_BranchCode,
|
||||
"accountDana": this.selectedAccountDana.coaID,
|
||||
"accountBiaya": this.selectedAccountBiaya.coaID,
|
||||
"accountTemp": this.selectedAccountTemp.coaID,
|
||||
"total": this.$store.state.voucher.resume_total.totalRealitation,
|
||||
"details": this.$store.state.voucher.selected_purchase,
|
||||
};
|
||||
this.$store.dispatch("voucher/update", prm);
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
search_branch(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.voucher.load_status_branch == 1) return;
|
||||
this.thr_search_branch();
|
||||
},
|
||||
search_accountDana(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.voucher.load_status_accDana == 1) return;
|
||||
this.thr_search_accountDana();
|
||||
},
|
||||
search_accountBiaya(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.voucher.load_status_accBiaya == 1) return;
|
||||
this.thr_search_accountBiaya();
|
||||
},
|
||||
search_accountTemp(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.voucher.load_status_accTemp == 1) return;
|
||||
this.thr_search_accountTemp();
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
590
test/vuex/acc-one-payment-voucher/components/voucherListing.vue
Normal file
590
test/vuex/acc-one-payment-voucher/components/voucherListing.vue
Normal file
@@ -0,0 +1,590 @@
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
<!-- SNACKBAR -->
|
||||
<v-snackbar
|
||||
v-model="snackbar"
|
||||
:timeout="5000"
|
||||
:multi-line="false"
|
||||
:vertical="false"
|
||||
:top="true"
|
||||
>
|
||||
{{ msgSnackbar }}
|
||||
<v-btn flat @click="updateAlertSuccess(false)"> Tutup </v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<!-- ERROR DIALOG -->
|
||||
<v-dialog v-model="dialog_error" max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title>
|
||||
<span>ERROR !</span>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card-title>
|
||||
<v-divider></v-divider>
|
||||
<div class="ma-3 red--text">{{ msgError }}</div>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="primary" flat @click="dialog_error = false"
|
||||
>Tutup</v-btn
|
||||
>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<!-- END ERROR DIALOG -->
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 fill-height pa-1>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text"
|
||||
>PAYMENT VOUCHER</v-toolbar-title
|
||||
>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn icon @click="openDialogVoucher()">
|
||||
<v-icon>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
<v-card class="pa-2">
|
||||
<v-layout>
|
||||
<v-flex xs6 pl-2>
|
||||
<v-menu
|
||||
v-model="menuStartDate"
|
||||
:close-on-content-click="false"
|
||||
transition="scale-transition"
|
||||
:nudge-right="40"
|
||||
lazy
|
||||
offset-y
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="startDateFormatted"
|
||||
label="Tanggal Awal"
|
||||
readonly
|
||||
style="max-width: 250px"
|
||||
outline
|
||||
hide-details
|
||||
v-on="on"
|
||||
@blur="dStartDate = deFormatedDate(startDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title
|
||||
v-model="xStartDate"
|
||||
@input="menuStartDate = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs6 pl-2>
|
||||
<v-menu
|
||||
v-model="menuEndDate"
|
||||
:close-on-content-click="false"
|
||||
transition="scale-transition"
|
||||
:nudge-right="40"
|
||||
lazy
|
||||
offset-y
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="endDateFormatted"
|
||||
label="Tanggal Akhir"
|
||||
readonly
|
||||
style="max-width: 250px"
|
||||
outline
|
||||
hide-details
|
||||
v-on="on"
|
||||
@blur="dEndDate = deFormatedDate(endDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title
|
||||
v-model="xEndDate"
|
||||
@input="menuEndDate = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs6 pl-2>
|
||||
<v-autocomplete
|
||||
return-object
|
||||
item-text="text"
|
||||
label="Status"
|
||||
:items="statusOptions"
|
||||
v-model="selected_status"
|
||||
outline
|
||||
hide-details
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs6 pl-2>
|
||||
<v-text-field
|
||||
label="Cari..."
|
||||
placeholder="NO."
|
||||
outline
|
||||
hide-details
|
||||
v-model="xsearch"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex pl-2 pr-2>
|
||||
<v-btn
|
||||
dark
|
||||
color="primary"
|
||||
style="min-width: 50px; height: 50px; margin: 0"
|
||||
@click="mainTableSearch()"
|
||||
>
|
||||
<v-icon>search</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card class="pa-2 mt-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 pl-2>
|
||||
<div>
|
||||
<span>Ada approved : </span>
|
||||
<span>{{ totalApproved }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row style="max-height: 600px; overflow: auto">
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
<v-data-table
|
||||
:items="xvoucehrList"
|
||||
:headers="headers"
|
||||
:loading="isLoading"
|
||||
hide-actions
|
||||
class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)"
|
||||
>
|
||||
<p class="mb-0 font-weight-bold" style="color:#000000">{{ props.item.PaymentVoucherNumber }}</p>
|
||||
<p class="mb-0 info--text mono font-weight-bold caption">{{ formatDateHeader(props.item.PaymentVoucherDate) }}</p>
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)"
|
||||
>
|
||||
<p class="mb-0">{{ props.item.M_BranchName }}</p>
|
||||
<p class="mb-0 font-weight-bold" style="color:#000000">Total : Rp {{ props.item.PaymentVoucherTotal.toString().replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
"."
|
||||
) }}</p>
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)"
|
||||
>{{ formatDateHeader(props.item.PaymentVoucherRealitationDate) }}</td>
|
||||
<td
|
||||
class="text-xs-center pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)"
|
||||
>
|
||||
<!-- :text-color="props.item.PaymentVoucherStatus === 'Draft' ? 'black' : 'white'" -->
|
||||
<v-chip
|
||||
small
|
||||
:color="getChipStatusColor(props.item.PaymentVoucherStatus)">
|
||||
{{ props.item.PaymentVoucherStatus }}
|
||||
</v-chip>
|
||||
</td>
|
||||
<template v-if="props.item.PaymentVoucherStatus == 'Draft'">
|
||||
<td class="text-xs-center pa-2"
|
||||
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectMe(props.item)"
|
||||
>
|
||||
<v-icon small @click="openUpdateVoucher(props.item)"
|
||||
>edit</v-icon
|
||||
>
|
||||
<v-icon small @click="deleteVoucher(props.item)"
|
||||
>delete</v-icon
|
||||
>
|
||||
</td>
|
||||
</template>
|
||||
<template v-else>
|
||||
<td
|
||||
class="text-xs-center pa-2"
|
||||
v-bind:class="{
|
||||
'amber lighten-4': isSelected(props.item),
|
||||
}"
|
||||
></td>
|
||||
</template>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider></v-divider>
|
||||
<v-pagination
|
||||
style="margin-top: 10px; margin-bottom: 10px"
|
||||
v-model="curr_page"
|
||||
:length="xtotal_page"
|
||||
></v-pagination>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<dialog-form-voucher></dialog-form-voucher>
|
||||
|
||||
<one-dialog-alert
|
||||
:status="dialogAlertDelete"
|
||||
:msg="msgAlertDelete"
|
||||
@forget-dialog-alert="dialogAlertDelete = false"
|
||||
@close-dialog-alert="closeAndDelete()"
|
||||
></one-dialog-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.date-type-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.table.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
scroll-padding: 50px 0 0 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
"dialog-form-voucher": httpVueLoader("./dialogFormVoucher.vue"),
|
||||
"one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
|
||||
"one-dialog-error": httpVueLoader("../../common/oneDialogError.vue")
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
msgAlertDelete: "",
|
||||
dialogAlertDelete: false,
|
||||
xPVID: 0,
|
||||
xPVNumber: "",
|
||||
headers: [
|
||||
{
|
||||
text: "NO / TANGGAL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "PENERIMA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "supplier",
|
||||
width: "30%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TANGGAL REALISASI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "total",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("voucher/search");
|
||||
this.$store.dispatch("voucher/getTotalApproved");
|
||||
},
|
||||
computed: {
|
||||
statusOptions() {
|
||||
return this.$store.state.voucher.status_options;
|
||||
},
|
||||
selected_status: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_status;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_status", val);
|
||||
this.mainTableSearch();
|
||||
},
|
||||
},
|
||||
menuStartDate: {
|
||||
get() {
|
||||
return this.$store.state.voucher.menuStartDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_menuStartDate", val);
|
||||
},
|
||||
},
|
||||
menuEndDate: {
|
||||
get() {
|
||||
return this.$store.state.voucher.menuEndDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_menuEndDate", val);
|
||||
},
|
||||
},
|
||||
startDateFormatted() {
|
||||
return this.formatDate(this.xStartDate);
|
||||
},
|
||||
endDateFormatted() {
|
||||
return this.formatDate(this.xEndDate);
|
||||
},
|
||||
xStartDate: {
|
||||
get() {
|
||||
return this.$store.state.voucher.xStartDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_xStartDate", val);
|
||||
},
|
||||
},
|
||||
xEndDate: {
|
||||
get() {
|
||||
return this.$store.state.voucher.xEndDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_xEndDate", val);
|
||||
},
|
||||
},
|
||||
dEndDate: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dEndDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dEndDate", val);
|
||||
},
|
||||
},
|
||||
dStartDate: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dStartDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dStartDate", val);
|
||||
},
|
||||
},
|
||||
xvoucehrList() {
|
||||
return this.$store.state.voucher.voucherList;
|
||||
},
|
||||
curr_page: {
|
||||
get() {
|
||||
return this.$store.state.voucher.currentPage;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_currentPage", val);
|
||||
this.mainTableSearch();
|
||||
},
|
||||
},
|
||||
xtotal_page: {
|
||||
get() {
|
||||
return this.$store.state.voucher.total_page_voucher;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_total_page_voucher", val);
|
||||
},
|
||||
},
|
||||
xsearch: {
|
||||
get() {
|
||||
return this.$store.state.voucher.xsearch;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_xsearch", val);
|
||||
},
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.voucher.search_status === 1;
|
||||
},
|
||||
msgSnackbar() {
|
||||
return this.$store.state.voucher.success_message;
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.voucher.alert_success;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_alert_success", val);
|
||||
},
|
||||
},
|
||||
dialog_error: {
|
||||
get() {
|
||||
return this.$store.state.voucher.alert_error;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_alert_error", val);
|
||||
},
|
||||
},
|
||||
msgError() {
|
||||
return this.$store.state.voucher.error_message;
|
||||
},
|
||||
totalApproved() {
|
||||
return this.$store.state.voucher.totalApproved
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
isSelected(o) {
|
||||
return o.PaymentVoucherID == this.$store.state.voucher.selected_voucher.PaymentVoucherID;
|
||||
},
|
||||
selectMe(sc) {
|
||||
this.$store.commit("voucher/update_selected_voucher", sc);
|
||||
this.$store.dispatch("voucher/searchdetail", sc.PaymentVoucherID)
|
||||
},
|
||||
openDialogVoucher() {
|
||||
this.$store.commit("voucher/update_dialog_voucher", true);
|
||||
this.$store.commit("voucher/update_act", "new");
|
||||
this.$store.commit("voucher/update_selected_branch", {});
|
||||
this.$store.commit("voucher/update_branchList", []);
|
||||
this.$store.commit("voucher/update_selected_accountDana", {});
|
||||
this.$store.commit("voucher/update_accountDanaList", []);
|
||||
this.$store.commit("voucher/update_selected_accountBiaya", {});
|
||||
this.$store.commit("voucher/update_accountBiayaList", []);
|
||||
this.$store.commit("voucher/update_selected_accountTemp", {});
|
||||
this.$store.commit("voucher/update_accountTempList", []);
|
||||
this.$store.commit("voucher/update_selected_purchase", []);
|
||||
this.$store.commit("voucher/update_purchaseList", []);
|
||||
this.$store.commit("voucher/update_resume_total", {"totalRealitation": 0});
|
||||
},
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
formatDateHeader(date) {
|
||||
if (!date) return null;
|
||||
const cleanDate = date.split(" ")[0];
|
||||
const [year, month, day] = cleanDate.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
deFormatedDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
const [day, month, year] = date.split("-");
|
||||
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
|
||||
},
|
||||
getChipStatusColor(status) {
|
||||
switch (status) {
|
||||
case "Realitation":
|
||||
return "warning";
|
||||
case "Paid":
|
||||
return "success";
|
||||
case "Partial":
|
||||
return "warning";
|
||||
case "Completed":
|
||||
return "success";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
},
|
||||
mainTableSearch() {
|
||||
this.$store.dispatch("voucher/search");
|
||||
},
|
||||
thr_searchDate: _.debounce(function () {
|
||||
this.$store.dispatch("voucher/search")
|
||||
}, 1000),
|
||||
thr_search: _.debounce(function () {
|
||||
this.$store.dispatch("voucher/search")
|
||||
}, 1000),
|
||||
deleteVoucher(data) {
|
||||
this.xPVID = data.PaymentVoucherID;
|
||||
this.xPVNumber = data.PaymentVoucherNumber;
|
||||
|
||||
this.msgAlertDelete = `Yakin, mau hapus Payment Voucher [${data.PaymentVoucherNumber}] ?`;
|
||||
this.dialogAlertDelete = true;
|
||||
},
|
||||
closeAndDelete() {
|
||||
this.$store.dispatch("voucher/delete", {
|
||||
PVID: this.xPVID,
|
||||
PVNumber: this.xPVNumber
|
||||
});
|
||||
this.dialogAlertDelete = false
|
||||
},
|
||||
openUpdateVoucher(data) {
|
||||
this.$store.commit("voucher/update_act", "edit");
|
||||
this.$store.commit("voucher/update_dialog_voucher", true);
|
||||
this.$store.commit("voucher/update_branchList", [{
|
||||
M_BranchCode: data.M_BranchCode,
|
||||
M_BranchName: data.M_BranchName
|
||||
}])
|
||||
this.$store.commit("voucher/update_selected_branch", {
|
||||
M_BranchCode: data.M_BranchCode,
|
||||
M_BranchName: data.M_BranchName
|
||||
})
|
||||
|
||||
// source
|
||||
this.$store.commit("voucher/update_accountDanaList", [{
|
||||
coaID: data.PaymentVoucherCoaSourceID,
|
||||
coaDescription: data.coaDescriptionSource
|
||||
}])
|
||||
this.$store.commit("voucher/update_selected_accountDana", {
|
||||
coaID: data.PaymentVoucherCoaSourceID,
|
||||
coaDescription: data.coaDescriptionSource
|
||||
})
|
||||
|
||||
// expense
|
||||
this.$store.commit("voucher/update_accountBiayaList", [{
|
||||
coaID: data.PaymentVoucherCoaSourceID,
|
||||
coaDescription: data.coaDescriptionExpense
|
||||
}])
|
||||
this.$store.commit("voucher/update_selected_accountBiaya", {
|
||||
coaID: data.PaymentVoucherCoaSourceID,
|
||||
coaDescription: data.coaDescriptionExpense
|
||||
})
|
||||
|
||||
//
|
||||
this.$store.commit("voucher/update_accountTempList", [{
|
||||
coaID: data.PaymentVoucherCoaTemporaryID,
|
||||
coaDescription: data.coaDescriptionTemporary
|
||||
}])
|
||||
this.$store.commit("voucher/update_selected_accountTemp", {
|
||||
coaID: data.PaymentVoucherCoaTemporaryID,
|
||||
coaDescription: data.coaDescriptionTemporary
|
||||
})
|
||||
|
||||
this.$store.dispatch("voucher/getPurchaseUpdateNew", {"branchcode": this.$store.state.voucher.selected_branch.M_BranchCode, "voucherID": data.PaymentVoucherID});
|
||||
this.$store.commit("voucher/update_selected_purchase", this.$store.state.voucher.details);
|
||||
|
||||
this.$store.commit("voucher/update_resume_total", {"totalRealitation": data.PaymentVoucherTotal} );
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
xStartDate(val, old) {
|
||||
this.xStartDate = val;
|
||||
this.thr_searchDate();
|
||||
},
|
||||
xEndDate(val, old) {
|
||||
this.xEndDate = val;
|
||||
this.thr_searchDate();
|
||||
},
|
||||
xsearch(val, old) {
|
||||
this.xsearch = val;
|
||||
this.thr_search();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,259 @@
|
||||
<template>
|
||||
<div style="width: 100%;">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 fill-height pa-1>
|
||||
<v-card>
|
||||
<v-card-text>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs11>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<div>
|
||||
<span>No : </span>
|
||||
<span>{{
|
||||
selected_voucher.PaymentVoucherNumber
|
||||
}}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<div>
|
||||
<span>Sumber Dana : </span>
|
||||
<span>{{
|
||||
selected_voucher.coaDescriptionSource
|
||||
}}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- <v-flex xs12>
|
||||
<div>
|
||||
<span>Biaya : </span>
|
||||
<span>{{
|
||||
selected_voucher.coaDescriptionExpense
|
||||
}}</span>
|
||||
</div>
|
||||
</v-flex> -->
|
||||
|
||||
<v-flex xs12>
|
||||
<div>
|
||||
<span>Tampungan Sementara : </span>
|
||||
<span>{{
|
||||
selected_voucher.coaDescriptionTemporary
|
||||
}}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<!-- <v-flex xs1>
|
||||
<v-btn
|
||||
color="primary"
|
||||
flat
|
||||
icon
|
||||
@click="openDialogDetail()"
|
||||
>
|
||||
<v-icon>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-flex> -->
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12 pt-2 pb-2>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="xdetails"
|
||||
:loading="isLoading"
|
||||
hide-actions
|
||||
class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-center pa-2">
|
||||
{{ props.item.RowNumber }}
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
{{ props.item.PurchaseRequestDirectNumber }}
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
Rp
|
||||
{{
|
||||
props.item.PaymentVoucherDetailTotal.toString().replace(
|
||||
/\B(?=(\d{3})+(?!\d))/g,
|
||||
"."
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
<td>
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small @click="openAccountDialog(props.item)" color="blue lighten-2"
|
||||
>
|
||||
<v-icon small color="blue">edit</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
|
||||
<!-- <v-flex xs12 v-show="xdetails.length > 0">
|
||||
<v-btn
|
||||
@click="simpanKasir()"
|
||||
>
|
||||
Simpan
|
||||
</v-btn>
|
||||
</v-flex> -->
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<dialog-account-item></dialog-account-item>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.date-type-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.table.v-table tbody td,
|
||||
table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.scroll-container {
|
||||
scroll-padding: 50px 0 0 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'dialog-account-item': httpVueLoader('./dialogAccountItem.vue')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "NO",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NO REQUEST",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "request",
|
||||
width: "45%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "total",
|
||||
width: "40%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "total",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
xdetails() {
|
||||
return this.$store.state.voucher.details;
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.voucher.search_status_detail === 1;
|
||||
},
|
||||
selected_voucher: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_voucher;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_voucher", val);
|
||||
},
|
||||
},
|
||||
dialog_account_item: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dialog_account_item;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dialog_account_item", val)
|
||||
}
|
||||
},
|
||||
list_voucher_detail: {
|
||||
get() {
|
||||
return this.$store.state.voucher.list_voucher_detail;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_list_voucher_detail", val)
|
||||
}
|
||||
},
|
||||
list_accitem: {
|
||||
get() {
|
||||
return this.$store.state.voucher.list_accitem;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_list_accitem", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
async openAccountDialog(data) {
|
||||
await this.$store.dispatch("voucher/getVoucherDetailItem", {
|
||||
PRDirectID: data.PaymentVoucherDetailPurchaseRequestDirectID
|
||||
})
|
||||
|
||||
this.$store.dispatch("voucher/searchAccountItem", {search: ''})
|
||||
this.dialog_account_item = true
|
||||
},
|
||||
simpanKasir() {
|
||||
let details = this.xdetails
|
||||
let isIncomplete = false
|
||||
let message = 'Acoount item belum terisi pada : '
|
||||
details.forEach(element => {
|
||||
if (element.PurchaseRequestDirectAccountFilled == 'N') {
|
||||
message = message + element.PurchaseRequestDirectNumber
|
||||
isIncomplete = true
|
||||
}
|
||||
});
|
||||
|
||||
if (isIncomplete) {
|
||||
this.$store.commit("voucher/update_alert_error", true);
|
||||
this.$store.commit("voucher/update_error_message", message);
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.dispatch("voucher/moveTokasir")
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
71
test/vuex/acc-one-payment-voucher/index.php
Normal file
71
test/vuex/acc-one-payment-voucher/index.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<!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>One</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 xs6 class="left" fill-height pa-1>
|
||||
<voucher-listing></voucher-listing>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<voucher-listing-detail></voucher-listing-detail>
|
||||
</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'),
|
||||
'voucher-listing': httpVueLoader('./components/voucherListing.vue'),
|
||||
'voucher-listing-detail': httpVueLoader('./components/voucherListingDetail.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
628
test/vuex/acc-one-payment-voucher/modules/voucher.js
Normal file
628
test/vuex/acc-one-payment-voucher/modules/voucher.js
Normal file
@@ -0,0 +1,628 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
|
||||
import * as api from "../api/voucher.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
dialog_voucher: false,
|
||||
status_options: [
|
||||
{ val: 0, text: 'All' }, { val: 1, text: 'Draft' },
|
||||
{ val: 2, text: 'Paid' }, { val: 3, text: 'Realitation' }
|
||||
],
|
||||
selected_status: { val: 1, text: 'Draft' },
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
|
||||
dStartDate: new Date().toISOString().substring(0, 10),
|
||||
dEndDate: new Date().toISOString().substring(0, 10),
|
||||
xStartDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
xEndDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
|
||||
// listing
|
||||
currentPage: 1,
|
||||
search_status: 0,
|
||||
search_error_message: "",
|
||||
voucherList: [],
|
||||
selected_voucher: {},
|
||||
total_page_voucher: 0,
|
||||
xsearch: "",
|
||||
act: "new",
|
||||
|
||||
// form
|
||||
load_status_branch: 0,
|
||||
error_message: "",
|
||||
alert_error: false,
|
||||
branchList: [],
|
||||
selected_branch: {},
|
||||
search_branch: "",
|
||||
accountDanaList: [],
|
||||
selected_accountDana: {},
|
||||
search_accountDana: "",
|
||||
load_status_accDana: 0,
|
||||
accountBiayaList: [],
|
||||
selected_accountBiaya: {},
|
||||
search_accountBiaya: "",
|
||||
load_status_accBiaya: 0,
|
||||
accountTempList: [],
|
||||
selected_accountTemp: {},
|
||||
search_accountTemp: "",
|
||||
load_status_accTemp: 0,
|
||||
load_status: 0,
|
||||
purchaseList: [],
|
||||
selected_purchase: [],
|
||||
resume_total: {"totalRealitation": 0},
|
||||
errors: [],
|
||||
alert_error: false,
|
||||
alert_success: false,
|
||||
success_message: "",
|
||||
totalApproved: 0,
|
||||
|
||||
// detail
|
||||
search_status_detail: 0,
|
||||
details: [],
|
||||
|
||||
// add coa per item
|
||||
dialog_account_item: false,
|
||||
list_voucher_detail: [],
|
||||
list_accitem: []
|
||||
},
|
||||
mutations: {
|
||||
update_dialog_voucher(state, val) {
|
||||
state.dialog_voucher = val;
|
||||
},
|
||||
update_status_options(state, val) {
|
||||
state.status_options = val;
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val;
|
||||
},
|
||||
update_menuStartDate(state, val) {
|
||||
state.menuStartDate = val;
|
||||
},
|
||||
update_menuEndDate(state, val) {
|
||||
state.menuEndDate = val;
|
||||
},
|
||||
update_dStartDate(state, val) {
|
||||
state.dStartDate = val;
|
||||
},
|
||||
update_dEndDate(state, val) {
|
||||
state.dEndDate = val;
|
||||
},
|
||||
update_xStartDate(state, val) {
|
||||
state.xStartDate = val;
|
||||
},
|
||||
update_xEndDate(state, val) {
|
||||
state.xEndDate = val;
|
||||
},
|
||||
update_currentPage(state, val) {
|
||||
state.currentPage = val;
|
||||
},
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val;
|
||||
},
|
||||
update_search_error_message(state, val) {
|
||||
state.search_error_message = val;
|
||||
},
|
||||
update_voucherList(state, val) {
|
||||
state.voucherList = val;
|
||||
},
|
||||
update_selected_voucher(state, val) {
|
||||
state.selected_voucher = val;
|
||||
},
|
||||
update_total_page_voucher(state, val) {
|
||||
state.total_page_voucher = val;
|
||||
},
|
||||
update_xsearch(state, val) {
|
||||
state.xsearch = val;
|
||||
state.currentPage = 1;
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_load_status_branch(state, val) {
|
||||
state.load_status_branch = val;
|
||||
},
|
||||
update_error_message(state, val) {
|
||||
state.error_message = val;
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val;
|
||||
},
|
||||
update_branchList(state, val) {
|
||||
state.branchList = val;
|
||||
},
|
||||
update_selected_branch(state, val) {
|
||||
state.selected_branch = val;
|
||||
},
|
||||
update_search_branch(state, val) {
|
||||
state.search_branch = val;
|
||||
},
|
||||
update_accountDanaList(state, val) {
|
||||
state.accountDanaList = val;
|
||||
},
|
||||
update_selected_accountDana(state, val) {
|
||||
state.selected_accountDana = val;
|
||||
},
|
||||
update_search_accountDana(state, val) {
|
||||
state.search_accountDana = val;
|
||||
},
|
||||
update_load_status_accDana(state, val) {
|
||||
state.load_status_accDana = val;
|
||||
},
|
||||
update_accountBiayaList(state, val) {
|
||||
state.accountBiayaList = val;
|
||||
},
|
||||
update_selected_accountBiaya(state, val) {
|
||||
state.selected_accountBiaya = val;
|
||||
},
|
||||
update_search_accountBiaya(state, val) {
|
||||
state.search_accountBiaya = val;
|
||||
},
|
||||
update_load_status_accBiaya(state, val) {
|
||||
state.load_status_accBiaya = val;
|
||||
},
|
||||
update_accountTempList(state, val) {
|
||||
state.accountTempList = val;
|
||||
},
|
||||
update_selected_accountTemp(state, val) {
|
||||
state.selected_accountTemp = val;
|
||||
},
|
||||
update_search_accountTemp(state, val) {
|
||||
state.search_accountTemp = val;
|
||||
},
|
||||
update_load_status_accTemp(state, val) {
|
||||
state.load_status_accTemp = val;
|
||||
},
|
||||
update_load_status(state, val) {
|
||||
state.load_status = val;
|
||||
},
|
||||
update_purchaseList(state, val) {
|
||||
state.purchaseList = val;
|
||||
},
|
||||
update_selected_purchase(state, val) {
|
||||
state.selected_purchase = val;
|
||||
},
|
||||
update_resume_total(state, val) {
|
||||
state.resume_total = val;
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val;
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val;
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val;
|
||||
},
|
||||
update_success_message(state, val) {
|
||||
state.success_message = val;
|
||||
},
|
||||
update_totalApproved(state, val) {
|
||||
state.totalApproved = val
|
||||
},
|
||||
update_search_status_detail(state, val) {
|
||||
state.search_status_detail = val;
|
||||
},
|
||||
update_details(state, val) {
|
||||
state.details = val
|
||||
},
|
||||
update_dialog_account_item(state, val) {
|
||||
state.dialog_account_item = val
|
||||
},
|
||||
update_list_voucher_detail(state, val) {
|
||||
state.list_voucher_detail = val
|
||||
},
|
||||
update_list_accitem(state, val) {
|
||||
state.list_accitem = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
context.commit("update_search_status", 1);
|
||||
|
||||
try {
|
||||
var prm = {
|
||||
token: one_token(),
|
||||
currentPage: context.state.currentPage,
|
||||
status: context.state.selected_status.text,
|
||||
search: context.state.xsearch,
|
||||
startdate: context.state.xStartDate,
|
||||
enddate: context.state.xEndDate,
|
||||
lastId: -1,
|
||||
};
|
||||
|
||||
let resp = await api.search(prm);
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3);
|
||||
context.commit("update_search_error_message", resp.message);
|
||||
} else {
|
||||
context.commit("update_search_status", 2);
|
||||
context.commit("update_search_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total,
|
||||
};
|
||||
|
||||
context.commit("update_voucherList", data.records);
|
||||
context.commit("update_total_page_voucher", data.total);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3);
|
||||
context.commit("update_search_error_message", e.message);
|
||||
}
|
||||
},
|
||||
|
||||
async searchBranch(context, prm) {
|
||||
context.commit("update_load_status_branch", 1)
|
||||
try {
|
||||
let resp = await api.searchBranch(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status_branch", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_load_status_branch", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_branchList", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_load_status_branch", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async searchAccDana(context, prm) {
|
||||
context.commit("update_load_status_accDana", 1)
|
||||
try {
|
||||
let resp = await api.searchAccDana(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status_accDana", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_load_status_accDana", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_accountDanaList", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_load_status_accDana", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async searchAccBiaya(context, prm) {
|
||||
context.commit("update_load_status_accBiaya", 1)
|
||||
try {
|
||||
let resp = await api.searchAccBiaya(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status_accBiaya", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_load_status_accBiaya", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_accountBiayaList", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_load_status_accBiaya", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async searchAccTemp(context, prm) {
|
||||
context.commit("update_load_status_accTemp", 1)
|
||||
try {
|
||||
let resp = await api.searchAccTemp(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status_accTemp", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_load_status_accTemp", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_accountTempList", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_load_status_accTemp", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async getPurchase(context, prm) {
|
||||
context.commit("update_load_status", 1)
|
||||
try {
|
||||
let resp = await api.getPurchase(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_load_status", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_purchaseList", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_load_status", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async searchdetail(context, prm) {
|
||||
context.commit("update_search_status_detail", 1)
|
||||
try {
|
||||
let resp = await api.searchdetail(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status_detail", 3)
|
||||
context.commit("update_search_error_message", resp.message);
|
||||
} else {
|
||||
context.commit("update_search_status_detail", 2)
|
||||
context.commit("update_search_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_details", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status_detail", 3)
|
||||
context.commit("update_search_error_message", e.message);
|
||||
}
|
||||
},
|
||||
|
||||
async save(context, prm) {
|
||||
context.commit("update_search_status_detail", 1)
|
||||
try {
|
||||
|
||||
let resp = await api.saveDetail(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status_detail", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_search_status_detail", 2)
|
||||
context.commit("update_error_message", resp.message);
|
||||
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_alert_success", true);
|
||||
context.commit("update_dialog_voucher", false);
|
||||
var msg = `Sukses menyimpan data baru dengan kode ${data.records[0].PaymentVoucherNumber}`;
|
||||
context.commit("update_success_message", msg);
|
||||
context.commit("update_selected_voucher", data.records[0]);
|
||||
context.dispatch("search");
|
||||
context.dispatch("searchdetail", data.records[0].PaymentVoucherID);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status_detail", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async getTotalApproved(context, prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
let resp = await api.getTotalApproved(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_totalApproved", data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
}
|
||||
},
|
||||
|
||||
async delete(context, prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
|
||||
let resp = await api.deleteVoucher(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_error_message", resp.message);
|
||||
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_alert_success", true);
|
||||
context.commit("update_dialog_voucher", false);
|
||||
var msg = `Sukses menghapus data dengan kode ` + prm.PVNumber;
|
||||
context.commit("update_success_message", msg);
|
||||
// context.commit("update_selected_voucher", data.records[0]);
|
||||
context.dispatch("search");
|
||||
context.dispatch("searchdetail", "");
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async update(context, prm) {
|
||||
context.commit("update_search_status_detail", 1)
|
||||
try {
|
||||
|
||||
let resp = await api.editVoucher(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status_detail", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_search_status_detail", 2)
|
||||
context.commit("update_error_message", resp.message);
|
||||
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_alert_success", true);
|
||||
context.commit("update_dialog_voucher", false);
|
||||
var msg = `Sukses edit data dengan kode ${data.records[0].PaymentVoucherNumber}`;
|
||||
context.commit("update_success_message", msg);
|
||||
context.commit("update_selected_voucher", data.records[0]);
|
||||
context.dispatch("search");
|
||||
context.dispatch("searchdetail", data.records[0].PaymentVoucherID);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status_detail", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async getPurchaseUpdateNew(context, prm) {
|
||||
context.commit("update_load_status", 1)
|
||||
try {
|
||||
let resp = await api.getPurchaseUpdateNew(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_load_status", 3)
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_load_status", 2)
|
||||
context.commit("update_error_message", "");
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_purchaseList", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_load_status", 3)
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async getVoucherDetailItem(context, param) {
|
||||
try {
|
||||
param.token = one_token()
|
||||
let resp = await api.getVoucherDetailItem(param)
|
||||
if (resp.status != 'OK') {
|
||||
context.commit("update_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_list_voucher_detail", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_error_message", error.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async searchAccountItem(context, prm) {
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchAccBiaya(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_error_message", "");
|
||||
context.commit("update_list_accitem", resp.data.records);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async saveAccountItem(context, headerID) {
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
PRDID: headerID,
|
||||
detail: context.state.list_voucher_detail
|
||||
}
|
||||
|
||||
let resp = await api.saveAccountItem(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
context.commit("update_alert_success", true);
|
||||
context.commit("update_success_message", "Success");
|
||||
|
||||
let ID = context.state.selected_voucher.PaymentVoucherID
|
||||
context.dispatch("searchdetail", ID)
|
||||
|
||||
context.commit("update_list_voucher_detail", []);
|
||||
context.commit("update_dialog_account_item", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_error_message", e.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
},
|
||||
|
||||
async moveTokasir(context) {
|
||||
try {
|
||||
let prm = {
|
||||
token: one_token(),
|
||||
ID: context.state.selected_voucher.PaymentVoucherID
|
||||
}
|
||||
let resp = await api.moveToKasir(prm)
|
||||
if (resp.status != 'OK') {
|
||||
context.commit("update_error_message", resp.message);
|
||||
context.commit("update_alert_error", true);
|
||||
} else {
|
||||
|
||||
let ID = context.state.selected_voucher.PaymentVoucherID
|
||||
context.dispatch("searchdetail", ID)
|
||||
|
||||
context.commit("update_alert_success", true);
|
||||
context.commit("update_success_message", "Success");
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_error_message", error.message);
|
||||
context.commit("update_alert_error", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
11
test/vuex/acc-one-payment-voucher/store.js
Normal file
11
test/vuex/acc-one-payment-voucher/store.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import voucher from "./modules/voucher.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
voucher: voucher,
|
||||
system: system,
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
});
|
||||
Reference in New Issue
Block a user