add modules folder based on s_menu
This commit is contained in:
101
test/vuex/acc-one-penyesuaian-harga/api/api.js
Normal file
101
test/vuex/acc-one-penyesuaian-harga/api/api.js
Normal file
@@ -0,0 +1,101 @@
|
||||
const URL = "/one-api/mockup/purchase/cashier/PurchaseRequestDirectAdjusment/";
|
||||
|
||||
export async function search(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "search", 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 searchDetail(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "searchDetail", 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 updateAdjusment(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "updateAdjustment", 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 approveRealisasi(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "approveRealisasi", 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 getListAccount(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getListAccount", 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_adjustment" persistent max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
FORM PENAMBAHAN HARGA
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form ref="formAdj" v-model="validationAdj" lazy-validation>
|
||||
<v-text-field
|
||||
v-model="formatted_original" label="Harga Awal"
|
||||
required outline hide-details prefix="Rp. " readonly
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="formatted_adjustment" label="Harga Tambahan"
|
||||
required outline hide-details prefix="Rp ." class="mt-2"
|
||||
@blur="onBlurInput" @focus="onFocusInput"
|
||||
></v-text-field>
|
||||
<v-autocomplete
|
||||
v-model="selected_account" :items="list_account" outline
|
||||
label="Account Tambahan" hide-details class="mt-2"
|
||||
item-text="coaDescription" item-value="coaAccountNo"
|
||||
>
|
||||
<template slot="item" slot-scope="{item}">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>{{ item.coaDescription }}</v-list-tile-title>
|
||||
<v-list-tile-sub-title>{{ item.coaSubDescription }}</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="cancelAdjusment()" outline>Batal</v-btn>
|
||||
<v-btn color="primary" @click="simpanAdjustment()" dark>Simpan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
validationAdj: false,
|
||||
price_original: 0,
|
||||
price_adjustment: 0,
|
||||
rules: [v => !!v || "tidak boleh kosong"]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_adjustment: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dialog_adjustment;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dialog_adjustment", val);
|
||||
}
|
||||
},
|
||||
formatted_original() {
|
||||
return this.price_original;
|
||||
},
|
||||
formatted_adjustment: {
|
||||
get() {
|
||||
return this.price_adjustment;
|
||||
},
|
||||
set(val) {
|
||||
const raw = val.replace(/\./g, '').replace(',', '.');
|
||||
this.selected_detail_voucher.PurchaseRequestDirectAdjustment = Number(raw);
|
||||
}
|
||||
},
|
||||
selected_detail_voucher: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_detail_voucher;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_detail_voucher", val);
|
||||
}
|
||||
},
|
||||
selected_account: {
|
||||
get() {
|
||||
return this.selected_detail_voucher.PurchaseRequestDirectAdjustmentAccount
|
||||
},
|
||||
set(val) {
|
||||
this.selected_detail_voucher.PurchaseRequestDirectAdjustmentAccount = val
|
||||
}
|
||||
},
|
||||
list_account() {
|
||||
return this.$store.state.voucher.list_account
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
oneMoney(value) {
|
||||
let splitvalue = value.toString().split(".");
|
||||
if (splitvalue.length > 1) {
|
||||
const real = splitvalue[0];
|
||||
const deci = parseInt(splitvalue[1], 10);
|
||||
|
||||
let decimal = 0
|
||||
if (isNaN(deci) || deci <= 0) {
|
||||
decimal = '00';
|
||||
} else {
|
||||
const scale = 10 ** splitvalue[1].length;
|
||||
decimal = Math.round((deci / scale) * 100);
|
||||
}
|
||||
|
||||
return real.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + decimal;
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
onBlurInput() {
|
||||
const price_adjst = this.selected_detail_voucher.PurchaseRequestDirectAdjustment;
|
||||
this.price_adjustment = this.oneMoney(price_adjst);
|
||||
},
|
||||
onFocusInput() {
|
||||
const price_adjst = this.selected_detail_voucher.PurchaseRequestDirectAdjustment;
|
||||
this.price_adjustment = price_adjst.toString().replace('.', ',');
|
||||
},
|
||||
cancelAdjusment() {
|
||||
this.price_adjustment = 0;
|
||||
this.price_original = 0;
|
||||
this.selected_detail_voucher = {};
|
||||
|
||||
this.$refs.formAdj.resetValidation();
|
||||
this.dialog_adjustment = false;
|
||||
},
|
||||
simpanAdjustment() {
|
||||
if (this.$refs.formAdj.validate()) {
|
||||
this.$store.dispatch("voucher/updateAdjusment");
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialog_adjustment(val) {
|
||||
if (val) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formAdj?.resetValidation();
|
||||
const detail = this.selected_detail_voucher
|
||||
this.price_original = this.oneMoney(detail.PaymentVoucherDetailTotal);
|
||||
this.price_adjustment = this.oneMoney(detail.PurchaseRequestDirectAdjustment);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<div style="width: 100%;" class="pa-1">
|
||||
<v-card class="pa-2">
|
||||
<v-layout row>
|
||||
<v-flex xs class="pr-1">
|
||||
<p class="mb-0">
|
||||
Nomor:
|
||||
<strong>{{ selected_voucher.PaymentVoucherNumber ?? "-" }}</strong>
|
||||
</p>
|
||||
<p class="mb-0">
|
||||
Sumber Dana:
|
||||
<strong>{{ selected_voucher.coaDescriptionSource ?? "-" }}</strong>
|
||||
</p>
|
||||
<p class="mb-0">
|
||||
Tampungan Sementara:
|
||||
<strong>{{ selected_voucher.coaDescriptionTemporary ?? "-" }}</strong>
|
||||
</p>
|
||||
</v-flex>
|
||||
<v-flex shrink class="pl-1">
|
||||
<v-btn
|
||||
v-if="selected_voucher.PaymentVoucherRealitationApproved == 'N'"
|
||||
color="primary" outline
|
||||
@click="approveRealisasi()"
|
||||
>
|
||||
Verifikasi
|
||||
</v-btn>
|
||||
<v-btn v-else dark color="primary" @click="{}">Verfified</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-data-table
|
||||
:items="list_detail_voucher.records" :headers="headers"
|
||||
class="elevation-1 mt-2" hide-actions
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<tr>
|
||||
<td class="pa-2 text-xs-center">
|
||||
{{ props.index + 1 }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
{{ props.item.PurchaseRequestDirectNumber }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
Rp. {{ one_money(props.item.PaymentVoucherDetailTotal) }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
Rp. {{ one_money(props.item.PurchaseRequestDirectAdjustment) }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small color="blue lighten-2" @click="editDetailVoucher(props.item)"
|
||||
:disabled="selected_voucher.PaymentVoucherRealitationApproved == 'Y'"
|
||||
>
|
||||
<v-icon small color="info">edit</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="mt-2 text-xs-center">
|
||||
<v-pagination
|
||||
v-model="detail_table_page" :total-visible="10"
|
||||
:length="calcTableLength()"
|
||||
></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<dialog-edit></dialog-edit>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar.isOpen" :timeout="3000" :multi-line="false"
|
||||
:vertical="false" :top="true" :color="snackbar.color"
|
||||
>
|
||||
{{ snackbar.message }}
|
||||
<v-btn class="px-2" flat @click="snackbar.isOpen = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
module.exports = {
|
||||
components: {
|
||||
'dialog-edit': httpVueLoader('./adjustment_form.vue'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "NO", align: "center", sortable: false,
|
||||
value: "no", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NOMOR REQUEST", align: "center", sortable: false,
|
||||
value: "supplier", width: "35%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL", align: "center", sortable: false,
|
||||
value: "total", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TAMBAHAN", align: "center", sortable: false,
|
||||
value: "total", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "status", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
selected_voucher() {
|
||||
return this.$store.state.voucher.selected_voucher;
|
||||
},
|
||||
list_detail_voucher() {
|
||||
return this.$store.state.voucher.list_detail_voucher;
|
||||
},
|
||||
detail_table_page: {
|
||||
get() {
|
||||
return this.$store.state.voucher.detail_table_page;
|
||||
},
|
||||
set(val) {
|
||||
this,$store.commit("voucher/update_detail_table_page", val);
|
||||
this.$store.dispatch("voucher/searchDetail");
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.voucher.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_snackbar", val);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
one_money(value) {
|
||||
let splitValue = value.toString().split(".");
|
||||
|
||||
if(splitValue.length > 1) {
|
||||
let val = splitValue[0]
|
||||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundtoThreeDecimal(splitValue[1]);
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
roundtoThreeDecimal(digit) {
|
||||
const num = parseInt(digit, 10)
|
||||
if (isNaN(num) || num <= 0) {
|
||||
return '00';
|
||||
}
|
||||
|
||||
const scale = 10 ** digit.length;
|
||||
const decimal = num / scale;
|
||||
return Math.round(decimal * 100);
|
||||
},
|
||||
calcTableLength() {
|
||||
const total = this.list_detail_voucher.total;
|
||||
if (total == undefined || total == 0) return 1;
|
||||
return Math.ceil(total/10);
|
||||
},
|
||||
editDetailVoucher(item) {
|
||||
this.$store.commit("voucher/update_selected_detail_voucher", item)
|
||||
this.$store.commit("voucher/update_dialog_adjustment", true);
|
||||
},
|
||||
approveRealisasi() {
|
||||
this.$store.dispatch("voucher/approveRealisasi")
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div style="width: 100%;" class="pa-1">
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">APPROVE REALISASI</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="pa-2">
|
||||
<v-layout row>
|
||||
<v-flex xs class="pr-1">
|
||||
<v-menu
|
||||
:close-on-content-click="false" max-width="290px" full-width
|
||||
:nudge-right="40" lazy offset-y min width="290px"
|
||||
transition="scale-transition" v-model="menuStartDate"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
label="Tanggal Awal" v-model="formatted_startdate"
|
||||
outline v-on="on" hide-details readonly
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title v-model="filter.startdate"
|
||||
@input="menuStartDate = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-menu
|
||||
:close-on-content-click="false" max-width="290px" full-width
|
||||
:nudge-right="40" lazy offset-y min width="290px"
|
||||
transition="scale-transition" v-model="menuEndDate"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
label="Tanggal Akhir" v-model="formatted_enddate"
|
||||
outline v-on="on" hide-details readonly
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title v-model="filter.enddate"
|
||||
@input="menuEndDate = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-text-field
|
||||
label="Cari ..." placeholder="nomor"
|
||||
outline hide-details v-model="filter.search"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex shrink class="pl-1 self-end">
|
||||
<v-btn
|
||||
dark color="primary" @click="searchVoucher()"
|
||||
style="min-width: 50px; height: 50px; margin: 0"
|
||||
>
|
||||
<v-icon>search</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card class="mt-2 pa-2">
|
||||
<v-data-table
|
||||
:items="listing_voucher.records" :headers="headers"
|
||||
hide-actions class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<tr
|
||||
:class="{'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectVoucher(props.item)"
|
||||
>
|
||||
<td class="text-xs-left pa-2">
|
||||
<p class="mb-0 font-weight-bold">{{ props.item.PaymentVoucherNumber }}</p>
|
||||
<p class="mb-0 info--text mono font-weight-bold caption">
|
||||
{{ props.item.PaymentVoucherDate }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
<p class="mb-0">{{ props.item.M_BranchName }}</p>
|
||||
<p class="mb-0 font-weight-bold" style="color:#000000">
|
||||
Total : Rp {{ one_money(props.item.PaymentVoucherTotal) }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
{{ props.item.PaymentVoucherRealitationDate }}
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
<v-chip small>
|
||||
{{ props.item.PaymentVoucherRealitationApproved == "N" ? 'Not Verified' : 'Verified'}}
|
||||
</v-chip>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="mt-2 text-xs-center">
|
||||
<v-pagination
|
||||
v-model="main_table_page" :total-visible="5"
|
||||
:length="calcTableLength()"
|
||||
></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
mounted() {
|
||||
this.$store.dispatch("voucher/search")
|
||||
this.$store.dispatch("voucher/getListAccount")
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
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: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS", align: "left", sortable: false,
|
||||
value: "status", width: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filter: {
|
||||
get() {
|
||||
return this.$store.state.voucher.filter;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_filter", val);
|
||||
}
|
||||
},
|
||||
main_table_page: {
|
||||
get() {
|
||||
return this.$store.state.voucher.main_table_page;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_main_table_page", val);
|
||||
this.$store.dispatch("voucher/search");
|
||||
}
|
||||
},
|
||||
selected_voucher() {
|
||||
return this.$store.state.voucher.selected_voucher;
|
||||
},
|
||||
listing_voucher() {
|
||||
return this.$store.state.voucher.listing_voucher;
|
||||
},
|
||||
formatted_startdate() {
|
||||
return this.formatDate(this.filter.startdate);
|
||||
},
|
||||
formatted_enddate() {
|
||||
return this.formatDate(this.filter.enddate);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
one_money(value) {
|
||||
let splitValue = value.toString().split(".");
|
||||
|
||||
if(splitValue.length > 1) {
|
||||
let val = splitValue[0]
|
||||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundtoThreeDecimal(splitValue[1]);
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
roundtoThreeDecimal(digit) {
|
||||
const num = parseInt(digit, 10)
|
||||
if (isNaN(num) || num <= 0) {
|
||||
return '00';
|
||||
}
|
||||
|
||||
const scale = 10 ** digit.length;
|
||||
const decimal = num / scale
|
||||
return Math.round(decimal * 100);
|
||||
},
|
||||
searchVoucher() {
|
||||
this.$store.dispatch("voucher/search")
|
||||
},
|
||||
isSelected(item) {
|
||||
let selected = this.selected_voucher
|
||||
|
||||
if (selected) {
|
||||
return (item.PaymentVoucherNumber == selected.PaymentVoucherNumber);
|
||||
}
|
||||
},
|
||||
selectVoucher(item) {
|
||||
this.$store.commit("voucher/update_selected_voucher", item);
|
||||
this.$store.dispatch("voucher/searchDetail")
|
||||
},
|
||||
calcTableLength() {
|
||||
const total = this.listing_voucher.total;
|
||||
if (total == undefined || total == 0) return 1;
|
||||
return Math.ceil(total / 8);
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
68
test/vuex/acc-one-penyesuaian-harga/index.php
Normal file
68
test/vuex/acc-one-penyesuaian-harga/index.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<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 || Penyesuaian Harga</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>
|
||||
<one-listing></one-listing>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="right" fill-height pa-1>
|
||||
<one-detail></one-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'),
|
||||
'one-listing': httpVueLoader('./components/listing_voucher.vue'),
|
||||
'one-detail': httpVueLoader('./components/detail_voucher.vue'),
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
137
test/vuex/acc-one-penyesuaian-harga/modules/voucher.js
Normal file
137
test/vuex/acc-one-penyesuaian-harga/modules/voucher.js
Normal file
@@ -0,0 +1,137 @@
|
||||
import * as api from "../api/api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
filter: {
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
search: ''
|
||||
},
|
||||
listing_voucher: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
main_table_page: 1,
|
||||
selected_voucher: {},
|
||||
list_detail_voucher: {},
|
||||
list_account: [],
|
||||
detail_table_page: 1,
|
||||
selected_detail_voucher: {},
|
||||
dialog_adjustment: false,
|
||||
snackbar: {
|
||||
isOpen: false,
|
||||
color: 'info',
|
||||
message: ''
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
update_filter(state, val) {
|
||||
state.filter = val
|
||||
},
|
||||
update_selected_voucher(state, val) {
|
||||
state.selected_voucher = val
|
||||
},
|
||||
update_listing_voucher(state, val) {
|
||||
state.listing_voucher = val
|
||||
},
|
||||
update_main_table_page(state, val) {
|
||||
state.main_table_page = val
|
||||
},
|
||||
update_list_detail_voucher(state, val) {
|
||||
state.list_detail_voucher = val
|
||||
},
|
||||
update_detail_table_page(state, val) {
|
||||
state.detail_table_page = val
|
||||
},
|
||||
update_selected_detail_voucher(state, val) {
|
||||
state.selected_detail_voucher = val
|
||||
},
|
||||
update_dialog_adjustment(state, val) {
|
||||
state.dialog_adjustment = val
|
||||
},
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_list_account(state, val) {
|
||||
state.list_account = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context) {
|
||||
var param = {
|
||||
token: one_token(),
|
||||
page: context.state.main_table_page,
|
||||
...context.state.filter
|
||||
}
|
||||
|
||||
let resp = await api.search(param)
|
||||
if (resp.status != 'OK') {
|
||||
let snk = {isOpen: true, color: 'error', message: '[Error] ' + resp.message}
|
||||
context.commit("update_snackbar", snk)
|
||||
} else {
|
||||
context.commit("update_listing_voucher", resp.data)
|
||||
}
|
||||
},
|
||||
async searchDetail(context) {
|
||||
var param = {
|
||||
token: one_token(),
|
||||
ID: context.state.selected_voucher.PaymentVoucherID
|
||||
}
|
||||
let resp = await api.searchDetail(param)
|
||||
if (resp.status != 'OK') {
|
||||
let snk = {isOpen: true, color: 'error', message: '[Error] ' + resp.message}
|
||||
context.commit("update_snackbar", snk)
|
||||
} else {
|
||||
context.commit("update_list_detail_voucher", resp.data)
|
||||
}
|
||||
},
|
||||
async updateAdjusment(context) {
|
||||
var param = {
|
||||
token: one_token(),
|
||||
prd_id: context.state.selected_detail_voucher.PurchaseRequestDirectID,
|
||||
price_adj: context.state.selected_detail_voucher.PurchaseRequestDirectAdjustment,
|
||||
account_adj: context.state.selected_detail_voucher.PurchaseRequestDirectAdjustmentAccount
|
||||
}
|
||||
|
||||
let resp = await api.updateAdjusment(param)
|
||||
if (resp.status != 'OK') {
|
||||
let snk = {isOpen: true, color: 'error', message: '[Error] ' + resp.message}
|
||||
context.commit("update_snackbar", snk)
|
||||
} else {
|
||||
let snk = {isOpen: true, color: 'success', message: '[Succeed]'};
|
||||
context.commit("update_snackbar", snk)
|
||||
context.dispatch("searchDetail");
|
||||
context.commit("update_selected_detail_voucher", {});
|
||||
context.commit("update_dialog_adjustment", false);
|
||||
}
|
||||
},
|
||||
async approveRealisasi(context) {
|
||||
var param = {
|
||||
token: one_token(),
|
||||
ID: context.state.selected_voucher.PaymentVoucherID
|
||||
}
|
||||
|
||||
let resp = await api.approveRealisasi(param);
|
||||
if (resp.status != 'OK') {
|
||||
let snk = {isOpen: true, color: 'error', message: '[Error] ' + resp.message}
|
||||
context.commit("update_snackbar", snk)
|
||||
} else {
|
||||
let snk = {isOpen: true, color: 'success', message: '[Succeed]'};
|
||||
context.commit("update_snackbar", snk)
|
||||
context.dispatch("search");
|
||||
context.commit("update_selected_voucher", {})
|
||||
context.commit("update_list_detail_voucher", {})
|
||||
}
|
||||
},
|
||||
async getListAccount(context) {
|
||||
var resp = await api.getListAccount({token: one_token()})
|
||||
if (resp.status != 'OK') {
|
||||
let snk = {isOpen: true, color: 'error', message: '[Error] ' + resp.message}
|
||||
context.commit("update_snackbar", snk)
|
||||
} else {
|
||||
context.commit("update_list_account", resp.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
test/vuex/acc-one-penyesuaian-harga/store.js
Normal file
11
test/vuex/acc-one-penyesuaian-harga/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