feature: po pay downpayment
This commit is contained in:
64
test/vuex/acc-one-approval-po-asset/api/api.js
Normal file
64
test/vuex/acc-one-approval-po-asset/api/api.js
Normal file
@@ -0,0 +1,64 @@
|
||||
const URL = "/one-api/mockup/purchase/order/PurchaseOrderAset";
|
||||
const URLRO = "/one-api/mockup/receive-item-po/ReceiveItemPOAsset";
|
||||
|
||||
async function request(endpoint, params) {
|
||||
try {
|
||||
const resp = await axios.post(URL + endpoint, params)
|
||||
if (resp.status !== 200) {
|
||||
throw new Error(resp.statusText);
|
||||
}
|
||||
return resp.data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getListSupplier(params) {
|
||||
return request("/getListSupplier", params);
|
||||
}
|
||||
|
||||
export async function getListCabang(params) {
|
||||
return request("/getListCabang", params);
|
||||
}
|
||||
|
||||
export async function getListGudang(params) {
|
||||
return request("/getListGudang", params);
|
||||
}
|
||||
|
||||
export async function getDaftarPoAset(params) {
|
||||
return request("/getDaftarPoAset", params);
|
||||
}
|
||||
|
||||
export async function getDaftarAttachment(params) {
|
||||
return request("/getDaftarAttachment", params);
|
||||
}
|
||||
|
||||
export async function getUserApproveLevel(params) {
|
||||
return request("/getUserApproveLevel", params);
|
||||
}
|
||||
|
||||
export async function updateApprovalPO(params) {
|
||||
return request("/updateApprovalPO", params);
|
||||
}
|
||||
|
||||
export async function getDataKontrakPoAset(params) {
|
||||
return request("/getDataKontrakPoAset", params);
|
||||
}
|
||||
|
||||
export async function generatePOItemReceive(params) {
|
||||
try {
|
||||
const resp = await axios.post(URLRO + "/generatePOItemReceive", params)
|
||||
if (resp.status !== 200) {
|
||||
throw new Error(resp.statusText);
|
||||
}
|
||||
return resp.data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog_attachment" persistent max-width="60vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
VIEW ATTACHMENT
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-layout row wrap>
|
||||
<v-flex
|
||||
v-for="(nota) in list_attachment"
|
||||
xs4 class="pa-2" :key="nota.attach_id"
|
||||
>
|
||||
<div style="position: relative; padding-bottom: 35px;">
|
||||
<v-img
|
||||
:src="makeImageURL(nota)" aspect-ratio="1" contain
|
||||
class="grey lighten-2" @click="fullview(nota)"
|
||||
></v-img>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="tutupViewAttachment()" color="error" class="white--text">Tutup</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-dialog v-model="dialog_fullview" persistent max-width="60vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
{{ view_title }}
|
||||
</v-card-title>
|
||||
<v-card-text style="max-height: 80vh; overflow-y: auto;">
|
||||
<div class="pa-2">
|
||||
<v-img :src="view_url" contain class="grey lighten-2"></v-img>
|
||||
</div>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn class="mr-2" color="red" flat outline @click="dialog_fullview = false">
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.close-button {
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
right: 5px;
|
||||
z-index: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
dialog_fullview: false,
|
||||
view_title: "",
|
||||
view_url: ""
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_attachment: {
|
||||
get() {
|
||||
return this.$store.state.orderAsset.dialog_attachment;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("orderAsset/update_dialog_attachment", val);
|
||||
}
|
||||
},
|
||||
list_attachment() {
|
||||
return this.$store.state.orderAsset.list_attachment;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
makeImageURL(nota) {
|
||||
const year = new Date(nota.created).getFullYear();
|
||||
const baseURL = BASE_URL + `/one-media/order-asset/${year}/`;
|
||||
return baseURL + nota.img_url;
|
||||
},
|
||||
fullview(nota) {
|
||||
this.view_title = nota.img_url;
|
||||
this.view_url = this.makeImageURL(nota)
|
||||
this.dialog_fullview = true;
|
||||
},
|
||||
tutupViewAttachment() {
|
||||
this.view_title = ""
|
||||
this.view_url = ""
|
||||
this.dialog_attachment = false
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_confirm_order" persistent width="80vw">
|
||||
<v-card class="style-card">
|
||||
<v-card-title class="headline grey lighten-2">KONFIRMASI ORDER ASET</v-card-title>
|
||||
<template>
|
||||
<div class="style-content">
|
||||
<v-stepper non-linear v-model="steps">
|
||||
<v-stepper-header>
|
||||
<v-stepper-step editable step="1" @click="steps = 1">
|
||||
FORM ORDER ASET
|
||||
</v-stepper-step>
|
||||
<v-divider></v-divider>
|
||||
<v-stepper-step editable step="2" @click="steps = 2">
|
||||
FORM KONTRAK ASET
|
||||
</v-stepper-step>
|
||||
<v-divider></v-divider>
|
||||
<v-stepper-step editable step="3" @click="steps = 3">
|
||||
ITEM ORDER ASET
|
||||
</v-stepper-step>
|
||||
</v-stepper-header>
|
||||
|
||||
<v-stepper-items>
|
||||
<v-stepper-content step="1">
|
||||
<form-order-asset></form-order-asset>
|
||||
</v-stepper-content>
|
||||
|
||||
<v-stepper-content step="2">
|
||||
<form-kontrak-asset></form-kontrak-asset>
|
||||
</v-stepper-content>
|
||||
|
||||
<v-stepper-content step="3">
|
||||
<form-item-request-asset></form-item-request-asset>
|
||||
<dialog-select-request-asset></dialog-select-request-asset>
|
||||
</v-stepper-content>
|
||||
</v-stepper-items>
|
||||
</v-stepper>
|
||||
<v-card-text>
|
||||
<v-layout v-for="(item, index) in summary_items" :key="index"
|
||||
row wrap align-center>
|
||||
<v-flex xs2 pa-1>
|
||||
<strong>{{ item.label }}</strong>
|
||||
</v-flex>
|
||||
<v-flex grow></v-flex>
|
||||
<v-flex xs2 pa-1 class="text-xs-right">
|
||||
<strong>Rp. {{ formatCurrency(item.value) }}</strong>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</template>
|
||||
<v-card-actions>
|
||||
<v-btn @click="lihatLampiran()" color="info" class="white--text">Lampiran</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="batalConfirm()" color="error" class="white--text">Batal</v-btn>
|
||||
<v-btn @click="confirmOrder()" color="primary" class="white--text"
|
||||
v-show="!view_detail_mode">
|
||||
{{ user.M_UserM_ApproveLevelID == '1' ? "Verifikasi" : "Approve" }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.style-card {
|
||||
max-height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.style-content {
|
||||
overflow-y: auto;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
steps: 1
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'form-order-asset': httpVueLoader('./form-order-asset.vue'),
|
||||
'form-kontrak-asset': httpVueLoader('./form-kontrak-asset.vue'),
|
||||
'form-item-request-asset': httpVueLoader('./form-item-request-asset.vue'),
|
||||
'dialog-select-request-asset': httpVueLoader('./dialog-select-request-asset.vue')
|
||||
},
|
||||
computed: {
|
||||
dialog_confirm_order: {
|
||||
get() {
|
||||
return this.$store.state.orderAsset.dialog_confirm_order;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("orderAsset/update_dialog_confirm_order", val);
|
||||
}
|
||||
},
|
||||
summary_order: {
|
||||
get() {
|
||||
return this.$store.state.formView.summary_order;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("formView/update_summary_order", val);
|
||||
}
|
||||
},
|
||||
summary_items() {
|
||||
if (!this.summary_order) return [];
|
||||
return [
|
||||
{label: 'JUMLAH', value: this.summary_order.subtotal},
|
||||
{label: 'DISKON', value: this.summary_order.diskon},
|
||||
{label: 'PAJAK', value: this.summary_order.pajak},
|
||||
{label: 'DOWN PAYMENT', value: this.summary_order.downpayment},
|
||||
{label: 'TOTAL', value: this.summary_order.total}
|
||||
]
|
||||
},
|
||||
loading_process() {
|
||||
return this.$store.state.orderAsset.loading_process;
|
||||
},
|
||||
selected_order() {
|
||||
return this.$store.state.orderAsset.selected_order;
|
||||
},
|
||||
view_detail_mode() {
|
||||
return this.$store.state.orderAsset.view_detail_mode;
|
||||
},
|
||||
user() {
|
||||
return this.$store.state.orderAsset.user
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatCurrency(value) {
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num)) return 0;
|
||||
return num.toFixed(2).replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
},
|
||||
lihatLampiran() {
|
||||
this.$store.commit("orderAsset/update_dialog_attachment", true)
|
||||
},
|
||||
confirmOrder() {
|
||||
if (!this.loading_process) {
|
||||
const poID = this.selected_order.PurchaseOrderID
|
||||
this.$store.dispatch("orderAsset/confirmOrderAsset", poID)
|
||||
}
|
||||
},
|
||||
batalConfirm() {
|
||||
this.$store.commit("formView/update_form_order", {
|
||||
podate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
supplierID: "",
|
||||
reference: "",
|
||||
branchID: "",
|
||||
typepajak: "percent",
|
||||
valuepajak: 0,
|
||||
typediskon: "percent",
|
||||
valuediskon: 0
|
||||
});
|
||||
this.$store.commit("formView/update_form_kontrak", {
|
||||
nama_kontrak: '',
|
||||
tanggal_kontrak: moment(new Date()).format('YYYY-MM-DD'),
|
||||
tanggalAwal_kontrak: moment(new Date()).format('YYYY-MM-DD'),
|
||||
tanggalAkhir_kontrak: moment(new Date()).format('YYYY-MM-DD'),
|
||||
durasi_cicilan: 1,
|
||||
jumlah_cicilan: 1,
|
||||
tanggalBayar_cicilan: 1,
|
||||
besarNilai_cicilan: 0,
|
||||
type_downpayment: 'percent',
|
||||
besarNilai_downpayment: 0
|
||||
});
|
||||
this.$store.commit("formView/update_received_order", []);
|
||||
|
||||
this.summary_order = {
|
||||
subtotal: 0,
|
||||
diskon: 0,
|
||||
pajak: 0,
|
||||
downpayment: 0,
|
||||
total_before_downpayment: 0,
|
||||
total: 0
|
||||
};
|
||||
|
||||
this.$store.commit("orderAsset/update_view_detail_mode", false);
|
||||
this.dialog_confirm_order = false;
|
||||
}
|
||||
},
|
||||
watch: { }
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_select_item" persistent width="60vw">
|
||||
<v-card class="style-limit-heightcard">
|
||||
<v-card-title class="headline grey lighten-2" primary title>
|
||||
TAMBAH ITEM REQUEST
|
||||
</v-card-title>
|
||||
<v-card-text class="style-limit-heightcontent">
|
||||
<v-flex xs12>
|
||||
<v-text-field
|
||||
label="Cari" hide-details outline
|
||||
v-model="keyword" placeholder="Nama item, nomor request"
|
||||
readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12 mt-2>
|
||||
<v-data-table
|
||||
:headers="headers" :items="requested_asset.records"
|
||||
class="elevation-1" hide-actions
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-start pa-2">
|
||||
{{ props.item.Requestedby }} <br>
|
||||
{{ props.item.M_BranchName }}
|
||||
</td>
|
||||
<td class="text-xs-start pa-2">
|
||||
{{ props.item.M_ItemCode }} <br>
|
||||
{{ props.item.M_ItemDesc }}
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.ItemUnitName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.RequestQty }}</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="dialog_select_item = false" color="error" class="white--text">Tutup</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.style-limit-heightcard {
|
||||
max-height: 60vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.style-limit-heightcontent {
|
||||
overflow-y: auto;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
dialog_select_item: false,
|
||||
keyword: "",
|
||||
requested_asset: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
headers: [
|
||||
{
|
||||
text: "NO PURCHASE REQ", align: "center", sortable: false,
|
||||
value: "noreq", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "REQUESTER", align: "center", sortable: false,
|
||||
value: "kode", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "serve", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "SATUAN", align: "center", sortable: false,
|
||||
value: "unit", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "REQ QTY", align: "center", sortable: false,
|
||||
value: "qty", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,157 @@
|
||||
<template>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="headers" :items="received_order"
|
||||
:expand="expand" class="elevation-1" hide-actions
|
||||
item-key="M_ItemID"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr @click="props.expanded = !props.expanded">
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon>{{ props.expanded
|
||||
? "keyboard_arrow_down"
|
||||
: "keyboard_arrow_right"
|
||||
}}</v-icon>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.RequestQty }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
Rp. {{ formatCurrency(props.item.SupplierPrice) }}
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<span v-if="props.item.DiskonType == 'P'">
|
||||
{{ props.item.DiskonAmount }}%
|
||||
</span>
|
||||
<span v-else>
|
||||
Rp. {{ formatCurrency(props.item.DiskonAmount) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
Rp. {{ formatCurrency(props.item.EndPrice) }}
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
Rp. {{ formatCurrency(props.item.TempTotal) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<template v-slot:expand="props">
|
||||
<v-card flat>
|
||||
<v-card-text>
|
||||
<v-data-table
|
||||
:headers="b_headers" class="elevation-0"
|
||||
:items="props.item.detail" hide-actions
|
||||
item-key="PurchaseRequestDetailID"
|
||||
>
|
||||
<template v-slot:items="det">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ det.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ det.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ det.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ det.item.RequestQty }}</td>
|
||||
<td class="text-xs-center pa-2">{{ det.item.ItemUnitName }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
Rp. {{ formatCurrency(det.item.SupplierPrice) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
expand: false,
|
||||
headers: [
|
||||
{
|
||||
text: "", align: "center", sortable: false,
|
||||
value: "item", width: "5%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "item", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "JUMLAH", align: "center", sortable: false,
|
||||
value: "qty", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA", align: "center", sortable: false,
|
||||
value: "price", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DISKON", align: "center", sortable: false,
|
||||
value: "disc", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA SETELAH DISKON", align: "center", sortable: false,
|
||||
value: "disc", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL", align: "center", sortable: false,
|
||||
value: "disc", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
b_headers: [
|
||||
{
|
||||
text: "NAMA PRODUK", align: "center", sortable: false,
|
||||
value: "prod", width: "25%", class: "pa-1 blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "NO REQUEST", align: "center", sortable: false,
|
||||
value: "noreq", width: "20%", class: "pa-1 blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "REQUESTER", align: "center", sortable: false,
|
||||
value: "req", width: "20%", class: "pa-1 blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "JUMLAH", align: "center", sortable: false,
|
||||
value: "qty", width: "10%", class: "pa-1 blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "UNIT", align: "center", sortable: false,
|
||||
value: "unit", width: "10%", class: "pa-1 blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA", align: "center", sortable: false,
|
||||
value: "price", width: "15%", class: "pa-1 blue lighten-4 black--text",
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
received_order: {
|
||||
get() {
|
||||
return this.$store.state.formView.received_order;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("formView/update_received_order", val)
|
||||
}
|
||||
},
|
||||
summary_order: {
|
||||
get() {
|
||||
return this.$store.state.formView.summary_order;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("formView/update_summary_order", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatCurrency(value) {
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num)) return 0;
|
||||
return num.toFixed(2).replace('.', ',').replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field
|
||||
v-model="form_kontrak.nama_kontrak" hide-details outline
|
||||
label="Nama Kontrak" placeholder="masukan nama kontrak" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field
|
||||
:value="formattedDateKontrak" hide-details readonly outline
|
||||
label="Tanggal Kontrak"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field
|
||||
:value="formattedStartdateKontrak" outline hide-details
|
||||
label="Tanggal Mulai Kontrak" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field
|
||||
:value="formattedEnddateKontrak" outline hide-details
|
||||
label="Tanggal Akhir Kontrak" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row wrap>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-text-field
|
||||
v-model="form_kontrak.durasi_cicilan" hide-details outline
|
||||
placeholder="1" label="Durasi Kontrak (Bulan)" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-text-field
|
||||
v-model="form_kontrak.jumlah_cicilan" hide-details
|
||||
placeholder="1" outline label="Jumlah Cicilan" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-text-field
|
||||
v-model="form_kontrak.tanggalBayar_cicilan" hide-details
|
||||
placeholder="1" outline label="Tanggal Bayar Cicilan" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-text-field
|
||||
v-model="form_kontrak.besarNilai_cicilan" hide-details
|
||||
label="Besar Bayar Cicilan" placeholder="0" prefix="Rp."
|
||||
outline readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs1 pa-1>
|
||||
<v-autocomplete
|
||||
:items="['nominal', 'percent']" label="Tipe Nilai"
|
||||
v-model="form_kontrak.type_downpayment" hide-details
|
||||
outline disabled
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs3 pa-1>
|
||||
<v-text-field
|
||||
v-if="form_kontrak.type_downpayment == 'percent'"
|
||||
label="Jumlah Uang Muka" hide-details
|
||||
v-model="form_kontrak.besarNilai_downpayment"
|
||||
placeholder="0" suffix="%" outline readonly
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-else label="Jumlah Uang Muka" hide-details
|
||||
placeholder="0" prefix="Rp." outline readonly
|
||||
v-model="form_kontrak.besarNilai_downpayment"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
form_kontrak: {
|
||||
get() {
|
||||
return this.$store.state.formView.form_kontrak;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("formView/update_form_kontrak", val);
|
||||
}
|
||||
},
|
||||
formattedDateKontrak() {
|
||||
return this.formatDate(this.form_kontrak.tanggal_kontrak);
|
||||
},
|
||||
formattedStartdateKontrak() {
|
||||
return this.formatDate(this.form_kontrak.tanggalAwal_kontrak);
|
||||
},
|
||||
formattedEnddateKontrak() {
|
||||
return this.formatDate(this.form_kontrak.tanggalAkhir_kontrak);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split('-');
|
||||
return `${day}-${month}-${year}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field
|
||||
:value="formattedPOdate" label="Tanggal PO"
|
||||
hide-details readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-autocomplete
|
||||
:items="list_supplier" hide-details outline disabled
|
||||
v-model="form_order.supplierID" label="Supplier"
|
||||
item-text="SupplierName" item-value="SupplierID"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs4 pa-1>
|
||||
<v-text-field
|
||||
v-model="form_order.reference" hide-details outline
|
||||
label="Referensi" placeholder="nomor request" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row wrap>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-autocomplete
|
||||
:items="list_cabang" hide-details outline disabled
|
||||
v-model="form_order.branchID" label="Cabang"
|
||||
item-text="M_BranchName" item-value="M_BranchID"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-autocomplete
|
||||
:items="list_gudang" hide-details outline disabled
|
||||
v-model="form_order.gudangID" label="Gudang"
|
||||
item-text="WarehouseName" item-value="WarehouseID"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-autocomplete
|
||||
:items="['nominal', 'percent']" label="Tipe Nilai"
|
||||
v-model="form_order.typepajak" hide-details outline disabled
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-text-field
|
||||
v-if="form_order.typepajak == 'percent'" label="Pajak"
|
||||
v-model="form_order.valuepajak" hide-details outline
|
||||
placeholder="besar pajak dalam persen" suffix="%" readonly
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-else label="Pajak" outline prefix="Rp."
|
||||
v-model="form_order.valuepajak" hide-details
|
||||
placeholder="besar pajak dalam rupiah" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-autocomplete
|
||||
:items="['nominal', 'percent']" hide-details outline disabled
|
||||
v-model="form_order.typediskon" label="Tipe Nilai"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 pa-1>
|
||||
<v-text-field
|
||||
v-if="form_order.typediskon == 'percent'" label="Diskon"
|
||||
v-model="form_order.valuediskon" hide-details outline
|
||||
placeholder="besar diskon dalam persen" suffix="%" readonly
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-else label="Diskon" outline prefix="Rp."
|
||||
v-model="form_order.valuediskon" hide-details
|
||||
placeholder="besar diskon dalam rupiah" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12 pa-1>
|
||||
<v-textarea
|
||||
v-model="form_order.catatan" auto-grow readonly
|
||||
rows="1" outline label="Catatan" hide-details
|
||||
></v-textarea>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
form_order: {
|
||||
get() {
|
||||
return this.$store.state.formView.form_order
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("formView/update_form_order", val)
|
||||
}
|
||||
},
|
||||
formattedPOdate() {
|
||||
return this.formatDate(this.form_order.podate);
|
||||
},
|
||||
list_cabang() {
|
||||
return this.$store.state.orderAsset.list_cabang;
|
||||
},
|
||||
list_gudang() {
|
||||
return this.$store.state.orderAsset.list_gudang;
|
||||
},
|
||||
list_supplier() {
|
||||
return this.$store.state.orderAsset.list_supplier;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split('-');
|
||||
return `${day}-${month}-${year}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
269
test/vuex/acc-one-approval-po-asset/components/main-layout.vue
Normal file
269
test/vuex/acc-one-approval-po-asset/components/main-layout.vue
Normal file
@@ -0,0 +1,269 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">APPROVE PURCHASE ORDER ASET</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="filter.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="filter.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="filter.status"
|
||||
label="Status"></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-text-field v-model="filter.search" hide-details outline label="Cari"
|
||||
placeholder="cari nomor po"></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<v-card class="pa-2 mt-2">
|
||||
<v-data-table
|
||||
:headers="headers" :items="list_order.records"
|
||||
class="elevation-1" hide-actions
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseOrderNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseOrderDate }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.SupplierName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseOrderNote }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
Rp. {{ formatCurrency(props.item.PurchaseOrderGrandTotal) }}
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseOrderStatus }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-layout
|
||||
v-if="props.item.PurchaseOrderStatus != 'Draft'"
|
||||
align-center justify-center row
|
||||
>
|
||||
<v-flex shrink pr-1>
|
||||
<v-btn
|
||||
color="warning" @click="viewdetail(props.item)" small
|
||||
>
|
||||
detail
|
||||
<v-icon small right>list_alt</v-icon>
|
||||
</v-btn>
|
||||
<v-chip
|
||||
v-if="props.item.approvedby != '0'"
|
||||
label color="success" text-color="white"
|
||||
>
|
||||
APPROVED
|
||||
</v-chip>
|
||||
</v-flex>
|
||||
<v-flex pl-1 v-if="props.item.approvedby == '0'">
|
||||
<v-btn
|
||||
color="info" @click="updateStatusPO(props.item)" small
|
||||
:disabled="user.M_UserM_ApproveLevelID != '1'"
|
||||
:outline="props.item.verifiedby == '0'"
|
||||
>
|
||||
verifikasi
|
||||
<v-icon small right>done</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="success" @click="updateStatusPO(props.item)" small
|
||||
:disabled="user.M_UserM_ApproveLevelID != '2'"
|
||||
:outline="props.item.PurchaseOrderStatus != 'Approved'"
|
||||
>
|
||||
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="po-2 mt-1 text-xs-center">
|
||||
<v-pagination v-model="currpage" :length="pagelength" :total-visible="10"></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<v-snackbar v-model="snackbar.state" multi-line top :timeout="3000" :color="snackbar.color">
|
||||
{{ snackbar.msg }}
|
||||
<v-btn class="ml-2" round flat @click="snackbar.state = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<dialog-confirm></dialog-confirm>
|
||||
<dialog-attachment></dialog-attachment>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'dialog-confirm': httpVueLoader('./dialog-confirm.vue'),
|
||||
'dialog-attachment': httpVueLoader('./dialog-attachment.vue')
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("orderAsset/getListingPOAsset")
|
||||
this.$store.dispatch("orderAsset/getUserApproveLevel")
|
||||
this.$store.dispatch("orderAsset/listingCabang")
|
||||
this.$store.dispatch("orderAsset/listingSupplier")
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartdateFilter: false,
|
||||
menuEnddateFilter: false,
|
||||
headers: [
|
||||
{
|
||||
text: "No PO", align: "center", sortable: false,
|
||||
value: "action", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TANGGAL", align: "center", sortable: false,
|
||||
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "VENDOR", align: "center", sortable: false,
|
||||
value: "action", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "CABANG", align: "center", sortable: false,
|
||||
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "KETERANGAN", align: "center", sortable: false,
|
||||
value: "action", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL", align: "center", sortable: false,
|
||||
value: "action", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS", align: "center", sortable: false,
|
||||
value: "action", width: "5%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "action", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.orderAsset.snackbar;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("orderAsset/update_snackbar", val);
|
||||
}
|
||||
},
|
||||
filter: {
|
||||
get() {
|
||||
return this.$store.state.orderAsset.filter;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("orderAsset/update_filter", val);
|
||||
}
|
||||
},
|
||||
currpage: {
|
||||
get() {
|
||||
return this.$store.state.orderAsset.currpage;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("orderAsset/update_currpage", val);
|
||||
this.$store.dispatch("orderAsset/getListingPOAsset");
|
||||
}
|
||||
},
|
||||
list_order: {
|
||||
get() {
|
||||
return this.$store.state.orderAsset.list_order;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("orderAsset/update_list_order", val);
|
||||
}
|
||||
},
|
||||
pagelength() {
|
||||
let total = this.list_order.total
|
||||
if (total === undefined || total < 1) return 1
|
||||
return Math.ceil(total/10)
|
||||
},
|
||||
formattedStartdate() {
|
||||
return this.formatDate(this.filter.startdate)
|
||||
},
|
||||
formattedEnddate() {
|
||||
return this.formatDate(this.filter.enddate)
|
||||
},
|
||||
list_status() {
|
||||
return this.$store.state.orderAsset.list_status
|
||||
},
|
||||
user() {
|
||||
return this.$store.state.orderAsset.user
|
||||
}
|
||||
},
|
||||
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, ".");
|
||||
},
|
||||
updateStatusPO(item) {
|
||||
const userlvl = this.user.M_UserM_ApproveLevelID
|
||||
if (item.verifiedby == '0' || userlvl != '1') {
|
||||
this.$store.dispatch("orderAsset/getAssetAttachment", {
|
||||
contractID: item.contractID,
|
||||
poID: item.PurchaseOrderID
|
||||
});
|
||||
|
||||
this.$store.dispatch("formView/getDetailDataPO", item.PurchaseOrderID);
|
||||
|
||||
this.$store.commit("orderAsset/update_selected_order", item)
|
||||
this.$store.commit("orderAsset/update_dialog_confirm_order", true)
|
||||
} else {
|
||||
const snac = { color: "info", msg: "PO sudah diverifikasi", state: true }
|
||||
this.snackbar = snac
|
||||
}
|
||||
},
|
||||
viewdetail(item) {
|
||||
this.$store.dispatch("orderAsset/getAssetAttachment", {
|
||||
contractID: item.contractID,
|
||||
poID: item.PurchaseOrderID
|
||||
});
|
||||
this.$store.dispatch("formView/getDetailDataPO", item.PurchaseOrderID);
|
||||
|
||||
this.$store.commit("orderAsset/update_view_detail_mode", true);
|
||||
this.$store.commit("orderAsset/update_dialog_confirm_order", true);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filter: {
|
||||
handler(val) {
|
||||
this.$store.dispatch("orderAsset/getListingPOAsset")
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
60
test/vuex/acc-one-approval-po-asset/index.php
Normal file
60
test/vuex/acc-one-approval-po-asset/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>
|
||||
<main-layout></main-layout>
|
||||
</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'),
|
||||
'main-layout': httpVueLoader('./components/main-layout.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
197
test/vuex/acc-one-approval-po-asset/modules/form-view.js
Normal file
197
test/vuex/acc-one-approval-po-asset/modules/form-view.js
Normal file
@@ -0,0 +1,197 @@
|
||||
import * as api from "../api/api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
form_order: {
|
||||
podate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
supplierID: "",
|
||||
reference: "",
|
||||
branchID: "",
|
||||
gudangID: "",
|
||||
typepajak: "percent",
|
||||
valuepajak: 0,
|
||||
typediskon: "percent",
|
||||
valuediskon: 0,
|
||||
catatan: ""
|
||||
},
|
||||
form_kontrak: {
|
||||
nama_kontrak: '',
|
||||
tanggal_kontrak: moment(new Date()).format('YYYY-MM-DD'),
|
||||
tanggalAwal_kontrak: moment(new Date()).format('YYYY-MM-DD'),
|
||||
tanggalAkhir_kontrak: moment(new Date()).format('YYYY-MM-DD'),
|
||||
durasi_cicilan: 1,
|
||||
jumlah_cicilan: 1,
|
||||
tanggalBayar_cicilan: 1,
|
||||
besarNilai_cicilan: 0,
|
||||
type_downpayment: 'percent',
|
||||
besarNilai_downpayment: 0
|
||||
},
|
||||
received_order: [],
|
||||
summary_order: {
|
||||
subtotal: 0,
|
||||
diskon: 0,
|
||||
pajak: 0,
|
||||
downpayment: 0,
|
||||
total_before_downpayment: 0,
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
update_form_order(state, val) {
|
||||
state.form_order = val
|
||||
},
|
||||
update_form_kontrak(state, val) {
|
||||
state.form_kontrak = val
|
||||
},
|
||||
update_received_order(state, val) {
|
||||
state.received_order = val
|
||||
},
|
||||
update_summary_order(state, val) {
|
||||
state.summary_order = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getDetailDataPO(context, poID) {
|
||||
try {
|
||||
const params = {
|
||||
token: one_token(),
|
||||
poID: poID,
|
||||
};
|
||||
const resp = await api.getDataKontrakPoAset(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
let formOrder = {
|
||||
podate: resp.data.podate,
|
||||
supplierID: resp.data.supplierID,
|
||||
reference: resp.data.reference,
|
||||
branchID: resp.data.branchID,
|
||||
gudangID: resp.data.gudangID,
|
||||
typepajak: resp.data.typepajak,
|
||||
valuepajak: parseFloat(resp.data.valuepajak),
|
||||
typediskon: resp.data.typediskon,
|
||||
valuediskon: parseFloat(resp.data.valuediskon),
|
||||
catatan: resp.data.catatan
|
||||
};
|
||||
let formKontrak = {
|
||||
nama_kontrak: resp.data.contractName,
|
||||
tanggal_kontrak: resp.data.contractDate,
|
||||
tanggalAwal_kontrak: resp.data.contractStart,
|
||||
tanggalAkhir_kontrak: resp.data.contractEnd,
|
||||
durasi_cicilan: resp.data.contractDuration,
|
||||
jumlah_cicilan: resp.data.installmentNumber,
|
||||
tanggalBayar_cicilan: resp.data.installmentDate,
|
||||
besarNilai_cicilan: parseFloat(resp.data.installmentPayAmount),
|
||||
type_downpayment: resp.data.installmentDownPaymentType,
|
||||
besarNilai_downpayment: parseFloat(resp.data.installmentDownPayment),
|
||||
};
|
||||
let summary = resp.data.summary;
|
||||
let selected_request = resp.data.detail;
|
||||
selected_request.forEach(item => {
|
||||
item.SupplierPrice = parseFloat(item.SupplierPrice)
|
||||
item.DiskonAmount = parseFloat(item.DiskonAmount)
|
||||
});
|
||||
|
||||
context.dispatch('orderAsset/listingGudang', resp.data.branchID, { root: true });
|
||||
|
||||
context.commit('update_form_kontrak', formKontrak);
|
||||
context.commit("update_form_order", formOrder);
|
||||
context.commit("update_received_order", selected_request);
|
||||
context.commit("update_summary_order", summary);
|
||||
|
||||
context.dispatch('recalculateOrderSummary');
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("orderAsset/update_snackbar", snac, { root: true });
|
||||
}
|
||||
},
|
||||
async recalculateOrderSummary(context) {
|
||||
const formOrder = context.state.form_order;
|
||||
const formKontrak = context.state.form_kontrak;
|
||||
const items = JSON.parse(JSON.stringify(context.state.received_order));
|
||||
|
||||
const calculatedItems = items.map(item => {
|
||||
const supplierPrice = parseCurrency(item.SupplierPrice);
|
||||
const requestQty = item.detail.reduce((sum, detail) => {
|
||||
return sum + parseCurrency(detail.RequestQty);
|
||||
}, 0);
|
||||
|
||||
let itemDiscount = 0;
|
||||
|
||||
if (item.DiskonType == 'P') {
|
||||
itemDiscount = supplierPrice * parseCurrency(item.DiskonAmount) / 100;
|
||||
} else {
|
||||
itemDiscount = parseCurrency(item.DiskonAmount);
|
||||
}
|
||||
|
||||
const endPrice = Math.max(supplierPrice - itemDiscount, 0);
|
||||
const tempTotal = requestQty * endPrice;
|
||||
|
||||
return {
|
||||
...item,
|
||||
RequestQty: requestQty,
|
||||
EndPrice: endPrice,
|
||||
TempTotal: tempTotal,
|
||||
detail: item.detail.map(detail => ({
|
||||
...detail,
|
||||
SupplierPrice: supplierPrice
|
||||
}))
|
||||
};
|
||||
});
|
||||
|
||||
const subtotal = calculatedItems.reduce((sum, item) => {
|
||||
return sum + parseCurrency(item.TempTotal);
|
||||
}, 0);
|
||||
|
||||
const diskon = calculateByType(
|
||||
formOrder.typediskon,
|
||||
formOrder.valuediskon,
|
||||
subtotal
|
||||
);
|
||||
const subtotalAfterDiskon = Math.max(subtotal - diskon, 0);
|
||||
|
||||
const pajak = calculateByType(
|
||||
formOrder.typepajak,
|
||||
formOrder.valuepajak,
|
||||
subtotalAfterDiskon
|
||||
);
|
||||
const totalBeforeDownpayment = subtotalAfterDiskon + pajak;
|
||||
|
||||
const downpayment = calculateByType(
|
||||
formKontrak.type_downpayment,
|
||||
formKontrak.besarNilai_downpayment,
|
||||
totalBeforeDownpayment
|
||||
);
|
||||
|
||||
const total = Math.max(totalBeforeDownpayment - downpayment, 0);
|
||||
|
||||
context.commit('update_received_order', calculatedItems);
|
||||
context.commit('update_summary_order', {
|
||||
subtotal: subtotal,
|
||||
diskon: diskon,
|
||||
pajak: pajak,
|
||||
downpayment: downpayment,
|
||||
total_before_downpayment: totalBeforeDownpayment,
|
||||
total: total
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function parseCurrency(value) {
|
||||
let cleanValue = String(value || 0).replace(/\./g, '');
|
||||
cleanValue = cleanValue.replace(',', '.');
|
||||
return parseFloat(cleanValue) || 0;
|
||||
}
|
||||
|
||||
function calculateByType(type, value, base) {
|
||||
const amount = parseCurrency(value);
|
||||
|
||||
if (type == 'percent') {
|
||||
return base * amount / 100;
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
216
test/vuex/acc-one-approval-po-asset/modules/order-asset.js
Normal file
216
test/vuex/acc-one-approval-po-asset/modules/order-asset.js
Normal file
@@ -0,0 +1,216 @@
|
||||
import * as api from '../api/api.js';
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
snackbar: {
|
||||
color: 'success',
|
||||
msg: '',
|
||||
state: false
|
||||
},
|
||||
user: {},
|
||||
loading_process: false,
|
||||
filter: {
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
status: "All",
|
||||
search: ""
|
||||
},
|
||||
list_status: ['All', 'Draft', 'Pending', 'Approved', 'Rejected', 'Completed'],
|
||||
list_order: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
currpage: 1,
|
||||
list_cabang: [],
|
||||
list_gudang: [],
|
||||
list_supplier: [],
|
||||
|
||||
/* dialog confirm order */
|
||||
dialog_confirm_order: false,
|
||||
selected_order: {},
|
||||
|
||||
view_detail_mode: false,
|
||||
|
||||
dialog_attachment: false,
|
||||
list_attachment: []
|
||||
},
|
||||
mutations: {
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_user(state, val) {
|
||||
state.user = val
|
||||
},
|
||||
update_loading_process(state, val) {
|
||||
state.loading_process = val
|
||||
},
|
||||
update_filter(state, val) {
|
||||
state.filter = val
|
||||
},
|
||||
update_list_status(state, val) {
|
||||
state.list_status = val
|
||||
},
|
||||
update_list_order(state, val) {
|
||||
state.list_order = val
|
||||
},
|
||||
update_currpage(state, val) {
|
||||
state.currpage = val
|
||||
},
|
||||
update_list_cabang(state, val) {
|
||||
state.list_cabang = val
|
||||
},
|
||||
update_list_gudang(state, val) {
|
||||
state.list_gudang = val
|
||||
},
|
||||
update_list_supplier(state, val) {
|
||||
state.list_supplier = val
|
||||
},
|
||||
update_dialog_confirm_order(state, val) {
|
||||
state.dialog_confirm_order = val
|
||||
},
|
||||
update_selected_order(state, val) {
|
||||
state.selected_order = val
|
||||
},
|
||||
update_view_detail_mode(state, val) {
|
||||
state.view_detail_mode = val
|
||||
},
|
||||
update_dialog_attachment(state, val) {
|
||||
state.dialog_attachment = val
|
||||
},
|
||||
update_list_attachment(state, val) {
|
||||
state.list_attachment = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async listingCabang(context) {
|
||||
try {
|
||||
let param = { token: one_token() }
|
||||
|
||||
const resp = await api.getListCabang(param);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_list_cabang', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("common/update_snackbar", snac, { root: true });
|
||||
}
|
||||
},
|
||||
async listingGudang(context, branchID) {
|
||||
try {
|
||||
let param = {
|
||||
token: one_token(),
|
||||
M_BranchID: branchID
|
||||
}
|
||||
|
||||
const resp = await api.getListGudang(param);
|
||||
if (resp.status != "OK") {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_list_gudang', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("common/update_snackbar", snac, { root: true });
|
||||
}
|
||||
},
|
||||
async listingSupplier(context) {
|
||||
try {
|
||||
const params = { token: one_token() };
|
||||
const resp = await api.getListSupplier(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_list_supplier', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("update_snackbar", snac, { root: true });
|
||||
}
|
||||
},
|
||||
async getListingPOAsset(context) {
|
||||
try {
|
||||
const params = {
|
||||
token: one_token(),
|
||||
currpage: context.state.currpage,
|
||||
...context.state.filter
|
||||
};
|
||||
const resp = await api.getDaftarPoAset(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_list_order', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async getUserApproveLevel(context) {
|
||||
try {
|
||||
const params = { token: one_token() };
|
||||
const resp = await api.getUserApproveLevel(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_user', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async getAssetAttachment(context, param) {
|
||||
try {
|
||||
const params = {
|
||||
token: one_token(),
|
||||
contractID: param.contractID,
|
||||
poID: param.poID
|
||||
};
|
||||
const resp = await api.getDaftarAttachment(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
context.commit('update_list_attachment', resp.data);
|
||||
} catch (e) {
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
async confirmOrderAsset(context, poID) {
|
||||
try {
|
||||
context.state.loading_process = true;
|
||||
const userlvl = context.state.user.M_UserM_ApproveLevelID
|
||||
|
||||
const params = {
|
||||
token: one_token(),
|
||||
approvelevel: userlvl,
|
||||
poID: poID,
|
||||
};
|
||||
const resp = await api.updateApprovalPO(params);
|
||||
if (resp.status != 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
if (userlvl == '2') {
|
||||
const generate = await api.generatePOItemReceive(params);
|
||||
if (generate.status !== 'OK') {
|
||||
throw new Error(generate.message);
|
||||
}
|
||||
}
|
||||
|
||||
context.dispatch("getListingPOAsset");
|
||||
context.state.loading_process = false;
|
||||
context.state.view_detail_mode = false;
|
||||
context.state.dialog_confirm_order = false;
|
||||
} catch (e) {
|
||||
context.state.loading_process = false;
|
||||
const snac = { color: 'error', msg: e.message, state: true };
|
||||
context.commit("update_snackbar", snac);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
14
test/vuex/acc-one-approval-po-asset/store.js
Normal file
14
test/vuex/acc-one-approval-po-asset/store.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
import formView from "./modules/form-view.js";
|
||||
import orderAsset from "./modules/order-asset.js";
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
orderAsset: orderAsset,
|
||||
formView: formView
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {}
|
||||
})
|
||||
Reference in New Issue
Block a user