add modules folder based on s_menu

This commit is contained in:
2026-06-30 10:16:11 +07:00
parent 315b657ee3
commit a1aab09ac9
625 changed files with 192283 additions and 794 deletions

View File

@@ -0,0 +1,115 @@
const URL = "/one-api/mockup/masterdata/accounting/JournalVerifEdit/";
export async function getListJournalEdit(params) {
try {
var resp = await axios.post(URL + "getListJournalEdit", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
var data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function getDetailJournalEdit(params) {
try {
var resp = await axios.post(URL + "getDetailJournalEdit", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
var data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function verifEditJurnal(params) {
try {
var resp = await axios.post(URL + "verifEditJurnal", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
var data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function getListPeriode(params) {
try {
var resp = await axios.post(URL + "getListPeriode", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
var data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function getListTypeJurnal(params) {
try {
var resp = await axios.post(URL + "getListTypeJurnal", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
var data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function updateRequestEditStatus(params) {
try {
var resp = await axios.post(URL + "updateRequestEditJurnal", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
var data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}

View File

@@ -0,0 +1,283 @@
<template>
<div style="width: 100%;">
<v-toolbar dark class="blue lighten-3 white--text">
<v-toolbar-title class="white--text">DAFTAR VERIFIKASI EDIT JURNAL</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card class="pa-2">
<v-layout row align-center>
<v-flex grow>
<span>
<v-chip outline color="red">
{{ selected_periode.periodeStartDate }} - {{ selected_periode.periodeEndDate }}
</v-chip>
</span>
</v-flex>
<v-flex xs2 pl-2>
<v-menu
v-model="menuFilterDate" 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="filterDateFormatted" label="Tanggal Awal"
hide-details readonly v-on="on" outline
></v-text-field>
</template>
<v-date-picker
v-model="filter.startdate" no-title
@input="menuFilterDate = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs2 pl-2>
<v-menu
v-model="menuFilterEndDate" 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="filterEndDateFormatted" label="Tanggal Akhir"
hide-details readonly v-on="on" outline
></v-text-field>
</template>
<v-date-picker
v-model="filter.enddate" no-title
@input="menuFilterEndDate = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs2 pl-2>
<v-autocomplete
:items="list_jurnaltype" v-model="filter.typejournal_id" outline hide-details
item-text="JurnalTypeName" label="Tipe jurnal" item-value="JurnalTypeID"
></v-autocomplete>
</v-flex>
<v-flex xs2 pl-2>
<v-text-field
v-model="filter.search" hide-details
label="Cari Nomor Jurnal" outline
></v-text-field>
</v-flex>
<v-flex shrink pl-2>
<v-btn
dark color="info" @click="searchJurnal()"
style="min-width: 50px; height: 50px; margin: 0;"
>
<v-icon>search</v-icon>
</v-btn>
</v-flex>
<v-flex text-xs-right>
<v-btn
color="orange" class="white--text"
@click="choosePeriode()"
>Accounting Period</v-btn>
</v-flex>
</v-layout>
</v-card>
<v-card class="pa-2 mt-2">
<v-data-table
:headers="headers" :items="listjournal.records"
hide-actions class="elevation-1"
>
<template slot="items" slot-scope="props">
<tr>
<td class="text-xs-center pa-2">
{{ props.item.jurnalDate }}
</td>
<td class="text-xs-center pa-2">
{{ props.item.jurnalNo }}
</td>
<td class="text-xs-left pa-2">
{{ props.item.jurnalTitle }}
</td>
<td class="text-xs-left pa-2">
{{ props.item.jurnalDescription }}
</td>
<td class="text-xs-center pa-2">
{{ props.item.JurnalRequestEditStaffName }}
</td>
<td class="text-xs-center pa-2">
<div>
<v-chip color="info" outline small>
{{ props.item.JurnalRequestEditStatusRequest }}
</v-chip> <br>
<p
v-if="props.item.JurnalRequestEditStatusRequest == 'approved'"
class="ml-0 mb-0"
>Approved by: {{ props.item.RequestApprovedBy }}</p>
</div>
</td>
<td class="text-xs-center pa-2">
<div>
<v-chip color="info" outline small>
{{ props.item.JurnalRequestEditStatusEdit }}
</v-chip> <br>
<p
v-if="props.item.JurnalRequestEditStatusEdit == 'approved'"
class="ml-0 mb-0"
>Approved by: {{ props.item.EditApprovedBy }}</p>
</div>
</td>
<td class="text-xs-center pa-2">
<v-btn
outline small color="primary"
@click="openDetailJurnal(props.item)"
> DETAIL</v-btn>
</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="currpage" :length="pagilength" :total-visible="10"></v-pagination>
</div>
</v-card>
<dialog-verifikasi></dialog-verifikasi>
<dialog-periode></dialog-periode>
<dialog-request></dialog-request>
<v-snackbar
v-model="snacbar.active" multi-line top
:timeout="3000" :color="snacbar.color"
>
{{ snacbar.message }}
<v-btn class="ml-2" round flat @click="snacbar.active = false">
Tutup
</v-btn>
</v-snackbar>
</div>
</template>
<script>
module.exports = {
components: {
'dialog-verifikasi': httpVueLoader('./dialogVerfikasiEdit.vue'),
'dialog-periode': httpVueLoader('./dialogSelectPeriode.vue'),
'dialog-request': httpVueLoader('./dialogRequestEdit.vue')
},
mounted() {
this.$store.dispatch("journal/getListTypeJurnal")
this.$store.dispatch("journal/getListPeriode")
.then(() => {
this.$store.dispatch("journal/getListJournalEdit")
})
},
data: () => ({
menuFilterDate: false,
menuFilterEndDate: false,
headers: [
{
text: "JOURNAL DATE", align: "center", sortable: false,
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "JOURNAL NO", align: "center", sortable: false,
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "JOURNAL", align: "center", sortable: false,
value: "action", width: "20%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "JOURNAL DESCRIPTION", align: "center", sortable: false,
value: "action", width: "25%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "STAFF", align: "center", sortable: false,
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "STATUS REQUEST", align: "center", sortable: false,
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "STATUS EDIT", align: "center", sortable: false,
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
},
{
text: "ACTION", align: "center", sortable: false,
value: "action", width: "5%", class: "pa-1 blue lighten-3 white--text",
}
]
}),
computed: {
listjournal() {
return this.$store.state.journal.listjournal
},
list_jurnaltype() {
return this.$store.state.journal.list_jurnaltype
},
list_periode() {
return this.$store.state.journal.list_periode
},
currpage: {
get() {
return this.$store.state.journal.currpage
},
set(val) {
this.$store.commit("journal/update_currpage", val)
this.$store.dispatch("journal/getListJournalEdit")
}
},
pagilength() {
let total = this.listjournal.total
if (total == undefined || total < 1) return 1
return Math.ceil(total/10)
},
snacbar: {
get() {
return this.$store.state.journal.snacbar
},
set(val) {
this.$store.commit("journal/update_snacbar", val)
}
},
filter: {
get() {
return this.$store.state.journal.filter
},
set(val) {
this.$store.commit("journal/update_filter", val)
}
},
filterDateFormatted() {
return this.formatDate(this.filter.startdate)
},
filterEndDateFormatted() {
return this.formatDate(this.filter.enddate)
},
selected_periode() {
return this.$store.state.journal.selected_periode
}
},
methods: {
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split('-');
return `${day}-${month}-${year}`;
},
openDetailJurnal(item) {
this.$store.commit("journal/update_selected_jurnal", item)
if (item.JurnalRequestEditStatusRequest == 'request') {
this.$store.commit("journal/update_dialog_edit_request", true)
} else {
this.$store.dispatch("journal/getDetailJournalEdit", item.jurnalID)
this.$store.commit("journal/update_dialog_verifikasi", true)
}
},
searchJurnal() {
this.$store.dispatch("journal/getListJournalEdit")
},
choosePeriode() {
this.$store.commit("journal/update_dialog_pick_periode", true)
}
},
watch: {}
}
</script>

View File

@@ -0,0 +1,59 @@
<template>
<v-dialog v-model="dialog_edit_request" persistent width="40vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
APPROVE / REJECT REQUEST EDIT JURNAL {{ selected_jurnal.jurnalNo }}
</v-card-title>
<v-card-text>
<p>
Request edit jurnal oleh: {{ selected_jurnal.JurnalRequestEditStaffName }}
</p>
<p>
Apakah anda yakin menyetujui request perubahan jurnal berikut: <br>
Nomor: <strong>{{ selected_jurnal.jurnalNo }}</strong> <br>
Judul: <strong>{{ selected_jurnal.jurnalTitle }}</strong> <br>
Deskripsi: {{ selected_jurnal.jurnalDescription }} <br>
</p>
</v-card-text>
<v-card-actions>
<v-btn color="warning" dark @click="updateStatus('rejected')">Reject</v-btn>
<v-spacer></v-spacer>
<v-btn color="error" outline @click="dialog_edit_request = false">Batal</v-btn>
<v-btn color="primary" dark @click="updateStatus('approved')">Approve</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
}
},
computed: {
dialog_edit_request: {
get() {
return this.$store.state.journal.dialog_edit_request
},
set(val) {
this.$store.commit("journal/update_dialog_edit_request", val)
}
},
selected_jurnal: {
get() {
return this.$store.state.journal.selected_jurnal
},
set(val) {
this.$store.commit("journal/update_selected_jurnal", val)
}
},
},
methods: {
updateStatus(status) {
this.$store.dispatch("journal/updateRequestEditStatus", {status: status})
}
},
}
</script>

View File

@@ -0,0 +1,91 @@
<template>
<v-dialog v-model="dialog_pick_periode" persistent max-width="35vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
PILIH PERIODE
</v-card-title>
<v-card-text>
<v-autocomplete
v-model="temp_periode" :items="list_periode"
outline hide-details label="Periode Jurnal"
item-text="periodeName" return-object
>
<template slot="item" slot-scope="{ item }">
<v-list-tile-content>
<v-list-tile-title v-text="item.periodeName"></v-list-tile-title>
<v-list-tile-sub-title>
{{ item.periodeStartDate }} - {{ item.periodeEndDate }}
</v-list-tile-sub-title>
</v-list-tile-content>
</template>
</v-autocomplete>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="error" flat @click="closeDialogPeriode()">TUTUP</v-btn>
<v-btn color="primary" @click="choosePeriode()">PILIH</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
temp_periode: {}
}
},
computed: {
list_periode() {
return this.$store.state.journal.list_periode
},
dialog_pick_periode: {
get() {
return this.$store.state.journal.dialog_pick_periode
},
set(val) {
this.$store.commit("journal/update_dialog_pick_periode", val)
}
},
selected_periode: {
get() {
return this.$store.state.journal.selected_periode
},
set(val) {
this.$store.commit("journal/update_selected_periode", val)
}
}
},
methods: {
closeDialogPeriode() {
this.temp_periode = {}
this.dialog_pick_periode = false
},
choosePeriode() {
var periode = this.temp_periode
let filter = this.$store.state.journal.filter
if (!periode || periode.periodeID == '') {
return
}
this.selected_periode = periode
filter.periode_id = periode.periodeID
this.$store.commit("journal/update_filter", filter)
this.temp_periode = {}
this.dialog_pick_periode = false
}
},
watch: {
dialog_pick_periode(val) {
if (val) {
this.$nextTick(() => {
this.temp_periode = this.selected_periode
})
}
}
},
}
</script>

View File

@@ -0,0 +1,244 @@
<template>
<v-dialog v-model="dialog_verifikasi" persistent width="90vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
VERIFIKASI PERUBAHAN ACCOUNT JURNAL
</v-card-title>
<v-card-text style="max-height: 80vh;">
<v-layout row wrap>
<v-flex xs6 pa-1 pr-3>
<div class="font-weight-bold">Company Name</div>
<div class="pa-2 grey lighten-2">
{{ selected_jurnal.M_BranchCompanyName }}
</div>
</v-flex>
<v-flex xs6 pa-1 pl-3>
<div class="font-weight-bold">Journal</div>
<div class="pa-2 grey lighten-2">
{{ selected_jurnal.jurnalTitle }}
</div>
</v-flex>
<v-flex xs6 pa-1 pr-3>
<div class="font-weight-bold">Regional</div>
<div class="pa-2 grey lighten-2">
{{ selected_jurnal.S_RegionalName }}
</div>
</v-flex>
<v-flex xs6 pa-1 pl-3>
<div class="font-weight-bold">Journal Date</div>
<div class="pa-2 grey lighten-2">
{{ selected_jurnal.jurnalDate }}
</div>
</v-flex>
<v-flex xs6 pa-1 pr-3>
<div class="font-weight-bold">Branch</div>
<div class="pa-2 grey lighten-2">
{{ selected_jurnal.M_BranchName }}
</div>
</v-flex>
<v-flex xs6 pa-1 pl-3>
<div class="font-weight-bold">Journal Type</div>
<div class="pa-2 grey lighten-2">
{{ selected_jurnal.JurnalTypeName }}
</div>
</v-flex>
</v-layout>
<v-divider class="my-2"></v-divider>
<v-layout row wrap class="mt-2">
<v-flex xs6 pr-1>
<h4>Detail Account Sebelum Diubah</h4>
<v-data-table
:headers="headers" hide-actions class="elevation-1"
:items="selected_jurnal_detail.changeBefore"
>
<template slot="items" slot-scope="props">
<tr>
<td class="text-xs-center pa-2">
{{ props.item.coaAccountNo }}
</td>
<td class="text-xs-left pa-2">
{{ props.item.coaDescription }}
</td>
<td class="text-xs-left pa-2">
{{ props.item.jurnalAddOnValue }}
</td>
<td class="text-xs-right pa-2">
{{ formatCurrency(props.item.jurnalTxDebit) }}
</td>
<td class="text-xs-right pa-2">
{{ formatCurrency(props.item.jurnalTxCredit) }}
</td>
</tr>
</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">
{{ formatCurrency(summary_jurnal_detail.total_debit) }}
</td>
<td class="text-xs-right pa-2 font-weight-bold">
{{ formatCurrency(summary_jurnal_detail.total_kredit) }}
</td>
</tr>
<tr>
<td colspan="4" class="font-weight-bold pa-2">BALANCE</td>
<td class="text-xs-right pa-2 font-weight-bold">
{{ formatCurrency(summary_jurnal_detail.balance) }}
</td>
</tr>
</template>
</v-data-table>
</v-flex>
<v-flex xs6 pl-1>
<h4>Detail Account Setelah Diubah</h4>
<v-data-table
:headers="headers" hide-actions class="elevation-1"
:items="selected_jurnal_detail.changeAfter"
>
<template slot="items" slot-scope="props">
<tr>
<td class="text-xs-center pa-2">
{{ props.item.coaAccountNo }}
</td>
<td class="text-xs-left pa-2">
{{ props.item.coaDescription }}
</td>
<td class="text-xs-left pa-2">
{{ props.item.jurnalAddOnValue }}
</td>
<td class="text-xs-right pa-2">
{{ formatCurrency(props.item.jurnalTxDebit) }}
</td>
<td class="text-xs-right pa-2">
{{ formatCurrency(props.item.jurnalTxCredit) }}
</td>
</tr>
</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">
{{ formatCurrency(summary_jurnal_detail.total_debit) }}
</td>
<td class="text-xs-right pa-2 font-weight-bold">
{{ formatCurrency(summary_jurnal_detail.total_kredit) }}
</td>
</tr>
<tr>
<td colspan="4" class="font-weight-bold pa-2">BALANCE</td>
<td class="text-xs-right pa-2 font-weight-bold">
{{ formatCurrency(summary_jurnal_detail.balance) }}
</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
dark small color="error"
@click="batalVerifikasi()"
>BATAL</v-btn>
<v-btn
v-if="selected_jurnal.JurnalRequestEditStatusEdit != 'approved'"
dark small color="primary"
@click="verifikasi()"
>VERIFIKASI</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
mounted() {},
data() {
return {
headers: [
{
text: "AKUN", align: "center", sortable: false,
value: "action", width: "15%", class: "pa-2 pl-2 blue lighten-3 white--text",
},
{
text: "DESKRIPSI", align: "center", sortable: false,
value: "mr", width: "30%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "INFO", align: "center", sortable: false,
value: "lab", width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "DEBIT", align: "center", sortable: false,
value: "lab", width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "CREDIT", align: "center", sortable: false,
value: "lab", width: "20%", class: "pa-2 blue lighten-3 white--text",
}
]
}
},
computed: {
dialog_verifikasi: {
get() {
return this.$store.state.journal.dialog_verifikasi
},
set(val) {
this.$store.commit("journal/update_dialog_verifikasi", val)
}
},
selected_jurnal: {
get() {
return this.$store.state.journal.selected_jurnal
},
set(val) {
this.$store.commit("journal/update_selected_jurnal", val)
}
},
selected_jurnal_detail: {
get() {
return this.$store.state.journal.selected_jurnal_detail
},
set(val) {
this.$store.commit("journal/update_selected_jurnal_detail", val)
}
},
summary_jurnal_detail: {
get() {
return this.$store.state.journal.summary_jurnal_detail
},
set(val) {
this.$store.commit("journal/update_summary_jurnal_detail", val)
}
}
},
methods: {
formatCurrency(amount) {
const price = parseFloat(amount)
const IDR = new Intl.NumberFormat("id-ID", {
style: "currency",
currency: "IDR"
})
return `${IDR.format(price)}`
},
batalVerifikasi() {
this.summary_jurnal_detail = {
total_debit: 0,
total_kredit: 0,
balance: 0
}
this.selected_jurnal = {}
this.selected_jurnal_detail = {}
this.dialog_verifikasi = false
},
verifikasi() {
this.$store.dispatch("journal/verifEditJurnal", 'approved')
}
},
watch: {
},
}
</script>

View File

@@ -0,0 +1,70 @@
<!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">
<title>One</title>
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
</head>
<body>
<div v-cloak id="app">
<v-app id="smartApp">
<one-navbar></one-navbar>
<v-content class="blue lighten-5">
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap>
<v-flex xs12 class="center" fill-height pa-1>
<!-- komponen -->
<daftar-journal></daftar-journal>
</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 -->
<?php
$ts = "?ts=" . Date("ymdhis");
?>
<script type="module">
import {
store
} from './store.js<?php echo $ts ?>';
new Vue({
store,
el: '#app',
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'daftar-journal': httpVueLoader('./components/daftarVerifikasiJournal.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,244 @@
import * as api from '../api/api.js'
export default {
namespaced: true,
state: {
snacbar: {
message: '',
color: 'success',
active: false
},
filter: {
startdate: moment(new Date()).format('YYYY-MM-DD'),
enddate: moment(new Date()).format('YYYY-MM-DD'),
typejournal_id: 0,
search: '',
periode_id: 0,
},
list_jurnaltype: [],
list_periode: [],
selected_periode: {},
listjournal: {
records: [],
total: 0
},
currpage: 1,
selected_jurnal: {},
selected_jurnal_detail: {},
summary_jurnal_detail: {
total_debit: 0,
total_kredit: 0,
balance: 0
},
dialog_verifikasi: false,
dialog_pick_periode: false,
dialog_edit_request: false
},
mutations: {
update_filter(state, val) {
state.filter = val
},
update_list_jurnaltype(state, val) {
state.list_jurnaltype = val
},
update_list_periode(state, val) {
state.list_periode = val
},
update_selected_periode(state, val) {
state.selected_periode = val
},
update_listjournal(state, val) {
state.listjournal = val
},
update_currpage(state, val) {
state.currpage = val
},
update_selected_jurnal(state, val) {
state.selected_jurnal = val
},
update_selected_jurnal_detail(state, val) {
state.selected_jurnal_detail = val
},
update_summary_jurnal_detail(state, val) {
state.summary_jurnal_detail = val
},
update_dialog_verifikasi(state, val) {
state.dialog_verifikasi = val
},
update_snacbar(state, val) {
state.snacbar = val
},
update_dialog_pick_periode(state, val) {
state.dialog_pick_periode = val
},
update_dialog_edit_request(state, val) {
state.dialog_edit_request = val
}
},
actions: {
async getListPeriode(context) {
try {
let snac = { color: 'error', message: '', active: false };
context.commit("update_snacbar", snac);
var resp = await api.getListPeriode({token: one_token()});
if (resp.status != 'OK') {
let snac = { color: 'error', message: resp.message, active: true };
context.commit("update_snacbar", snac);
} else {
context.commit("update_list_periode", resp.data);
// update to latest periode id in masterdata
let filter = context.state.filter
filter.periode_id = resp.data[0].periodeID
context.commit("update_filter", filter);
context.commit("update_selected_periode", resp.data[0]);
}
} catch (error) {
let snac = { color: 'error', message: error.message, active: true };
context.commit("update_snacbar", snac);
}
},
async getListTypeJurnal(context) {
try {
let snac = { color: 'error', message: '', active: false };
context.commit("update_snacbar", snac);
var resp = await api.getListTypeJurnal({token: one_token()});
if (resp.status != 'OK') {
let snac = { color: 'error', message: resp.message, active: true };
context.commit("update_snacbar", snac);
} else {
context.commit("update_list_jurnaltype", resp.data);
}
} catch (error) {
let snac = { color: 'error', message: error.message, active: true };
context.commit("update_snacbar", snac);
}
},
async getListJournalEdit(context) {
try {
let snac = { color: 'error', message: '', active: false };
context.commit("update_snacbar", snac);
let param = {
periodeID: context.state.filter.periode_id,
typeJournalID: context.state.filter.typejournal_id,
search: context.state.filter.search,
startdate: context.state.filter.startdate,
enddate: context.state.filter.enddate,
page: context.state.currpage,
token: one_token()
}
var resp = await api.getListJournalEdit(param);
if (resp.status != "OK") {
let snac = { color: 'error', message: resp.message, active: true };
context.commit("update_snacbar", snac);
} else {
context.commit("update_listjournal", resp.data);
}
} catch (error) {
let snac = { color: 'error', message: error.message, active: true };
context.commit("update_snacbar", snac);
}
},
async getDetailJournalEdit(context, jurnalid) {
try {
let snac = { color: 'error', message: '', active: false };
context.commit("update_snacbar", snac);
let param = {
jurnalID: jurnalid,
token: one_token()
}
var resp = await api.getDetailJournalEdit(param);
if (resp.status != "OK") {
let snac = { color: 'error', message: resp.message, active: true };
context.commit("update_snacbar", snac);
} else {
const data = resp.data;
context.commit("update_selected_jurnal_detail", data);
// summary total kredit & debit jurnal
// changeAfter & changeBefore harusnya sama
const summary = data.changeAfter.reduce((acc, item) => {
const debit = Number(item.jurnalTxDebit) || 0;
const kredit = Number(item.jurnalTxCredit) || 0;
acc.total_debit += debit;
acc.total_kredit += kredit;
return acc;
}, {total_debit: 0, total_kredit: 0});
summary.balance = summary.total_debit - summary.total_kredit;
context.commit("update_summary_jurnal_detail", summary);
}
} catch (error) {
let snac = { color: 'error', message: error.message, active: true };
context.commit("update_snacbar", snac);
}
},
async updateRequestEditStatus(context, status) {
try {
let snac = { color: 'error', message: '', active: false };
context.commit("update_snacbar", snac);
let param = {
JurnalRequestEditID: context.state.selected_jurnal.JurnalRequestEditID,
jurnalID: context.state.selected_jurnal.jurnalID,
status: status.status,
token: one_token()
}
var resp = await api.updateRequestEditStatus(param);
if (resp.status != "OK") {
let snac = { color: 'error', message: resp.message, active: true };
context.commit("update_snacbar", snac);
} else {
context.dispatch("getListJournalEdit");
let snac = { color: 'success', message: resp.data, active: true };
context.commit("update_snacbar", snac);
context.commit("update_dialog_edit_request", false)
}
} catch (error) {
let snac = { color: 'error', message: error.message, active: true };
context.commit("update_snacbar", snac);
}
},
async verifEditJurnal(context, status) {
try {
let snac = { color: 'error', message: '', active: false };
context.commit("update_snacbar", snac);
let param = {
jurnalID: context.state.selected_jurnal.jurnalID,
newtrx: context.state.selected_jurnal_detail.changeAfter,
JurnalRequestEditID: context.state.selected_jurnal.JurnalRequestEditID,
status: status,
token: one_token()
}
var resp = await api.verifEditJurnal(param);
if (resp.status != "OK") {
let snac = { color: 'error', message: resp.message, active: true };
context.commit("update_snacbar", snac);
} else {
context.dispatch("getListJournalEdit");
let snac = { color: 'success', message: resp.data, active: true };
context.commit("update_snacbar", snac);
context.commit("update_summary_jurnal_detail", {
total_debit: 0,
total_kredit: 0,
balance: 0
});
context.commit("update_selected_jurnal_detail", {});
context.commit("update_selected_jurnal", {})
context.commit("update_dialog_verifikasi", false);
}
} catch (error) {
let snac = { color: 'error', message: error.message, active: true };
context.commit("update_snacbar", snac);
}
}
}
}

View File

@@ -0,0 +1,11 @@
import journal from "./modules/journal.js";
import system from "../../../apps/modules/system/system.js";
export const store = new Vuex.Store({
modules: {
journal: journal,
system: system
},
state: {},
mutations: {},
actions: {}
});