add modules folder based on s_menu
This commit is contained in:
192
test/vuex/acc-one-transfer-req/api/nonpersediaan_api.js
Normal file
192
test/vuex/acc-one-transfer-req/api/nonpersediaan_api.js
Normal file
@@ -0,0 +1,192 @@
|
||||
const URL = "/one-api/mockup/purchase/transfer/TransferRequestNP/";
|
||||
const URL_SJ = "/one-api/mockup/purchase/suratjalan/SuratJalan/";
|
||||
|
||||
export async function getBranches(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getBranches", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDivision(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getDivision", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function search(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "search", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function createTfRequest(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "createTfRequest", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTfRequest(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "updateTfRequest", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteTfRequest(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "deleteTfRequest", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getListDetail(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getListDetail", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDraftDetail(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getDraftDetail", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getListStock(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getListStock", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserLevel(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "getUserLevel", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
260
test/vuex/acc-one-transfer-req/api/persediaan_api.js
Normal file
260
test/vuex/acc-one-transfer-req/api/persediaan_api.js
Normal file
@@ -0,0 +1,260 @@
|
||||
const URL = "/one-api/mockup/purchase/transfer/";
|
||||
const URL_SJ = "/one-api/mockup/purchase/suratjalan/SuratJalan/";
|
||||
|
||||
export async function getBranches(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "TransferRequest/getBranches", params);
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStatus(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "TransferRequest/getStatus", params);
|
||||
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function search(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "TransferRequest/search", params);
|
||||
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveRequest(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "TransferRequest/createTfRequest", params);
|
||||
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.statusText
|
||||
}
|
||||
}
|
||||
|
||||
let data = response.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getListDetail(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "TransferRequest/getListDetail", params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.message
|
||||
}
|
||||
}
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function deleteTransfer(params) {
|
||||
try {
|
||||
var response = await axios.post(URL + "TransferRequest/deleteTFRequest", params)
|
||||
if (response.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: response.message
|
||||
}
|
||||
}
|
||||
let data = response.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTransfer(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "TransferRequest/updateTfRequest", params)
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDraftDetail(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "TransferRequest/getDraftDetail", params)
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function createSuratJalanFromTF(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL_SJ + "CreateSuratJalanFromTF", params)
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getItemBatchListing(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "TransferRequest/getItemBatchListing", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUnpackItemBatchListing(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "TransferRequest/getUnpackItemBatchListing", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function unpackingStock(params){
|
||||
try {
|
||||
var resp = await axios.post(URL + "TransferRequest/unpackingStock", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getUserLevel(params){
|
||||
try {
|
||||
var resp = await axios.post(URL + "TransferRequest/getUserLevel", params);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
61
test/vuex/acc-one-transfer-req/index.php
Normal file
61
test/vuex/acc-one-transfer-req/index.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
<title>Transfer Reg ke Cab</title>
|
||||
</head>
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background: #F5E8DF!important;">
|
||||
<v-container fluid class="pl-1 pr-1 pt-2 pb-2">
|
||||
<one-tf-main></one-tf-main>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer></one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
|
||||
<!-- App Script -->
|
||||
<script type="module">
|
||||
import {
|
||||
store
|
||||
} from './store.js';
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: "#app",
|
||||
methods: {},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-tf-main': httpVueLoader('./components/mainlayout.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
||||
135
test/vuex/acc-one-transfer-req/modules/np_data.js
Normal file
135
test/vuex/acc-one-transfer-req/modules/np_data.js
Normal file
@@ -0,0 +1,135 @@
|
||||
import * as api from "../api/nonpersediaan_api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: one_user(),
|
||||
user_level: {},
|
||||
filter_sdate: new Date().toISOString().substr(0, 10),
|
||||
filter_edate: new Date().toISOString().substr(0, 10),
|
||||
filter_cabang: {
|
||||
M_BranchID: "0",
|
||||
M_BranchCode: "All",
|
||||
M_BranchName: "Semua"
|
||||
},
|
||||
filter_status: "All",
|
||||
filter_search: "",
|
||||
listing_cabang: [],
|
||||
listing_status: [
|
||||
"All",
|
||||
"Draft",
|
||||
"Verified",
|
||||
"Process",
|
||||
"Completed"
|
||||
],
|
||||
|
||||
listing_tf_req: {
|
||||
total: 0,
|
||||
records: []
|
||||
},
|
||||
listing_tf_page: 1,
|
||||
selected_tf: {}
|
||||
},
|
||||
mutations: {
|
||||
update_filter_sdate(state, data) {
|
||||
state.filter_sdate = data
|
||||
},
|
||||
update_filter_edate(state, data) {
|
||||
state.filter_edate = data
|
||||
},
|
||||
update_filter_cabang(state, data) {
|
||||
state.filter_cabang = data
|
||||
},
|
||||
update_filter_status(state, data) {
|
||||
state.filter_status = data
|
||||
},
|
||||
update_filter_search(state, data) {
|
||||
state.filter_search = data
|
||||
},
|
||||
update_listing_cabang(state, data) {
|
||||
state.listing_cabang = data
|
||||
},
|
||||
update_listing_status(state, data) {
|
||||
state.listing_status = data
|
||||
},
|
||||
update_listing_tf_req(state, data) {
|
||||
state.listing_tf_req = data
|
||||
},
|
||||
update_listing_tf_page(state, data) {
|
||||
state.listing_tf_page = data
|
||||
},
|
||||
update_selected_tf(state, data) {
|
||||
state.selected_tf = data
|
||||
},
|
||||
update_user_level(state, data) {
|
||||
state.user_level = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getBranches(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID
|
||||
}
|
||||
|
||||
let resp = await api.getBranches(params);
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
let all = [
|
||||
{
|
||||
M_BranchID: "0",
|
||||
M_BranchCode: "All",
|
||||
M_BranchName: "Semua"
|
||||
}
|
||||
]
|
||||
all.concat(resp.data.records)
|
||||
context.commit("update_listing_cabang", all)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async cariTF(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
startDate: context.state.filter_sdate,
|
||||
endDate: context.state.filter_edate,
|
||||
M_BranchCode: context.state.filter_cabang.M_BranchCode,
|
||||
StatusName: context.state.filter_status,
|
||||
currentPage: context.state.listing_tf_page,
|
||||
search: context.state.filter_search
|
||||
}
|
||||
|
||||
let resp = await api.search(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else [
|
||||
context.commit("update_listing_tf_req", resp.data)
|
||||
]
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async userLevel(context) {
|
||||
try {
|
||||
let resp = await api.getUserLevel({token: one_token()})
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_user_level", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
307
test/vuex/acc-one-transfer-req/modules/np_form.js
Normal file
307
test/vuex/acc-one-transfer-req/modules/np_form.js
Normal file
@@ -0,0 +1,307 @@
|
||||
import * as api from "../api/nonpersediaan_api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: one_user(),
|
||||
form_transfer_date: new Date().toISOString().substr(0, 10),
|
||||
form_cabang: {},
|
||||
form_divisi: {},
|
||||
form_catatan: "",
|
||||
form_detail: [],
|
||||
|
||||
dialog_detailform: false,
|
||||
list_cabangform: [],
|
||||
list_divisiform: [],
|
||||
list_detailform: {
|
||||
total: 0,
|
||||
records: []
|
||||
},
|
||||
list_detailform_page: 1,
|
||||
type_act: 'BARU',
|
||||
is_verif: 'Draft',
|
||||
|
||||
buffer_detailitem: {},
|
||||
dialog_batchitem: false,
|
||||
list_barnote: {},
|
||||
form_barnote: [],
|
||||
edit_qty: 'Eqty',
|
||||
act_verif: ''
|
||||
},
|
||||
mutations: {
|
||||
update_form_transfer_date(state, data) {
|
||||
state.form_transfer_date = data
|
||||
},
|
||||
update_form_cabang(state, data) {
|
||||
state.form_cabang = data
|
||||
},
|
||||
update_form_divisi(state, data) {
|
||||
state.form_divisi = data
|
||||
},
|
||||
update_form_catatan(state, data) {
|
||||
state.form_catatan = data
|
||||
},
|
||||
update_form_detail(state, data) {
|
||||
state.form_detail = data
|
||||
},
|
||||
update_dialog_detailform(state, data) {
|
||||
state.dialog_detailform = data
|
||||
},
|
||||
update_list_cabangform(state, data) {
|
||||
state.list_cabangform = data
|
||||
},
|
||||
update_list_divisiform(state, data) {
|
||||
state.list_divisiform = data
|
||||
},
|
||||
update_list_detailform(state, data) {
|
||||
state.list_detailform = data
|
||||
},
|
||||
update_list_detailform_page(state, data) {
|
||||
state.list_detailform_page = data
|
||||
},
|
||||
update_type_act(state, data) {
|
||||
state.type_act = data
|
||||
},
|
||||
update_is_verif(state, data) {
|
||||
state.is_verif = data
|
||||
},
|
||||
update_buffer_detailitem(state, data) {
|
||||
state.buffer_detailitem = data
|
||||
},
|
||||
update_list_barnote(state, data) {
|
||||
state.list_barnote = data
|
||||
},
|
||||
update_dialog_batchitem(state, data) {
|
||||
state.dialog_batchitem = data
|
||||
},
|
||||
update_form_barnote(state, data) {
|
||||
state.form_barnote = data
|
||||
},
|
||||
update_edit_qty(state, data) {
|
||||
state.edit_qty = data
|
||||
},
|
||||
update_act_verif(state, data) {
|
||||
state.act_verif = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async newForm(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID
|
||||
}
|
||||
let resp = await api.getBranches(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_type_act", "BARU")
|
||||
context.commit("update_list_cabangform", resp.data.records)
|
||||
context.dispatch("getDivisi", {})
|
||||
|
||||
context.commit("update_form_transfer_date", new Date().toISOString().substr(0, 10))
|
||||
context.commit("update_form_cabang", { })
|
||||
context.commit("update_form_divisi", { })
|
||||
context.commit("update_form_catatan", "")
|
||||
context.commit("update_list_detailform", {total: 0, records: []})
|
||||
context.commit("update_is_verif", 'Draft')
|
||||
context.commit("update_form_detail", [ ])
|
||||
context.commit("np_data/update_selected_tf", { }, { root: true })
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async getDivisi(context) {
|
||||
try {
|
||||
let params = {token: one_token()}
|
||||
|
||||
let resp = await api.getDivision(params);
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_list_divisiform", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async getListItemDetail(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
currpage: context.state.list_detailform_page,
|
||||
regionalid: context.state.user.S_RegionalID,
|
||||
branchcodedestin: context.state.form_cabang.M_BranchCode,
|
||||
branchIDorigin: context.state.user.M_BranchID,
|
||||
divisionID: context.state.form_divisi.DivisionID
|
||||
}
|
||||
|
||||
let resp = await api.getListDetail(params)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
const current_detail = context.state.form_detail
|
||||
if (current_detail.length == 0) {
|
||||
context.commit("update_list_detailform", resp.data)
|
||||
} else {
|
||||
const inserted = resp.data.records.filter(item => !current_detail.some(obj => obj.PurchaseRequestFlagID == item.PurchaseRequestFlagID))
|
||||
let data = {
|
||||
records: inserted,
|
||||
total: parseInt(resp.data.total)
|
||||
}
|
||||
context.commit("update_list_detailform", data)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async createTFReq(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID,
|
||||
M_BranchCode: context.state.form_cabang.M_BranchCode,
|
||||
DivisionID: context.state.form_divisi.DivisionID,
|
||||
GoodsTfNotes: context.state.form_catatan,
|
||||
GoodsTfDate: context.state.form_transfer_date,
|
||||
GoodsTfStatus: context.state.is_verif,
|
||||
detail: context.state.form_detail
|
||||
}
|
||||
|
||||
let resp = await api.createTfRequest(params);
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
// generate surat jalan atau nggak?
|
||||
|
||||
context.dispatch("newForm")
|
||||
context.dispatch("np_data/cariTF", { }, { root: true })
|
||||
let snac = { isOpen: true, color: "success", msg: "Success" }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async updateTFReq(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID,
|
||||
M_BranchCode: context.state.form_cabang.M_BranchCode,
|
||||
DivisionID: context.state.form_divisi.DivisionID,
|
||||
GoodsTfID: context.rootState.np_data.selected_tf.T_GoodsTransferID,
|
||||
GoodsTfNum: context.rootState.np_data.selected_tf.T_GoodsTransferNum,
|
||||
GoodsTfNotes: context.state.form_catatan,
|
||||
GoodsTfDate: context.state.form_transfer_date,
|
||||
GoodsTfStatus: context.state.is_verif,
|
||||
editqty: context.state.edit_qty,
|
||||
actverif: context.state.act_verif,
|
||||
detail: context.state.form_detail
|
||||
}
|
||||
|
||||
let resp = await api.updateTfRequest(params);
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
// generate surat jalan atau nggak?
|
||||
|
||||
context.dispatch("newForm")
|
||||
context.dispatch("np_data/cariTF", { }, { root: true })
|
||||
let snac = { isOpen: true, color: "success", msg: "Success" }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async deleteTFReq(context, params) {
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.deleteTfRequest(params);
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.dispatch("newForm")
|
||||
context.dispatch("p_data/cariTF", { }, { root: true })
|
||||
|
||||
let snac = { isOpen: true, color: "success", msg: resp.data}
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async displayDetail(context) {
|
||||
try {
|
||||
let detail = context.rootState.np_data.selected_tf
|
||||
context.commit("update_form_transfer_date", detail.T_GoodsTransferDate)
|
||||
context.commit("update_form_catatan", detail.T_GoodsTransferNotes)
|
||||
context.commit("update_is_verif", detail.T_GoodsTransferStatus)
|
||||
|
||||
context.commit("update_form_cabang", {
|
||||
M_BranchID: detail.M_BranchID,
|
||||
M_BranchCode: detail.M_BranchCode,
|
||||
M_BranchName: detail.M_BranchName
|
||||
})
|
||||
|
||||
context.commit("update_form_divisi", {
|
||||
DivisionID: detail.T_GoodsTransferDivisionID,
|
||||
DivisionCode: detail.DivisionCode,
|
||||
DivisionName: detail.DivisionName
|
||||
})
|
||||
|
||||
let params = {
|
||||
token: one_token(),
|
||||
goodTfID: detail.T_GoodsTransferID
|
||||
}
|
||||
const resp = await api.getDraftDetail(params)
|
||||
if (resp.status !== 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
const draft = resp.data.records
|
||||
context.commit("update_form_detail", draft);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async getListStock(context, params) {
|
||||
try {
|
||||
params.token = one_token()
|
||||
params.regionalid = context.state.user.S_RegionalID
|
||||
|
||||
const resp = await api.getListStock(params)
|
||||
if (resp.status !== 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_list_barnote", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
169
test/vuex/acc-one-transfer-req/modules/p_data.js
Normal file
169
test/vuex/acc-one-transfer-req/modules/p_data.js
Normal file
@@ -0,0 +1,169 @@
|
||||
import * as api from "../api/persediaan_api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: one_user(),
|
||||
user_level: {},
|
||||
filter_sdate: new Date().toISOString().substr(0, 10),
|
||||
filter_edate: new Date().toISOString().substr(0, 10),
|
||||
filter_cabang: {
|
||||
M_BranchID: "0",
|
||||
M_BranchCode: "All",
|
||||
M_BranchName: "Semua"
|
||||
},
|
||||
filter_status: "All",
|
||||
filter_search: "",
|
||||
listing_cabang: [],
|
||||
listing_status: [
|
||||
"All",
|
||||
"Draft",
|
||||
"Pending",
|
||||
"Verified",
|
||||
"Approved",
|
||||
"Process",
|
||||
"Completed"
|
||||
],
|
||||
|
||||
listing_tf_req: {
|
||||
total: 0,
|
||||
records: []
|
||||
},
|
||||
listing_tf_page: 1,
|
||||
selected_tf: {},
|
||||
|
||||
snackbar: {
|
||||
isOpen: false,
|
||||
color: "error",
|
||||
msg: ""
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
update_filter_sdate(state, data) {
|
||||
state.filter_sdate = data
|
||||
},
|
||||
update_filter_edate(state, data) {
|
||||
state.filter_edate = data
|
||||
},
|
||||
update_filter_cabang(state, data) {
|
||||
state.filter_cabang = data
|
||||
},
|
||||
update_filter_status(state, data) {
|
||||
state.filter_status = data
|
||||
},
|
||||
update_filter_search(state, data) {
|
||||
state.filter_search = data
|
||||
},
|
||||
update_listing_cabang(state, data) {
|
||||
state.listing_cabang = data
|
||||
},
|
||||
update_listing_status(state, data) {
|
||||
state.listing_status = data
|
||||
},
|
||||
update_listing_tf_req(state, data) {
|
||||
state.listing_tf_req = data
|
||||
},
|
||||
update_listing_tf_page(state, data) {
|
||||
state.listing_tf_page = data
|
||||
},
|
||||
update_selected_tf(state, data) {
|
||||
state.selected_tf = data
|
||||
},
|
||||
update_snackbar(state, data) {
|
||||
state.snackbar = data
|
||||
},
|
||||
update_user_level(state, data) {
|
||||
state.user_level = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getBranches(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID
|
||||
}
|
||||
let resp = await api.getBranches(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
let all = [
|
||||
{
|
||||
M_BranchID: "0",
|
||||
M_BranchCode: "All",
|
||||
M_BranchName: "Semua"
|
||||
}
|
||||
]
|
||||
|
||||
all = all.concat(resp.data.records)
|
||||
context.commit("update_listing_cabang", all)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async cariTF(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
startDate: context.state.filter_sdate,
|
||||
endDate: context.state.filter_edate,
|
||||
M_BranchCode: context.state.filter_cabang.M_BranchCode,
|
||||
StatusName: context.state.filter_status,
|
||||
currentPage: context.state.listing_tf_page,
|
||||
search: context.state.filter_search
|
||||
}
|
||||
|
||||
let resp = await api.search(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: parseInt(resp.data.total)
|
||||
}
|
||||
context.commit("update_listing_tf_req", data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async deleteTF(context, params) {
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.deleteTransfer(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.dispatch("p_form/newForm", { },{ root: true })
|
||||
context.dispatch("cariTF")
|
||||
|
||||
let snac = { isOpen: true, color: "success", msg: "Sukses"}
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
},
|
||||
async userlevel(context) {
|
||||
try {
|
||||
let resp = await api.getUserLevel({token: one_token()})
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
} else {
|
||||
context.commit("update_user_level", resp.data);
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("update_snackbar", snac)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
316
test/vuex/acc-one-transfer-req/modules/p_form.js
Normal file
316
test/vuex/acc-one-transfer-req/modules/p_form.js
Normal file
@@ -0,0 +1,316 @@
|
||||
import * as api from "../api/persediaan_api.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: one_user(),
|
||||
form_transfer_date: new Date().toISOString().substr(0, 10),
|
||||
form_cabang: {},
|
||||
form_catatan: "",
|
||||
form_detail: [],
|
||||
|
||||
dialog_detailform: false,
|
||||
list_cabangform: [],
|
||||
list_detailform: {
|
||||
total: 0,
|
||||
records: []
|
||||
},
|
||||
list_detailform_page: 1,
|
||||
type_act: 'BARU',
|
||||
is_verif: 'Draft',
|
||||
|
||||
buffer_detailitem: {},
|
||||
list_batchitemform: {},
|
||||
dialog_batchitem: false,
|
||||
form_batchitem: [],
|
||||
|
||||
dialog_unpackform: false,
|
||||
buffer_itemrequestedunpack: {},
|
||||
list_batchitemunpack: [],
|
||||
selected_batchitemunpack: {},
|
||||
edit_qty: 'Eqty',
|
||||
act_verif: ''
|
||||
},
|
||||
mutations: {
|
||||
update_form_transfer_date(state, data) {
|
||||
state.form_transfer_date = data
|
||||
},
|
||||
update_form_cabang(state, data) {
|
||||
state.form_cabang = data
|
||||
},
|
||||
update_form_catatan(state, data) {
|
||||
state.form_catatan = data
|
||||
},
|
||||
update_form_detail(state, data) {
|
||||
state.form_detail = data
|
||||
},
|
||||
update_dialog_detailform(state, data) {
|
||||
state.dialog_detailform = data
|
||||
},
|
||||
update_list_cabangform(state, data) {
|
||||
state.list_cabangform = data
|
||||
},
|
||||
update_list_detailform(state, data) {
|
||||
state.list_detailform = data
|
||||
},
|
||||
update_list_detailform_page(state, data) {
|
||||
state.list_detailform_page = data
|
||||
},
|
||||
update_type_act(state, data) {
|
||||
state.type_act = data
|
||||
},
|
||||
update_is_verif(state, data) {
|
||||
state.is_verif = data
|
||||
},
|
||||
update_buffer_detailitem(state, data) {
|
||||
state.buffer_detailitem = data
|
||||
},
|
||||
update_list_batchitemform(state, data) {
|
||||
state.list_batchitemform = data
|
||||
},
|
||||
update_dialog_batchitem(state, data) {
|
||||
state.dialog_batchitem = data
|
||||
},
|
||||
update_form_batchitem(state, data) {
|
||||
state.form_batchitem = data
|
||||
},
|
||||
update_dialog_unpackform(state, data){
|
||||
state.dialog_unpackform = data
|
||||
},
|
||||
update_buffer_itemrequestedunpack(state, data){
|
||||
state.buffer_itemrequestedunpack = data
|
||||
},
|
||||
update_list_batchitemunpack(state, data){
|
||||
state.list_batchitemunpack = data
|
||||
},
|
||||
update_selected_batchitemunpack(state, data){
|
||||
state.selected_batchitemunpack = data
|
||||
},
|
||||
update_edit_qty(state, data) {
|
||||
state.edit_qty = data
|
||||
},
|
||||
update_act_verif(state, data) {
|
||||
state.act_verif = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async newForm(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID
|
||||
}
|
||||
let resp = await api.getBranches(params)
|
||||
if (resp.status != "OK") {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_type_act", "BARU")
|
||||
context.commit("update_list_cabangform", resp.data.records)
|
||||
|
||||
context.commit("update_form_cabang", { })
|
||||
context.commit("update_form_transfer_date", new Date().toISOString().substr(0, 10))
|
||||
context.commit("update_form_catatan", "")
|
||||
context.commit("update_list_detailform", {total: 0, records: [ ]})
|
||||
context.commit("update_is_verif", 'Draft')
|
||||
context.commit("update_form_detail", [ ])
|
||||
context.commit("p_data/update_selected_tf" , {}, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async displayDetail(context) {
|
||||
try {
|
||||
let detail = context.rootState.p_data.selected_tf
|
||||
context.commit("update_form_transfer_date", detail.T_GoodsTransferDate)
|
||||
context.commit("update_form_catatan", detail.T_GoodsTransferNotes)
|
||||
context.commit("update_is_verif", detail.T_GoodsTransferStatus)
|
||||
context.commit("update_form_cabang", {
|
||||
M_BranchID: detail.M_BranchID,
|
||||
M_BranchCode: detail.M_BranchCode,
|
||||
M_BranchName: detail.M_BranchName
|
||||
})
|
||||
|
||||
// get list detail item form
|
||||
let params = {
|
||||
token: one_token(),
|
||||
goodTfID: detail.T_GoodsTransferID
|
||||
}
|
||||
let resp = await api.getDraftDetail(params);
|
||||
if (resp.status !== 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
let draft = resp.data.records
|
||||
context.commit("update_form_detail", draft)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async getListItemDetail(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
currpage: context.state.list_detailform_page,
|
||||
regionalid: context.state.user.S_RegionalID,
|
||||
branchcodedestin: context.state.form_cabang.M_BranchCode,
|
||||
branchIDorigin: context.state.user.M_BranchID
|
||||
}
|
||||
|
||||
let resp = await api.getListDetail(params)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
let current_detail = context.state.form_detail
|
||||
if (current_detail.length == 0) {
|
||||
context.commit("update_list_detailform", resp.data)
|
||||
} else {
|
||||
const inserted = resp.data.records.filter(item => !current_detail.some(obj => obj.PurchaseRequestFlagID == item.PurchaseRequestFlagID))
|
||||
let data = {
|
||||
records: inserted,
|
||||
total: parseInt(resp.data.total)
|
||||
}
|
||||
context.commit("update_list_detailform", data)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async createTFrequest(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID,
|
||||
M_BranchCode: context.state.form_cabang.M_BranchCode,
|
||||
GoodsTfNotes: context.state.form_catatan,
|
||||
GoodsTfDate: context.state.form_transfer_date,
|
||||
GoodsTfStatus: context.state.is_verif,
|
||||
detail: context.state.form_detail
|
||||
}
|
||||
|
||||
let resp = await api.saveRequest(params)
|
||||
|
||||
if (resp.status !== 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
if (params.GoodsTfStatus === 'Verified') {
|
||||
params.GoodsTfNum = resp.data.records.T_GoodsTransferNum
|
||||
params.GoodsTfID = resp.data.records.T_GoodsTransferID
|
||||
params.detail = resp.data.records.detail
|
||||
}
|
||||
|
||||
context.dispatch("newForm")
|
||||
context.dispatch("p_data/cariTF", { }, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async updateTFrequest(context) {
|
||||
try {
|
||||
let params = {
|
||||
token: one_token(),
|
||||
S_RegionalID: context.state.user.S_RegionalID,
|
||||
M_BranchCode: context.state.form_cabang.M_BranchCode,
|
||||
GoodsTfID: context.rootState.p_data.selected_tf.T_GoodsTransferID,
|
||||
GoodsTfNum: context.rootState.p_data.selected_tf.T_GoodsTransferNum,
|
||||
GoodsTfNotes: context.state.form_catatan,
|
||||
GoodsTfDate: context.state.form_transfer_date,
|
||||
GoodsTfStatus: context.state.is_verif,
|
||||
editqty: context.state.edit_qty,
|
||||
actverif: context.state.act_verif,
|
||||
detail: context.state.form_detail
|
||||
}
|
||||
|
||||
let resp = await api.updateTransfer(params)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
if (params.GoodsTfStatus === 'Verified') {
|
||||
params.detail = resp.data.records.detail
|
||||
}
|
||||
|
||||
context.dispatch("newForm")
|
||||
context.dispatch("p_data/cariTF", { }, { root: true })
|
||||
|
||||
if (context.state.edit_qty == 'Eqty') {
|
||||
var snac = { isOpen: true, color: 'success', msg: 'Success update qty tf request' }
|
||||
} else {
|
||||
var snac = { isOpen: true, color: 'success', msg: 'Success update tf request' }
|
||||
}
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async getBatchItemDetail(context, params) {
|
||||
try {
|
||||
params.token = one_token()
|
||||
params.regionalid = context.state.user.S_RegionalID
|
||||
params.branchid = context.state.user.M_BranchID
|
||||
|
||||
let resp = await api.getItemBatchListing(params)
|
||||
if (resp.status != 'OK') {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + resp.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_list_batchitemform", resp.data)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async getBatchItemUnpackList(context, params){
|
||||
try{
|
||||
params.token = one_token()
|
||||
params.regionalid = context.state.user.S_RegionalID
|
||||
params.branchid = context.state.user.M_BranchID
|
||||
|
||||
let resp = await api.getUnpackItemBatchListing(params)
|
||||
if (resp.status != 'OK'){
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
context.commit("update_list_batchitemunpack", resp.data.records)
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
},
|
||||
async unpackingStock(context, params){
|
||||
try {
|
||||
params.token = one_token()
|
||||
|
||||
let resp = await api.unpackingStock(params)
|
||||
|
||||
if (resp.status != 'OK'){
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
} else {
|
||||
let snac = { isOpen: true, color: "success", msg: "Berhasil Unpack Stock"}
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
|
||||
// Reload Item Requested List Detail
|
||||
await context.dispatch("getListItemDetail")
|
||||
}
|
||||
} catch (error) {
|
||||
let snac = { isOpen: true, color: "error", msg: "Gagal, " + error.message }
|
||||
context.commit("p_data/update_snackbar", snac, { root: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
26
test/vuex/acc-one-transfer-req/store.js
Normal file
26
test/vuex/acc-one-transfer-req/store.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
import np_data from "./modules/np_data.js";
|
||||
import np_form from "./modules/np_form.js";
|
||||
import p_data from "./modules/p_data.js";
|
||||
import p_form from "./modules/p_form.js";
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
system: system,
|
||||
p_data: p_data,
|
||||
p_form: p_form,
|
||||
np_data: np_data,
|
||||
np_form: np_form
|
||||
},
|
||||
state: {
|
||||
type_transfer: 'P'
|
||||
},
|
||||
mutations: {
|
||||
update_type_transfer(state, data) {
|
||||
state.type_transfer = data
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user