feature: po pay downpayment

This commit is contained in:
2026-07-20 13:14:28 +07:00
parent dd5f0b6ab4
commit d92fb57751
64 changed files with 6166 additions and 1739 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View 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>