add modules folder based on s_menu
This commit is contained in:
81
test/vuex/acc-one-supplier-payment-approved-v4/api/api.js
Normal file
81
test/vuex/acc-one-supplier-payment-approved-v4/api/api.js
Normal file
@@ -0,0 +1,81 @@
|
||||
const URL = "/one-api/mockup/supplierpaymentapprovedv3/billv2/";
|
||||
|
||||
export async function search(params) {
|
||||
try {
|
||||
const response = await axios.post(URL + "search", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
const data = response.data
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchDetail(params) {
|
||||
try {
|
||||
const response = await axios.post(URL + "searchDetail", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
const data = response.data
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserApproveLevel(params) {
|
||||
try {
|
||||
const response = await axios.post(URL + "getUserApproveLevel", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
const data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateStatusPayment(params) {
|
||||
try {
|
||||
const response = await axios.post(URL + "updateStatusPayment", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
const data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_detail" persistent width="85vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
DETAIL PAYMENT INSTRUCTION {{ selected_payment.SupplierPaymentNumber ?? "" }}
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Nomor Payment</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selected_payment.SupplierPaymentNumber }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Tanggal</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">
|
||||
: {{ selected_payment.SupplierPaymentDate }}
|
||||
</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Nomor PI</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selected_payment.SupplierInvoiceNumber }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Supplier</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selected_payment.SupplierName }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Tanggal Rencana Bayar</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">
|
||||
: {{ selected_payment.SupplierInvoiceDraftPaymentDate }}
|
||||
</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Total Bayar</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">
|
||||
: Rp. {{ formatCurrency(selected_payment.SupplierPaymentAmount) }}
|
||||
</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider class="my-1"></v-divider>
|
||||
<div class="mt-2">
|
||||
<v-data-table
|
||||
:headers="headers" :items="payment_items.detail"
|
||||
hide-actions class="elevation-1"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierInvoiceDetailQty }}</td>
|
||||
<td class="text-xs-center">
|
||||
Rp. {{ formatCurrency(props.item.SupplierInvoiceDetailPrice) }}
|
||||
</td>
|
||||
<td class="text-xs-center">
|
||||
Rp. {{ formatCurrency(props.item.SupplierInvoiceDetailDiscountAmount) }}
|
||||
</td>
|
||||
<td class="text-xs-center">
|
||||
Rp. {{ formatCurrency(props.item.DiscountedPrice) }}
|
||||
</td>
|
||||
<td class="text-xs-center">
|
||||
Rp. {{ formatCurrency(props.item.SupplierInvoiceDetailTotal) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">SUBTOTAL</strong>
|
||||
</td>
|
||||
<td :colspan="2" class="text-xs-right">
|
||||
<strong>
|
||||
Rp. {{ formatCurrency(payment_items.SupplierInvoiceSubTotal) }}
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="payment_items.SupplierInvoiceShippingCost > 0.00">
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">BIAYA PENGIRIMAN</strong>
|
||||
</td>
|
||||
<td :colspan="2" class="text-xs-right">
|
||||
<strong>
|
||||
Rp. {{ formatCurrency(payment_items.SupplierInvoiceShippingCost) }}
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">DISKON</strong>
|
||||
</td>
|
||||
<td :colspan="2" class="text-xs-right">
|
||||
<v-chip
|
||||
v-if="payment_items.SupplierInvoiceDiscountPercent > 0.00" label
|
||||
>{{ payment_items.SupplierInvoiceDiscountPercent }} %</v-chip>
|
||||
<strong>
|
||||
Rp. {{ formatCurrency(payment_items.SupplierInvoiceDiscountAmount) }}
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">PAJAK</strong>
|
||||
</td>
|
||||
<td :colspan="2" class="text-xs-right">
|
||||
<v-chip
|
||||
v-if="payment_items.SupplierInvoiceTaxPercentPpn > 0.00" label
|
||||
>{{ payment_items.SupplierInvoiceTaxPercentPpn }} %</v-chip>
|
||||
<strong>
|
||||
Rp. {{ formatCurrency(payment_items.SupplierInvoiceTaxAmountPpn) }}
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">GRAND TOTAL</strong>
|
||||
</td>
|
||||
<td :colspan="2" class="text-xs-right">
|
||||
<strong>
|
||||
Rp. {{ formatCurrency(payment_items.SupplierInvoiceGrandTotal) }}
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" outline flat @click="dialog_detail = false">TUTUP</v-btn>
|
||||
<v-btn
|
||||
v-show="operation_mode == 'update'"
|
||||
color="success" outline flat
|
||||
@click="updateStatusPayment()"
|
||||
>
|
||||
{{ userinfo.level == '1'
|
||||
? "VERIFIKASI"
|
||||
: "APPROVE"
|
||||
}}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.label-value subheading mb-2 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "M_ItemCode", width: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "QTY", align: "center", sortable: false,
|
||||
value: "PoQty", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA", align: "center", sortable: false,
|
||||
value: "price", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DISKON", align: "center", sortable: false,
|
||||
value: "price", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA SETELAH DISKON", align: "center", sortable: false,
|
||||
value: "price", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL", align: "center", sortable: false,
|
||||
value: "Total", width: "15%", class: "blue lighten-3 white--text",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_detail: {
|
||||
get() {
|
||||
return this.$store.state.suppayment.dialog_detail;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suppayment/update_dialog_detail", val);
|
||||
}
|
||||
},
|
||||
selected_payment: {
|
||||
get() {
|
||||
return this.$store.state.suppayment.selected_payment;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suppayment/update_selected_payment", val);
|
||||
}
|
||||
},
|
||||
payment_items() {
|
||||
return this.$store.state.suppayment.payment_items;
|
||||
},
|
||||
userinfo() {
|
||||
return this.$store.state.suppayment.userinfo
|
||||
},
|
||||
operation_mode() {
|
||||
return this.$store.state.suppayment.operation_mode;
|
||||
},
|
||||
operation_loading() {
|
||||
return this.$store.state.suppayment.operation_loading;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatCurrency(value) {
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num)) return 0;
|
||||
return num.toFixed(2).replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
},
|
||||
updateStatusPayment() {
|
||||
let loading = this.operation_loading;
|
||||
if (loading) {
|
||||
const snack = { state: true, color: 'warning', message: 'proses masih berjalan' }
|
||||
this.$store.commit("suppayment/update_snackbar", snack)
|
||||
} else {
|
||||
this.$store.dispatch("suppayment/updateStatus")
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">PAYMENT APPROVAL</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="pa-2">
|
||||
<v-layout row align-center>
|
||||
<v-flex xs3>
|
||||
<v-menu
|
||||
v-model="menuStartdateFilter" offset-y lazy min-width="290px"
|
||||
transition="scale-transition" max-width="290px" full-width
|
||||
:nudge-right="40" :close-on-content-click="false"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="formattedStartdate" label="Tanggal Awal"
|
||||
hide-details readonly v-on="on" outline
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
v-model="filterpay.startdate" no-title
|
||||
@input="menuStartdateFilter = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-menu
|
||||
v-model="menuEnddatefilter" offset-y lazy min-width="290px"
|
||||
transition="scale-transition" max-width="290px" full-width
|
||||
:nudge-right="40" :close-on-content-click="false"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="formattedEnddate" label="Tanggal Akhir"
|
||||
hide-details readonly v-on="on" outline
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
v-model="filterpay.enddate" no-title
|
||||
@input="menuEnddatefilter = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-autocomplete
|
||||
:items="list_status" hide-details outline
|
||||
v-model="filterpay.status" label="Status"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-text-field
|
||||
v-model="filterpay.search" hide-details outline
|
||||
label="Cari" placeholder="No. PI / Pembayaran"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<v-card class="pa-2 mt-2">
|
||||
<v-data-table
|
||||
:headers="headers" class="elevation-1"
|
||||
:items="list_payment.records" hide-actions
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center">{{ props.item.SupplierInvoiceNumber }}</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierPaymentDate }}</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierInvoiceDraftPaymentDate }}</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierPaymentNumber }}</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierName }}</td>
|
||||
<td class="text-xs-center">
|
||||
Rp. {{ formatCurrency(props.item.SupplierPaymentAmount) }}
|
||||
</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierPaymentStatus }}</td>
|
||||
<td class="text-xs-center">
|
||||
<v-layout align-center justify-center row>
|
||||
<v-flex shrink pr-1>
|
||||
<v-btn color="info" @click="viewDetail(props.item)" small>
|
||||
DETAIL
|
||||
<v-icon small right>list_alt</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-flex pl-1 v-if="props.item.SupplierPaymentStatus != 'Approved'">
|
||||
<v-btn
|
||||
color="success" @click="updateStatusPayment(props.item)"
|
||||
:disabled="userinfo.level != '1'" small
|
||||
:outline="props.item.SupplierPaymentIsVerif != 'Y'"
|
||||
>
|
||||
{{ props.item.SupplierPaymentIsVerif != 'Y'
|
||||
? "VERIFIKASI"
|
||||
: "VERIFIED"
|
||||
}}
|
||||
<v-icon small right>done</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="success" @click="updateStatusPayment(props.item)"
|
||||
:disabled="userinfo.level != '2'" small
|
||||
:outline="props.item.SupplierPaymentIsApproved != 'Y'"
|
||||
>
|
||||
APPROVE
|
||||
<v-icon small right>done_all</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider class="my-1"></v-divider>
|
||||
<div class="pa-2 mt-1 text-xs-center">
|
||||
<v-pagination
|
||||
v-model="currentpage" :length="datarowlength"
|
||||
:total-visible="10"
|
||||
></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<v-snackbar v-model="snackbar.state" multi-line top :timeout="3000" :color="snackbar.color">
|
||||
{{ snackbar.message }}
|
||||
<v-btn class="ml-2" round flat @click="snackbar.state = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<dialog-detail></dialog-detail>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'dialog-detail': httpVueLoader('./dialog-detail.vue'),
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("suppayment/lookupUserApproveLevel");
|
||||
this.$store.dispatch("suppayment/lookupPayment");
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartdateFilter: false,
|
||||
menuEnddatefilter: false,
|
||||
headers: [
|
||||
{
|
||||
text: "NO TAGIHAN", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TANGGAL", align: "center", sortable: false,
|
||||
value: "no", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TANGGAL RENCANA BAYAR", align: "center", sortable: false,
|
||||
value: "no", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NO. INSTRUKSI", align: "center", sortable: false,
|
||||
value: "no",width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "SUPPLIER", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL BAYAR", align: "center", sortable: false,
|
||||
value: "", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS", align: "center", sortable: false,
|
||||
value: "", width: "5%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filterpay: {
|
||||
get() {
|
||||
return this.$store.state.suppayment.filterpay;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suppayment/update_filterpay", val);
|
||||
}
|
||||
},
|
||||
currentpage: {
|
||||
get() {
|
||||
return this.$store.state.suppayment.currentpage;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suppayment/update_currentpage", val);
|
||||
this.$store.dispatch("suppayment/lookupPayment");
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.suppayment.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("suppayment/update_snackbar", val)
|
||||
}
|
||||
},
|
||||
formattedStartdate() {
|
||||
return this.formatDate(this.filterpay.startdate);
|
||||
},
|
||||
formattedEnddate() {
|
||||
return this.formatDate(this.filterpay.enddate);
|
||||
},
|
||||
list_status() {
|
||||
return this.$store.state.suppayment.list_status;
|
||||
},
|
||||
list_payment() {
|
||||
return this.$store.state.suppayment.list_payment;
|
||||
},
|
||||
datarowlength() {
|
||||
const total = this.list_payment.total;
|
||||
if (total === undefined || total < 1) return 1;
|
||||
return Math.ceil(total/5);
|
||||
},
|
||||
userinfo() {
|
||||
return this.$store.state.suppayment.userinfo
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split('-');
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
formatCurrency(value) {
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num)) return 0;
|
||||
return num.toFixed(2).replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
},
|
||||
viewDetail(item) {
|
||||
this.$store.commit("suppayment/update_operation_mode", 'view');
|
||||
this.$store.commit("suppayment/update_selected_payment", item);
|
||||
this.$store.dispatch("suppayment/lookupPaymentItem");
|
||||
this.$store.commit("suppayment/update_dialog_detail", true);
|
||||
},
|
||||
updateStatusPayment(item) {
|
||||
if (item.SupplierPaymentIsVerif == 'Y' && this.userinfo == "1") {
|
||||
const snack = { state: true, color: 'info', message: 'sudah diverifikasi' };
|
||||
this.snackbar = snack;
|
||||
return;
|
||||
}
|
||||
|
||||
this.$store.commit("suppayment/update_operation_mode", 'update');
|
||||
this.$store.commit("suppayment/update_selected_payment", item);
|
||||
this.$store.dispatch("suppayment/lookupPaymentItem");
|
||||
this.$store.commit("suppayment/update_dialog_detail", true);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterpay: {
|
||||
handler(val) {
|
||||
this.$store.dispatch("suppayment/lookupPayment")
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
60
test/vuex/acc-one-supplier-payment-approved-v4/index.php
Normal file
60
test/vuex/acc-one-supplier-payment-approved-v4/index.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<!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="px-1 py-2">
|
||||
<v-flex xs12 fill-height pa-1>
|
||||
<one-main-content></one-main-content>
|
||||
</v-flex>
|
||||
</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-main-content': httpVueLoader('./components/one-main-content.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,138 @@
|
||||
import * as api from '../api/api.js';
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
snackbar: { state: false, color: 'error', message: "" },
|
||||
userinfo: {},
|
||||
filterpay: {
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
status: "All",
|
||||
search: ""
|
||||
},
|
||||
list_status: ['All', 'Draft', 'Verified', 'Approved', 'Rejected', 'Completed'],
|
||||
list_payment: { records: [], total: 1 },
|
||||
currentpage: 1,
|
||||
|
||||
selected_payment: {},
|
||||
payment_items: {},
|
||||
dialog_detail: false,
|
||||
operation_mode: 'view',
|
||||
operation_loading: false
|
||||
},
|
||||
mutations: {
|
||||
update_userinfo(state, val) {
|
||||
state.userinfo = val
|
||||
},
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_filterpay(state, val) {
|
||||
state.filterpay = val
|
||||
},
|
||||
update_list_status(state, val) {
|
||||
state.list_status = val
|
||||
},
|
||||
update_list_payment(state, val) {
|
||||
state.list_payment = val
|
||||
},
|
||||
update_currentpage(state, val) {
|
||||
state.currentpage = val
|
||||
},
|
||||
update_selected_payment(state, val) {
|
||||
state.selected_payment = val
|
||||
},
|
||||
update_payment_items(state, val) {
|
||||
state.payment_items = val
|
||||
},
|
||||
update_dialog_detail(state, val) {
|
||||
state.dialog_detail = val
|
||||
},
|
||||
update_operation_mode(state, val) {
|
||||
state.operation_mode = val
|
||||
},
|
||||
update_operation_loading(state, val) {
|
||||
state.operation_loading = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookupUserApproveLevel(context) {
|
||||
try {
|
||||
const resp = await api.getUserApproveLevel({token: one_token()});
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
} else {
|
||||
context.commit('update_userinfo', resp.data);
|
||||
}
|
||||
} catch (error) {
|
||||
const snack = { state: true, color: 'error', message: error.message }
|
||||
context.commit("update_snackbar", snack)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupPayment(context) {
|
||||
try {
|
||||
let param = {
|
||||
...context.state.filterpay,
|
||||
currentpage: context.state.currentpage,
|
||||
token: one_token()
|
||||
}
|
||||
const resp = await api.search(param)
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
} else {
|
||||
context.commit("update_list_payment", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
const snack = { state: true, color: 'error', message: error.message }
|
||||
context.commit("update_snackbar", snack)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupPaymentItem(context) {
|
||||
try {
|
||||
let param = {
|
||||
token: one_token(),
|
||||
paymentID: context.state.selected_payment.SupplierPaymentID
|
||||
};
|
||||
|
||||
const resp = await api.searchDetail(param);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
} else {
|
||||
context.commit("update_payment_items", resp.data);
|
||||
}
|
||||
} catch (error) {
|
||||
const snack = { state: true, color: 'error', message: error.message }
|
||||
context.commit("update_snackbar", snack)
|
||||
}
|
||||
},
|
||||
|
||||
async updateStatus(context) {
|
||||
try {
|
||||
context.state.operation_loading = true
|
||||
let param = {
|
||||
token: one_token(),
|
||||
userlevel: context.state.userinfo.level ?? "0",
|
||||
paymentID: context.state.selected_payment.SupplierPaymentID
|
||||
}
|
||||
|
||||
const resp = await api.updateStatusPayment(param)
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
} else {
|
||||
const snack = { state: true, color: 'success', message: resp.data }
|
||||
context.commit("update_snackbar", snack)
|
||||
|
||||
context.dispatch("lookupPayment")
|
||||
context.state.operation_loading = false
|
||||
context.state.dialog_detail = false
|
||||
}
|
||||
} catch (error) {
|
||||
const snack = { state: true, color: 'error', message: error.message }
|
||||
context.commit("update_snackbar", snack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
test/vuex/acc-one-supplier-payment-approved-v4/store.js
Normal file
11
test/vuex/acc-one-supplier-payment-approved-v4/store.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import system from '../../../apps/modules/system/system.js';
|
||||
import suppayment from './modules/suppayment.js';
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
suppayment: suppayment
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {}
|
||||
})
|
||||
Reference in New Issue
Block a user