add modules folder based on s_menu

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

View File

@@ -0,0 +1,177 @@
const URL = "/one-api/mockup/purchase/manager/";
export async function search(payload) {
try {
var response = await axios.post(URL + "purchaseRequestDirectApproved/search", payload);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function getlevel(payload) {
try {
var response = await axios.post(URL + "purchaseRequestDirectApproved/getlevel", payload);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function searchDetail(payload) {
try {
var response = await axios.post(
URL + "purchaseRequestDirectApproved/searchDetail",
payload
);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function deleteDetail(payload) {
try {
var response = await axios.post(
URL + "purchaseRequestDirectApproved/deleteDetail",
payload
);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function approveRequest(payload) {
try {
var response = await axios.post(
URL + "purchaseRequestDirectApproved/approveRequest",
payload
);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function rejectRequest(payload) {
try {
var response = await axios.post(
URL + "purchaseRequestDirectApproved/rejectRequest",
payload
);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function unApproveRequest(payload) {
try {
var response = await axios.post(
URL + "purchaseRequestDirectApproved/unApproveRequest",
payload
);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}
export async function updateDetail(payload) {
try {
var response = await axios.post(
URL + "purchaseRequestDirectApproved/updateDetail",
payload
);
if (response.status !== 200) {
return {
status: "ERR",
message: response.statusText,
};
}
let data = response.data;
return data;
} catch (e) {
return {
status: "ERR",
message: e.message,
};
}
}

View File

@@ -0,0 +1,50 @@
<template>
<v-dialog v-model="dialogAlertDeleteDetail" max-width="30%" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
Peringatan !!
</v-card-title>
<v-card-text class="my-2">
{{ msgAlertDeleteRequest }}
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
@click="dialogAlertDeleteDetail = false"
color="error" flat outline
>Tutup</v-btn>
<v-btn
color="primary" dark
@click="closeAndDeleteDetail()"
>Ya</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
}
},
computed: {
dialogAlertDeleteDetail: {
}
},
methods: {
closeAndDeleteDetail() {
this.$store.dispatch("manager/deleteDetail", {
PRID: this.xPRID,
PRDDescription: this.xDescriptionDetail,
PRDID: this.xPRDID,
});
this.dialogAlertDeleteDetail = false
}
},
}
</script>

View File

@@ -0,0 +1,148 @@
<template>
<v-layout row justify-center>
<v-dialog v-model="dialogForm" persistent max-width="60vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
BUKTI PEMBAYARAN
</v-card-title>
<v-card-text class="pt-2 pb-0">
<v-layout v-if="show_progrees_upload" row align-center mr-2 ml-2>
<v-flex xs12>
<v-progress-linear :indeterminate="true"></v-progress-linear>
</v-flex>
</v-layout>
<v-layout v-if="imagePreviews.length > 0 && !show_progrees_upload" align-center row wrap>
<v-flex
v-for="(img, index) in imagePreviews"
:key="index"
xs6
class="pa-2"
>
<v-img :src="img">
<div class="fill-height bottom-gradient"></div>
</v-img>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="error" flat @click="closeDiallog()"> Tutup </v-btn>
<v-btn color="primary" v-if="actAttach == 'upload'" dark @click="saveForm()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-layout>
</template>
<script>
module.exports = {
name: "formDialogAttachtment",
data() {
return {
};
},
mounted() {
},
computed: {
dialogForm: {
get() {
return this.$store.state.manager.dialog_form;
},
set(val) {
this.$store.commit("manager/update_dialog_form", val);
},
},
show_progrees_upload: {
get() {
return this.$store.state.manager.show_progrees_upload
},
set(val) {
this.$store.commit("manager/update_show_progrees_upload", val)
}
},
imageFiles: {
get() {
return this.$store.state.manager.imageFiles
},
set(val) {
this.$store.commit("manager/update_imageFiles", val)
}
},
imagePreviews: {
get() {
return this.$store.state.manager.imagePreviews
},
set(val) {
this.$store.commit("manager/update_imagePreviews", val)
}
},
cekFile: {
get() {
return this.$store.state.manager.cekFile;
},
set(val) {
this.$store.commit("manager/update_cekFile", val);
},
},
actAttach: {
get() {
return this.$store.state.manager.actAttach;
},
set(val) {
this.$store.commit("manager/update_actAttach", val);
},
}
},
methods: {
closeDiallog() {
this.$store.commit("manager/update_dialog_form", false);
},
handleFileUploads(){
// this.files = this.$refs.files.files
const files = this.$refs.files.files;
this.imagePreviews = [];
this.imageFiles = [];
for (let i = 0; i < files.length; i++) {
const file = files[i];
const url = URL.createObjectURL(file);
this.imagePreviews.push(url);
this.imageFiles.push(file);
}
// console.log('imagePreviews', this.imagePreviews)
// console.log('imageFiles', this.imageFiles)
},
saveForm() {
var formData = new FormData()
console.log("formData",this.imageFiles.length)
for( var i = 0; i < this.imageFiles.length; i++ ){
let file = this.imageFiles[i]
formData.append('files[' + i + ']', file)
// console.log("formData",formData)
}
var user = one_user()
formData.append('PRDID', this.$store.state.manager.selectedDetailTable.PurchaseRequestDirectDetailID)
formData.append('directNumber', this.$store.state.manager.selectedMainTable.PurchaseRequestDirectNumber)
formData.append('userId', user.M_UserID)
// console.log('prpd', this.$store.state.manager.selectedDetailTable.PurchaseRequestDirectDetailID)
// console.log('prm', formData)
this.$store.dispatch('manager/saveFiles', formData)
//this.submitFiles();
}
},
watch: {
},
}
</script>

View File

@@ -0,0 +1,116 @@
<template>
<v-dialog v-model="dialogDetail" persistent max-width="500px">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM EDIT REQUEST DETAIL
</v-card-title>
<v-card-text>
<v-form ref="formDetail" v-model="validationDetail" lazy-validation>
<v-text-field
v-model="formattedAmount" type="number" label="Jumlah"
:min="0" required :rules="amountRules"
hide-details outline
></v-text-field>
<v-text-field
v-model="formattedPrice" label="Harga Satuan"
prefix="Rp. " required hide-details outline
></v-text-field>
<v-text-field
v-model="formattedTotal" label="Harga Total"
prefix="Rp. " required hide-details outline
></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="error" flat @click="closeDialogDetail()">Tutup</v-btn>
<v-btn color="primary" dark @click="updateDialogDetail()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
validationDetail: false,
amount_input: 0,
price_input: 0,
total_input: 0,
amountRules: [v => !!v || "Tidak boleh kosong"]
}
},
computed: {
dialogDetail: {
get() {
return this.$store.state.manager.dialogDetail;
},
set(val) {
this.$store.commit("manager/updateDialogDetail", val);
},
},
formattedAmount: {
get() {
return this.amount_input
}
},
formattedPrice: {
get() {
return this.price_input
}
},
formattedTotal: {
get() {
return this.total_input
}
}
},
methods: {
roundToThreeSignificantDigits(digit) {
// if (num === 0) return 0;
// const absNum = Math.abs(num);
// const magnitude = Math.floor(Math.log10(absNum)) + 1;
// if (magnitude <= 3) return num;
// const factor = Math.pow(10, magnitude - 3);
// return Math.round(num / factor) * factor;
const num = parseInt(digit, 10)
if (isNaN(num) || num <= 0) {
return 0;
}
const scale = 10 ** digit.length;
const decimal = num / scale
return Math.round(decimal * 1000);
},
oneMoney(value) {
let splitValue = value.toString().split(".");
if(splitValue.length > 1) {
let val = splitValue[0]
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
} else {
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
},
closeDialogDetail() {
this.dialogDetail = false
},
updateDialogDetail() {
}
},
watch: {
dialogDetail(val) {
if (val) {
this.$nextTick(() => {
this.$ref.formDetail?.resetValidation()
})
}
}
},
}
</script>

View File

@@ -0,0 +1,234 @@
<template>
<v-dialog v-model="dialogDetail" persistent max-width="500px">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM EDIT REQUEST DETAIL
</v-card-title>
<v-card-text>
<v-form ref="formDetail" v-model="validationDetail" lazy-validation>
<v-text-field
v-model="formattedAmount" label="Jumlah" outline
:min="0" required class="mb-2" hide-details
:readonly="selectedDetailTable.PurchaseDirectCategoryName == 'BBM'"
@blur="onBlurInput()" @focus="onFokusInput()"
></v-text-field>
<v-text-field
v-model="formattedPrice" label="Harga Satuan" class="mb-2"
prefix="Rp. " required hide-details outline
@blur="onBlurInput()" @focus="onFokusInput()"
></v-text-field>
<v-text-field
v-model="formattedTotal" label="Harga Total" class="mb-2"
prefix="Rp. " required hide-details outline
:readonly="selectedDetailTable.PurchaseDirectCategoryName != 'BBM'"
@blur="onBlurInput()" @focus="onFokusInput()"
></v-text-field>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="error" flat @click="closeDialogDetail()">Tutup</v-btn>
<v-btn color="primary" dark @click="updateDialogDetail()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
validationDetail: false,
amount_input: 0,
price_input: 0,
total_input: 0,
amountRules: [v => !!v || "Tidak boleh kosong"]
}
},
computed: {
dialogDetail: {
get() {
return this.$store.state.manager.dialogDetail;
},
set(val) {
this.$store.commit("manager/updateDialogDetail", val);
},
},
formattedAmount: {
get() {
return this.amount_input
},
set(val) {
let raw = val.replace(/\./g, '').replace(',', '.');
this.xAmount = parseFloat(raw)
}
},
formattedPrice: {
get() {
return this.price_input
},
set(val) {
let raw = val.replace(/\./g, '').replace(',', '.');
this.xPrice = parseFloat(raw)
}
},
formattedTotal: {
get() {
return this.total_input
},
set(val) {
let raw = val.replace(/\./g, '').replace(',', '.');
this.xTotal = parseFloat(raw)
}
},
selectedDetailTable: {
get() {
return this.$store.state.manager.selectedDetailTable
},
set(val) {
this.$store.commit("manager/updateSelectedDetailTable", val)
}
},
xAmount: {
get() {
return this.$store.state.manager.xAmount;
},
set(val) {
this.$store.commit("manager/updateXAmount", val);
},
},
xPrice: {
get() {
return this.$store.state.manager.xPrice;
},
set(val) {
this.$store.commit("manager/updatexPrice", val);
},
},
xTotal: {
get() {
return this.$store.state.manager.xTotal;
},
set(val) {
this.$store.commit("manager/updatexTotal", val);
},
}
},
methods: {
roundToThreeSignificantDigits(digit) {
// if (num === 0) return 0;
// const absNum = Math.abs(num);
// const magnitude = Math.floor(Math.log10(absNum)) + 1;
// if (magnitude <= 3) return num;
// const factor = Math.pow(10, magnitude - 3);
// return Math.round(num / factor) * factor;
const num = parseInt(digit, 10)
if (isNaN(num) || num <= 0) {
return '00';
}
const scale = 10 ** digit.length;
const decimal = num / scale
return Math.round(decimal * 100).toString();
},
oneMoney(value) {
let splitValue = value.toString().split(".");
if(splitValue.length > 1) {
let val = splitValue[0]
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
} else {
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
},
onBlurInput() {
let detail = this.selectedDetailTable;
if (detail.PurchaseDirectCategoryName == 'BBM') {
let total = this.xTotal;
if (total % 1 === 0) {
total = this.oneMoney(total) + ",000";
this.total_input = total
} else {
this.total_input = this.oneMoney(total);
}
let price = this.xPrice;
if (price % 1 === 0) {
price = this.oneMoney(price) + ",000";
this.price_input = price
} else {
this.price_input = this.oneMoney(price);
}
let amount = this.xAmount
if (amount % 1 === 0) {
this.amount_input = amount
} else {
this.amount_input = this.oneMoney(amount)
}
} else {
this.price_input = this.oneMoney(this.xPrice);
this.total_input = this.oneMoney(this.xTotal);
}
},
onFokusInput() {
let amount = this.xAmount ?? 0;
let price = this.xPrice ?? 0;
let total = this.xTotal ?? 0;
this.amount_input = amount.toString().replace('.', ',');
this.price_input = price.toString().replace('.', ',');
this.total_input = total.toString().replace('.', ',');
},
closeDialogDetail() {
this.amount_input = 0;
this.price_input = 0;
this.total_input = 0;
this.xAmount = 0;
this.xPrice = 0;
this.xTotal = 0;
this.$refs.formDetail.resetValidation();
this.dialogDetail = false;
},
updateDialogDetail() {
if (this.$refs.formDetail.validate()) {
this.$store.dispatch("manager/updateDetail", {
PRID: this.selectedDetailTable.PurchaseRequestDirectDetailPurchaseRequestDirectID,
PRDID: this.selectedDetailTable.PurchaseRequestDirectDetailID,
PRDDescription: this.selectedDetailTable.PurchaseRequestDirectDescription,
PRDAmount: this.xAmount,
PRDPrice: this.xPrice,
PRDTotal: this.xTotal
});
}
}
},
watch: {
dialogDetail(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formDetail?.resetValidation();
let detail = this.selectedDetailTable;
this.amount_input = this.oneMoney(detail.PurchaseRequestDirectDetailAmountRequest);
this.price_input = this.oneMoney(detail.PurchaseRequestDirectDetailEstimationPrice);
this.total_input = this.oneMoney(detail.PurchaseRequestDirectDetailTotalEstimationPrice);
if (detail.PurchaseDirectCategoryName == 'BBM') {
this.xAmount = parseFloat(detail.PurchaseRequestDirectDetailAmountRequest)
this.xPrice = parseFloat(detail.PurchaseRequestDirectDetailEstimationPrice)
this.xTotal = parseFloat(detail.PurchaseRequestDirectDetailTotalEstimationPrice)
} else {
this.xAmount = detail.PurchaseRequestDirectDetailAmountRequest
this.xPrice = detail.PurchaseRequestDirectDetailEstimationPrice
this.xTotal = detail.PurchaseRequestDirectDetailTotalEstimationPrice
}
})
}
}
},
}
</script>

View File

@@ -0,0 +1,748 @@
<template>
<div style="width: 100%;">
<v-layout row wrap>
<!-- left side -->
<v-flex xs6 class="left" fill-height pa-1>
<v-toolbar color="primary" dark>
<v-toolbar-title class="white--text">
APPROVED PURCHASE REQUEST [ {{ levelname }} ]
</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn
v-if="(flag == 'G')" dark
@click="goBack()" color="orange darken-2" title="Kembali ke listing pending approval"
>
<v-icon dark left>arrow_back</v-icon>
Back
</v-btn>
</v-toolbar>
<v-card class="pa-2">
<v-layout row>
<v-flex xs3 class="pr-1">
<v-menu
v-model="menuStartDate" lazy offset-y
:nudge-right="40" max-width="290px" min-width="290px"
:close-on-content-click="false" full-width
>
<template v-slot:activator="{on}">
<v-text-field
:value="startDateFormatted" label="Tanggal Awal"
readonly outline hide-details v-on="on"
></v-text-field>
</template>
<v-date-picker
no-title v-model="fStartDate"
@input="menuStartDate = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs3 class="px-1">
<v-menu
v-model="menuEndDate" lazy offset-y
:nudge-right="40" max-width="290px" min-width="290px"
:close-on-content-click="false" full-width
>
<template v-slot:activator="{on}">
<v-text-field
:value="endDateFormatted" label="Tanggal Akhir"
readonly outline hide-details v-on="on"
></v-text-field>
</template>
<v-date-picker
no-title v-model="fEndDate"
@input="menuEndDate = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs2 class="px-1">
<v-autocomplete
v-model="fStatus" :items="statusOptions" label="Status"
item-text="title" item-value="title" outline hide-details
></v-autocomplete>
</v-flex>
<v-flex xs3 class="px-1">
<v-text-field
v-model="fSearch" placeholder="Nomor Request"
outline hide-details label="Cari..."
></v-text-field>
</v-flex>
<v-flex xs class="pl-1">
<v-btn dark color="primary" @click="mainTableSearch()">
<v-icon>search</v-icon>
</v-btn>
</v-flex>
</v-layout>
</v-card>
<v-card class="pa-2 mt-2">
<v-data-table
:headers="headers" :items="mainTable"
hide-actions class="elevation-1"
>
<template slot="items" slot-scope="props">
<tr :class="{ 'amber lighten-4': isSelected(props.item) }" @click="selectMe(props.item)">
<td class="text-xs-center pa-2">
{{ props.item.PurchaseRequestDirectNumber }}
<v-chip small style="border-radius: 5px; flex-grow: 0">
{{ props.item.M_RequesterFullName }}
</v-chip>
</td>
<td class="text-xs-left pa-2">
<span class="font-weight-medium">Permintaan: </span><br>
<span>{{ props.item.PurchaseRequestDirectDate }}</span><br>
<span class="font-weight-medium">Pelaksanaan: </span><br>
<span>{{ props.item.PurchaseRequestDirectDateUse }}</span>
</td>
<td class="text-xs-left pa-2">
{{ props.item.PurchaseRequestDirectDescription }}
</td>
<td class="text-xs-left pa-2">
<span class="font-weight-medium"> Estimasi: </span><br>
<span>Rp. {{ oneMoney(props.item.PurchaseRequestDirectTotalEstimation) }}</span><br>
<span class="font-weight-medium"> Realisasi: </span><br>
<span>Rp. {{ oneMoney(props.item.PurchaseRequestDirectTotalRealitation) }}</span>
</td>
<td class="text-xs-center pa-2">
<v-chip
:text-color="props.item.PurchaseRequestDirectStatus === 'Draft' ? 'black':'white'"
:color="getChipStatusColor(props.item.PurchaseRequestDirectStatus)" small
>
{{ props.item.PurchaseRequestDirectStatus }}
</v-chip>
</td>
<td class="text-xs-center pa-2">
<div v-if="props.item.PurchaseRequestDirectStatus != 'Draft'">
<v-btn
v-if="props.item.PurchaseRequestDirectStatus == 'Pending'"
small color="black" title="Edit" @click="{}"
>
<v-icon small color="white">edit</v-icon>
</v-btn>
<v-btn
v-if="['Approved', 'Paid', 'Completed'].includes(props.item.PurchaseRequestDirectStatus)"
small color="blue" title="Detail"
>
<v-icon small color="white">visibility</v-icon>
</v-btn>
</div>
</td>
</tr>
</template>
</v-data-table>
<v-divider></v-divider>
<div class="text-xs-center">
<v-pagination
class="mt-2" v-model="mainTableCurrentPage"
:length="mainTableTotalPage ?? 1" total-visible="5"
></v-pagination>
</div>
</v-card>
</v-flex>
<!-- right side -->
<v-flex xs6 class="right" fill-height pa-1>
<v-card class="pa-2">
<p>
Nama Pengambil:
<strong>{{ selectedMainTable.M_RequesterFullName ?? "-" }}</strong>
</p>
<v-data-table
:headers="detail_headers" :items="detailTable"
hide-actions class="elevation-1"
>
<template slot="items" slot-scope="props">
<tr>
<td class="text-xs-center pa-2">
{{ props.item.RowNumber }}
</td>
<td class="text-xs-left pa-2">
<p class="mb-0">{{ props.item.PurchaseRequestDirectDescription }}</p>
<strong>Kategori: {{ props.item.PurchaseDirectCategoryName }}</strong>
</td>
<td class="text-xs-left pa-2">
{{ props.item.PurchaseRequestDirectDetailAmountRequest }}
<strong>{{ props.item.ItemUnitName }}</strong>
</td>
<td class="text-xs-left pa-2">
{{
props.item.PurchaseRequestDirectDetailAmount ??
props.item.PurchaseRequestDirectDetailAmountRequest
}}
<strong>{{ props.item.ItemUnitName }}</strong>
</td>
<td class="text-xs-left pa-2">
<p class="mb-0">
Rp. {{ oneMoney(props.item.PurchaseRequestDirectDetailEstimationPrice) }} /
<strong>{{ props.item.ItemUnitName }}</strong>
</p>
<p class="mb-0">
TOTAL :
<strong>Rp. {{ oneMoney(props.item.PurchaseRequestDirectDetailTotalEstimationPrice) }}</strong>
</p>
</td>
<td class="text-xs-center pa-2">
<div v-if="!(selectedMainTable.PurchaseRequestDirectStatus != 'Pending')">
<v-btn
v-if="props.item.isAttachemnt == true"
color="grey" title="Lihat nota pembayaran" small
style="min-width: 25px; height: 25px; margin: 0;"
@click="openDialogPreviewNota(props.item)"
>
<v-icon small color="white">description</v-icon>
</v-btn>
<v-btn
color="black" title="Edit" small @click="updateDetail(props.item)"
style="min-width: 25px; height: 25px; margin: 0;"
>
<v-icon small color="white">edit</v-icon>
</v-btn>
<v-btn
color="red" title="Delete" small @click="deleteDetail(props.item)"
style="min-width: 25px; height: 25px; margin: 0;"
>
<v-icon small color="white">delete</v-icon>
</v-btn>
</div>
<div v-else>
<v-btn
v-if="props.item.isAttachemnt == true"
color="grey" title="Lihat nota pembayaran" small
style="min-width: 25px; height: 25px; margin: 0;"
@click="openDialogPreviewNota(props.item)"
>
<v-icon small color="white">description</v-icon>
</v-btn>
</div>
</td>
</tr>
</template>
</v-data-table>
<v-layout row wrap class="mt-2">
<v-text-field
v-if="selectedMainTable.PurchaseRequestDirectStatus == 'Pending'"
v-model="xNote" label="Catatan" hide-details outline
:disabled="!(Object.keys(selectedMainTable).length > 0)"
></v-text-field>
<span v-else-if="selectedMainTable.PurchaseRequestDirectStatus == 'Approved'">
Catatan: {{ selectedMainTable.PurchaseRequestDirectNote ?? "-" }}
</span>
<v-spacer></v-spacer>
<v-btn
v-if="selectedMainTable.PurchaseRequestDirectStatus == 'Pending'"
color="error" outline @click="rejectRequest(selectedMainTable)"
>Reject</v-btn>
<v-btn
v-if="selectedMainTable.PurchaseRequestDirectStatus == 'Pending'"
color="primary" dark @click="approveRequest(selectedMainTable)"
>Approve</v-btn>
<v-btn
v-if="selectedMainTable.PurchaseRequestDirectStatus == 'Approved'"
color="orange" dark @click="unApproveRequest(selectedMainTable)"
>Un-Approve</v-btn>
</v-layout>
</v-card>
</v-flex>
<!-- utility -->
<one-dialog-edit-req></one-dialog-edit-req>
<one-dialog-attachment></one-dialog-attachment>
<!-- dialog delete -->
<template>
<v-dialog v-model="dialogAlertDeleteDetail" max-width="30%" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
Peringatan !!
</v-card-title>
<v-card-text class="my-2">
{{ msgAlertDeleteRequest }}
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
@click="dialogAlertDeleteDetail = false"
color="error" flat outline
>Tutup</v-btn>
<v-btn
color="primary" dark
@click="closeAndDeleteDetail()"
>Ya</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<!-- dialog reject -->
<one-dialog-alert
:status="dialogAlertRejectRequest"
:msg="msgAlertDeleteOrReject"
@forget-dialog-alert="dialogAlertRejectRequest = false"
@close-dialog-alert="closeAndRejectRequest()"
></one-dialog-alert>
<!-- dialog un-approve -->
<template>
<v-dialog v-model="dialogAlertUnapprove" max-width="30%" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
Peringatan !!
</v-card-title>
<v-card-text class="my-2">
{{ msgAlertUnapproveRequest }}
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
@click="dialogAlertUnapprove = false"
color="error" flat outline
>Tutup</v-btn>
<v-btn
color="primary" dark
@click="closeAndUnapprove()"
>Ya</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<!-- alert success -->
<template>
<v-snackbar
v-model="snackbar" :timeout="5000" :multi-line="false"
:vertical="false" :top="true" color="orange"
>
{{ msgSnackbar }}
<v-btn flat @click="updateAlertSuccess()">Tutup</v-btn>
</v-snackbar>
</template>
<!-- alert info -->
<template>
<one-dialog-info :status="opendialoginfo" :msg="msginfo"
@close-dialog-info="opendialoginfo = false"></one-dialog-info>
</template>
</v-layout>
</div>
</template>
<style scoped>
.date-type-table {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
</style>
<script>
module.exports = {
mounted() {
this.$store.dispatch("manager/getlevel");
this.$store.dispatch("manager/search");
},
components: {
"one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
"one-dialog-error": httpVueLoader("../../common/oneDialogError.vue"),
"one-dialog-info": httpVueLoader("../../common/oneDialogInfo.vue"),
"one-dialog-attachment": httpVueLoader("./formDialogAttachtment.vue"),
"one-dialog-edit-req": httpVueLoader("./formEditRequest.vue"),
},
data() {
return {
msgAlertDeleteOrReject: "",
dialogAlertRejectRequest: false,
dialogAlertDeleteDetail: false,
dialogAlertUnapprove: false,
msgAlertDeleteRequest: "",
msgAlertUnapproveRequest: "",
menuStartDate: false,
menuEndDate: false,
xStatusNota: "",
headers: [
{
text: "NO. PD", align: "center", sortable: false,
value: "no", width: "15%", class: "blue lighten-3 white--text",
},
{
text: "TANGGAL", align: "left", sortable: false,
value: "date", width: "15%", class: "blue lighten-3 white--text",
},
{
text: "KETERANGAN", align: "left", sortable: false,
value: "description", width: "30%", class: "blue lighten-3 white--text",
},
{
text: "TOTAL", align: "left", sortable: false,
value: "description", width: "20%", class: "blue lighten-3 white--text",
},
{
text: "STATUS", align: "center", sortable: false,
value: "status", width: "10%", class: "blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false,
value: "action", width: "10%", class: "blue lighten-3 white--text",
},
],
detail_headers: [
{
text: "NO", align: "center", sortable: false,
value: "no", width: "5%", class: "blue lighten-3 white--text",
},
{
text: "KETERANGAN", align: "center", sortable: false,
value: "requestDate", width: "25%", class: "blue lighten-3 white--text",
},
{
text: "JMLH REQUEST", align: "center", sortable: false,
value: "requestDate", width: "15%", class: "blue lighten-3 white--text",
},
{
text: "JUMLAH", align: "center", sortable: false,
value: "requestDate", width: "15%", class: "blue lighten-3 white--text",
},
{
text: "HARGA", align: "center", sortable: false,
value: "requestDate", width: "20%", class: "blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false,
value: "action", width: "20%", class: "blue lighten-3 white--text",
},
],
}
},
computed: {
flag() {
return this.$store.state.manager.flag;
},
status() {
return this.$store.state.manager.status;
},
xstartdate() {
return this.$store.state.manager.xstartdate;
},
levelname() {
return this.$store.state.manager.levelname;
},
startDateFormatted() {
return this.formatDate(this.fStartDate)
},
endDateFormatted() {
return this.formatDate(this.fEndDate)
},
statusOptions() {
return this.$store.state.manager.statusOptions;
},
mainTable() {
return this.$store.state.manager.mainTable;
},
detailTable() {
return this.$store.state.manager.detailTable;
},
fStartDate: {
get() {
return this.$store.state.manager.fStartDate;
},
set(val) {
this.$store.commit("manager/updateFStartDate", val);
},
},
fEndDate: {
get() {
return this.$store.state.manager.fEndDate;
},
set(val) {
this.$store.commit("manager/updateFEndDate", val);
},
},
fStatus: {
get() {
return this.$store.state.manager.fStatus;
},
set(val) {
this.$store.commit("manager/updateFStatus", val);
},
},
fSearch: {
get() {
return this.$store.state.manager.fSearch;
},
set(val) {
this.$store.commit("manager/updateFSearch", val);
},
},
mainTableCurrentPage: {
get() {
return this.$store.state.manager.mainTableCurrentPage;
},
set(val) {
this.$store.commit("manager/updateMainTableCurrentPage", val);
this.$store.commit("manager/updateMainTableLastId", -1);
this.$store.dispatch("manager/search");
},
},
mainTableTotalPage: {
get() {
return this.$store.state.manager.countMainTable;
},
set(val) {
this.$store.commit("manager/updateCountMainTable", val);
},
},
selectedMainTable: {
get() {
return this.$store.state.manager.selectedMainTable;
},
set(val) {
this.$store.commit("updateSelectedMainTable", val);
},
},
xNote: {
get() {
return this.$store.state.manager.xNote;
},
set(val) {
this.$store.commit("manager/updateXNote", val);
},
},
xPRID: {
get() {
return this.$store.state.manager.xPRID;
},
set(val) {
this.$store.commit("manager/updateXPRID", val);
},
},
xPRDID: {
get() {
return this.$store.state.manager.xPRDID;
},
set(val) {
this.$store.commit("manager/updateXPRDID", val);
},
},
xStatus: {
get() {
return this.$store.state.manager.xStatus;
},
set(val) {
this.$store.commit("manager/updateXStatus", val);
},
},
xDescriptionDetail: {
get() {
return this.$store.state.manager.xDescriptionDetail;
},
set(val) {
this.$store.commit("manager/updateXDescriptionDetail", val);
},
},
opendialoginfo: {
get() {
return this.$store.state.manager.open_dialog_info
},
set(val) {
this.$store.commit("manager/update_open_dialog_info", val)
}
},
msginfo: {
get() {
return this.$store.state.manager.msg_info
},
set(val) {
this.$store.commit("manager/update_msg_info", val)
}
},
snackbar: {
get() {
return this.$store.state.manager.alertSuccess;
},
set(val) {
this.$store.commit("manager/updateAlertSuccess", val);
},
},
msgSnackbar: {
get() {
return this.$store.state.manager.successMessage;
},
set(val) {
this.$store.commit("manager/updateSuccessMessage", val);
},
},
},
methods: {
updateAlertSuccess() {
this.$store.commit("manager/updateAlertSuccess", false);
},
roundToThreeSignificantDigits(digit) {
// if (num === 0) return 0;
// const absNum = Math.abs(num);
// const magnitude = Math.floor(Math.log10(absNum)) + 1;
// if (magnitude <= 3) return num;
// const factor = Math.pow(10, magnitude - 3);
// return Math.round(num / factor) * factor;
const num = parseInt(digit, 10)
if (isNaN(num) || num <= 0) {
return '00';
}
const scale = 10 ** digit.length;
const decimal = num / scale
return Math.round(decimal * 100).toString();
},
oneMoney(value) {
let splitValue = value.toString().split(".");
if(splitValue.length > 1) {
let val = splitValue[0]
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
} else {
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
},
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
goBack() {
window.history.back();
},
mainTableSearch() {
this.$store.dispatch("manager/search");
this.$store.commit("manager/updateSelectedMainTable", {});
this.$store.commit("manager/updateDetailTable", []);
},
isSelected(item) {
return (
item.PurchaseRequestDirectNumber ==
this.$store.state.manager.selectedMainTable.PurchaseRequestDirectNumber
);
},
selectMe(item) {
this.$store.commit("manager/updateSelectedMainTable", item);
this.$store.dispatch("manager/searchDetail");
},
getChipStatusColor(status) {
switch (status) {
case "Pending":
return "warning";
case "Approved":
return "success";
case "Rejected":
return "error";
case "Completed":
return "info";
case "Paid":
return "success";
default:
return "";
}
},
openDialogPreviewNota(data) {
const fileBaseUrl = BASE_URL + "/one-media/cashier/";
const allImageUrls = [];
for (let index = 0; index < data.dataAttachment.length; index++) {
const element = data.dataAttachment[index];
allImageUrls.push(fileBaseUrl + element.PurchaseDirectAttachmentName)
}
this.$store.commit("manager/update_imagePreviews", allImageUrls);
this.$store.commit("manager/update_dialog_form", true);
this.$store.commit("manager/update_cekFile", false);
this.$store.commit("manager/update_actAttach", 'preview');
},
updateDetail(val) {
this.$store.commit("manager/updateSelectedDetailTable", val);
this.$store.commit("manager/updateDialogDetail", true);
},
deleteDetail(data) {
this.xPRID = data.PurchaseRequestDirectDetailPurchaseRequestDirectID;
this.xPRDID = data.PurchaseRequestDirectDetailID;
this.xDescriptionDetail = data.PurchaseRequestDirectDescription;
this.msgAlertDeleteRequest = `Yakin, mau hapus Request [${data.PurchaseRequestDirectDescription}] ?`;
this.dialogAlertDeleteDetail = true;
},
closeAndDeleteDetail() {
this.$store.dispatch("manager/deleteDetail", {
PRID: this.xPRID,
PRDDescription: this.xDescriptionDetail,
PRDID: this.xPRDID,
});
this.dialogAlertDeleteDetail = false
},
rejectRequest(data) {
this.xPRID = data.PurchaseRequestDirectID
this.xStatus = data.PurchaseRequestDirectStatus
this.msgAlertDeleteOrReject = `Yakin, mau Reject Purchase Request [${data.PurchaseRequestDirectNumber}] ?`;
this.dialogAlertRejectRequest = true;
},
closeAndRejectRequest() {
if (this.xStatus === 'Pending') {
this.$store.dispatch("manager/rejectRequest", {
PRNumber: this.selectedMainTable.PurchaseRequestDirectNumber,
PRID: this.xPRID,
});
}
this.dialogAlertRejectRequest = false;
},
approveRequest(data) {
this.xPRID = data.PurchaseRequestDirectID;
this.xStatus = data.PurchaseRequestDirectStatus;
this.xStatusNota = data.PurchaseRequestDirectNotaStatus;
if (this.xStatusNota == 'Pending') {
this.opendialoginfo = true
this.msginfo = "Bukti Pembayaran belum di approve, silahkan melakukan approve bukti pembayaran!"
} else {
this.detailTable.forEach((detail) => {
if (!detail.PurchaseRequestDirectDetailAmount) {
this.$store.dispatch("manager/updateDetail", {
PRID: data.PurchaseRequestDirectID,
PRDID: detail.PurchaseRequestDirectDetailID,
PRDDescription: detail.PurchaseRequestDirectDescription,
PRDAmount: parseFloat(detail.PurchaseRequestDirectDetailAmountRequest),
PRDPrice: parseFloat(detail.PurchaseRequestDirectDetailEstimationPrice),
PRDTotal: parseFloat(detail.PurchaseRequestDirectDetailTotalEstimationPrice)
});
}
});
if (this.xStatus === 'Pending') {
this.$store.dispatch("manager/approveRequest", {
PRID: this.xPRID,
PRNumber: data.PurchaseRequestDirectNumber,
PRNote: this.xNote
})
}
}
},
unApproveRequest(data) {
this.xPRID = data.PurchaseRequestDirectID
this.xStatus = data.PurchaseRequestDirectStatus
this.msgAlertUnapproveRequest = `Yakin, mau unapprove Request [${data.PurchaseRequestDirectNumber}] ?`
this.dialogAlertUnapprove = true
},
closeAndUnapprove() {
if (this.xStatus === 'Approved') {
this.$store.dispatch("manager/unApproveRequest", {
PRNumber: this.selectedMainTable.PurchaseRequestDirectNumber,
PRID: this.xPRID,
})
}
this.dialogAlertUnapprove = false;
}
},
}
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,69 @@
<!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="pl-1 pr-1 pt-2 pb-2">
<v-layout row wrap>
<v-flex xs12 class="left" fill-height pa-1>
<!-- <request-listing></request-listing> -->
<listing-request></listing-request>
</v-flex>
</v-layout>
</v-container>
</v-content>
<one-footer></one-footer>
</v-app>
</div>
<!-- Vendor -->
<script src="../../../libs/vendor/moment.min.js"></script>
<script src="../../../libs/vendor/numeral.min.js"></script>
<script src="../../../libs/vendor/moment-locale-id.js"></script>
<script src="../../../libs/vendor/lodash.js"></script>
<script src="../../../libs/vendor/axios.min.js"></script>
<script src="../../../libs/vendor/vue.js"></script>
<script src="../../../libs/vendor/vuex.js"></script>
<script src="../../../libs/vendor/vuetify.js"></script>
<script src="../../../libs/vendor/httpVueLoader.js"></script>
<script src="../../../libs/one_global.js"></script>
<!-- App Script -->
<script type="module">
import {
store
} from './store.js';
window.store = store;
new Vue({
store,
el: "#app",
methods: {},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'request-listing': httpVueLoader('./components/requestListing.vue'),
'listing-request': httpVueLoader('./components/listingRequest.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
</style>
</body>
</html>

View File

@@ -0,0 +1,508 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/api-manager.js";
export default {
namespaced: true,
state: {
mainTable: [],
detailTable: [],
countMainTable: 0,
countDetailTable: 0,
mainTableLoadingStatus: 0,
detailTableLoadingStatus: 0,
mainTableErrorMessage: "",
detailTableErrorMessage: "",
mainTableCurrentPage: 1,
mainTableLastId: -1,
selectedMainTable: {},
selectedDetailTable: {},
statusOptions: [
{ value: 0, title: "All" },
{ value: 2, title: "Pending" },
{ value: 3, title: "Approved" },
{ value: 4, title: "Rejected" },
{ value: 5, title: "Paid" },
{ value: 6, title: "Completed" },
],
menuStartDate: false,
menuEndDate: false,
dStartDate: new Date().toISOString().substring(0, 10),
dEndDate: new Date().toISOString().substring(0, 10),
fStartDate: moment(new Date()).format("YYYY-MM-DD"),
fEndDate: moment(new Date()).format("YYYY-MM-DD"),
fStatus: "All",
fSearch: "",
xNote: "",
xAmount: 0,
xPrice: 0,
xTotal: 0,
xPRID: 0,
xPRDID: 0,
xStatus: "",
xStatusNota: "",
xDescriptionDetail: "",
dialogDetail: false,
errMessage: "",
succesMessage: "",
alertError: false,
alertSuccess: false,
errors: [],
levelname: [],
dialog_form: false,
show_progrees_upload: false,
imageFiles: [],
imagePreviews: [],
cekFile: false,
actAttach: "",
open_dialog_info: false,
msg_info: "",
status: '',
xstartdate: '',
successMessage:'',
flag: '',
},
mutations: {
updateMainTable(state, val) {
state.mainTable = val;
},
updateLevelName(state, val) {
state.levelname = val;
},
updateDetailTable(state, val) {
state.detailTable = val;
},
updateCountMainTable(state, val) {
state.countMainTable = val;
},
updateCountDetailTable(state, val) {
state.countDetailTable = val;
},
updateMainTableLoadingStatus(state, val) {
state.mainTableLoadingStatus = val;
},
updateDetailTableLoadingStatus(state, val) {
state.detailTableLoadingStatus = val;
},
updateMainTableErrorMessage(state, val) {
state.mainTableErrorMessage = val;
},
updateDetailTableErrorMessage(state, val) {
state.detailTableErrorMessage = val;
},
updateMainTableCurrentPage(state, val) {
state.mainTableCurrentPage = val;
},
updateMainTableLastId(state, val) {
state.mainTableLastId = val;
},
updateSelectedMainTable(state, val) {
state.selectedMainTable = val;
},
updateSelectedDetailTable(state, val) {
state.selectedDetailTable = val;
},
updateMenuStartDate(state, val) {
state.menuStartDate = val;
},
updateMenuEndDate(state, val) {
state.menuEndDate = val;
},
updateDStartDate(state, val) {
state.dStartDate = val;
},
updateDEndDate(state, val) {
state.dEndDate = val;
},
updateFStartDate(state, val) {
state.fStartDate = val;
},
updateFEndDate(state, val) {
state.fEndDate = val;
},
updateFStatus(state, val) {
state.fStatus = val;
},
updateFSearch(state, val) {
state.fSearch = val;
},
updateXNote(state, val) {
state.xNote = val;
},
updateXAmount(state, val) {
state.xAmount = val;
},
updatexPrice(state, val) {
state.xPrice = val;
},
updatexTotal(state, val) {
state.xTotal = val;
},
updateXPRID(state, val) {
state.xPRID = val;
},
updateXPRDID(state, val) {
state.xPRDID = val;
},
updateXStatus(state, val) {
state.xStatus = val;
},
updateXStatusNota(state, val) {
state.XStatusNota = val;
},
updateXDescriptionDetail(state, val) {
state.xDescriptionDetail = val;
},
updateDialogDetail(state, val) {
state.dialogDetail = val;
},
updateErrMessage(state, val) {
state.errMessage = val;
},
updateSuccessMessage(state, val) {
state.successMessage = val;
},
updateAlertError(state, val) {
state.alertError = val;
},
updateAlertSuccess(state, val) {
state.alertSuccess = val;
},
updateErrors(state, val) {
state.errors = val;
},
update_dialog_form(state, val) {
state.dialog_form = val;
},
update_show_progrees_upload(state, val) {
state.show_progrees_upload = val
},
update_imageFiles(state, val) {
state.imageFiles = val
},
update_imagePreviews(state, val) {
state.imagePreviews = val
},
update_cekFile(state, val) {
state.cekFile = val
},
update_actAttach(state, val) {
state.actAttach = val
},
update_open_dialog_info(state, val) {
state.open_dialog_info = val
},
update_msg_info(state, val) {
state.msg_info = val
},
update_status(state, val) {
state.status = val
},
update_xstartdate(state, val) {
state.xstartdate = val
},
update_flag(state, val) {
state.flag = val
}
},
actions: {
async search(context) {
context.commit("updateMainTableLoadingStatus", 1);
try {
var url_string = window.location.href
var url = new URL(url_string);
var status = url.searchParams.get("status");
var xstartdate = url.searchParams.get("startdate");
var xsearch = url.searchParams.get("search");
var xflag = url.searchParams.get("flag");
// untuk notifikasi
if (xflag == 'N') {
if (xsearch != null && xsearch != '') {
context.commit("updateFSearch", xsearch);
}
if (status != null && status != '') {
context.commit("updateFStatus", status);
}
if (xstartdate != null && xstartdate != '') {
context.commit("update_selectedDate", xstartdate);
context.commit("update_selectedEndDate", xstartdate);
}
} else if (xflag == 'G') {
// untuk get data param approve all
if (status != null && status != '') {
context.commit("updateFStatus", status);
}
if (xstartdate != null && xstartdate != '') {
context.commit("updateFStartDate", xstartdate);
context.commit("updateFEndDate", moment(new Date()).format('YYYY-MM-DD'));
}
context.commit("update_flag", xflag);
}
var payload = {
token: one_token(),
currentPage: context.state.mainTableCurrentPage,
startDate: context.state.fStartDate,
endDate: context.state.fEndDate,
status: context.state.fStatus == 'All' ? "" : context.state.fStatus,
search: context.state.fSearch,
lastId: -1,
};
let response = await api.search(payload);
if (response.status != "OK") {
context.commit("updateMainTableLoadingStatus", 3);
context.commit("updateMainTableErrorMessage", response.message);
} else {
context.commit("updateMainTableLoadingStatus", 2);
context.commit("updateMainTableErrorMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
context.commit("updateMainTable", data.records);
context.commit("updateCountMainTable", data.total);
}
} catch (e) {
context.commit("updateMainTableLoadingStatus", 3);
context.commit("updateMainTableErrorMessage", e.message);
}
},
async getlevel(context) {
context.commit("updateMainTableLoadingStatus", 1);
try {
var payload = {
token: one_token()
};
let response = await api.getlevel(payload);
if (response.status != "OK") {
context.commit("updateMainTableLoadingStatus", 3);
context.commit("updateMainTableErrorMessage", response.message);
} else {
context.commit("updateMainTableLoadingStatus", 2);
context.commit("updateMainTableErrorMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
context.commit("updateLevelName", data.records[0].M_ApproveLevelName);
}
} catch (e) {
context.commit("updateMainTableLoadingStatus", 3);
context.commit("updateMainTableErrorMessage", e.message);
}
},
async searchDetail(context) {
context.commit("updateDetailTableLoadingStatus", 1);
try {
var payload = {
token: one_token(),
PRID: context.state.selectedMainTable.PurchaseRequestDirectID,
};
let response = await api.searchDetail(payload);
if (response.status != "OK") {
context.commit("updateDetailTableLoadingStatus", 3);
context.commit("updateDetailTableErrorMessage", response.message);
} else {
context.commit("updateDetailTableLoadingStatus", 2);
context.commit("updateDetailTableErrorMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
context.commit("updateDetailTable", data.records);
context.commit("updateCountDetailTable", data.total);
}
} catch (e) {
context.commit("updateDetailTableLoadingStatus", 3);
context.commit("updateDetailTableErrorMessage", e.message);
}
},
async updateDetail(context, payload) {
try {
payload.token = one_token();
let response = await api.updateDetail(payload);
if (response.status != "OK") {
context.commit("updateErrMessage", response.message);
context.commit("updateAlertError", true);
} else {
context.commit("updateErrMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
if (data.total !== -1) {
context.commit("updateErrors", []);
context.commit("updateAlertSuccess", true);
context.commit("updateDialogDetail", false);
var msg = `Request [${payload.PRDDescription}] telah diperbarui`;
context.commit("updateSuccessMessage", msg);
context.dispatch("search");
context.dispatch("searchDetail");
} else {
context.commit("updateErrors", response.data.errors);
}
}
} catch (e) {
context.commit("updateErrMessage", e.message);
context.commit("updateAlertError", true);
}
},
async rejectRequest(context, payload) {
try {
payload.token = one_token();
let response = await api.rejectRequest(payload);
if (response.status != "OK") {
context.commit("updateErrMessage", response.message);
context.commit("updateAlertError", true);
} else {
context.commit("updateErrMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
if (data.total !== -1) {
context.commit("updateErrors", []);
context.commit("updateAlertSuccess", true);
var msg = `Purchase Request [${payload.PRNumber}] sudah ditolak`;
context.commit("updateSuccessMessage", msg);
context.commit("updateSelectedMainTable", {});
context.commit("updateDetailTable", []);
context.commit("updateSelectedDetailTable", {});
context.dispatch("search");
} else {
context.commit("updateErrors", response.data.errors);
}
}
} catch (e) {
context.commit("updateErrMessage", e.message);
context.commit("updateAlertError", true);
}
},
async unApproveRequest(context, payload) {
try {
payload.token = one_token();
let response = await api.unApproveRequest(payload);
if (response.status != "OK") {
context.commit("updateErrMessage", response.message);
context.commit("updateAlertError", true);
} else {
context.commit("updateErrMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
if (data.total !== -1) {
context.commit("updateErrors", []);
context.commit("updateAlertSuccess", true);
var msg = `Purchase Request [${payload.PRNumber}] berhasil di unapprove`;
context.commit("updateSuccessMessage", msg);
context.commit("updateSelectedMainTable", {});
context.commit("updateDetailTable", []);
context.commit("updateSelectedDetailTable", {});
context.dispatch("search");
} else {
context.commit("updateErrors", response.data.errors);
}
}
} catch (e) {
context.commit("updateErrMessage", e.message);
context.commit("updateAlertError", true);
}
},
async deleteDetail(context, payload) {
try {
payload.token = one_token();
let response = await api.deleteDetail(payload);
if (response.status !== "OK") {
context.commit("updateErrMessage", response.message);
context.commit("updateAlertError", true);
} else {
context.commit("updateErrMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
if (data.total !== -1) {
context.commit("updateErrors", []);
context.commit("updateAlertSuccess", true);
var msg = `Request [${payload.PRDDescription}] sudah dihapus`;
context.commit("updateSuccessMessage", msg);
context.dispatch("search");
context.dispatch("searchDetail");
} else {
context.commit("updateErrors", response.data.errors);
}
}
} catch (e) {
context.commit("updateErrMessage", e.message);
context.commit("updateAlertError", true);
}
},
async approveRequest(context, payload) {
try {
payload.token = one_token();
let response = await api.approveRequest(payload);
if (response.status != "OK") {
context.commit("updateErrMessage", response.message);
context.commit("updateAlertError", true);
} else {
context.commit("updateErrMessage", "");
let data = {
records: response.data.records,
total: response.data.total,
};
if (data.total !== -1) {
context.commit("updateErrors", []);
context.commit("updateAlertSuccess", true);
var msg = `Purchase Request [${payload.PRNumber}] telah diapprove`;
context.commit("updateSuccessMessage", msg);
context.dispatch("search");
context.commit("updateSelectedMainTable", data.records[0]);
context.dispatch("searchDetail");
} else {
context.commit("updateErrors", response.data.errors);
}
}
} catch (e) {
context.commit("updateErrMessage", e.message);
context.commit("updateAlertError", true);
}
},
},
};

View File

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