add modules folder based on s_menu
This commit is contained in:
162
test/vuex/acc-one-approve-po-jasa/api/api.js
Normal file
162
test/vuex/acc-one-approve-po-jasa/api/api.js
Normal file
@@ -0,0 +1,162 @@
|
||||
const URL = "/one-api/mockup/purchase/order/PurchaseOrderService/";
|
||||
const URLRO = "/one-api/mockup/receive-item-po/ReceiveOrderService/";
|
||||
|
||||
export async function getDaftarCabang(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "getDaftarCabang", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDaftarSupplier(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "getDaftarSupplier", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDaftarPOJasa(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "getDaftarPOJasa", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDataKontrakPOJasa(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "getDataKontrakPOJasa", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserApproveLevel(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "getUserApproveLevel", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateApprovalPO(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "updateApprovalPO", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function generatePOItemReceive(params) {
|
||||
try {
|
||||
const response = await axios.post(URLRO + "generatePOItemReceive", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
const data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDaftarAttachment(params) {
|
||||
try {
|
||||
const response = await axios.post(URL + "getDaftarAttachment", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
};
|
||||
}
|
||||
|
||||
const data = response.data;
|
||||
return data;
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
};
|
||||
}
|
||||
}
|
||||
364
test/vuex/acc-one-approve-po-jasa/components/dialog-confirm.vue
Normal file
364
test/vuex/acc-one-approve-po-jasa/components/dialog-confirm.vue
Normal file
@@ -0,0 +1,364 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_confirm" persistent width="70vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2">KONFIRMASI PO JASA</v-card-title>
|
||||
<v-card-text style="max-height: 80vh; overflow-y: auto;">
|
||||
<!-- first row -->
|
||||
<v-layout row wrap>
|
||||
<v-flex xs4>
|
||||
<v-text-field
|
||||
v-model="formattedPODate" hide-details
|
||||
label="Tanggal PO" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pl-2>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.SupplierName" hide-details
|
||||
label="Vendor" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 pl-2>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.reference" hide-details
|
||||
label="Referensi" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<!-- second row -->
|
||||
<v-layout row wrap mt-2>
|
||||
<v-flex xs4>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.M_BranchName"
|
||||
label="Cabang" readonly outline hide-details
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pl-2>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.typepajak" hide-details
|
||||
label="Pajak (PPN)" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pl-2>
|
||||
<v-text-field
|
||||
v-if="selected_pojasa.typepajak == 'percent'"
|
||||
v-model="selected_pojasa.valuepajak" hide-details
|
||||
label="Jumlah Pajak" readonly outline suffix="%"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-else hide-details outline prefix="Rp."
|
||||
v-model="formattedPajak"
|
||||
label="Jumlah Pajak" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pl-2>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.typediskon" hide-details
|
||||
label="Diskon" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs2 pl-2>
|
||||
<v-text-field
|
||||
v-if="selected_pojasa.typediskon == 'percent'"
|
||||
v-model="selected_pojasa.valuediskon" hide-details
|
||||
label="Jumlah Diskon" readonly outline suffix="%"
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-else hide-details outline prefix="Rp."
|
||||
v-model="formattedDiskon"
|
||||
label="Jumlah Diskon" readonly
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<!-- third row -->
|
||||
<v-layout row wrap mt-2>
|
||||
<v-flex xs3>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.typekontrak" outline
|
||||
label="Jenis Kontrak" readonly hide-details
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-text-field
|
||||
v-model="formattedKontrakStartDate" hide-details
|
||||
label="Tanggal Mulai Kontrak" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-text-field
|
||||
v-model="formattedKontrakEndDate" hide-details
|
||||
label="Tanggal Akhir Kontrak" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-text-field
|
||||
v-model="selected_pojasa.PIOutQty" hide-details
|
||||
label="Jumlah PI keluar" readonly outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-textarea
|
||||
v-model="selected_pojasa.catatan" auto-grow readonly
|
||||
rows="1" outline label="Catatan" hide-details class="mt-2"
|
||||
></v-textarea>
|
||||
|
||||
<!-- detail table -->
|
||||
<v-layout row wrap class="mt-2">
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="headers" :items="selected_pojasa.detail" :expand="expand"
|
||||
class="elevation-1" hide-actions item-key="M_ItemCode"
|
||||
>
|
||||
<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">
|
||||
Rp. {{ formatCurrency(props.item.DiskonAmount) }}
|
||||
</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="headers_detail" class="elevation-0"
|
||||
:items="props.item.detail" hide-actions
|
||||
>
|
||||
<template v-slot:items="obj">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ obj.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ obj.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ obj.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ obj.item.RequestQty }}</td>
|
||||
<td class="text-xs-center pa-2">{{ obj.item.ItemUnitName }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
{{ formatCurrency(obj.item.SupplierPrice) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<template v-slot:footer>
|
||||
<tr>
|
||||
<td colspan="1" class="text-xs-left pa-2"></td>
|
||||
<td colspan="5" class="text-xs-left pa-2">
|
||||
<strong>JUMLAH</strong>
|
||||
</td>
|
||||
<td colspan="1" class="text-xs-center pa-2">
|
||||
<strong>Rp. {{ formatCurrency(selected_pojasa.summary.subtotal) }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1" class="text-xs-left pa-2"></td>
|
||||
<td colspan="5" class="text-xs-left pa-2">
|
||||
<strong>DISKON</strong>
|
||||
</td>
|
||||
<td colspan="1" class="text-xs-center pa-2">
|
||||
<strong>Rp. {{ formatCurrency(selected_pojasa.summary.diskon) }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1" class="text-xs-left pa-2"></td>
|
||||
<td colspan="5" class="text-xs-left pa-2">
|
||||
<strong>PAJAK</strong>
|
||||
</td>
|
||||
<td colspan="1" class="text-xs-center pa-2">
|
||||
<strong>Rp. {{ formatCurrency(selected_pojasa.summary.pajak) }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="1" class="text-xs-left pa-2"></td>
|
||||
<td colspan="5" class="text-xs-left pa-2">
|
||||
<strong>TOTAL</strong>
|
||||
</td>
|
||||
<td colspan="1" class="text-xs-center pa-2">
|
||||
<strong>Rp. {{ formatCurrency(selected_pojasa.summary.total) }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn @click="viewAttachment()" color="info" class="white--text">Attachment</v-btn>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn @click="batalKonfirmasi()" color="error" class="white--text">Batal</v-btn>
|
||||
<v-btn v-if="!detail_view" @click="KonfirmasiJasa()" color="primary" class="white--text">
|
||||
{{ selected_pojasa.verifiedby == '0' ? "Verifikasi" : "Approve" }}
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</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: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA SETELAH DISKON", align: "center", sortable: false,
|
||||
value: "disc", width: "15%", 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",
|
||||
},
|
||||
],
|
||||
headers_detail: [
|
||||
{
|
||||
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: {
|
||||
loading_process() {
|
||||
return this.$store.state.poservice.loading_process
|
||||
},
|
||||
selected_pojasa() {
|
||||
return this.$store.state.poservice.selected_pojasa
|
||||
},
|
||||
formattedPODate() {
|
||||
return this.formatDate(this.selected_pojasa.podate)
|
||||
},
|
||||
formattedKontrakStartDate() {
|
||||
return this.formatDate(this.selected_pojasa.kontrakstart)
|
||||
},
|
||||
formattedKontrakEndDate() {
|
||||
return this.formatDate(this.selected_pojasa.kontrakend)
|
||||
},
|
||||
formattedPajak() {
|
||||
return this.formatCurrency(this.selected_pojasa.valuepajak)
|
||||
},
|
||||
formattedDiskon() {
|
||||
return this.formatCurrency(this.selected_pojasa.valuediskon)
|
||||
},
|
||||
detail_view() {
|
||||
return this.$store.state.poservice.detail_view
|
||||
},
|
||||
dialog_confirm: {
|
||||
get() {
|
||||
return this.$store.state.poservice.dialog_confirm
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("poservice/update_dialog_confirm", val)
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.poservice.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("poservice/update_snackbar", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
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, ".");
|
||||
},
|
||||
viewAttachment() {
|
||||
let item = this.selected_pojasa
|
||||
let param = {
|
||||
TJasaID: item.T_KontrakJasaID,
|
||||
poID: item.PurchaseOrderID
|
||||
}
|
||||
|
||||
this.$store.dispatch("poservice/lookupAttachment", param)
|
||||
this.$store.commit("poservice/update_dialog_attachment", true)
|
||||
},
|
||||
batalKonfirmasi() {
|
||||
this.$store.commit("poservice/update_selected_pojasa", {
|
||||
summary: {
|
||||
subtotal: 0.00,
|
||||
diskon: 0.00,
|
||||
pajak: 0.00,
|
||||
total: 0.00
|
||||
}
|
||||
})
|
||||
this.dialog_confirm = false
|
||||
},
|
||||
KonfirmasiJasa() {
|
||||
if (!this.loading_process) {
|
||||
this.$store.dispatch("poservice/updateApprovePO");
|
||||
} else {
|
||||
let snac = {color: 'warning', msg: 'proses sedang berjalan', state: true}
|
||||
this.snackbar = snac
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -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 prview_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>
|
||||
.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.poservice.dialog_attachment
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("poservice/update_dialog_attachment", val)
|
||||
}
|
||||
},
|
||||
prview_attachment() {
|
||||
return this.$store.state.poservice.prview_attachment
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
makeImageURL(nota) {
|
||||
const year = new Date(nota.created).getFullYear();
|
||||
const baseURL = BASE_URL + `/one-media/order-jasa/${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,275 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">APPROVE PURCHASE ORDER JASA</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="filterjasa.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="filterjasa.enddate" no-title
|
||||
@input="menuEnddateFilter = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-autocomplete
|
||||
:items="liststatus" hide-details outline
|
||||
v-model="filterjasa.status" label="Status"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs3 pl-2>
|
||||
<v-text-field
|
||||
v-model="filterjasa.search" hide-details outline
|
||||
label="Cari" placeholder="cai 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_pojasa.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="userinfo.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="userinfo.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-attachs></dialog-attachs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'dialog-confirm': httpVueLoader('./dialog-confirm.vue'),
|
||||
'dialog-attachs': httpVueLoader('./dialog-view-attachment.vue')
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("poservice/lookupVendor")
|
||||
this.$store.dispatch("poservice/lookupCabang")
|
||||
this.$store.dispatch("poservice/lookupPOJasa")
|
||||
this.$store.dispatch("poservice/lookupUserApproveLevel")
|
||||
},
|
||||
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: "date", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "VENDOR", align: "center", sortable: false,
|
||||
value: "supplier", width: "15%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "CABANG", align: "center", sortable: false,
|
||||
value: "branch", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "KETERANGAN", align: "center", sortable: false,
|
||||
value: "note", width: "20%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL", align: "center", sortable: false,
|
||||
value: "total", width: "10%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS", align: "center", sortable: false,
|
||||
value: "status", width: "7%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "action", width: "13%", class: "pa-1 blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filterjasa: {
|
||||
get() {
|
||||
return this.$store.state.poservice.filterjasa;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("poservice/update_filterjasa", val);
|
||||
}
|
||||
},
|
||||
formattedStartdate() {
|
||||
return this.formatDate(this.filterjasa.startdate)
|
||||
},
|
||||
formattedEnddate() {
|
||||
return this.formatDate(this.filterjasa.enddate)
|
||||
},
|
||||
liststatus() {
|
||||
return this.$store.state.poservice.liststatus
|
||||
},
|
||||
list_pojasa() {
|
||||
return this.$store.state.poservice.list_pojasa
|
||||
},
|
||||
pagelength() {
|
||||
let total = this.list_pojasa.total
|
||||
if (total === undefined || total < 1) return 1
|
||||
return Math.ceil(total/10)
|
||||
},
|
||||
userinfo() {
|
||||
return this.$store.state.poservice.userinfo
|
||||
},
|
||||
loading_process() {
|
||||
return this.$store.state.poservice.loading_process
|
||||
},
|
||||
currpage: {
|
||||
get() {
|
||||
return this.$store.state.poservice.currpage
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("poservice/update_currpage", val)
|
||||
this.$store.dispatch("poservice/lookupPOJasa")
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.poservice.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("poservice/update_snackbar", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
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) {
|
||||
let poid = item.PurchaseOrderID
|
||||
let userlevel = this.userinfo.M_UserM_ApproveLevelID
|
||||
if (item.verifiedby == '0' || userlevel != '1') {
|
||||
this.$store.dispatch("poservice/lookupDetailPO", poid)
|
||||
this.$store.commit("poservice/update_detail_view", false)
|
||||
this.$store.commit("poservice/update_dialog_confirm", true)
|
||||
} else {
|
||||
let snac = {color: 'info', msg: 'po sudah diverifikasi', state: true}
|
||||
this.snackbar = snac
|
||||
}
|
||||
},
|
||||
viewdetail(item) {
|
||||
this.$store.dispatch("poservice/lookupDetailPO", item.PurchaseOrderID)
|
||||
this.$store.commit("poservice/update_detail_view", true)
|
||||
this.$store.commit("poservice/update_dialog_confirm", true)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
filterjasa: {
|
||||
handler(val) {
|
||||
this.$store.dispatch("poservice/lookupPOJasa")
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
60
test/vuex/acc-one-approve-po-jasa/index.php
Normal file
60
test/vuex/acc-one-approve-po-jasa/index.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
<title>One</title>
|
||||
</head>
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background: #F5E8DF!important">
|
||||
<v-container fluid fill-height class="px-1 py-2">
|
||||
<v-flex xs12 fill-height pa-1>
|
||||
<one-layout-service></one-layout-service>
|
||||
</v-flex>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer></one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
|
||||
<!-- App Script -->
|
||||
<script type="module">
|
||||
import { store } from './store.js';
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: "#app",
|
||||
methods: {},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-layout-service': httpVueLoader('./components/one-layout-service.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
231
test/vuex/acc-one-approve-po-jasa/modules/poservice.js
Normal file
231
test/vuex/acc-one-approve-po-jasa/modules/poservice.js
Normal file
@@ -0,0 +1,231 @@
|
||||
import * as api from '../api/api.js';
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
/* utility */
|
||||
snackbar: {
|
||||
color: 'success',
|
||||
msg: '',
|
||||
state: false
|
||||
},
|
||||
|
||||
filterjasa: {
|
||||
startdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
enddate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
status: "All",
|
||||
search: ""
|
||||
},
|
||||
liststatus: ['All', 'Draft', 'Pending', 'Approved', 'Rejected', 'Completed'],
|
||||
list_pojasa: {
|
||||
records: [],
|
||||
total: 0
|
||||
},
|
||||
currpage: 1,
|
||||
loading_process: false,
|
||||
list_supplier: [],
|
||||
list_branch: [],
|
||||
userinfo: {},
|
||||
|
||||
/* dialog konfirmasi */
|
||||
dialog_confirm: false,
|
||||
detail_view: false,
|
||||
selected_pojasa: {
|
||||
summary: {
|
||||
subtotal: 0.00,
|
||||
diskon: 0.00,
|
||||
pajak: 0.00,
|
||||
total: 0.00
|
||||
}
|
||||
},
|
||||
|
||||
/* dialog attachment */
|
||||
dialog_attachment: false,
|
||||
prview_attachment: []
|
||||
},
|
||||
mutations: {
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_filterjasa(state, val) {
|
||||
state.filterjasa = val
|
||||
},
|
||||
update_liststatus(state, val) {
|
||||
state.liststatus = val
|
||||
},
|
||||
update_list_pojasa(state, val) {
|
||||
state.list_pojasa = val
|
||||
},
|
||||
update_currpage(state, val) {
|
||||
state.currpage = val
|
||||
},
|
||||
update_loading_process(state, val) {
|
||||
state.loading_process = val
|
||||
},
|
||||
update_list_supplier(state, val) {
|
||||
state.list_supplier = val
|
||||
},
|
||||
update_list_branch(state, val) {
|
||||
state.list_branch = val
|
||||
},
|
||||
update_userinfo(state, val) {
|
||||
state.userinfo = val
|
||||
},
|
||||
update_dialog_confirm(state, val) {
|
||||
state.dialog_confirm = val
|
||||
},
|
||||
update_detail_view(state, val) {
|
||||
state.detail_view = val
|
||||
},
|
||||
update_selected_pojasa(state, val) {
|
||||
state.selected_pojasa = val
|
||||
},
|
||||
update_dialog_attachment(state, val) {
|
||||
state.dialog_attachment = val
|
||||
},
|
||||
update_prview_attachment(state, val) {
|
||||
state.prview_attachment = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookupCabang(context) {
|
||||
try {
|
||||
const resp = await api.getDaftarCabang({token: one_token()})
|
||||
if (resp.status != 'OK') {
|
||||
let snac = {color: 'error', msg: resp.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
} else {
|
||||
context.commit("update_list_branch", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupVendor(context) {
|
||||
try {
|
||||
const resp = await api.getDaftarSupplier({token: one_token()})
|
||||
if (resp.status != 'OK') {
|
||||
let snac = {color: 'error', msg: resp.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
} else {
|
||||
context.commit("update_list_supplier", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupPOJasa(context) {
|
||||
try {
|
||||
let param = {
|
||||
token: one_token(),
|
||||
currpage: context.state.currpage,
|
||||
...context.state.filterjasa
|
||||
}
|
||||
|
||||
const resp = await api.getDaftarPOJasa(param)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = {color: 'error', msg: resp.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
} else {
|
||||
context.commit('update_list_pojasa', resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupDetailPO(context, poid) {
|
||||
try {
|
||||
let param = {
|
||||
token: one_token(),
|
||||
poID: poid
|
||||
}
|
||||
|
||||
const resp = await api.getDataKontrakPOJasa(param)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = {color: 'error', msg: resp.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
} else {
|
||||
context.commit("update_selected_pojasa", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupUserApproveLevel(context) {
|
||||
try {
|
||||
const resp = await api.getUserApproveLevel({token: one_token()})
|
||||
if (resp.status != 'OK') {
|
||||
let snac = {color: 'error', msg: resp.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
} else {
|
||||
context.commit("update_userinfo", resp.data)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
}
|
||||
},
|
||||
|
||||
async lookupAttachment(context, param) {
|
||||
try {
|
||||
param.token = one_token()
|
||||
const resp = await api.getDaftarAttachment(param)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = {color: 'error', msg: resp.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
} else {
|
||||
context.commit('update_prview_attachment', resp.data)
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true}
|
||||
context.commit('update_snackbar', snac)
|
||||
}
|
||||
},
|
||||
|
||||
async updateApprovePO(context) {
|
||||
try {
|
||||
context.state.loading_process = true;
|
||||
|
||||
const jasa = context.state.selected_pojasa;
|
||||
const param = {
|
||||
token: one_token(),
|
||||
approvelevel: context.state.userinfo.M_UserM_ApproveLevelID,
|
||||
poID: jasa.PurchaseOrderID,
|
||||
kontrakid: jasa.T_KontrakJasaID
|
||||
};
|
||||
|
||||
const resp = await api.updateApprovalPO(param);
|
||||
if (resp.status !== 'OK') {
|
||||
throw new Error(resp.message);
|
||||
}
|
||||
|
||||
if (param.approvelevel === '2') {
|
||||
const generate = await api.generatePOItemReceive(param);
|
||||
if (generate.status !== 'OK') {
|
||||
throw new Error(generate.message);
|
||||
}
|
||||
}
|
||||
|
||||
let snac = {color: 'success', msg: resp.data, state: true};
|
||||
context.commit('update_snackbar', snac);
|
||||
context.dispatch('lookupPOJasa');
|
||||
context.state.dialog_confirm = false
|
||||
} catch (error) {
|
||||
let snac = {color: 'error', msg: error.message, state: true};
|
||||
context.commit('update_snackbar', snac);
|
||||
} finally {
|
||||
context.state.loading_process = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
test/vuex/acc-one-approve-po-jasa/store.js
Normal file
11
test/vuex/acc-one-approve-po-jasa/store.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
import poservice from "./modules/poservice.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
poservice: poservice
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {}
|
||||
});
|
||||
Reference in New Issue
Block a user