767 lines
35 KiB
Vue
767 lines
35 KiB
Vue
<template>
|
|
<div style="width: 100%">
|
|
<v-snackbar v-model="snackbar.state" :color="snackbar.type" :timeout="3000" multi-line top>
|
|
{{ snackbar.message }}
|
|
<v-btn flat @click="snackbar.state = false">
|
|
Close
|
|
</v-btn>
|
|
</v-snackbar>
|
|
|
|
<v-layout row wrap>
|
|
<v-flex xs12 class="left" fill-height pa-1>
|
|
<v-toolbar color="primary" dark>
|
|
<v-toolbar-title class="white--text">STOCK REQUEST NON PERSEDIAAN</v-toolbar-title>
|
|
<v-spacer></v-spacer>
|
|
<v-btn icon @click="openDialogRequest()">
|
|
<v-icon>add_box</v-icon>
|
|
</v-btn>
|
|
</v-toolbar>
|
|
<v-card class="pa-2">
|
|
<v-layout row align-center>
|
|
<v-flex pa-1 xs3>
|
|
<v-menu v-model="menuStartDate" :close-on-content-click="false"
|
|
transition="scale-transition" :nudge-right="40" lazy offset-y max-width="290px"
|
|
min-width="290px" full-width>
|
|
<template v-slot:activator="{ on }">
|
|
<v-text-field :value="startDateFormatted" label="Tanggal Awal" readonly outline
|
|
v-on="on" @blur="dStartDate = deFormatedDate(startDateFormatted)"
|
|
hide-details></v-text-field>
|
|
</template>
|
|
<v-date-picker no-title v-model="fStartDate"
|
|
@input="menuStartDate = false"></v-date-picker>
|
|
</v-menu>
|
|
</v-flex>
|
|
<v-flex pa-1 xs3>
|
|
<v-menu v-model="menuEndDate" full-width :close-on-content-click="false"
|
|
transition="scale-transition" :nudge-right="40" lazy offset-y max-width="290px"
|
|
min-width="290px">
|
|
<template v-slot:activator="{ on }">
|
|
<v-text-field :value="endDateFormatted" label="Tanggal Akhir" readonly outline
|
|
@blur="dEndDate = deFormatedDate(endDateFormatted)" 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 pa-1 xs2>
|
|
<v-autocomplete v-model="fStatus" menu-icon="mdi-chevron-down" :items="statusOptions"
|
|
item-text="title" item-value="value" label="Status" outline
|
|
hide-details></v-autocomplete>
|
|
</v-flex>
|
|
<v-flex pa-1 grow>
|
|
<v-text-field v-model="fSearch" label="Cari..." placeholder="NO. PR" outline
|
|
hide-details></v-text-field>
|
|
</v-flex>
|
|
<v-flex pa-1 shrink text-xs-center>
|
|
<v-btn dark color="primary" style="min-width: 50px; height: 50px; margin: 0"
|
|
@click="mainTableSearch()">
|
|
<v-icon>search</v-icon>
|
|
</v-btn>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card>
|
|
|
|
<v-card class="pa-2 mt-2">
|
|
<v-layout row style="max-height: 600px; overflow: auto">
|
|
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
|
<v-data-table :headers="headers" :items="mainTable" :loading="mainTableLoading" hide-actions
|
|
class="elevation-1">
|
|
<template slot="items" slot-scope="props">
|
|
<td class="text-xs-center pa-2"
|
|
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
<div style=" display: flex; flex-direction: column; align-items: center;">
|
|
{{ props.item.prNumber }}
|
|
<v-chip small style="border-radius: 5px; flex-grow: 0">
|
|
{{ props.item.prRequestedBy }}
|
|
</v-chip>
|
|
</div>
|
|
</td>
|
|
<td class="text-xs-left pa-2"
|
|
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
<div class="date-type-table">
|
|
<span>{{ deFormatedDate(props.item.prDate) }}</span>
|
|
</div>
|
|
</td>
|
|
<td class="text-xs-left pa-2"
|
|
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
<div>
|
|
{{ props.item.prNote }}
|
|
</div>
|
|
</td>
|
|
<td class="text-xs-left pa-2"
|
|
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
|
|
@click="selectMe(props.item)">
|
|
<v-chip small :text-color="props.item.prStatus === 'Draft' ? 'black' : 'white'"
|
|
:color="getChipStatusColor(props.item.prStatus)">
|
|
{{ props.item.prStatus }}
|
|
</v-chip>
|
|
</td>
|
|
|
|
<template v-if="props.item.prStatus == 'Draft'">
|
|
<td class="text-xs-center pa-2" style="white-space: nowrap;" v-bind:class="{
|
|
'amber lighten-4': isSelected(props.item),
|
|
}">
|
|
<v-btn
|
|
style="min-width: 25px; height: 25px; margin: 0;"
|
|
@click="editRequest(props.item)"
|
|
small title="Edit"
|
|
color="black"
|
|
>
|
|
<v-icon small color="white">edit</v-icon>
|
|
</v-btn>
|
|
<v-btn
|
|
style="min-width: 25px; height: 25px; margin: 0;"
|
|
@click="deleteRequest(props.item)"
|
|
small title="Hapus"
|
|
color="red"
|
|
>
|
|
<v-icon small color="white">delete</v-icon>
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
<template v-else-if="props.item.prStatus == 'Pending'">
|
|
<td class="text-xs-center pa-2" style="white-space: nowrap;" v-bind:class="{
|
|
'amber lighten-4': isSelected(props.item),
|
|
}">
|
|
<v-btn
|
|
style="min-width: 25px; height: 25px; margin: 0;"
|
|
@click="previewRequest(props.item)"
|
|
small title="Preview Request"
|
|
color="blue"
|
|
>
|
|
<v-icon small color="white">receipt</v-icon>
|
|
</v-btn>
|
|
<v-btn
|
|
style="min-width: 25px; height: 25px; margin: 0;"
|
|
@click="printout(props.item)"
|
|
small title="Cetak PDF"
|
|
color="primary"
|
|
>
|
|
<v-icon small color="white">print</v-icon>
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
<template v-else-if="hasHandover(props.item.itemHandedOver)">
|
|
<td class="text-xs-center pa-2" style="white-space: nowrap;"
|
|
v-bind:class="{ 'amber lighten-4': isSelected(props.item), }">
|
|
<v-btn color="success" prepend-icon="mdi-check-circle"
|
|
@click="confirmHandover(props.item)">
|
|
Konfirmasi Terima
|
|
</v-btn>
|
|
<v-btn
|
|
style="min-width: 25px; height: 25px; margin: 0;"
|
|
@click="printout(props.item)"
|
|
small title="Cetak PDF"
|
|
color="primary"
|
|
>
|
|
<v-icon small color="white">print</v-icon>
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
<template v-else>
|
|
<td class="text-xs-center pa-2" style="white-space: nowrap;"
|
|
v-bind:class="{ 'amber lighten-4': isSelected(props.item), }">
|
|
<v-btn
|
|
style="min-width: 25px; height: 25px; margin: 0;"
|
|
@click="printout(props.item)"
|
|
small title="Cetak PDF"
|
|
color="primary"
|
|
>
|
|
<v-icon small color="white">print</v-icon>
|
|
</v-btn>
|
|
</td>
|
|
</template>
|
|
</template>
|
|
</v-data-table>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-divider></v-divider>
|
|
<v-pagination style="margin-top: 10px; margin-bottom: 10px" v-model="mainTableCurrentPage"
|
|
:length="mainTableTotalPage"></v-pagination>
|
|
</v-card>
|
|
</v-flex>
|
|
</v-layout>
|
|
|
|
<add-purchase-request-dialog></add-purchase-request-dialog>
|
|
<add-request-detail-dialog></add-request-detail-dialog>
|
|
<riwayat-dialog></riwayat-dialog>
|
|
<dialog-confirm-handover></dialog-confirm-handover>
|
|
|
|
<one-dialog-alert :status="dialogAlertDeleteRequest" :msg="msgAlertDeleteRequest"
|
|
@forget-dialog-alert="dialogAlertDeleteRequest = false"
|
|
@close-dialog-alert="closeAndDeleteRequest()"></one-dialog-alert>
|
|
|
|
<one-dialog-alert :status="dialogAlertDeleteDetail" :msg="msgAlertDeleteRequest"
|
|
@forget-dialog-alert="dialogAlertDeleteDetail = false"
|
|
@close-dialog-alert="closeAndDeleteDetail()"></one-dialog-alert>
|
|
|
|
<one-dialog-print
|
|
:title="printtitle"
|
|
:width="printwidth"
|
|
:height="600"
|
|
:status="openprint"
|
|
:urlprint="urlprint"
|
|
@close-dialog-print="openprint = false"
|
|
></one-dialog-print>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.date-type-table {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.table.v-table tbody td,
|
|
table.v-table tbody th {
|
|
height: 40px;
|
|
}
|
|
|
|
.table.v-table thead tr {
|
|
height: 40px;
|
|
}
|
|
|
|
.scroll-container {
|
|
scroll-padding: 50px 0 0 50px;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
module.exports = {
|
|
components: {
|
|
"add-purchase-request-dialog": httpVueLoader("./addPurchaseRequestDialog.vue"),
|
|
"add-request-detail-dialog": httpVueLoader("./addRequestDetailDialog.vue"),
|
|
"riwayat-dialog": httpVueLoader("./dialogRiwayat.vue"),
|
|
"dialog-confirm-handover": httpVueLoader("./dialogConfirmHandover.vue"),
|
|
"one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
|
|
"one-dialog-error": httpVueLoader("../../common/oneDialogError.vue"),
|
|
"one-dialog-print": httpVueLoader("../../common/oneDialogPrintX.vue"),
|
|
},
|
|
data() {
|
|
return {
|
|
urlprint: "",
|
|
printtitle: "",
|
|
printwidth: "60%",
|
|
openprint: false,
|
|
msgAlertDeleteRequest: "",
|
|
dialogAlertDeleteRequest: false,
|
|
dialogAlertDeleteDetail: false,
|
|
headers: [
|
|
{
|
|
text: "NO PR",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "no",
|
|
width: "15%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "TANGGAL",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "requestDate",
|
|
width: "15%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "KETERANGAN",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "keterangan",
|
|
width: "20%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "STATUS",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "status",
|
|
width: "15%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "action",
|
|
width: "15%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
],
|
|
detailHeaders: [
|
|
{
|
|
text: "NO",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "no",
|
|
width: "5%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "KETERANGAN",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "requestDate",
|
|
width: "25%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "JUMLAH",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "requestDate",
|
|
width: "5%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "HARGA",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "requestDate",
|
|
width: "15%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "SATUAN",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "requestDate",
|
|
width: "20%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "TOTAL HARGA",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "useDate",
|
|
width: "15%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "STATUS",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "status",
|
|
width: "10%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "action",
|
|
width: "5%",
|
|
class: "blue lighten-3 white--text",
|
|
},
|
|
],
|
|
};
|
|
},
|
|
mounted() {
|
|
this.$store.dispatch("requester/getRegionalBranchByUser");
|
|
this.$store.dispatch("requester/getItemCategory");
|
|
this.$store.dispatch("requester/search");
|
|
},
|
|
computed: {
|
|
act() {
|
|
return this.$store.state.requester.act;
|
|
},
|
|
mainTable() {
|
|
return this.$store.state.requester.mainTable;
|
|
},
|
|
detailTable() {
|
|
return this.$store.state.requester.detailTable;
|
|
},
|
|
mainTableLoading() {
|
|
return this.$store.state.requester.mainTableLoadingStatus === 1;
|
|
},
|
|
detailTableLoading() {
|
|
return this.$store.state.requester.detailTableLoadingStatus === 1;
|
|
},
|
|
mainTableTotalPage: {
|
|
get() {
|
|
return this.$store.state.requester.countMainTable;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateCountMainTable", val);
|
|
},
|
|
},
|
|
mainTableCurrentPage: {
|
|
get() {
|
|
return this.$store.state.requester.mainTableCurrentPage;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateMainTableCurrentPage", val);
|
|
this.$store.commit("requester/updateMainTableLastId", -1);
|
|
this.$store.dispatch("requester/search");
|
|
},
|
|
},
|
|
selectedMainTable: {
|
|
get() {
|
|
return this.$store.state.requester.selectedMainTable;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("updateSelectedMainTable", val);
|
|
},
|
|
},
|
|
menuStartDate: {
|
|
get() {
|
|
return this.$store.state.requester.menuStartDate;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateMenuStartDate", val);
|
|
},
|
|
},
|
|
menuEndDate: {
|
|
get() {
|
|
return this.$store.state.requester.menuEndDate;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateMenuEndDate", val);
|
|
},
|
|
},
|
|
startDateFormatted() {
|
|
return this.formatDate(this.fStartDate);
|
|
},
|
|
endDateFormatted() {
|
|
return this.formatDate(this.fEndDate);
|
|
},
|
|
dStartDate: {
|
|
get() {
|
|
return this.$store.state.requester.dStartDate;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateDStartDate", val);
|
|
},
|
|
},
|
|
dEndDate: {
|
|
get() {
|
|
return this.$store.state.requester.dEndDate;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateDEndDate", val);
|
|
},
|
|
},
|
|
fStartDate: {
|
|
get() {
|
|
return this.$store.state.requester.fStartDate;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateFStartDate", val);
|
|
},
|
|
},
|
|
fEndDate: {
|
|
get() {
|
|
return this.$store.state.requester.fEndDate;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateFEndDate", val);
|
|
},
|
|
},
|
|
fStatus: {
|
|
get() {
|
|
return this.$store.state.requester.fStatus;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateFStatus", val);
|
|
},
|
|
},
|
|
statusOptions() {
|
|
return this.$store.state.requester.statusOptions;
|
|
},
|
|
fSearch: {
|
|
get() {
|
|
return this.$store.state.requester.fSearch;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateFSearch", val);
|
|
},
|
|
},
|
|
xNumber: {
|
|
get() {
|
|
return this.$store.state.requester.xNumber;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateXNumber", val);
|
|
},
|
|
},
|
|
xPRID: {
|
|
get() {
|
|
return this.$store.state.requester.xPRID;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateXPRID", val);
|
|
},
|
|
},
|
|
xPRDID: {
|
|
get() {
|
|
return this.$store.state.requester.xPRDID;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateXPRDID", val);
|
|
},
|
|
},
|
|
snackbar: {
|
|
get() {
|
|
return this.$store.state.requester.snackbar;
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateSnackbar", val);
|
|
},
|
|
},
|
|
user: {
|
|
get() {
|
|
return this.$store.state.requester.user
|
|
},
|
|
set(val) {
|
|
this.$store.commit("requester/updateUser", val)
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
previewRequest(val) {
|
|
this.$store.commit("requester/updateSelectedMainTable", val);
|
|
let selectedPr = val
|
|
this.$store.commit("requester/updateRegionalOptions", [{ S_RegionalID: selectedPr.S_RegionalID, S_RegionalName: selectedPr.S_RegionalName }]);
|
|
this.$store.commit("requester/updateXRegional", { S_RegionalID: selectedPr.S_RegionalID, S_RegionalName: selectedPr.S_RegionalName });
|
|
//this.$store.commit("requester/updateBranchOptions", [{M_BranchCode : selectedPr.M_BranchCode, M_BranchName : selectedPr.M_BranchName}]);
|
|
this.$store.commit("requester/updateXBranch", { M_BranchCode: selectedPr.M_BranchCode, M_BranchName: selectedPr.M_BranchName });
|
|
this.$store.commit(
|
|
"requester/updateXDateUse",
|
|
selectedPr.prDate
|
|
);
|
|
this.$store.commit("requester/updateSelectedItemCategory", { itemCategoryID: selectedPr.itemCategoryID, itemCategoryName: selectedPr.itemCategoryName });
|
|
this.$store.commit("requester/updateXDescription", selectedPr.prNote);
|
|
this.$store.dispatch("requester/getDivisionByUser");
|
|
this.$store.commit("requester/updateDialogRequest", true);
|
|
this.$store.dispatch("requester/getDetailRequest", {
|
|
requestId: selectedPr.prId
|
|
});
|
|
this.$store.commit("requester/updateAct", "preview");
|
|
},
|
|
convertMoney(money) {
|
|
return one_money(money)
|
|
},
|
|
isSelected(p) {
|
|
return (
|
|
p.prId ==
|
|
this.$store.state.requester.selectedMainTable
|
|
.prId
|
|
);
|
|
},
|
|
selectMe(spr) {
|
|
this.$store.commit("requester/updateSelectedMainTable", spr);
|
|
this.$store.dispatch("requester/searchDetail");
|
|
},
|
|
formatDate(date) {
|
|
if (!date) return null;
|
|
|
|
const [year, month, day] = date.split("-");
|
|
return `${day}-${month}-${year}`;
|
|
},
|
|
deFormatedDate(date) {
|
|
if (!date) return null;
|
|
|
|
const [day, month, year] = date.split("-");
|
|
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
|
|
},
|
|
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 "";
|
|
}
|
|
},
|
|
getChipStatusDetailColor(status) {
|
|
switch (status) {
|
|
case "Pending":
|
|
return "warning";
|
|
case "Ordered":
|
|
return "success";
|
|
case "Received":
|
|
return "info";
|
|
case "Cancelled":
|
|
return "error";
|
|
default:
|
|
return "warning";
|
|
}
|
|
},
|
|
mainTableSearch() {
|
|
this.$store.dispatch("requester/search");
|
|
this.$store.commit("requester/updateSelectedMainTable", {});
|
|
this.$store.commit("requester/updateDetailTable", []);
|
|
},
|
|
resetItemTable() {
|
|
this.$store.commit("requester/updateItems", []);
|
|
this.$store.commit("requester/updateSelectedItem", {});
|
|
this.$store.commit("requester/updateSearchItem", "");
|
|
this.$store.commit("requester/updateLoadingItem", false);
|
|
this.$store.commit("requester/updateItemGroupOptions", []);
|
|
this.$store.commit("requester/updateSelectedItemGroup", {});
|
|
this.$store.commit("requester/updateItemSubGroupOptions", []);
|
|
this.$store.commit("requester/updateSelectedItemSubGroup", {});
|
|
},
|
|
openDialogRequest() {
|
|
let user = one_user()
|
|
this.$store.commit("requester/updateAct", "new");
|
|
this.$store.commit("requester/updateRegionalOptions", [{ S_RegionalID: user.S_RegionalID, S_RegionalName: user.S_RegionalName }]);
|
|
this.$store.commit("requester/updateXRegional", { S_RegionalID: user.S_RegionalID, S_RegionalName: user.S_RegionalName });
|
|
this.$store.commit("requester/updateXBranch", {});
|
|
if (user.M_BranchName != "") {
|
|
this.$store.commit("requester/updateXBranch", { M_BranchCode: user.M_BranchCode, M_BranchName: user.M_BranchName });
|
|
}
|
|
this.$store.commit(
|
|
"requester/updateXDateUse",
|
|
moment(new Date()).format("YYYY-MM-DD")
|
|
);
|
|
this.$store.commit("requester/updateXDescription", "");
|
|
this.$store.commit("requester/updateDialogRequest", true);
|
|
this.$store.commit("requester/updateSelectedMainTable", {});
|
|
this.resetItemTable();
|
|
this.$store.dispatch("requester/getDivisionByUser");
|
|
// this.$store.dispatch("requester/getItems", {
|
|
// search: "",
|
|
// division: "",
|
|
// itemGroup: "",
|
|
// itemSubGroup: ""
|
|
// });
|
|
this.$store.commit("requester/updateAct", "new");
|
|
this.$store.commit("requester/updateSelectedItems", []);
|
|
},
|
|
editRequest(val) {
|
|
this.$store.commit("requester/updateSelectedMainTable", val);
|
|
this.$store.commit("requester/updateAct", "edit");
|
|
let selectedPr = val
|
|
this.$store.commit("requester/updateRegionalOptions", [{ S_RegionalID: selectedPr.S_RegionalID, S_RegionalName: selectedPr.S_RegionalName }]);
|
|
this.$store.commit("requester/updateXRegional", { S_RegionalID: selectedPr.S_RegionalID, S_RegionalName: selectedPr.S_RegionalName });
|
|
this.$store.commit("requester/updateBranchOptions", [{ M_BranchCode: selectedPr.M_BranchCode, M_BranchName: selectedPr.M_BranchName }]);
|
|
this.$store.commit("requester/updateXBranch", { M_BranchCode: selectedPr.M_BranchCode, M_BranchName: selectedPr.M_BranchName });
|
|
this.$store.commit(
|
|
"requester/updateXDateUse",
|
|
selectedPr.prDate
|
|
);
|
|
this.$store.commit("requester/updateXDescription", selectedPr.prNote);
|
|
this.$store.commit("requester/updateSelectedItemCategory", { itemCategoryID: selectedPr.itemCategoryID, itemCategoryName: selectedPr.itemCategoryName });
|
|
//console.log(this.$store.state.requester.itemCategory);
|
|
this.$store.dispatch("requester/getDivisionByUser");
|
|
this.$store.commit("requester/updateDialogRequest", true);
|
|
this.$store.dispatch("requester/getDetailRequest", {
|
|
requestId: selectedPr.prId
|
|
});
|
|
},
|
|
updateRequest(val) {
|
|
//this.$store.dispatch("requester/branch");
|
|
this.$store.commit(
|
|
"requester/updateXDateUse",
|
|
val.prDate
|
|
);
|
|
this.$store.commit("requester/updateBranchOptions", [{ M_BranchCode: val.M_BranchCode, M_BranchName: val.M_BranchName }]);
|
|
this.$store.commit("requester/updateXBranch", { M_BranchCode: val.M_BranchCode, M_BranchName: val.M_BranchName });
|
|
this.$store.commit("requester/updateRegionalOptions", [{ S_RegionalID: val.S_RegionalID, S_RegionalName: val.S_RegionalName }]);
|
|
this.$store.commit("requester/updateXRegional", { S_RegionalID: val.S_RegionalID, S_RegionalName: val.S_RegionalName });
|
|
this.$store.commit(
|
|
"requester/updateXDescription",
|
|
val.PurchaseRequestDirectDescription
|
|
);
|
|
this.$store.commit("requester/updateXPRID", val.PurchaseRequestDirectID);
|
|
this.$store.commit("requester/updateAct", "edit");
|
|
this.$store.commit("requester/updateDialogRequest", true);
|
|
},
|
|
deleteRequest(data) {
|
|
this.xPRID = data.prId;
|
|
this.xNumber = data.prNumber;
|
|
|
|
this.msgAlertDeleteRequest = `Yakin, mau hapus Purchase Request [${data.prNumber}] ?`;
|
|
this.dialogAlertDeleteRequest = true;
|
|
},
|
|
closeAndDeleteRequest() {
|
|
this.$store.dispatch("requester/deleteRequest", {
|
|
PRID: this.xPRID,
|
|
PRNumber: this.xNumber,
|
|
});
|
|
this.dialogAlertDeleteRequest = false;
|
|
},
|
|
openDialogDetail() {
|
|
this.$store.commit("requester/updateXDescriptionDetail", "");
|
|
this.$store.commit("requester/updateXAmountRequest", 0);
|
|
this.$store.commit("requester/updateXEstimationPrice", 0);
|
|
this.$store.commit("requester/updateAct", "new");
|
|
this.$store.commit("requester/updateDialogDetail", true);
|
|
this.$store.commit("requester/updateSelectedItemUnit", {});
|
|
},
|
|
updateDetail(val) {
|
|
this.$store.commit("requester/updateXDescriptionDetail", val.PurchaseRequestDirectDescription);
|
|
this.$store.commit(
|
|
"requester/updateXAmountRequest",
|
|
val.PurchaseRequestDirectDetailAmountRequest
|
|
);
|
|
this.$store.commit(
|
|
"requester/updateXEstimationPrice",
|
|
val.PurchaseRequestDirectDetailEstimationPrice
|
|
);
|
|
this.$store.commit("requester/updateItemUnits", [{
|
|
ItemUnitID: val.PurchaseRequestDirectDetailItemUnitID,
|
|
ItemUnitName: val.ItemUnitName
|
|
}]);
|
|
this.$store.commit("requester/updateSelectedItemUnit", {
|
|
ItemUnitID: val.PurchaseRequestDirectDetailItemUnitID,
|
|
ItemUnitName: val.ItemUnitName
|
|
});
|
|
this.$store.commit("requester/updateSelectedDetailTable", val);
|
|
this.$store.commit("requester/updateAct", "edit");
|
|
this.$store.commit("requester/updateDialogDetail", true);
|
|
},
|
|
deleteDetail(data) {
|
|
this.xPRDID = data.PurchaseRequestDirectDetailID;
|
|
|
|
this.msgAlertDeleteRequest = `Yakin, mau hapus Request [${data.PurchaseRequestDirectDescription}] ?`;
|
|
this.dialogAlertDeleteDetail = true;
|
|
},
|
|
closeAndDeleteDetail() {
|
|
this.$store.dispatch("requester/deleteDetail", {
|
|
PRDID: this.xPRDID,
|
|
PRDDescriptionDetail: this.xDescriptionDetail,
|
|
PRID: this.selectedMainTable.PurchaseRequestDirectID,
|
|
});
|
|
this.dialogAlertDeleteDetail = false;
|
|
},
|
|
orderRequest(id, status) {
|
|
if (status === "Draft") {
|
|
this.$store.dispatch("requester/orderRequest", {
|
|
PRID: id,
|
|
});
|
|
}
|
|
},
|
|
hasHandover(item) {
|
|
// props.item.hasHandover === '1' && props.item.handoverConfirmedBy == '0' && props.item.handoverToUserID === user.M_UserID
|
|
return Array.isArray(item) && item.length > 0 && item.every(obj => obj.allHandedOver == 'N')
|
|
},
|
|
confirmHandover(item) {
|
|
this.$store.commit("requester/updateSelectedMainTable", item);
|
|
this.$store.commit("requester/updateDialogConfirmHandover", true);
|
|
},
|
|
printout(val) {
|
|
this.printwidth = "60%";
|
|
this.printtitle = "";
|
|
let user = one_user();
|
|
let username = user && user.M_StaffName ? user.M_StaffName : "";
|
|
let tm = Date.now();
|
|
this.urlprint = BASE_URL + "/one-api/report/rpt_stock_request_np/pdf?id=" + val.prId + "&username=" + username + "&tm=" + tm;
|
|
this.openprint = true;
|
|
},
|
|
},
|
|
};
|
|
</script>
|