add modules folder based on s_menu
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog_batchitem" persistent width="25vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
Transfer Item
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout row wrap>
|
||||
<v-autocomplete
|
||||
v-model="form_barnote" multiple label="Pilih Stock Item" item-text="StockStockNumber"
|
||||
chips outline return-object :items="list_barnote.records" hide-details
|
||||
>
|
||||
<template v-slot:selection="data">
|
||||
<v-chip
|
||||
:selected="data.selected"
|
||||
close class="chip--select-multi"
|
||||
@input="removeChips(data.item)"
|
||||
> {{ data.item.StockStockNumber }} </v-chip>
|
||||
</template>
|
||||
<template v-slot:item="data">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>
|
||||
Nomor {{ data.item.StockStockNumber }}
|
||||
</v-list-tile-title>
|
||||
<v-list-tile-sub-title>
|
||||
{{ data.item.WarehouseName }}
|
||||
</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
|
||||
<v-flex xs12 class="mt-2" v-for="(item, index) in form_barnote" :key="item.StockStockNumber">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs6 class="pr-2">
|
||||
<p class="body-2 mb-0">Nomor: {{ item.StockStockNumber }}</p>
|
||||
<p class="body-2 mb-0">{{ item.WarehouseName }}</p>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="pr-1">
|
||||
<p class="body-2 mb-0">Stock:</p>
|
||||
<p class="body-2 mb-0">{{ item.StockQty }} {{ item.ItemUnitName }}</p>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="pl-1">
|
||||
<v-text-field
|
||||
single-line
|
||||
type="number" min="0" step="1"
|
||||
label="Jumlah" v-model="item.QtyReq"
|
||||
outline hide-details
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider v-if="index + 1 < form_barnote.length" :key="`divider-${index}`" class="mt-2"></v-divider>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" @click="batalItem()">BATAL</v-btn>
|
||||
<v-btn color="primary" @click="simpanItem()">SIMPAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
totalrequest: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_batchitem: {
|
||||
get() {
|
||||
return this.$store.state.np_form.dialog_batchitem
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_dialog_batchitem", val)
|
||||
}
|
||||
},
|
||||
buffer_detailitem: {
|
||||
get() {
|
||||
return this.$store.state.np_form.buffer_detailitem
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_buffer_detailitem", val)
|
||||
}
|
||||
},
|
||||
list_barnote: {
|
||||
get() {
|
||||
return this.$store.state.np_form.list_barnote
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_list_barnote", val)
|
||||
}
|
||||
},
|
||||
form_barnote: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_barnote
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_barnote", val)
|
||||
}
|
||||
},
|
||||
form_detail: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_detail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_detail", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
batalItem() {
|
||||
this.buffer_detailitem = {}
|
||||
this.form_barnote = []
|
||||
this.dialog_batchitem = false
|
||||
},
|
||||
simpanItem() {
|
||||
let current_detail = this.form_detail
|
||||
let current_item = this.buffer_detailitem
|
||||
let new_note = this.form_barnote
|
||||
|
||||
let qty = 0
|
||||
let isError = false
|
||||
new_note.forEach(element => {
|
||||
let req = Number(element.QtyReq)
|
||||
let stock = Number(element.StockQty)
|
||||
if (!req || req <= 0 || req > stock) {
|
||||
isError = true
|
||||
const snac = { isOpen: true, color: "error", msg: "[Error] Jumlah tidak boleh melebihi Stock" }
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
qty = qty + req
|
||||
});
|
||||
if (isError) {
|
||||
return
|
||||
}
|
||||
|
||||
current_detail.forEach(element => {
|
||||
if (element.PurchaseRequestFlagID == current_item.PurchaseRequestFlagID) {
|
||||
element.ItemRequest = new_note
|
||||
element.QtyFilled = qty
|
||||
element.PurchaseRequestFlagQtyRest = qty
|
||||
}
|
||||
});
|
||||
|
||||
this.form_detail = current_detail
|
||||
this.form_barnote = []
|
||||
this.buffer_detailitem = {}
|
||||
this.dialog_batchitem = false
|
||||
},
|
||||
removeChips(data) {
|
||||
let temp = this.form_barnote.filter(item => item.StockStockNumber !== data.StockStockNumber)
|
||||
this.form_barnote = temp
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog_batchitem" persistent width="30vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
Transfer Item
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 class="mb-2">
|
||||
<v-autocomplete
|
||||
v-model="form_batchitem" multiple label="Pilih Batch Item" item-text="StockBatchNo"
|
||||
chips outline return-object :items="list_batchitemform.records" hide-details
|
||||
>
|
||||
<template v-slot:selection="data">
|
||||
<v-chip
|
||||
:selected="data.selected"
|
||||
close class="chip--select-multi"
|
||||
@input="removeChips(data.item)"
|
||||
>
|
||||
{{ data.item.StockBatchNo }}
|
||||
</v-chip>
|
||||
</template>
|
||||
<template v-slot:item="data">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>
|
||||
Batch {{ data.item.StockBatchNo }}
|
||||
</v-list-tile-title>
|
||||
<v-list-tile-sub-title>
|
||||
Expired: {{ data.item.StockED }}
|
||||
</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs12 v-for="(item, index) in form_batchitem" :key="item.StockStockNumber" class="mt-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs6 class="pr-2">
|
||||
<p class="body-2 mb-0">Nomor batch: {{ item.StockBatchNo }}</p>
|
||||
<p class="body-2 mb-0">Expired: {{ item.StockED }}</p>
|
||||
<p class="body-2 mb-0">{{ item.WarehouseName }}</p>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="pr-1">
|
||||
<p class="body-2 mb-0">Stock:</p>
|
||||
<p class="body-2 mb-0">{{ item.StockQty }} {{ item.ItemUnitName }}</p>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="pl-1">
|
||||
<p class="text-xs-center">TF Qty: </p>
|
||||
<v-text-field
|
||||
single-line
|
||||
type="number" min="0" step="1"
|
||||
label="Jumlah" v-model="item.QtyReq"
|
||||
outline hide-details
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-divider v-if="index + 1 < form_batchitem.length" :key="`divider-${index}`" class="mt-2"></v-divider>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" @click="batalItem()">BATAL</v-btn>
|
||||
<v-btn color="primary" @click="simpanItem()">SIMPAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_batchitem: {
|
||||
get() {
|
||||
return this.$store.state.p_form.dialog_batchitem
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_dialog_batchitem", val)
|
||||
}
|
||||
},
|
||||
buffer_detailitem: {
|
||||
get() {
|
||||
return this.$store.state.p_form.buffer_detailitem
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_buffer_detailitem", val)
|
||||
}
|
||||
},
|
||||
list_batchitemform: {
|
||||
get() {
|
||||
return this.$store.state.p_form.list_batchitemform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_list_batchitemform", val)
|
||||
}
|
||||
},
|
||||
form_batchitem: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_batchitem
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_batchitem", val)
|
||||
}
|
||||
},
|
||||
form_detail: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_detail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_detail", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
batalItem() {
|
||||
this.buffer_detailitem = {}
|
||||
this.list_batchitemform = {}
|
||||
this.form_batchitem = []
|
||||
this.dialog_batchitem = false
|
||||
},
|
||||
simpanItem() {
|
||||
let current_detail = this.form_detail
|
||||
let current_item = this.buffer_detailitem
|
||||
let new_batchitem = this.form_batchitem
|
||||
|
||||
let qty = 0
|
||||
let isError = false
|
||||
new_batchitem.forEach(element => {
|
||||
let req = Number(element.QtyReq)
|
||||
let stock = Number(element.StockQty)
|
||||
if (!req || req <= 0 || req > stock) {
|
||||
isError = true
|
||||
const snac = { isOpen: true, color: "error", msg: `[Error] jumlah tidak boleh <0 atau melebihi stock (${stock})` }
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
qty = qty + req
|
||||
});
|
||||
if (isError) {
|
||||
return
|
||||
}
|
||||
|
||||
current_detail.forEach(element => {
|
||||
if (element.PurchaseRequestFlagID == current_item.PurchaseRequestFlagID) {
|
||||
element.ItemRequest = new_batchitem
|
||||
element.QtyFilled = qty
|
||||
element.PurchaseRequestFlagQtyRest = qty
|
||||
}
|
||||
});
|
||||
|
||||
this.form_detail = current_detail
|
||||
this.form_batchitem = []
|
||||
this.list_batchitemform = {}
|
||||
this.buffer_detailitem = {}
|
||||
this.dialog_batchitem = false
|
||||
},
|
||||
removeChips(data) {
|
||||
let tempo = this.form_batchitem.filter(item => item.StockBatchNo !== data.StockBatchNo)
|
||||
this.form_batchitem = tempo
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog_detailform" persistent width="70vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
DAFTAR PERMINTAAN ITEM
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-data-table
|
||||
class="elevation-1 mb-2" hide-actions xs12
|
||||
v-model="temp_item" item-key="PurchaseRequestFlagID"
|
||||
:headers="headers" :items="list_detailform.records"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.ItemUnitName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.StockGudang }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestFlagQty }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-checkbox
|
||||
hide-details primary class="d-inline-flex"
|
||||
v-model="props.selected"
|
||||
></v-checkbox>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
|
||||
<div class="text-xs-center mt-2">
|
||||
<v-pagination v-model="list_detailform_page" :length="detail_length" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="batalPick()">BATAL</v-btn>
|
||||
<v-btn color="primary" @click="simpanPick()">TAMBAH</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.flex-centered {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
temp_item: [],
|
||||
headers: [
|
||||
{
|
||||
text: "NO REQUEST", align: "center", sortable: false,
|
||||
value: "no", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "no", width: "30%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "UNIT", align: "center", sortable: false,
|
||||
value: "no", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STOK GUDANG", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "JUMLAH", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "no", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_detailform: {
|
||||
get() {
|
||||
return this.$store.state.np_form.dialog_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_dialog_detailform", val)
|
||||
}
|
||||
},
|
||||
list_detailform: {
|
||||
get() {
|
||||
return this.$store.state.np_form.list_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_list_detailform", val)
|
||||
}
|
||||
},
|
||||
list_detailform_page: {
|
||||
get() {
|
||||
return this.$store.state.np_form.list_detailform_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_list_detailform_page", val)
|
||||
this.$store.dispatch("np_form/getListItemDetail")
|
||||
}
|
||||
},
|
||||
form_detail: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_detail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_detail", val)
|
||||
}
|
||||
},
|
||||
detail_length() {
|
||||
const total = this.list_detailform.total
|
||||
if (total == undefined || total == 0) {
|
||||
return 1
|
||||
}
|
||||
return Math.ceil(total/5)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
batalPick() {
|
||||
this.temp_item = []
|
||||
this.dialog_detailform = false
|
||||
},
|
||||
simpanPick() {
|
||||
const current_detail = this.form_detail
|
||||
const new_detail = this.temp_item
|
||||
|
||||
new_detail.forEach(element => {
|
||||
element['PurchaseRequestFlagQtyRest'] = 0;
|
||||
element['ItemRequest'] = [];
|
||||
});
|
||||
|
||||
const merge = current_detail.concat(new_detail)
|
||||
this.temp_item = []
|
||||
this.form_detail = merge
|
||||
this.dialog_detailform = false
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,224 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog_detailform" persistent width="70vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
DAFTAR PERMINTAAN ITEM
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-data-table
|
||||
class="elevation-1 mb-2" hide-actions xs12
|
||||
v-model="temp_item" item-key="PurchaseRequestFlagID"
|
||||
:headers="headers" :items="list_detailform.records" :key="list_detailform.records.length + '-' + JSON.stringify(list_detailform.records.map(i => i.CanDirectUse))"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<div class="stock-container">
|
||||
<div
|
||||
v-for="(stock, index) in props.item.StockGudang"
|
||||
:key="index" class="stock-badge">
|
||||
<strong>{{ stock.StockQty }} {{ stock.StockItemUnitName }}</strong> -- <em>{{ stock.StockBatchNo }}</em>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestFlagQty }} {{ props.item.RequestItemUnitName }} </td>
|
||||
<td class="text-xs-center pa-2" style="white-space:nowrap;">
|
||||
<v-checkbox
|
||||
v-if="props.item.CanDirectUse"
|
||||
hide-details primary class="d-inline-flex"
|
||||
v-model="props.selected"
|
||||
style="display:inline-block;vertical-align:middle;"
|
||||
></v-checkbox>
|
||||
<v-tooltip bottom v-if="props.item.CanUnpack">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn
|
||||
icon @click="unpackStock(props.item)" v-on="on" style="display:inline-block;vertical-align:middle;">
|
||||
<v-icon color="blue">inbox</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Unpack</span>
|
||||
</v-tooltip>
|
||||
<v-icon v-if="!props.item.CanDirectUse && !props.item.CanUnpack" color="red">
|
||||
block
|
||||
</v-icon>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="props.item.MustUnpack && !props.item.UnpackData.CanUnpack">
|
||||
<td :colspan="headers.length" class="pa-2 red lighten-5 red--text" style="font-size:13px;">
|
||||
<v-icon small left color="red">info</v-icon>
|
||||
<span>{{ props.item.UnpackData.ReasonCannotUnpack }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
|
||||
<div class="text-xs-center mt-2">
|
||||
<v-pagination v-model="list_detailform_page" :length="detail_length" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="batalPick()">BATAL</v-btn>
|
||||
<v-btn color="primary" @click="simpanPick()">TAMBAH</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.flex-centered {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.flex-centered {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.stock-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.stock-badge {
|
||||
background-color: #424242;
|
||||
color: white;
|
||||
padding: 4px 8px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
temp_item: [],
|
||||
headers: [
|
||||
{
|
||||
text: "NO REQUEST", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "no", width: "40%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STOK (Qty-Batch)", align: "center", sortable: false,
|
||||
value: "no", width: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "REQUEST", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "no", width: "5%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_detailform: {
|
||||
get() {
|
||||
return this.$store.state.p_form.dialog_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_dialog_detailform", val)
|
||||
}
|
||||
},
|
||||
form_detail: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_detail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_detail", val)
|
||||
}
|
||||
},
|
||||
list_detailform: {
|
||||
get() {
|
||||
return this.$store.state.p_form.list_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_list_detailform", val)
|
||||
}
|
||||
},
|
||||
list_detailform_page: {
|
||||
get() {
|
||||
return this.$store.state.p_form.list_detailform_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_list_detailform_page", val)
|
||||
this.$store.dispatch("p_form/getListItemDetail")
|
||||
}
|
||||
},
|
||||
detail_length() {
|
||||
let total = this.list_detailform.total
|
||||
if (total == undefined || total == 0) {
|
||||
return 1
|
||||
}
|
||||
return Math.ceil(total/5)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
batalPick() {
|
||||
this.temp_item = [];
|
||||
this.dialog_detailform = false;
|
||||
},
|
||||
simpanPick() {
|
||||
const current_detail = this.form_detail;
|
||||
const new_detail = this.temp_item;
|
||||
|
||||
new_detail.forEach(element => {
|
||||
element['PurchaseRequestFlagQtyRest'] = 0;
|
||||
element['ItemRequest'] = [];
|
||||
});
|
||||
|
||||
const merge = current_detail.concat(new_detail);
|
||||
this.temp_item = [];
|
||||
this.form_detail = merge;
|
||||
this.dialog_detailform = false;
|
||||
},
|
||||
async unpackStock(item){
|
||||
try {
|
||||
this.$store.commit("p_form/update_buffer_itemrequestedunpack", item)
|
||||
|
||||
let unitIds = [];
|
||||
// Get unique unitID untuk SQL Query: StockItemUnitID IN unitIds
|
||||
if (item.UnpackData && Array.isArray(item.UnpackData.ConversionOptions)) {
|
||||
unitIds = [...new Set(
|
||||
item.UnpackData.ConversionOptions.map(option => option.FromItemUnitID)
|
||||
)];
|
||||
} else {
|
||||
unitIds = [0]; // Agar SQL tidak error saja
|
||||
}
|
||||
|
||||
let prm = {
|
||||
itemid: item.UnpackData.M_ItemID,
|
||||
unitid: unitIds,
|
||||
batchno: ""
|
||||
}
|
||||
await this.$store.dispatch("p_form/getBatchItemUnpackList", prm)
|
||||
this.$store.commit("p_form/update_dialog_unpackform", true);
|
||||
} catch (error) {
|
||||
console.error('Failed to load batch data:', error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_unpackform" persistent width="30vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
Unpack Stock Confirmation
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<!-- Batch Selection -->
|
||||
<v-autocomplete
|
||||
v-model="selected_batchitemunpack"
|
||||
:items="list_batchitemunpack"
|
||||
item-text="StockBatchNo"
|
||||
return-object
|
||||
label="Select Batch Number"
|
||||
outlined
|
||||
dense
|
||||
@change="onBatchChange"
|
||||
>
|
||||
<template v-slot:item="data">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>
|
||||
Batch {{ data.item.StockBatchNo }}
|
||||
</v-list-tile-title>
|
||||
<v-list-tile-sub-title>
|
||||
Expired: {{ data.item.StockED }} | Stock: {{ data.item.StockQty }} {{ data.item.ItemUnitName }}
|
||||
</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
|
||||
<!-- Stock Info & Unpack Input (show when batch selected) -->
|
||||
<div v-if="selected_batchitemunpack && Object.keys(selected_batchitemunpack).length > 0">
|
||||
<div class="mb-3 text-body-1">
|
||||
Current Stock: <strong>{{ selected_batchitemunpack.StockQty }} {{ selected_batchitemunpack.ItemUnitName }}</strong>
|
||||
</div>
|
||||
|
||||
<div class="d-inline-flex align-end flex-wrap mb-3">
|
||||
<span class="mr-2">Unpack:</span>
|
||||
<v-text-field
|
||||
v-model="unpackQty"
|
||||
type="number"
|
||||
:min="0"
|
||||
:max="selected_batchitemunpack.StockQty"
|
||||
:step="1"
|
||||
dense
|
||||
outlined
|
||||
hide-details
|
||||
style="width: 120px;"
|
||||
class="mx-2"
|
||||
></v-text-field>
|
||||
<span class="mx-1">{{ selected_batchitemunpack.ItemUnitName }}</span>
|
||||
<span class="mx-1">to</span>
|
||||
<strong class="ml-2">{{ unpackResult }} {{ buffer_itemrequestedunpack.RequestItemUnitName }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="cancelUnpack()">CANCEL</v-btn>
|
||||
<v-btn
|
||||
color="primary"
|
||||
@click="confirmUnpack()"
|
||||
:disabled="!selected_batchitemunpack || Object.keys(selected_batchitemunpack).length === 0 || !unpackQty || unpackQty <= 0"
|
||||
>
|
||||
UNPACK
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted(){
|
||||
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
unpackQty: 0,
|
||||
conversionAmount: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_unpackform: {
|
||||
get(){
|
||||
return this.$store.state.p_form.dialog_unpackform
|
||||
},
|
||||
set(val){
|
||||
this.$store.commit("p_form/update_dialog_unpackform", val)
|
||||
}
|
||||
},
|
||||
buffer_itemrequestedunpack: {
|
||||
get(){
|
||||
return this.$store.state.p_form.buffer_itemrequestedunpack
|
||||
},
|
||||
set(val){
|
||||
this.$store.commit("p_form/update_buffer_itemrequestedunpack", val)
|
||||
}
|
||||
},
|
||||
list_batchitemunpack: {
|
||||
get(){
|
||||
return this.$store.state.p_form.list_batchitemunpack
|
||||
},
|
||||
set(val){
|
||||
this.$store.commit("p_form/update_list_batchitemunpack", val)
|
||||
}
|
||||
},
|
||||
selected_batchitemunpack: {
|
||||
get(){
|
||||
return this.$store.state.p_form.selected_batchitemunpack
|
||||
},
|
||||
set(val){
|
||||
this.$store.commit("p_form/update_selected_batchitemunpack", val)
|
||||
}
|
||||
},
|
||||
unpackResult() {
|
||||
if (!this.unpackQty || !this.selected_batchitemunpack) return 0
|
||||
|
||||
if (this.buffer_itemrequestedunpack.UnpackData &&
|
||||
Array.isArray(this.buffer_itemrequestedunpack.UnpackData.ConversionOptions)) {
|
||||
|
||||
// Find conversion option where:
|
||||
// FromItemUnitID matches selected stock batch's ItemUnitID
|
||||
// AND ToItemUnitID matches requested item's unit ID
|
||||
const matchingOption = this.buffer_itemrequestedunpack.UnpackData.ConversionOptions.find(option =>
|
||||
option.FromItemUnitID === this.selected_batchitemunpack.StockItemUnitID &&
|
||||
option.ToItemUnitID === this.buffer_itemrequestedunpack.PurchaseRequestDetailItemUnitID
|
||||
)
|
||||
|
||||
if (matchingOption) {
|
||||
this.conversionAmount = parseFloat(matchingOption.UnitConvertAmount)
|
||||
}
|
||||
}
|
||||
return this.unpackQty * this.conversionAmount
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onBatchChange() {
|
||||
this.unpackQty = 0
|
||||
},
|
||||
cancelUnpack() {
|
||||
this.selected_batchitemunpack = {}
|
||||
this.unpackQty = 0
|
||||
this.conversionAmount = 0
|
||||
this.list_batchitemunpack = []
|
||||
this.dialog_unpackform = false
|
||||
this.buffer_itemrequestedunpack = {}
|
||||
},
|
||||
confirmUnpack() {
|
||||
if (!this.selected_batchitemunpack || !this.unpackQty) return
|
||||
|
||||
let params = {
|
||||
StockStockNumber : this.selected_batchitemunpack.StockStockNumber,
|
||||
StockBatchNo : this.selected_batchitemunpack.StockBatchNo,
|
||||
UnpackQty : this.unpackQty,
|
||||
ToItemUnitID : this.buffer_itemrequestedunpack.PurchaseRequestDetailItemUnitID,
|
||||
UnitConvertAmount : this.conversionAmount
|
||||
}
|
||||
|
||||
this.$store.dispatch("p_form/unpackingStock", params)
|
||||
this.cancelUnpack()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,515 @@
|
||||
<template>
|
||||
<v-card class="pa-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs6 class="pr-1">
|
||||
<h3>FORM TRANSFER NON PERSEDIAAN</h3>
|
||||
<h3>TYPE FORM: {{ this.type_act }}</h3>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="pl-1">
|
||||
<h3>NOMOR: {{ this.selected_tf.T_GoodsTransferNum ?? '-' }}</h3>
|
||||
<h3>STATUS: {{ this.selected_tf.T_GoodsTransferStatus ?? '-' }}</h3>
|
||||
</v-flex>
|
||||
|
||||
<!-- first row -->
|
||||
<v-flex xs4 class="pr-2 mt-2">
|
||||
<v-menu
|
||||
v-model="menuTFDate" transition="scale-transition"
|
||||
lazy offset-y full-width :nudge-right="40"
|
||||
max-width="290px" min-width="290px"
|
||||
:close-on-content-click="false"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="computedTFDate" label="Tanggal Transfer"
|
||||
readonly v-on="on" outline hide-details :disabled="isVerif()"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="form_transfer_date" @input="menuTFDate = false" no-title></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs4 class="pr-1 mt-2">
|
||||
<v-autocomplete
|
||||
outline v-model="form_cabang" hide-details
|
||||
:items="list_cabangform" label="Cabang" return-object item-key="M_BranchCode"
|
||||
item-text="M_BranchName" @input="changeCabang" :disabled="isVerif()"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs4 class="pl-1 mt-2">
|
||||
<v-autocomplete
|
||||
outline v-model="form_divisi" hide-details
|
||||
:items="list_divisiform" label="Divisi" return-object item-key="DivisionID"
|
||||
item-text="DivisionName" @input="changeDivisi" :disabled="isVerif()"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
|
||||
<!-- second row -->
|
||||
<v-flex xs12 class="mt-2">
|
||||
<v-textarea
|
||||
outline hide-details label="Catatan" v-model="form_catatan" :disabled="isVerif()"
|
||||
></v-textarea>
|
||||
</v-flex>
|
||||
|
||||
<!-- button add detail -->
|
||||
<v-flex xs12 class="mt-4 flex-end">
|
||||
<v-btn icon @click="addItem()" :disabled="isVerif()">
|
||||
<v-icon medium color="primary">add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
|
||||
<!-- detail table row -->
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
class="elevation-1 mb-2" hide-actions xs12 item-key="PurchaseRequestFlagID"
|
||||
:headers="headers" :items="form_detail" :loading="false"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<p v-for="obj in props.item.ItemRequest" class="body-1 mb-0">
|
||||
Nomor: {{ obj.StockStockNumber }}, Jumlah: {{ obj.QtyReq }}, {{ obj.WarehouseName }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<!-- <v-text-field
|
||||
v-model="props.item.PurchaseRequestFlagQtyRest" single-line
|
||||
type="number" outline hide-details :disabled="isVerif()" readonly
|
||||
></v-text-field> -->
|
||||
<p class="body-2">{{ props.item.PurchaseRequestFlagQty }} / {{ props.item.PurchaseRequestFlagQtyRest }} {{ props.item.ItemUnitName }}</p>
|
||||
<p v-show="empty_id.includes(props.item.PurchaseRequestFlagID)" style="color: red;" class="ma-0 pa-0">Jumlah melebihi stok</p>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-btn icon @click="editDetail(props.item)" :disabled="isVerif() && is_verif !='Verified'">
|
||||
<v-icon color="blue">edit</v-icon>
|
||||
</v-btn>
|
||||
<v-btn icon @click="removeDetail(props.item)" :disabled="isVerif()">
|
||||
<v-icon color="error">delete</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
</v-flex>
|
||||
|
||||
<v-flex grow class="mt-4">
|
||||
<!-- <v-btn
|
||||
color="primary" class="white--text" @click="doVerif()"
|
||||
:outline="!isVerif()" :disabled="isVerif()"
|
||||
>
|
||||
{{ !isVerif() ? 'Verifikasi' : 'Verified' }}
|
||||
<v-icon v-show="isVerif()" right>check_circle</v-icon>
|
||||
</v-btn> -->
|
||||
|
||||
<v-btn
|
||||
color="primary" class="white--text" @click="submitReq()"
|
||||
:outline="!isVerif()" :disabled="isVerif()"
|
||||
v-show="Object.keys(selected_tf).length <= 0 || selected_tf.T_GoodsTransferStatus == 'Draft'"
|
||||
>
|
||||
Buat Request
|
||||
<v-icon right small>assignment_turned_in</v-icon>
|
||||
</v-btn>
|
||||
|
||||
<v-btn
|
||||
color="primary" class="white--text" @click="submitTF('V')"
|
||||
:outline="selected_tf.T_GoodsTransferVerifiedBy == '0'"
|
||||
v-show="Object.keys(selected_tf).length > 0 && selected_tf.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
{{ selected_tf.T_GoodsTransferVerifiedBy == '0' ? 'Verify' : 'Verified' }}
|
||||
<v-icon right small>done</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="primary" class="white--text" @click="submitTF('A')"
|
||||
:outline="selected_tf.T_GoodsTransferApprovedBy == '0'"
|
||||
v-show="Object.keys(selected_tf).length > 0 && selected_tf.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
{{ selected_tf.T_GoodsTransferApprovedBy == '0' ? 'Approve' : 'Approved' }}
|
||||
<v-icon right small>done_all</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-flex shrink class="mt-4">
|
||||
<v-btn
|
||||
outline color="primary" class="white--text"
|
||||
@click="batalForm()" :disabled="isVerif()"
|
||||
>Batal</v-btn>
|
||||
<v-btn
|
||||
color="primary" class="white--text"
|
||||
@click="simpanForm()"
|
||||
:disabled="selected_tf.T_GoodsTransferStatus != 'Verified' || selected_tf.T_GoodsTransferStatus != 'Draft'"
|
||||
v-show="type_act == 'BARU' || (type_act == 'EDIT' && edit_qty != 'Eqty')"
|
||||
>Simpan</v-btn>
|
||||
<v-btn
|
||||
color="primary" class="white--text"
|
||||
@click="simpanForm()"
|
||||
v-show="selected_tf.T_GoodsTransferStatus == 'Verified' && type_act == 'EDIT' && edit_qty == 'Eqty'"
|
||||
>Simpan qty</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.flex-centered {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.flex-end {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuTFDate: false,
|
||||
empty_id: [],
|
||||
headers: [
|
||||
{
|
||||
text: "NO REQUEST", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "no", width: "35%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM GUDANG", align: "center", sortable: false,
|
||||
value: "no", width: "30%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "JUMLAH", align: "center", sortable: false,
|
||||
value: "no", width: "5%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
form_transfer_date: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_transfer_date
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_transfer_date", val)
|
||||
}
|
||||
},
|
||||
form_cabang: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_cabang", val)
|
||||
}
|
||||
},
|
||||
form_divisi: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_divisi
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_divisi", val)
|
||||
}
|
||||
},
|
||||
form_catatan: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_catatan
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_catatan", val)
|
||||
}
|
||||
},
|
||||
form_detail: {
|
||||
get() {
|
||||
return this.$store.state.np_form.form_detail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_form_detail", val)
|
||||
}
|
||||
},
|
||||
dialog_detailform: {
|
||||
get() {
|
||||
return this.$store.state.np_form.dialog_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_dialog_detailform", val)
|
||||
}
|
||||
},
|
||||
list_cabangform: {
|
||||
get() {
|
||||
return this.$store.state.np_form.list_cabangform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_list_cabangform", val)
|
||||
}
|
||||
},
|
||||
list_divisiform: {
|
||||
get() {
|
||||
return this.$store.state.np_form.list_divisiform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_list_divisiform", val)
|
||||
}
|
||||
},
|
||||
list_detailform: {
|
||||
get() {
|
||||
return this.$store.state.np_form.list_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_list_detailform", val)
|
||||
}
|
||||
},
|
||||
type_act: {
|
||||
get() {
|
||||
return this.$store.state.np_form.type_act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_type_act", val)
|
||||
}
|
||||
},
|
||||
is_verif: {
|
||||
get() {
|
||||
return this.$store.state.np_form.is_verif
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_is_verif", val)
|
||||
}
|
||||
},
|
||||
selected_tf: {
|
||||
get() {
|
||||
return this.$store.state.np_data.selected_tf
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_selected_tf", val)
|
||||
}
|
||||
},
|
||||
edit_qty: {
|
||||
get() {
|
||||
return this.$store.state.np_form.edit_qty
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_edit_qty", val)
|
||||
}
|
||||
},
|
||||
act_verif: {
|
||||
get() {
|
||||
return this.$store.state.np_form.act_verif
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_form/update_act_verif", val)
|
||||
}
|
||||
},
|
||||
computedTFDate() {
|
||||
return this.formatDate(this.form_transfer_date)
|
||||
},
|
||||
approve_level() {
|
||||
return this.$store.state.np_data.user_level
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
isVerif() {
|
||||
let stat = this.is_verif
|
||||
if (stat == 'Draft') {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
changeCabang() {
|
||||
this.empty_id = []
|
||||
},
|
||||
changeDivisi() {
|
||||
this.empty_id = []
|
||||
},
|
||||
addItem() {
|
||||
if (!this.form_cabang.M_BranchCode || !this.form_transfer_date || !this.form_divisi.DivisionID) {
|
||||
const snac = { isOpen: true, color: 'error', msg: 'Form harus diisi' };
|
||||
this.$store.commit("p_data/update_snackbar", snac);
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.dispatch("np_form/getListItemDetail")
|
||||
this.dialog_detailform = true
|
||||
},
|
||||
editDetail(item) {
|
||||
let params = {
|
||||
itemid: item.PurchaseRequestDetailM_ItemID,
|
||||
unitid: item.PurchaseRequestDetailItemUnitID
|
||||
}
|
||||
this.$store.dispatch("np_form/getListStock", params);
|
||||
|
||||
if (item.ItemRequest.length > 0) {
|
||||
this.$store.commit("np_form/update_form_barnote", item.ItemRequest);
|
||||
}
|
||||
|
||||
this.$store.commit("np_form/update_buffer_detailitem", item)
|
||||
this.$store.commit("np_form/update_dialog_batchitem", true)
|
||||
},
|
||||
removeDetail(item) {
|
||||
const old = this.form_detail
|
||||
let nwd = old.filter((val) => val.PurchaseRequestFlagID !== item.PurchaseRequestFlagID)
|
||||
this.form_detail = nwd
|
||||
},
|
||||
batalForm() {
|
||||
this.$store.dispatch("np_form/newForm")
|
||||
this.empty_id = []
|
||||
},
|
||||
simpanForm() {
|
||||
let empty = []
|
||||
let temp_detail = this.form_detail
|
||||
|
||||
if (Object.keys(this.form_cabang).length <= 0 || Object.keys(this.form_divisi).length <= 0) {
|
||||
this.empty_id = empty
|
||||
return
|
||||
}
|
||||
|
||||
temp_detail.forEach(element => {
|
||||
let qty = parseInt(element.PurchaseRequestFlagQtyRest)
|
||||
let stock = parseInt(element.StockGudang)
|
||||
if (qty > stock) {
|
||||
empty.push(element.PurchaseRequestFlagID)
|
||||
return
|
||||
}
|
||||
});
|
||||
|
||||
if (this.form_cabang.T_GoodsTransferStatus == 'Verified' && this.edit_qty == 'NoEqty') {
|
||||
return
|
||||
}
|
||||
|
||||
// jika type_act BARU maka inser
|
||||
// jika type_act EDIT dan edit_qty == NoEqty maka update data
|
||||
// jika type_act EDIT dan edit_qty == Eqty maka update qty
|
||||
if (this.type_act == 'BARU' && empty.length == 0) {
|
||||
this.empty_id = empty
|
||||
this.$store.dispatch("np_form/createTFReq")
|
||||
} else if (this.type_act == 'EDIT' && this.edit_qty == 'NoEqty' && empty.length == 0) {
|
||||
this.empty_id = empty
|
||||
this.$store.dispatch("np_form/updateTFReq")
|
||||
} else if (this.type_act == 'EDIT' && this.edit_qty == 'Eqty' && empty.length == 0) {
|
||||
this.empty_id = empty
|
||||
this.$store.dispatch("np_form/updateTFReq")
|
||||
} else {
|
||||
this.empty_id = empty
|
||||
}
|
||||
},
|
||||
submitReq() {
|
||||
let error_id = []
|
||||
let act = this.type_act
|
||||
let item = this.form_detail
|
||||
|
||||
let snac = { isOpen: true, color: "error", msg: "[Error]" }
|
||||
if (!this.form_transfer_date || Object.keys(this.form_cabang).length == 0 || Object.keys(this.form_divisi).length == 0) {
|
||||
snac.msg = "[Error] Masih terdapat form yang kosong"
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (item.length <= 0) {
|
||||
snac.msg = "[Error] Detail Item masih kosong"
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
item.forEach(element => {
|
||||
if (parseInt(element.PurchaseRequestFlagQtyRest) > parseInt(element.StockGudang)) {
|
||||
error_id.push(element.PurchaseRequestFlagID)
|
||||
}
|
||||
});
|
||||
|
||||
if (error_id.length > 0) {
|
||||
this.empty_id = error_id
|
||||
return
|
||||
}
|
||||
|
||||
if (this.is_verif == 'Draft') {
|
||||
this.is_verif = 'Pending'
|
||||
}
|
||||
|
||||
if (act == 'BARU' && error_id.length == 0) {
|
||||
this.empty_id = error_id
|
||||
this.$store.dispatch("np_form/createTFReq")
|
||||
} else if (act == 'EDIT' && error_id.length == 0) {
|
||||
this.empty_id = error_id
|
||||
this.$store.dispatch("np_form/updateTFReq")
|
||||
}
|
||||
},
|
||||
submitTF(type) {
|
||||
let error_id = [];
|
||||
let act = this.type_act;
|
||||
let item = this.form_detail;
|
||||
let approvlevel = this.approve_level;
|
||||
let currentTF = this.selected_tf
|
||||
|
||||
let snac = { isOpen: true, color: "error", msg: "[Error]" };
|
||||
|
||||
if (!this.form_transfer_date || Object.keys(this.form_cabang).length == 0 || Object.keys(this.form_divisi).length == 0) {
|
||||
snac.msg = "[Error] Masih terdapat form yang kosong";
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.length <= 0) {
|
||||
snac.msg = "[Error] Detail Item masih kosong";
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true });
|
||||
return;
|
||||
}
|
||||
|
||||
item.forEach(element => {
|
||||
if (parseInt(element.PurchaseRequestFlagQtyRest) > parseInt(element.StockGudang)) {
|
||||
error_id.push(element.PurchaseRequestFlagID);
|
||||
}
|
||||
});
|
||||
|
||||
if (error_id.length > 0) {
|
||||
this.empty_id = error_id;
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == 'V' && approvlevel.M_UserM_ApproveLevelID == '1') {
|
||||
if (currentTF.T_GoodsTransferVerifiedBy != '0') {
|
||||
snac.msg = "[INFO] Request sudah diverifikasi";
|
||||
snac.color = 'warning';
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true });
|
||||
return;
|
||||
}
|
||||
|
||||
this.is_verif = 'Verified';
|
||||
this.act_verif = type
|
||||
if (act == 'EDIT' && error_id.length == 0) {
|
||||
this.empty_id = error_id;
|
||||
this.$store.dispatch("np_form/updateTFReq");
|
||||
}
|
||||
} else if (type == 'A' && approvlevel.M_UserM_ApproveLevelID == '2') {
|
||||
if (currentTF.T_GoodsTransferApprovedBy != '0') {
|
||||
snac.msg = "[INFO] Request sudah diapprove";
|
||||
snac.color = 'warning';
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true });
|
||||
return;
|
||||
}
|
||||
|
||||
this.is_verif = 'Approved';
|
||||
if (act == 'EDIT' && error_id.length == 0) {
|
||||
this.empty_id = error_id;
|
||||
this.$store.dispatch("np_form/updateTFReq");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
524
test/vuex/acc-one-transfer-req/components/formPersediaanTF.vue
Normal file
524
test/vuex/acc-one-transfer-req/components/formPersediaanTF.vue
Normal file
@@ -0,0 +1,524 @@
|
||||
<template>
|
||||
<v-card class="pa-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs6 class="pr-1">
|
||||
<h3>FORM TRANSFER PERSEDIAAN</h3>
|
||||
<h3>TYPE FORM: {{ this.type_act }}</h3>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="pl-1">
|
||||
<h3>NOMOR: {{ this.selected_tf.T_GoodsTransferNum ?? '-' }}</h3>
|
||||
<h3>STATUS: {{ this.selected_tf.T_GoodsTransferStatus ?? '-' }}</h3>
|
||||
</v-flex>
|
||||
|
||||
<!-- first row -->
|
||||
<v-flex xs6 class="pr-1 mt-2">
|
||||
<v-menu
|
||||
v-model="menuTFDate" transition="scale-transition"
|
||||
lazy offset-y full-width :nudge-right="40"
|
||||
max-width="290px" min-width="290px"
|
||||
:close-on-content-click="false"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="computedTFDate" label="Tanggal Transfer"
|
||||
readonly v-on="on" outline hide-details :disabled="isVerif()"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="form_transfer_date" @input="menuTFDate = false" no-title></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="pl-1 mt-2">
|
||||
<v-autocomplete
|
||||
outline v-model="form_cabang" hide-details
|
||||
:items="list_cabangform" label="Cabang" return-object item-key="M_BranchCode"
|
||||
item-text="M_BranchName" @input="changeCabang" :disabled="isVerif()"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
|
||||
<!-- second row -->
|
||||
<v-flex xs12 class="mt-2">
|
||||
<v-textarea
|
||||
outline hide-details label="Catatan" v-model="form_catatan" :disabled="isVerif()"
|
||||
></v-textarea>
|
||||
</v-flex>
|
||||
|
||||
<!-- button add detail -->
|
||||
<v-flex xs12 class="mt-4 flex-end">
|
||||
<v-btn icon @click="addItem()" :disabled="isVerif()">
|
||||
<v-icon medium color="primary">add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
|
||||
<!-- detail table row -->
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
class="elevation-1 mb-2" hide-actions xs12 item-key="PurchaseRequestFlagID"
|
||||
:headers="headers" :items="form_detail" :loading="false"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2">{{ props.item.PurchaseRequestNumber }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_ItemDesc }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<p v-for="obj in props.item.ItemRequest" class="body-1 mb-0">
|
||||
Batch: {{ obj.StockBatchNo }}, Jumlah: {{ obj.QtyReq }}, {{ obj.WarehouseName }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<!-- <v-text-field
|
||||
v-model="props.item.PurchaseRequestFlagQtyRest" single-line
|
||||
type="number" outline hide-details :disabled="isVerif()" readonly
|
||||
></v-text-field> -->
|
||||
<p class="body-2">{{ props.item.PurchaseRequestFlagQty }} / {{ props.item.PurchaseRequestFlagQtyRest }} {{ props.item.ItemUnitName }}</p>
|
||||
<p v-show="empty_id.includes(props.item.PurchaseRequestFlagID)" style="color: red;" class="ma-0 pa-0">Jumlah melebihi stok</p>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon @click="editDetail(props.item)" :disabled="isVerif() && is_verif !='Verified'" v-on="on">
|
||||
<v-icon color="blue">edit</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Edit Detail</span>
|
||||
</v-tooltip>
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon @click="removeDetail(props.item)" :disabled="isVerif()" v-on="on">
|
||||
<v-icon color="error">delete</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Delete</span>
|
||||
</v-tooltip>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
</v-flex>
|
||||
|
||||
<v-flex grow class="mt-4">
|
||||
<v-btn
|
||||
color="primary" class="white--text" @click="submitReq()"
|
||||
:outline="!isVerif()" :disabled="isVerif()"
|
||||
v-show="Object.keys(selected_tf).length <= 0 || selected_tf.T_GoodsTransferStatus == 'Draft'"
|
||||
>
|
||||
Buat Request
|
||||
<v-icon right small>assignment_turned_in</v-icon>
|
||||
</v-btn>
|
||||
|
||||
<v-btn
|
||||
color="primary" class="white--text" @click="submitTF('V')"
|
||||
:outline="selected_tf.T_GoodsTransferVerifiedBy == '0'"
|
||||
v-show="Object.keys(selected_tf).length > 0 && selected_tf.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
{{ selected_tf.T_GoodsTransferVerifiedBy == '0' ? 'Verify' : 'Verified' }}
|
||||
<v-icon right small>done</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="primary" class="white--text" @click="submitTF('A')"
|
||||
:outline="selected_tf.T_GoodsTransferApprovedBy == '0'"
|
||||
v-show="Object.keys(selected_tf).length > 0 && selected_tf.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
{{ selected_tf.T_GoodsTransferApprovedBy == '0' ? 'Approve' : 'Approved' }}
|
||||
<v-icon right small>done_all</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-flex shrink class="mt-4">
|
||||
<v-btn
|
||||
:disabled="isVerif() && is_verif !='Verified'" outline
|
||||
color="primary" class="white--text" @click="batalForm()"
|
||||
>Batal</v-btn>
|
||||
<v-btn
|
||||
color="primary" class="white--text"
|
||||
@click="simpanForm()"
|
||||
:disabled="selected_tf.T_GoodsTransferStatus != 'Verified' || selected_tf.T_GoodsTransferStatus != 'Draft'"
|
||||
v-show="type_act == 'BARU' || (type_act == 'EDIT' && edit_qty != 'Eqty')"
|
||||
>Simpan</v-btn>
|
||||
<v-btn
|
||||
color="primary" class="white--text"
|
||||
@click="simpanForm()"
|
||||
v-show="selected_tf.T_GoodsTransferStatus == 'Verified' && type_act == 'EDIT' && edit_qty == 'Eqty'"
|
||||
>Simpan qty</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.flex-centered {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.flex-end {
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuTFDate: false,
|
||||
empty_id: [],
|
||||
headers: [
|
||||
{
|
||||
text: "NO REQUEST", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM", align: "center", sortable: false,
|
||||
value: "no", width: "35%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM GUDANG", align: "center", sortable: false,
|
||||
value: "no", width: "30%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "JUMLAH (Req/TF)", align: "center", sortable: false,
|
||||
value: "no", width: "5%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "no", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
form_transfer_date: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_transfer_date
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_transfer_date", val)
|
||||
}
|
||||
},
|
||||
form_cabang: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_cabang", val)
|
||||
}
|
||||
},
|
||||
form_catatan: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_catatan
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_catatan", val)
|
||||
}
|
||||
},
|
||||
form_detail: {
|
||||
get() {
|
||||
return this.$store.state.p_form.form_detail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_form_detail", val)
|
||||
}
|
||||
},
|
||||
dialog_detailform: {
|
||||
get() {
|
||||
return this.$store.state.p_form.dialog_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_dialog_detailform", val)
|
||||
}
|
||||
},
|
||||
list_cabangform: {
|
||||
get() {
|
||||
return this.$store.state.p_form.list_cabangform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_list_cabangform", val)
|
||||
}
|
||||
},
|
||||
list_detailform: {
|
||||
get() {
|
||||
return this.$store.state.p_form.list_detailform
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_list_detailform", val)
|
||||
}
|
||||
},
|
||||
type_act: {
|
||||
get() {
|
||||
return this.$store.state.p_form.type_act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_type_act", val)
|
||||
}
|
||||
},
|
||||
is_verif: {
|
||||
get() {
|
||||
return this.$store.state.p_form.is_verif
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_is_verif", val)
|
||||
}
|
||||
},
|
||||
selected_tf: {
|
||||
get() {
|
||||
return this.$store.state.p_data.selected_tf
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_selected_tf", val)
|
||||
}
|
||||
},
|
||||
edit_qty: {
|
||||
get() {
|
||||
return this.$store.state.p_form.edit_qty
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_edit_qty", val)
|
||||
}
|
||||
},
|
||||
act_verif: {
|
||||
get() {
|
||||
return this.$store.state.p_form.act_verif
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_form/update_act_verif", val)
|
||||
}
|
||||
},
|
||||
computedTFDate() {
|
||||
return this.formatDate(this.form_transfer_date)
|
||||
},
|
||||
approvelevel() {
|
||||
return this.$store.state.p_data.user_level
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
isVerif() {
|
||||
let stat = this.is_verif
|
||||
if (stat == 'Draft') {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
},
|
||||
changeCabang() {
|
||||
this.empty_id = []
|
||||
},
|
||||
addItem() {
|
||||
if (!this.form_cabang.M_BranchCode || !this.form_transfer_date) {
|
||||
const snac = { isOpen: true, color: 'error', msg: 'Pilih cabang dahulu' };
|
||||
this.$store.commit("p_data/update_snackbar", snac);
|
||||
return
|
||||
}
|
||||
this.$store.dispatch("p_form/getListItemDetail")
|
||||
this.dialog_detailform = true;
|
||||
},
|
||||
editDetail(item) {
|
||||
let params = {
|
||||
itemid: item.PurchaseRequestDetailM_ItemID,
|
||||
unitid: item.PurchaseRequestDetailItemUnitID,
|
||||
batchno: ""
|
||||
}
|
||||
this.$store.dispatch("p_form/getBatchItemDetail", params)
|
||||
this.$store.commit("p_form/update_buffer_detailitem", item)
|
||||
|
||||
if (item.ItemRequest.length > 0) {
|
||||
this.$store.commit("p_form/update_form_batchitem", item.ItemRequest)
|
||||
}
|
||||
|
||||
this.$store.commit("p_form/update_dialog_batchitem", true)
|
||||
},
|
||||
removeDetail(item) {
|
||||
const old = this.form_detail
|
||||
const nwd = old.filter((val) => val.PurchaseRequestFlagID !== item.PurchaseRequestFlagID)
|
||||
this.form_detail = nwd
|
||||
},
|
||||
batalForm() {
|
||||
this.$store.dispatch("p_form/newForm")
|
||||
this.empty_id = []
|
||||
},
|
||||
simpanForm() {
|
||||
let empty = []
|
||||
let temp_detail = this.form_detail
|
||||
|
||||
if (Object.keys(this.form_cabang).length == 0) {
|
||||
this.empty_id = empty
|
||||
return
|
||||
}
|
||||
|
||||
temp_detail.forEach(element => {
|
||||
let qty = parseInt(element.PurchaseRequestFlagQtyRest)
|
||||
|
||||
let availableStock = this.calculateAvailableStock(
|
||||
element.StockGudang,
|
||||
element.PurchaseRequestDetailItemUnitID
|
||||
)
|
||||
|
||||
if (qty > availableStock) {
|
||||
empty.push(element.PurchaseRequestFlagID)
|
||||
return
|
||||
}
|
||||
});
|
||||
|
||||
if (this.form_cabang.T_GoodsTransferStatus == 'Verified' && this.edit_qty == 'NoEqty') {
|
||||
return
|
||||
}
|
||||
|
||||
// jika type_act BARU maka inser
|
||||
// jika type_act EDIT dan edit_qty == NoEqty maka update data
|
||||
// jika type_act EDIT dan edit_qty == Eqty maka update qty
|
||||
if (this.type_act == 'BARU' && empty.length == 0) {
|
||||
this.empty_id = empty
|
||||
this.$store.dispatch("p_form/createTFrequest")
|
||||
} else if (this.type_act == 'EDIT' && this.edit_qty == 'NoEqty' && empty.length == 0) {
|
||||
// console.log('edit')
|
||||
this.empty_id = empty
|
||||
this.$store.dispatch("p_form/updateTFrequest")
|
||||
} else if (this.type_act == 'EDIT' && this.edit_qty == 'Eqty' && empty.length == 0) {
|
||||
// console.log('edit qty')
|
||||
this.empty_id = empty
|
||||
this.$store.dispatch("p_form/updateTFrequest")
|
||||
} else {
|
||||
this.empty_id = empty
|
||||
}
|
||||
},
|
||||
submitReq() {
|
||||
let error_id = []
|
||||
|
||||
let snac = { isOpen: true, color: "error", msg: "[Error]" }
|
||||
if (!this.form_transfer_date || Object.keys(this.form_cabang).length == 0) {
|
||||
snac.msg = "[Error] Tanggal atau Cabang masih kosong"
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
let item = this.form_detail
|
||||
if (item.length <= 0) {
|
||||
snac.msg = "[Error] Detail Item masih kosong"
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
item.forEach(element => {
|
||||
let qty = parseInt(element.PurchaseRequestFlagQtyRest)
|
||||
|
||||
let availableStock = this.calculateAvailableStock(
|
||||
element.StockGudang,
|
||||
element.PurchaseRequestDetailItemUnitID
|
||||
)
|
||||
|
||||
if (qty > availableStock) {
|
||||
error_id.push(element.PurchaseRequestFlagID)
|
||||
}
|
||||
});
|
||||
|
||||
if (error_id.length > 0) {
|
||||
this.empty_id = error_id
|
||||
return
|
||||
}
|
||||
|
||||
if (this.is_verif == 'Draft') {
|
||||
this.is_verif = 'Pending'
|
||||
}
|
||||
|
||||
let act = this.type_act
|
||||
if (act == 'BARU' && error_id.length == 0) {
|
||||
this.empty_id = error_id
|
||||
this.$store.dispatch("p_form/createTFrequest")
|
||||
} else if (act == 'EDIT' && error_id.length == 0) {
|
||||
this.empty_id = error_id
|
||||
this.$store.dispatch("p_form/updateTFrequest")
|
||||
}
|
||||
},
|
||||
submitTF(type) {
|
||||
let error_id = []
|
||||
let act = this.type_act
|
||||
let item = this.form_detail
|
||||
let approvlevel = this.approvelevel
|
||||
let currentTF = this.selected_tf
|
||||
|
||||
let snac = { isOpen: true, color: "error", msg: "[Error]" }
|
||||
|
||||
if (!this.form_transfer_date || Object.keys(this.form_cabang).length == 0) {
|
||||
snac.msg = "[Error] Tanggal atau Cabang masih kosong"
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
if (item.length <= 0) {
|
||||
snac.msg = "[Error] Detail Item masih kosong"
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
item.forEach(element => {
|
||||
let qty = Number(element.PurchaseRequestFlagQtyRest)
|
||||
let availableStock = this.calculateAvailableStock(
|
||||
element.StockGudang,
|
||||
element.PurchaseRequestDetailItemUnitID
|
||||
)
|
||||
|
||||
// temp solution
|
||||
// stock di gudang + stock yang sekarang diambil
|
||||
// (sudah terupdate di gudang padahal belum approve ?)
|
||||
|
||||
if (qty > (availableStock + qty)) {
|
||||
error_id.push(element.PurchaseRequestFlagID)
|
||||
}
|
||||
});
|
||||
|
||||
if (error_id.length > 0) {
|
||||
this.empty_id = error_id
|
||||
return
|
||||
}
|
||||
|
||||
if (type == 'V' && approvlevel.M_UserM_ApproveLevelID == '1') {
|
||||
if (currentTF.T_GoodsTransferVerifiedBy != '0') {
|
||||
snac.msg = "[INFO] Request sudah diverifikasi"
|
||||
snac.color = 'warning'
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
this.is_verif = 'Verified'
|
||||
this.act_verif = type
|
||||
if (act == 'EDIT' && error_id.length == 0) {
|
||||
this.empty_id = error_id
|
||||
this.$store.dispatch("p_form/updateTFrequest")
|
||||
}
|
||||
} else if (type == 'A' && approvlevel.M_UserM_ApproveLevelID == '2') {
|
||||
if (currentTF.T_GoodsTransferApprovedBy != '0') {
|
||||
snac.msg = "[INFO] Request sudah diapprove"
|
||||
snac.color = 'warning'
|
||||
this.$store.commit("p_data/update_snackbar", snac, { root: true })
|
||||
return
|
||||
}
|
||||
|
||||
this.is_verif = 'Approved'
|
||||
if (act == 'EDIT' && error_id.length == 0) {
|
||||
this.empty_id = error_id
|
||||
this.$store.dispatch("p_form/updateTFrequest")
|
||||
}
|
||||
}
|
||||
},
|
||||
calculateAvailableStock(stockGudangArray, requestedUnitID) {
|
||||
if (!Array.isArray(stockGudangArray)) {
|
||||
return parseInt(stockGudangArray || 0);
|
||||
}
|
||||
|
||||
// Filter stock items that match the requested unit ID and sum their quantities
|
||||
return stockGudangArray
|
||||
.filter(stockItem => stockItem.StockItemUnitID === requestedUnitID)
|
||||
.reduce((sum, stockItem) => sum + parseInt(stockItem.StockQty || 0), 0);
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,320 @@
|
||||
<template>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">DAFTAR PERMINTAAN TRANSFER (NON PERSEDIAAN)</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn icon @click="newForm()">
|
||||
<v-icon>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="pa-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs2 class="pr-1">
|
||||
<v-menu
|
||||
v-model="menuStartDate" lazy offset-y full-width
|
||||
:close-on-content-click="false" :nudge-right="40"
|
||||
transition="scale-transition" max-width="290px" min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="startDateFormated" label="Tanggal Awal"
|
||||
hide-details v-on="on" readonly outline
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="filter_sdate" @input="menuStartDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-menu
|
||||
v-model="menuEndDate" lazy offset-y full-width
|
||||
:close-on-content-click="false" :nudge-right="40"
|
||||
transition="scale-transition" max-width="290px" min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="endDateFormated" label="Tanggal Akhir"
|
||||
readonly outline hide-details v-on="on"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="filter_edate" @input="menuEndDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="px-1">
|
||||
<v-autocomplete
|
||||
v-model="filter_cabang" :items="listing_cabang" label="Cabang"
|
||||
outline hide-details return-object item-text="M_BranchName"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-autocomplete
|
||||
v-model="filter_status" :items="listing_status"
|
||||
outline hide-details label="Status"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-text-field v-model="filter_search" label="No Transfer" outline hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs1 class="pl-1">
|
||||
<v-btn
|
||||
dark color="primary" @click="cariTF()"
|
||||
style="min-width: 50px; height: 100%; margin: 0;"
|
||||
>
|
||||
<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="listing_tf_req.records" :loading="false"
|
||||
hide-actions class="elevation-1 mb-2"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr @click="selectTF(props.item)" :class="{'yellow lighten-4':isSelected(props.item)}">
|
||||
<td class="text-xs-center pa-2">{{ deformatDate(props.item.T_GoodsTransferDate) }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.T_GoodsTransferNum }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-chip small>
|
||||
{{ props.item.T_GoodsTransferStatus }}
|
||||
</v-chip>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<!-- <v-icon small class="mr-2" @click="updateTF(props.item)">edit</v-icon> -->
|
||||
<!-- <v-icon
|
||||
small class="ml-2"
|
||||
@click="deleteTF(props.item)"
|
||||
:disabled="props.item.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
delete
|
||||
</v-icon> -->
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small @click="{}" color="blue lighten-2" v-on="on"
|
||||
>
|
||||
<v-icon small>picture_as_pdf</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>View PDF</span>
|
||||
</v-tooltip>
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small @click="deleteTF(props.item)" color="red lighten-2"
|
||||
:disabled="props.item.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
<v-icon small>delete</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
<div class="pa-2 mt-2 text-xs-center">
|
||||
<v-pagination v-model="listing_tf_page" :length="listing_length" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {
|
||||
this.$store.dispatch("np_data/getBranches")
|
||||
this.$store.dispatch("np_form/newForm")
|
||||
this.$store.dispatch("np_data/cariTF")
|
||||
this.$store.dispatch("np_data/userLevel")
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
headers: [
|
||||
{
|
||||
text: "TANGGAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "CABANG",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NO. TRANSFER",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filter_sdate: {
|
||||
get() {
|
||||
return this.$store.state.np_data.filter_sdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_filter_sdate", val)
|
||||
}
|
||||
},
|
||||
filter_edate: {
|
||||
get() {
|
||||
return this.$store.state.np_data.filter_edate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_filter_edate", val)
|
||||
}
|
||||
},
|
||||
filter_cabang: {
|
||||
get() {
|
||||
return this.$store.state.np_data.filter_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_filter_cabang", val)
|
||||
}
|
||||
},
|
||||
filter_status: {
|
||||
get() {
|
||||
return this.$store.state.np_data.filter_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_filter_status", val)
|
||||
}
|
||||
},
|
||||
filter_search: {
|
||||
get() {
|
||||
return this.$store.state.np_data.filter_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_filter_search", val)
|
||||
}
|
||||
},
|
||||
listing_cabang: {
|
||||
get() {
|
||||
return this.$store.state.np_data.listing_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_listing_cabang", val)
|
||||
}
|
||||
},
|
||||
listing_status: {
|
||||
get() {
|
||||
return this.$store.state.np_data.listing_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_listing_status", val)
|
||||
}
|
||||
},
|
||||
listing_tf_req: {
|
||||
get() {
|
||||
return this.$store.state.np_data.listing_tf_req
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_listing_tf_req", val)
|
||||
}
|
||||
},
|
||||
listing_tf_page: {
|
||||
get() {
|
||||
return this.$store.state.np_data.listing_tf_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_listing_tf_page", val)
|
||||
this.$store.dispatch("np_data/cariTF")
|
||||
}
|
||||
},
|
||||
selected_tf: {
|
||||
get() {
|
||||
return this.$store.state.np_data.selected_tf
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_selected_tf", val)
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.np_data.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("np_data/update_snackbar", val)
|
||||
}
|
||||
},
|
||||
startDateFormated() {
|
||||
return this.formatDate(this.filter_sdate)
|
||||
},
|
||||
endDateFormated() {
|
||||
return this.formatDate(this.filter_edate)
|
||||
},
|
||||
listing_length() {
|
||||
let total = this.listing_tf_req.total
|
||||
if (total == undefined || total == 0) {
|
||||
return 1
|
||||
}
|
||||
return Math.ceil(total/10)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [year, month, day] = date.split("-")
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
deformatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [day, month, year] = date.split("-")
|
||||
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`
|
||||
},
|
||||
newForm() {
|
||||
this.$store.dispatch("np_form/newForm")
|
||||
},
|
||||
cariTF() {
|
||||
this.$store.dispatch("np_data/cariTF")
|
||||
},
|
||||
selectTF(data) {
|
||||
this.selected_tf = data
|
||||
this.$store.commit("np_form/update_type_act", 'EDIT')
|
||||
this.$store.dispatch("np_form/displayDetail", { }, { root: true })
|
||||
},
|
||||
isSelected(data) {
|
||||
return data.T_GoodsTransferID === this.selected_tf.T_GoodsTransferID
|
||||
},
|
||||
deleteTF(data) {
|
||||
if (data.T_GoodsTransferID != "") {
|
||||
this.$store.dispatch("np_form/deleteTFReq", { GoodsTfID: data.T_GoodsTransferID })
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,319 @@
|
||||
<template>
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">DAFTAR PERMINTAAN TRANSFER (PERSEDIAAN)</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn icon @click="newForm()">
|
||||
<v-icon>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="pa-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs2 class="pr-1">
|
||||
<v-menu
|
||||
v-model="menuStartDate" lazy offset-y full-width
|
||||
:close-on-content-click="false" :nudge-right="40"
|
||||
transition="scale-transition" max-width="290px" min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="startDateFormated" label="Tanggal Awal"
|
||||
hide-details v-on="on" readonly outline
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="filter_sdate" @input="menuStartDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-menu
|
||||
v-model="menuEndDate" lazy offset-y full-width
|
||||
:close-on-content-click="false" :nudge-right="40"
|
||||
transition="scale-transition" max-width="290px" min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
v-model="endDateFormated" label="Tanggal Akhir"
|
||||
readonly outline hide-details v-on="on"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="filter_edate" @input="menuEndDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3 class="px-1">
|
||||
<v-autocomplete
|
||||
v-model="filter_cabang" :items="listing_cabang" label="Cabang"
|
||||
outline hide-details return-object item-text="M_BranchName"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-autocomplete
|
||||
v-model="filter_status" :items="listing_status"
|
||||
outline hide-details label="Status"
|
||||
></v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs2 class="px-1">
|
||||
<v-text-field v-model="filter_search" label="No Transfer" outline hide-details></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs1 class="pl-1">
|
||||
<v-btn
|
||||
dark color="primary" @click="cariTF()"
|
||||
style="min-width: 50px; height: 100%; margin: 0;"
|
||||
>
|
||||
<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="listing_tf_req.records" :loading="false"
|
||||
hide-actions class="elevation-1 mb-2"
|
||||
>
|
||||
<template v-slot:items="props">
|
||||
<tr @click="selectTF(props.item)" :class="{'yellow lighten-4':isSelected(props.item)}">
|
||||
<td class="text-xs-center pa-2">{{ deformatDate(props.item.T_GoodsTransferDate) }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.M_BranchName }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.T_GoodsTransferNum }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-chip small>
|
||||
{{ props.item.T_GoodsTransferStatus }}
|
||||
</v-chip>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<!-- <v-icon small class="mr-2" @click="updateTF(props.item)">edit</v-icon> -->
|
||||
<!-- <v-icon
|
||||
small class="ml-2"
|
||||
@click="deleteTF(props.item)"
|
||||
:disabled="props.item.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
delete
|
||||
</v-icon> -->
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small @click="{}" color="blue lighten-2" v-on="on"
|
||||
>
|
||||
<v-icon small>picture_as_pdf</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>View PDF</span>
|
||||
</v-tooltip>
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small @click="deleteTF(props.item)" color="red lighten-2"
|
||||
:disabled="props.item.T_GoodsTransferStatus != 'Draft'"
|
||||
>
|
||||
<v-icon small>delete</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<v-divider></v-divider>
|
||||
<div class="pa-2 mt-2 text-xs-center">
|
||||
<v-pagination v-model="listing_tf_page" :length="listing_length" :total-visible="5"></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {},
|
||||
mounted() {
|
||||
this.$store.dispatch("p_data/getBranches");
|
||||
this.$store.dispatch("p_data/cariTF");
|
||||
this.$store.dispatch("p_form/newForm");
|
||||
this.$store.dispatch("p_data/userlevel");
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
headers: [
|
||||
{
|
||||
text: "TANGGAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "CABANG",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NO. TRANSFER",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filter_sdate: {
|
||||
get() {
|
||||
return this.$store.state.p_data.filter_sdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_filter_sdate", val)
|
||||
}
|
||||
},
|
||||
filter_edate: {
|
||||
get() {
|
||||
return this.$store.state.p_data.filter_edate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_filter_edate", val)
|
||||
}
|
||||
},
|
||||
filter_cabang: {
|
||||
get() {
|
||||
return this.$store.state.p_data.filter_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_filter_cabang", val)
|
||||
}
|
||||
},
|
||||
filter_status: {
|
||||
get() {
|
||||
return this.$store.state.p_data.filter_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_filter_status", val)
|
||||
}
|
||||
},
|
||||
filter_search: {
|
||||
get() {
|
||||
return this.$store.state.p_data.filter_search
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_filter_search", val)
|
||||
}
|
||||
},
|
||||
listing_cabang: {
|
||||
get() {
|
||||
return this.$store.state.p_data.listing_cabang
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_listing_cabang", val)
|
||||
}
|
||||
},
|
||||
listing_status: {
|
||||
get() {
|
||||
return this.$store.state.p_data.listing_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_listing_status", val)
|
||||
}
|
||||
},
|
||||
listing_tf_req: {
|
||||
get() {
|
||||
return this.$store.state.p_data.listing_tf_req
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_listing_tf_req", val)
|
||||
}
|
||||
},
|
||||
listing_tf_page: {
|
||||
get() {
|
||||
return this.$store.state.p_data.listing_tf_page
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_listing_tf_page", val);
|
||||
this.$store.dispatch("p_data/cariTF");
|
||||
}
|
||||
},
|
||||
selected_tf: {
|
||||
get() {
|
||||
return this.$store.state.p_data.selected_tf
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_selected_tf", val)
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.p_data.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_snackbar", val)
|
||||
}
|
||||
},
|
||||
startDateFormated() {
|
||||
return this.formatDate(this.filter_sdate)
|
||||
},
|
||||
endDateFormated() {
|
||||
return this.formatDate(this.filter_edate)
|
||||
},
|
||||
listing_length() {
|
||||
let total = this.listing_tf_req.total
|
||||
if (total == undefined || total == 0) {
|
||||
return 1
|
||||
}
|
||||
return Math.ceil(total/10)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [year, month, day] = date.split("-")
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
deformatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [day, month, year] = date.split("-")
|
||||
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`
|
||||
},
|
||||
newForm() {
|
||||
this.$store.dispatch("p_form/newForm", {}, { root: true })
|
||||
},
|
||||
cariTF() {
|
||||
this.$store.dispatch("p_data/cariTF");
|
||||
},
|
||||
selectTF(data) {
|
||||
this.selected_tf = data
|
||||
this.$store.commit("p_form/update_edit_qty", data.T_GoodsTransferStatus == 'Verified' ? 'Eqty' : 'NoEqty')
|
||||
this.$store.commit("p_form/update_type_act", 'EDIT')
|
||||
this.$store.dispatch("p_form/displayDetail", {}, { root: true })
|
||||
},
|
||||
isSelected(data) {
|
||||
return data.T_GoodsTransferID === this.selected_tf.T_GoodsTransferID
|
||||
},
|
||||
deleteTF(data) {
|
||||
this.$store.dispatch("p_data/deleteTF", { GoodsTfID: data.T_GoodsTransferID })
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
115
test/vuex/acc-one-transfer-req/components/mainlayout.vue
Normal file
115
test/vuex/acc-one-transfer-req/components/mainlayout.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<template>
|
||||
<v-layout row wrap pa-1 fill-height>
|
||||
<v-snackbar v-model="snackbar.isOpen" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="snackbar.color">
|
||||
{{ snackbar.msg }}
|
||||
<v-btn pr-1 flat @click="closeSnack()">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
|
||||
<!-- First section with buttons -->
|
||||
<v-flex xs12>
|
||||
<v-card flat>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-btn
|
||||
color="primary" :outline="this.type_transfer === 'NP'"
|
||||
class="white--text" @click="changeType('P')" block>
|
||||
Transfer Persediaan
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
<v-flex xs6 pa-1>
|
||||
<v-btn
|
||||
color="primary" :outline="this.type_transfer === 'P'"
|
||||
class="white--text" @click="changeType('NP')" block>
|
||||
Transfer Non Persediaan
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
|
||||
<!-- persediaan section -->
|
||||
<v-flex v-if="type_transfer === 'P'" xs12 mt-2>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pr-1>
|
||||
<one-tfp-listing></one-tfp-listing>
|
||||
</v-flex>
|
||||
<v-flex xs6 pl-1>
|
||||
<one-tfp-form></one-tfp-form>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
|
||||
<!-- non persediaan section -->
|
||||
<v-flex v-if="type_transfer === 'NP'" xs12 mt-2>
|
||||
<v-layout row>
|
||||
<v-flex xs6 pr-1>
|
||||
<one-tfnp-listing></one-tfnp-listing>
|
||||
</v-flex>
|
||||
<v-flex xs6 pl-1>
|
||||
<one-tfnp-form></one-tfnp-form>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
|
||||
<!-- dialog -->
|
||||
<one-tfp-dialogdetail></one-tfp-dialogdetail>
|
||||
<one-tfp-dialogbatch></one-tfp-dialogbatch>
|
||||
<one-tfnp-dialogdetail></one-tfnp-dialogdetail>
|
||||
<one-tfnp-dialogbatch></one-tfnp-dialogbatch>
|
||||
<one-tfp-dialogunpack></one-tfp-dialogunpack>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'one-tfp-listing': httpVueLoader('./listingPersediaanTF.vue'),
|
||||
'one-tfp-form': httpVueLoader('./formPersediaanTF.vue'),
|
||||
'one-tfp-dialogdetail': httpVueLoader('./dialogDetailPersediaan.vue'),
|
||||
'one-tfp-dialogbatch': httpVueLoader('./dialogBatchPersediaan.vue'),
|
||||
'one-tfnp-listing': httpVueLoader('./listingNonPersediaanTF.vue'),
|
||||
'one-tfnp-form': httpVueLoader('./formNonPersediaanTF.vue'),
|
||||
'one-tfnp-dialogdetail': httpVueLoader('./dialogDetailNonPersediaan.vue'),
|
||||
'one-tfnp-dialogbatch': httpVueLoader('./dialogBatchNonPersediaan.vue'),
|
||||
'one-tfp-dialogunpack': httpVueLoader('./dialogUnpackPersediaan.vue')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.p_data.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("p_data/update_snackbar", val)
|
||||
}
|
||||
},
|
||||
type_transfer: {
|
||||
get() {
|
||||
return this.$store.state.type_transfer
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("update_type_transfer", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeSnack() {
|
||||
const snac = {
|
||||
isOpen: false,
|
||||
color: "success",
|
||||
msg: ""
|
||||
}
|
||||
this.snackbar = snac
|
||||
},
|
||||
changeType(type) {
|
||||
this.type_transfer = type
|
||||
this.$store.dispatch("p_form/newForm", {}, { root: true })
|
||||
this.$store.dispatch("np_form/newForm", {}, { root: true })
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user