add modules folder based on s_menu

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

View File

@@ -0,0 +1,191 @@
const URL = "/one-api/mockup/mutasi/";
export async function search(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/search', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getCategory(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/getCategory', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getBranchAsal(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/getBranchAsal', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getBranchTujuan(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/getBranchTujuan', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getReceiveOrderPo(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/getReceiveOrderPo', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getItemReceive(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/getItemReceive', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function saveMutasi(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/saveMutasi', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getItemMutasiUpdate(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/getItemMutasiUpdate', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function saveEditMutasi(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/saveEditMutasi', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function deleteMutasi(params) {
try {
var resp = await axios.post(URL + 'Requestmutasi/deleteMutasi', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}

View File

@@ -0,0 +1,310 @@
<template>
<v-dialog v-model="dialog_form_mutasi" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM MUTASI INVENTARIS & ASSET
<v-spacer></v-spacer>
</v-card-title>
<v-card-text>
<v-form ref="formmutasi" lazy-validation v-model="valid_formmutasi">
<v-layout row>
<v-flex xs6 pr-1>
<v-menu
v-model="menuMutasiDateForm" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="mutasiDateForm" label="Tanggal"
outline hide-details v-on="on" readonly
></v-text-field>
</template>
<v-date-picker
v-model="mutasi_date" no-title
@input="menuMutasiDateForm = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs6 px-1>
<v-autocomplete
v-model="selected_category" :rules="rules_category"
:items="list_category" return-object outline item-value="itemCategoryID"
item-text="itemCategoryName" label="Kategori*" required
></v-autocomplete>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs6 pr-1>
<v-autocomplete
v-model="selected_branch_asal" :rules="rules_branch_asal"
:items="list_branch_asal" outline required disabled
item-text="M_BranchName" label="Cabang Asal*" return-object
></v-autocomplete>
</v-flex>
<v-flex xs6 px-1>
<v-autocomplete
v-model="selected_branch_tujuan" :rules="rules_branch_tujuan"
:items="list_branch_tujuan" outline required
item-text="M_BranchName" label="Cabang Tujuan*" return-object
></v-autocomplete>
</v-flex>
</v-layout>
<v-layout row wrap>
<v-flex xs12 pl-1>
<v-textarea
v-model="note" hide-details
auto-grow rows="1" label="Catatan" outline
></v-textarea>
</v-flex>
<v-flex xs3>
<v-btn
block color="info" class="mt-2" @click="pilihItem()"
:disabled="!selected_category || Object.keys(selected_category).length === 0"
>TAMBAH ITEM</v-btn>
</v-flex>
</v-layout>
<v-layout row mt-4 wrap>
<v-flex xs12>
<v-data-table
v-if="list_mutasi_item.length > 0"
:headers = "headers" :items="list_mutasi_item"
hide-actions item-key="ReceiveOrderPoID" class="elevation-1"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-left">{{ props.item.ReceiveOrderPoNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
</td>
<td class="text-xs-center">{{ props.item.stock_total }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-center">{{ props.item.qty_available }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-center">{{ props.item.qty_mutasi }}</td>
<td class="text-xs-center">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="removeItem(props)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="batalMutasi()">Batal</v-btn>
<v-btn color="green" flat outline @click="simpanRO()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
components: {},
data() {
return {
menuMutasiDateForm: false,
valid_formmutasi: true,
rules_category: [v => (v && Object.keys(v).length > 0) || 'Kategori harus diisi'],
rules_lokasi: [v => (v && Object.keys(v).length > 0) || 'Lokasi harus diisi'],
rules_branch_asal: [v => (v && Object.keys(v).length > 0) || 'Cabang Asal harus diisi'],
rules_branch_tujuan: [v => (v && Object.keys(v).length > 0) || 'Cabang Tujuan harus diisi'],
headers: [
{
text: "RO NUMBER", align: "center", sortable: false, value: "ItemUnitName",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "center", sortable: false, value: "qty",
width: "12%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA By BARCODE", align: "center", sortable: false, value: "qty",
width: "13%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY MUTASI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
]
}
},
computed: {
dialog_form_mutasi: {
get() {
return this.$store.state.form.dialog_form_mutasi;
},
set(val) {
this.$store.commit('form/update_dialog_form_mutasi', val);
}
},
mutasiDateForm() {
return this.formatDate(this.mutasi_date)
},
mutasi_date: {
get() {
return this.$store.state.form.mutasi_date;
},
set(val) {
this.$store.commit('form/update_mutasi_date', val);
}
},
selected_category: {
get() {
return this.$store.state.form.selected_category;
},
set(val) {
this.$store.commit('form/update_selected_category', val);
this.$store.commit('form/update_list_mutasi_item', []);
this.$store.commit('form/update_selected_branch_tujuan', {});
this.$store.commit('form/update_note', '');
}
},
selected_branch_asal: {
get() {
return this.$store.state.form.selected_branch_asal;
},
set(val) {
this.$store.commit('form/update_selected_branch_asal', val);
}
},
selected_branch_tujuan: {
get() {
return this.$store.state.form.selected_branch_tujuan;
},
set(val) {
this.$store.commit('form/update_selected_branch_tujuan', val);
}
},
note: {
get() {
return this.$store.state.form.note;
},
set(val) {
this.$store.commit('form/update_note', val);
}
},
list_category() {
return this.$store.state.form.list_category
},
list_branch_asal() {
return this.$store.state.form.list_branch_asal
},
list_branch_tujuan() {
return this.$store.state.form.list_branch_tujuan
},
dialog_select_item: {
get() {
return this.$store.state.form.dialog_select_item;
},
set(val) {
this.$store.commit('form/update_dialog_select_item', val);
}
},
list_mutasi_item: {
get() {
return this.$store.state.form.list_mutasi_item;
},
set(val) {
this.$store.commit('form/update_list_mutasi_item', val);
}
},
select_item_temp: {
get() {
return this.$store.state.form.select_item_temp;
},
set(val) {
this.$store.commit('form/update_select_item_temp', val);
}
},
},
methods: {
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
batalMutasi() {
this.list_mutasi_item = [];
this.dialog_form_mutasi = false;
},
pilihItem() {
let temp = this.list_mutasi_item
if (temp.length > 0) {
this.$store.commit("form/update_select_item_temp", temp);
}
this.dialog_select_item = true;
this.$store.dispatch('form/getReceiveOrderPo');
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.list_mutasi_item));
this.list_mutasi_item = temp.filter(ele => ele.ReceiveOrderPoID !== props.item.ReceiveOrderPoID);
},
simpanRO() {
if (this.$refs.formmutasi.validate()) {
const list_mutasi = JSON.parse(JSON.stringify(this.list_mutasi_item));
for (let i = 0; i < list_mutasi.length; i++) {
const qtyMutasi = Number(list_mutasi[i].qty_mutasi);
const qtyAvailable = Number(list_mutasi[i].qty_available);
if (!qtyMutasi || qtyMutasi <= 0) {
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: `QTY MUTASI pada item ${list_mutasi[i].M_ItemCode} - ${list_mutasi[i].M_ItemDesc} harus diisi dan lebih dari 0`,
isOpen: true
});
return;
}
if (qtyMutasi > qtyAvailable) {
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: `QTY MUTASI pada item ${list_mutasi[i].M_ItemCode} - ${list_mutasi[i].M_ItemDesc} tidak boleh lebih dari QTY tersedia`,
isOpen: true
});
return;
}
}
this.$store.dispatch("form/saveMutasi");
this.$refs.formmutasi.resetValidation();
}
}
},
watch: {
dialog_form_mutasi(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formmutasi?.resetValidation();
});
}
}
},
}
</script>

View File

@@ -0,0 +1,307 @@
<template>
<v-dialog v-model="dialog_form_mutasi_edit" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM MUTASI INVENTARIS & ASSET
<v-spacer></v-spacer>
</v-card-title>
<v-card-text>
<v-form ref="formmutasi" lazy-validation v-model="valid_formmutasi">
<v-layout row>
<v-flex xs6 pr-1>
<v-menu
v-model="menuMutasiDateForm" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="mutasiDateForm" label="Tanggal"
outline hide-details v-on="on" readonly
></v-text-field>
</template>
<v-date-picker
v-model="mutasi_date" no-title
@input="menuMutasiDateForm = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs6 px-1>
<v-autocomplete
v-model="selected_category" :rules="rules_category" disabled
:items="list_category" return-object outline item-value="itemCategoryID"
item-text="itemCategoryName" label="Kategori*" required
></v-autocomplete>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs6 pr-1>
<v-autocomplete
v-model="selected_branch_asal" :rules="rules_branch_asal"
:items="list_branch_asal" outline required disabled
item-text="M_BranchName" label="Cabang Asal*" return-object
></v-autocomplete>
</v-flex>
<v-flex xs6 px-1>
<v-autocomplete
v-model="selected_branch_tujuan" :rules="rules_branch_tujuan"
:items="list_branch_tujuan" outline required
item-text="M_BranchName" label="Cabang Tujuan*" return-object
></v-autocomplete>
</v-flex>
</v-layout>
<v-layout row wrap>
<v-flex xs12 pl-1>
<v-textarea
v-model="note" hide-details
auto-grow rows="1" label="Catatan" outline
></v-textarea>
</v-flex>
<v-flex xs3>
<v-btn
block color="info" class="mt-2" @click="pilihItem()"
:disabled="!selected_category || Object.keys(selected_category).length === 0"
>TAMBAH ITEM</v-btn>
</v-flex>
</v-layout>
<v-layout row mt-4 wrap>
<v-flex xs12>
<v-data-table
v-if="list_mutasi_item.length > 0"
:headers = "headers" :items="list_mutasi_item"
hide-actions item-key="ReceiveOrderPoID" class="elevation-1"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-left">{{ props.item.ReceiveOrderPoNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
</td>
<td class="text-xs-center">{{ props.item.stock_total }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-center">{{ props.item.qty_available }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-center">{{ props.item.qty_mutasi }}</td>
<td class="text-xs-center">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="removeItem(props)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="batalMutasi()">Batal</v-btn>
<v-btn color="green" flat outline @click="simpanEdit()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
components: {},
data() {
return {
menuMutasiDateForm: false,
valid_formmutasi: true,
rules_category: [v => (v && Object.keys(v).length > 0) || 'Kategori harus diisi'],
rules_lokasi: [v => (v && Object.keys(v).length > 0) || 'Lokasi harus diisi'],
rules_branch_asal: [v => (v && Object.keys(v).length > 0) || 'Cabang Asal harus diisi'],
rules_branch_tujuan: [v => (v && Object.keys(v).length > 0) || 'Cabang Tujuan harus diisi'],
headers: [
{
text: "RO NUMBER", align: "center", sortable: false, value: "ItemUnitName",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "center", sortable: false, value: "qty",
width: "12%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA BY BARCODE", align: "center", sortable: false, value: "qty",
width: "13%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY MUTASI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
]
}
},
computed: {
dialog_form_mutasi_edit: {
get() {
return this.$store.state.form.dialog_form_mutasi_edit;
},
set(val) {
this.$store.commit('form/update_dialog_form_mutasi_edit', val);
}
},
mutasiDateForm() {
return this.formatDate(this.mutasi_date)
},
mutasi_date: {
get() {
return this.$store.state.form.mutasi_date;
},
set(val) {
this.$store.commit('form/update_mutasi_date', val);
}
},
selected_category: {
get() {
return this.$store.state.form.selected_category;
},
set(val) {
this.$store.commit('form/update_selected_category', val);
}
},
selected_branch_asal: {
get() {
return this.$store.state.form.selected_branch_asal;
},
set(val) {
this.$store.commit('form/update_selected_branch_asal', val);
}
},
selected_branch_tujuan: {
get() {
return this.$store.state.form.selected_branch_tujuan;
},
set(val) {
this.$store.commit('form/update_selected_branch_tujuan', val);
}
},
note: {
get() {
return this.$store.state.form.note;
},
set(val) {
this.$store.commit('form/update_note', val);
}
},
list_category() {
return this.$store.state.form.list_category
},
list_branch_asal() {
return this.$store.state.form.list_branch_asal
},
list_branch_tujuan() {
return this.$store.state.form.list_branch_tujuan
},
dialog_select_item: {
get() {
return this.$store.state.form.dialog_select_item;
},
set(val) {
this.$store.commit('form/update_dialog_select_item', val);
}
},
list_mutasi_item: {
get() {
return this.$store.state.form.list_mutasi_item;
},
set(val) {
this.$store.commit('form/update_list_mutasi_item', val);
}
},
select_item_temp: {
get() {
return this.$store.state.form.select_item_temp;
},
set(val) {
this.$store.commit('form/update_select_item_temp', val);
}
},
},
methods: {
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
batalMutasi() {
this.list_mutasi_item = [];
this.dialog_form_mutasi_edit = false;
},
pilihItem() {
let temp = this.list_mutasi_item
if (temp.length > 0) {
this.$store.commit("form/update_select_item_temp", temp);
}
this.dialog_select_item = true;
this.$store.dispatch('form/getReceiveOrderPo');
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.list_mutasi_item));
this.list_mutasi_item = temp.filter(ele => ele.ReceiveOrderPoID !== props.item.ReceiveOrderPoID);
},
simpanEdit() {
if (this.$refs.formmutasi.validate()) {
const list_mutasi = JSON.parse(JSON.stringify(this.list_mutasi_item));
for (let i = 0; i < list_mutasi.length; i++) {
const qtyMutasi = Number(list_mutasi[i].qty_mutasi);
const qtyAvailable = Number(list_mutasi[i].qty_available);
if (!qtyMutasi || qtyMutasi <= 0) {
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: `QTY MUTASI pada item ${list_mutasi[i].M_ItemCode} - ${list_mutasi[i].M_ItemDesc} harus diisi dan lebih dari 0`,
isOpen: true
});
return;
}
if (qtyMutasi > qtyAvailable) {
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: `QTY MUTASI pada item ${list_mutasi[i].M_ItemCode} - ${list_mutasi[i].M_ItemDesc} tidak boleh lebih dari QTY tersedia`,
isOpen: true
});
return;
}
}
this.$store.dispatch("form/saveEditMutasi");
this.$refs.formmutasi.resetValidation();
}
}
},
watch: {
dialog_form_mutasi(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formmutasi?.resetValidation();
});
}
}
},
}
</script>

View File

@@ -0,0 +1,59 @@
<template>
<div>
<!-- dialog delete -->
<v-dialog v-model="dialog_delete" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
KONFIRMASI HAPUS
<p class="mb-0 p-0"> {{ selected_list_data.MutasiRequestNumber }} </p>
</v-card-title>
<v-card-text>
<p>
Apakah anda yakin menghapus data berikut
<span class="font-weight-bold"> {{ selected_list_data.MutasiRequestNumber }}</span>
?
</p>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="dialog_delete = false">
TIDAK
</v-btn>
<v-btn color="green" flat outline @click="deleteRO()">
YA
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
module.exports = {
data() {
return {
}
},
computed: {
dialog_delete: {
get() {
return this.$store.state.mutasi.dialog_delete;
},
set(val) {
this.$store.commit("mutasi/update_dialog_delete", val);
}
},
selected_list_data() {
return this.$store.state.mutasi.selected_list_data;
}
},
methods: {
deleteRO() {
this.$store.dispatch("mutasi/deleteMutasi");
}
},
}
</script>

View File

@@ -0,0 +1,350 @@
<template>
<v-dialog v-model="dialog_select_item" persistent width="60vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
TAMBAH ITEM
</v-card-title>
<v-card-text>
<v-autocomplete
v-model="selected_ro" :items="list_ro" hide-details
return-object flat label="Cari GR" outline class="mb-3"
item-text="ReceiveOrderPoNumber" @input="searchItem()"
></v-autocomplete>
<!-- list item -->
<v-data-table
v-model="select_item_temp" :headers="headers" :items="list_item_receive"
hide-actions select-all item-key="ReceiveOrderPoID" class="elevation-1"
>
<template v-slot:headers="props">
<tr>
<th width="10%" class="blue lighten-3 white--text">
<v-checkbox
:input-value="props.all" :indeterminate="props.indeterminate"
primary hide-details @click.stop="toggleAll(props)"
></v-checkbox>
</th>
<th
v-for="header in props.headers" :key="header.text"
:width="header.width" :class="header.class"
>
{{ header.text }}
</th>
</tr>
</template>
<template v-slot:items="props">
<tr :active="props.selected" @click="selectItemRow(props)">
<td>
<v-checkbox
v-if="hideCheckbox(props)"
:input-value="props.selected"
primary hide-details
></v-checkbox>
</td>
<td class="text-xs-center">{{ props.item.M_ItemCode }}</td>
<td class="text-xs-center">
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
</td>
<td class="text-xs-center">
{{ props.item.barcode_total }}
</td>
<td class="text-xs-center">
{{ props.item.stock_total }}
{{ props.item.ItemUnitName }}
</td>
<td class="text-xs-center">
{{ props.item.qty_available }}
{{ props.item.ItemUnitName }}
</td>
<td class="text-xs-center">
{{ props.item.qty_locked }}
</td>
</tr>
</template>
</v-data-table>
<div class="text-xs-center mt-2">
<v-pagination v-model="current_page" :length="total_pages" :total-visible="5"></v-pagination>
</div>
<!-- list item selected -->
<v-divider class="my-3"></v-divider>
<h3>ITEM DIPILIH</h3>
<v-data-table
:headers="headers_selected" :items="display_selected_item" hide-actions
item-key="ReceiveOrderPoID" class="elevation-1 mt-3"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-center">{{ (props.index + 1) }}</td>
<td class="text-xs-left">{{ props.item.ReceiveOrderPoNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
</td>
<td class="text-xs-center">
{{ props.item.barcode_total }}
</td>
<td class="text-xs-center">
{{ props.item.stock_total }}
{{ props.item.ItemUnitName }}
</td>
<td class="text-xs-center">
{{ props.item.qty_available }}
{{ props.item.ItemUnitName }}
</td>
<td class="text-xs-center">
{{ props.item.qty_locked }}
</td>
<td class="text-xs-center">
<v-text-field
v-model="props.item.qty_mutasi" class="my-2" hide-details outline
type="number" min="0" :max="parseInt(props.item.qty_available)" step="1"
></v-text-field>
</td>
<td class="text-xs-center">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="removeItem(props)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat @click="tutupDialog()">Tutup</v-btn>
<v-btn color="green" flat @click="simpanItem()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
headers: [
{
text: "ITEM CODE ", align: "left", sortable: false, value: "M_ItemCode",
width: "15%", class: "pa-2 pl-2 blue lighten-3 white--text",
},
{
text: "NAME", align: "left", sortable: false, value: "M_ItemDesc",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL BARCODE", align: "left", sortable: false, value: "ItemUnitName",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "left", sortable: false, value: "ItemUnitName",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA BY BARCODE", align: "left", sortable: false, value: "ItemUnitName",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY LOCKED", align: "left", sortable: false, value: "ItemUnitName",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
],
headers_selected: [
{
text: "NO", align: "center", sortable: false, value: "no",
width: "5%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "NO GR", align: "center", sortable: false, value: "po",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "ITEM",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL BARCODE", align: "left", sortable: false, value: "ItemUnitName",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "left", sortable: false, value: "ItemUnitName",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA BY BARCODE", align: "left", sortable: false, value: "ItemUnitName",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY LOCKED", align: "left", sortable: false, value: "ItemUnitName",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY MUTASI", align: "center", sortable: false, value: "qty_ro",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "", align: "center", sortable: false, value: "qty_ro",
width: "5%", class: "pa-2 blue lighten-3 white--text",
},
],
}
},
computed: {
dialog_select_item: {
get() {
return this.$store.state.form.dialog_select_item;
},
set(val) {
this.$store.commit("form/update_dialog_select_item", val);
}
},
list_ro: {
get() {
return this.$store.state.form.list_ro;
},
set(val) {
this.$store.commit("form/update_list_ro", val)
}
},
selected_ro: {
get() {
return this.$store.state.form.selected_ro;
},
set(val) {
this.$store.commit("form/update_selected_ro", val)
}
},
list_item_receive: {
get() {
return this.$store.state.form.list_item_receive;
},
set(val) {
this.$store.commit("form/update_list_item_receive", val)
}
},
total_pages: {
get() {
return this.$store.state.form.total_pages;
},
set(val) {
this.$store.commit("form/update_total_pages", val)
}
},
current_page: {
get() {
return this.$store.state.form.current_page;
},
set(val) {
this.$store.commit("form/update_current_page", val);
this.$store.dispatch("form/getItemReceive");
}
},
xsearch: {
get() {
return this.$store.state.form.x_search;
},
set(val) {
this.$store.commit("form/update_x_search", val)
}
},
select_item_temp: {
get() {
return this.$store.state.form.select_item_temp;
},
set(val) {
this.$store.commit("form/update_select_item_temp", val)
}
},
display_selected_item() {
return this.select_item_temp;
}
},
methods: {
thr_search: _.debounce(function () {
this.$store.dispatch("form/getItemReceive");
}, 1000),
tutupDialog() {
this.selected_ro = {};
this.list_ro = [];
this.list_item_receive = [];
this.select_item_temp = [];
this.dialog_select_item = false;
},
toggleAll(data) {
if (data.all) {
// this.select_item_temp = []
return
} else {
this.select_item_temp = this.list_item_receive
}
},
selectItemRow(data) {
if (!data.selected) {
data.selected = !data.selected;
};
},
hideCheckbox(data) {
return !data.selected;
},
searchItem() {
this.$store.dispatch("form/getItemReceive");
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.select_item_temp));
let list_item_receive = JSON.parse(JSON.stringify(this.list_item_receive));
let find_index = list_item_receive.findIndex(ele => ele.M_ItemID === props.item.M_ItemID);
if (find_index !== -1) {
list_item_receive[find_index].qty_mutasi = 0;
this.list_item_receive = list_item_receive;
}
this.select_item_temp = temp.filter(ele => ele.ReceiveOrderPoID !== props.item.ReceiveOrderPoID);
},
simpanItem() {
let temp = JSON.parse(JSON.stringify(this.select_item_temp));
let isError = false
temp.forEach(element => {
if (Number(element.qty_mutasi) > Number(element.qty_available)) {
isError = true;
return;
}
});
if (isError) {
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: 'qty mutasi melebihi item tersedia',
isOpen: true
});
return;
}
this.$store.commit("form/update_list_mutasi_item", temp);
this.list_ro = [];
this.selected_ro = {};
this.list_item_receive = [];
this.select_item_temp = [];
this.dialog_select_item = false;
}
},
watch: {
xsearch(val, old) {
this.xsearch = val;
this.thr_search();
},
}
}
</script>

View File

@@ -0,0 +1,552 @@
<template>
<div style="width: 100%">
<!-- snackbar -->
<v-snackbar
:color="snackbar.color" v-model="snackbar.isOpen"
:timeout="3000" multi-line top
>
{{ snackbar.msg }}
<v-btn class="ml-2" flat @click="snackbar.isOpen = false">Tutup</v-btn>
</v-snackbar>
<!-- ERROR DIALOG -->
<!-- <v-dialog v-model="dialog_error" max-width="500px">
<v-card>
<v-card-title>
<span>ERROR !</span>
<v-spacer></v-spacer>
</v-card-title>
<v-divider></v-divider>
<div class="ma-3 red--text">{{ msgError }}</div>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" flat @click="dialog_error = false"
>Tutup</v-btn
>
</v-card-actions>
</v-card>
</v-dialog> -->
<!-- END ERROR DIALOG -->
<v-toolbar color="primary" dark>
<v-toolbar-title class="white--text"
>MUTASI ANTAR CABANG</v-toolbar-title
>
<v-spacer></v-spacer>
<v-btn icon @click="openDialogRequest()">
<v-icon>add_box</v-icon>
</v-btn>
</v-toolbar>
<v-card class="pa-2">
<v-layout row align-center>
<v-flex pl-2 xs2>
<v-menu
v-model="menuStartDate"
:close-on-content-click="false"
transition="scale-transition"
:nudge-right="40"
lazy
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="startDateFormatted"
label="Tanggal Awal"
readonly
outline
hide-details
v-on="on"
@blur="dStartDate = deFormatedDate(startDateFormatted)"
></v-text-field>
</template>
<v-date-picker
no-title
v-model="fStartDate"
@input="menuStartDate = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex pl-2 xs2>
<v-menu
v-model="menuEndDate"
:close-on-content-click="false"
transition="scale-transition"
:nudge-right="40"
lazy
offset-y
full-width
max-width="290px"
min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="endDateFormatted"
label="Tanggal Akhir"
readonly
outline
hide-details
v-on="on"
@blur="dEndDate = deFormatedDate(endDateFormatted)"
></v-text-field>
</template>
<v-date-picker
no-title
v-model="fEndDate"
@input="menuEndDate = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex pl-2 xs2>
<v-autocomplete
v-model="fStatus"
menu-icon="mdi-chevron-down"
:items="statusOptions"
item-text="text"
item-value="value"
label="Status"
outline
hide-details
></v-autocomplete>
</v-flex>
<v-flex pl-2 xs2>
<v-text-field
v-model="fSearch"
label="Cari..."
placeholder="NO. "
outline
hide-details
></v-text-field>
</v-flex>
<v-flex pl-2>
<v-btn
dark
color="primary"
style="min-width: 50px; height: 50px; margin: 0"
@click="mainSearch()"
>
<v-icon>search</v-icon>
</v-btn>
</v-flex>
<v-spacer></v-spacer>
</v-layout>
</v-card>
<v-card class="pa-2 mt-2">
<div style="overflow-y: scroll;">
<v-data-table
:headers="headers"
:items="listdata"
:loading="isLoading"
hide-actions
class="elevation-1"
>
<template slot="items" slot-scope="props">
<tr>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
{{ props.item.MutasiRequestNumber }}
</td>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
<span>
{{
deFormatedDate(props.item.MutasiRequestDate)
}}
</span>
</td>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
{{ props.item.itemCategoryName }}
</td>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
{{ props.item.branch_asal_name }}
</td>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
{{ props.item.branch_tujuan_name }}
</td>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
{{ props.item.MutasiRequestNote }}
</td>
<td
class="text-xs-center"
v-bind:class="{ 'amber lighten-4': isSelected(props.item) }"
@click="selectMe(props.item)"
>
<v-chip
small
:text-color="
props.item.MutasiRequestStatus === 'Draft'
? 'black'
: 'white'
"
:color="
getChipStatusColor(
props.item.MutasiRequestStatus
)
"
>
{{ props.item.MutasiRequestStatus }}
</v-chip>
</td>
<td
class="text-xs-center"
v-bind:class="{
'amber lighten-4': isSelected(props.item),
}"
>
<div v-show="props.item.MutasiRequestStatus === 'Draft'">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="editRM(props.item)" color="blue lighten-2"
class="mt-1 mb-1"
>
<v-icon small color="blue" v-on="on">edit</v-icon>
</v-btn>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="deleteRM(props.item)" color="red lighten-2"
class="mt-1 mb-1"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</div>
</td>
</tr>
</template>
</v-data-table>
</div>
<v-divider></v-divider>
<v-pagination
style="margin-top: 10px; margin-bottom: 10px"
v-model="currentPage"
:length="totalPages"
></v-pagination>
</v-card>
<add-request-mutasi></add-request-mutasi>
<one-dialog-item-mutasi></one-dialog-item-mutasi>
<one-dialog-form-edit-mutasi></one-dialog-form-edit-mutasi>
<one-dialog-rm-layout></one-dialog-rm-layout>
</div>
</template>
<style scoped>
.date-type-table {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.table.v-table tbody td,
table.v-table tbody th {
height: 40px;
}
.table.v-table thead tr {
height: 40px;
}
.scroll-container {
scroll-padding: 50px 0 0 50px;
}
</style>
<script>
module.exports = {
components: {
"one-dialog-item-mutasi": httpVueLoader("./dialogSelectItem.vue"),
"one-dialog-form-edit-mutasi": httpVueLoader("./dialogFormMutasiEdit.vue"),
"one-dialog-rm-layout": httpVueLoader("./dialogRmLayout.vue"),
"add-request-mutasi": httpVueLoader("./dialogFormMutasi.vue"),
"add-request-detail-dialog": httpVueLoader("./addRequestDetailDialog.vue"),
"approve-dialog": httpVueLoader("./approveDialog.vue"),
"one-dialog-alert": httpVueLoader("../../common/oneDialogAlert.vue"),
"one-dialog-error": httpVueLoader("../../common/oneDialogError.vue"),
},
data() {
return {
msgAlertDeleteRequest: "",
dialogAlertDeleteRequest: false,
dialogAlertDeleteDetail: false,
headers: [
{
text: "NO",
align: "center",
sortable: false,
value: "no",
width: "10%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "TANGGAL",
align: "center",
sortable: false,
value: "requestDate",
width: "10%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "KATEGORI",
align: "center",
sortable: false,
value: "keterangan",
width: "10%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "CABANG ASAL",
align: "center",
sortable: false,
value: "keterangan",
width: "15%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "CABANG TUJUAN",
align: "center",
sortable: false,
value: "keterangan",
width: "15%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "KETERANGAN",
align: "center",
sortable: false,
value: "keterangan",
width: "20%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "STATUS",
align: "center",
sortable: false,
value: "status",
width: "10%",
class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI",
align: "center",
sortable: false,
value: "action",
width: "25%",
class: "pa-2 text-center blue lighten-3 white--text",
},
]
};
},
mounted() {
this.$store.dispatch("mutasi/search");
},
computed: {
menuStartDate: {
get() {
return this.$store.state.mutasi.menu_start_date;
},
set(val) {
this.$store.commit("mutasi/update_menu_start_date", val);
},
},
menuEndDate: {
get() {
return this.$store.state.mutasi.menu_end_date;
},
set(val) {
this.$store.commit("mutasi/update_menu_end_date", val);
},
},
startDateFormatted() {
return this.formatDate(this.fStartDate);
},
endDateFormatted() {
return this.formatDate(this.fEndDate);
},
dStartDate: {
get() {
return this.$store.state.mutasi.d_start_date;
},
set(val) {
this.$store.commit("mutasi/update_d_start_date", val);
},
},
dEndDate: {
get() {
return this.$store.state.mutasi.d_end_date;
},
set(val) {
this.$store.commit("mutasi/update_d_end_date", val);
},
},
fStartDate: {
get() {
return this.$store.state.mutasi.f_start_date;
},
set(val) {
this.$store.commit("mutasi/update_f_start_date", val);
},
},
fEndDate: {
get() {
return this.$store.state.mutasi.f_end_date;
},
set(val) {
this.$store.commit("mutasi/update_f_end_date", val);
},
},
fStatus: {
get() {
return this.$store.state.mutasi.f_status;
},
set(val) {
this.$store.commit("mutasi/update_f_status", val);
},
},
statusOptions() {
return this.$store.state.mutasi.status_options;
},
fSearch: {
get() {
return this.$store.state.mutasi.f_search;
},
set(val) {
this.$store.commit("mutasi/update_f_search", val);
},
},
listdata() {
return this.$store.state.mutasi.list_data;
},
isLoading() {
return this.$store.state.mutasi.isLoading === 1;
},
currentPage: {
get() {
return this.$store.state.mutasi.current_page;
},
set(val) {
this.$store.commit("mutasi/update_current_page", val);
this.$store.dispatch("mutasi/search");
},
},
totalPages: {
get() {
return this.$store.state.mutasi.total_pages;
},
set(val) {
this.$store.commit("mutasi/update_total_pages", val);
},
},
snackbar: {
get() {
return this.$store.state.mutasi.snackbar;
},
set(val) {
this.$store.commit("mutasi/update_snackbar", val);
}
},
},
methods: {
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
deFormatedDate(date) {
if (!date) return null;
const [day, month, year] = date.split("-");
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
},
isSelected(p) {
return (
p.MutasiRequestID ==
this.$store.state.mutasi.selected_list_data
.MutasiRequestID
);
},
selectMe(spr) {
this.$store.commit("mutasi/update_selected_list_data", spr);
},
getChipStatusColor(status) {
switch (status) {
case "Verified":
return "primary"
case "Approved":
return "green";
case "Rejected":
return "error";
case "Sent":
return "yellow darken-2";
case "Received":
return "blue";
case "Done":
return "info";
default:
return "";
}
},
openDialogRequest() {
this.$store.commit("form/update_dialog_form_mutasi", true);
this.$store.dispatch("form/resetForm");
this.$store.dispatch("form/getCategory");
this.$store.dispatch("form/getBranchAsal");
this.$store.dispatch("form/getBranchTujuan");
},
mainSearch() {
this.$store.dispatch("mutasi/search");
},
editRM(data) {
this.$store.commit("form/update_dialog_form_mutasi_edit", true);
this.$store.commit("mutasi/update_selected_list_data", data);
this.$store.dispatch("mutasi/getItemMutasiUpdate");
this.$store.dispatch("form/getCategory");
this.$store.dispatch("form/getBranchAsal");
this.$store.dispatch("form/getBranchTujuan");
},
deleteRM(data) {
this.$store.commit("mutasi/update_selected_list_data", data);
this.$store.commit("mutasi/update_dialog_delete", true);
}
},
};
</script>

View File

@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
<title>One</title>
</head>
<body>
<v-dialog
v-model="alertError"
width="350">
<v-card>
<v-card-title
class="headline error lighten-2"
primary-title>
Error
</v-card-title>
<v-card-text>
{{errMessage}}
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn
color="primary"
flat
@click="alertError = false">
Tutup
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<div v-cloak id="app">
<v-app id="smartApp">
<one-navbar></one-navbar>
<v-container style="background: #F5E8DF!important" fluid fill-height class="pl-1 pr-1 pt-2 pb-2 mt-4">
<v-layout row wrap>
<v-flex xs12 class="left" fill-height pa-1>
<request-listing></request-listing>
</v-flex>
</v-layout>
</v-container>
<one-footer></one-footer>
</v-app>
</div>
<!-- Vendor -->
<script src="../../../libs/vendor/moment.min.js"></script>
<script src="../../../libs/vendor/numeral.min.js"></script>
<script src="../../../libs/vendor/moment-locale-id.js"></script>
<script src="../../../libs/vendor/lodash.js"></script>
<script src="../../../libs/vendor/axios.min.js"></script>
<script src="../../../libs/vendor/vue.js"></script>
<script src="../../../libs/vendor/vuex.js"></script>
<script src="../../../libs/vendor/vuetify.js"></script>
<script src="../../../libs/vendor/httpVueLoader.js"></script>
<script src="../../../libs/one_global.js"></script>
<!-- App Script -->
<script type="module">
import {
store
} from './store.js';
window.store = store;
new Vue({
store,
el: "#app",
methods: {},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'request-listing': httpVueLoader('./components/mutasiListing.vue')
},
computed: {
alertError: {
get() {
return this.$store.state.mutasi.alert_error;
},
set(val) {
this.$store.commit("mutasi/update_alert_error", val);
}
},
errMessage: {
get() {
return this.$store.state.mutasi.err_message;
},
set(val) {
this.$store.commit("mutasi/update_err_message", val);
}
}
}
})
</script>
<style>
[v-cloak] {
display: none
}
</style>
</body>
</html>

View File

@@ -0,0 +1,311 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/api.js";
export default {
namespaced: true,
state: {
dialog_form_mutasi: false,
mutasi_date: moment(new Date()).format('YYYY-MM-DD'),
list_category: [],
selected_category: {},
list_branch_asal: [],
selected_branch_asal: {},
list_branch_tujuan: [],
selected_branch_tujuan: {},
note: '',
dialog_select_item: false,
list_ro: [],
selected_ro: {},
current_page: 1,
x_search: '',
total_pages: 0,
list_item_receive: [],
select_item_temp: [],
list_mutasi_item: [],
dialog_form_mutasi_edit: false
},
mutations: {
update_dialog_form_mutasi(state, val) {
state.dialog_form_mutasi = val;
},
update_mutasi_date(state, val) {
state.mutasi_date = val;
},
update_list_category(state, val) {
state.list_category = val;
},
update_selected_category(state, val) {
state.selected_category = val;
},
update_list_branch_asal(state, val) {
state.list_branch_asal = val;
},
update_selected_branch_asal(state, val) {
state.selected_branch_asal = val;
},
update_list_branch_tujuan(state, val) {
state.list_branch_tujuan = val;
},
update_selected_branch_tujuan(state, val) {
state.selected_branch_tujuan = val;
},
update_note(state, val) {
state.note = val;
},
update_dialog_select_item(state, val) {
state.dialog_select_item = val;
},
update_current_page(state, val) {
state.current_page = val;
},
update_x_search(state, val) {
state.x_search = val;
state.current_page = 1;
},
update_total_pages(state, val) {
state.total_pages = val;
},
update_list_item_receive(state, val) {
state.list_item_receive = val;
},
update_select_item_temp(state, val) {
state.select_item_temp = val;
},
update_list_ro(state, val) {
state.list_ro = val;
},
update_selected_ro(state, val) {
state.selected_ro = val;
},
update_list_mutasi_item(state, val) {
state.list_mutasi_item = val;
},
update_dialog_form_mutasi_edit(state, val) {
state.dialog_form_mutasi_edit = val
}
},
actions: {
resetForm(context) {
context.state.mutasi_date = moment(new Date()).format('YYYY-MM-DD')
context.state.selected_category = {}
context.state.selected_branch_asal = {}
context.state.selected_branch_tujuan = {}
context.state.note = ''
context.state.list_mutasi_item = []
},
async getCategory(context) {
try {
let param = {
token: one_token(),
search: ''
}
const resp = await api.getCategory(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.commit("update_list_category", resp.data.records);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async getBranchAsal(context) {
try {
let param = {
token: one_token()
}
const resp = await api.getBranchAsal(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.commit("update_list_branch_asal", resp.data.records);
context.commit("update_selected_branch_asal", resp.data.records[0]);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async getBranchTujuan(context) {
try {
let param = {
token: one_token()
}
const resp = await api.getBranchTujuan(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.commit("update_list_branch_tujuan", resp.data.records);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async getReceiveOrderPo(context) {
try {
let param = {
token: one_token(),
branchAsalCode: context.state.selected_branch_asal.M_BranchCode,
itemCategoryID: context.state.selected_category.itemCategoryID,
search: '',
}
const resp = await api.getReceiveOrderPo(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.commit("update_list_ro", resp.data.records);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async getItemReceive(context) {
try {
let param = {
token: one_token(),
warhouseID: context.state.selected_ro.ReceiveOrderPoWarehouseID,
branchAsalCode: context.state.selected_ro.ReceiveOrderPoM_BranchCode,
receiveOrderPoID: context.state.selected_ro.ReceiveOrderPoID,
search: '',
current_page: context.state.current_page
}
const resp = await api.getItemReceive(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.commit("update_list_item_receive", resp.data.records);
context.commit("update_total_pages", resp.data.total_page);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async saveMutasi(context) {
try {
let param = {
token: one_token(),
mutasi_date: context.state.mutasi_date,
category_id: context.state.selected_category.itemCategoryID,
branch_asal_id: context.state.selected_branch_asal.M_BranchID,
branch_tujuan_id: context.state.selected_branch_tujuan.M_BranchID,
note: context.state.note,
list_mutasi: context.state.list_mutasi_item
}
const resp = await api.saveMutasi(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.dispatch("resetForm");
context.dispatch("mutasi/search", {}, {root: true});
context.commit("mutasi/update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
}, {root: true});
context.commit("update_dialog_form_mutasi", false);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async saveEditMutasi(context) {
try {
let param = {
token: one_token(),
mutasi_request_id: context.rootState.mutasi.selected_list_data.MutasiRequestID,
mutasi_date: context.state.mutasi_date,
category_id: context.state.selected_category.itemCategoryID,
branch_asal_id: context.state.selected_branch_asal.M_BranchID,
branch_tujuan_id: context.state.selected_branch_tujuan.M_BranchID,
note: context.state.note,
list_mutasi: context.state.list_mutasi_item
}
const resp = await api.saveEditMutasi(param);
if (resp.status != 'OK') {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.dispatch("resetForm");
context.dispatch("mutasi/search", {}, {root: true});
context.commit("mutasi/update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
}, {root: true});
context.commit("update_dialog_form_mutasi_edit", false);
}
} catch (error) {
context.commit("mutasi/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
},
};

View File

@@ -0,0 +1,216 @@
// 1 => LOADING
// 2 => DONE
// 3 => ERROR
import * as api from "../api/api.js";
export default {
namespaced: true,
state: {
alert_error: false,
err_message: "",
menu_start_date: false,
menu_end_date: false,
d_start_date: new Date().toISOString().substring(0, 10),
d_end_date: new Date().toISOString().substring(0, 10),
f_start_date: moment(new Date()).format("YYYY-MM-DD"),
f_end_date: moment(new Date()).format("YYYY-MM-DD"),
f_status: '',
status_options: [
{ text: 'All', value: '' },
{ text: 'Draft', value: 'Draft' },
{ text: 'Verified', value: 'Verified' },
{ text: 'Approved', value: 'Approved' },
{ text: 'Rejected', value: 'Rejected' },
{ text: 'sent', value: 'sent' },
{ text: 'Received', value: 'Received' },
{ text: 'Done', value: 'Done' },
],
f_search : '',
list_data: [],
selected_list_data: {},
isLoading: 0,
current_page: 1,
total_pages: 0,
snackbar: {
color: 'success',
msg: '',
isOpen: false
},
dialog_delete: false
},
mutations: {
update_alert_error(state, val) {
state.alert_error = val;
},
update_err_message(state, val) {
state.err_message = val;
},
update_menu_start_date(state, val) {
state.menu_start_date = val;
},
update_menu_end_date(state, val) {
state.menu_end_date = val;
},
update_d_start_date(state, val) {
state.d_start_date = val;
},
update_d_end_date(state, val) {
state.d_end_date = val;
},
update_f_start_date(state, val) {
state.f_start_date = val;
},
update_f_end_date(state, val) {
state.f_end_date = val;
},
update_f_status(state, val) {
state.f_status = val;
},
update_status_options(state, val) {
state.status_options = val;
},
update_f_search(state, val) {
state.f_search = val;
state.current_page = 1
},
update_list_data(state, val) {
state.list_data = val;
},
update_selected_list_data(state, val) {
state.selected_list_data = val;
},
update_isLoading(state, val) {
state.isLoading = val;
},
update_current_page(state, val) {
state.current_page = val;
},
update_total_pages(state, val) {
state.total_pages = val;
},
update_snackbar(state, data) {
state.snackbar = data
},
update_dialog_delete(state, val) {
state.dialog_delete = val
}
},
actions: {
async search(context) {
context.commit("update_isLoading", 1)
try {
let param = {
token: one_token(),
search: context.state.f_search,
start_date: context.state.f_start_date,
end_date: context.state.f_end_date,
current_page: context.state.current_page,
status: context.state.f_status
}
const resp = await api.search(param);
if (resp.status != 'OK') {
context.commit("update_isLoading", 3)
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, { root: true });
} else {
context.commit("update_isLoading", 2)
context.commit("update_list_data", resp.data.records);
context.commit("update_total_pages", resp.data.total_page);
}
} catch (error) {
context.commit("update_isLoading", 3)
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, { root: true });
}
},
async getItemMutasiUpdate(context) {
try {
let param = {
token: one_token(),
mutasiRequestID: context.state.selected_list_data.MutasiRequestID
}
const resp = await api.getItemMutasiUpdate(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.commit("form/update_mutasi_date", context.state.selected_list_data.MutasiRequestDate, { root: true });
let category = {
itemCategoryID: context.state.selected_list_data.itemCategoryID,
itemCategoryName: context.state.selected_list_data.itemCategoryName
}
context.commit("form/update_selected_category", category, { root: true });
let branch_asal = {
M_BranchID: context.state.selected_list_data.branch_asal_id,
M_BranchName: context.state.selected_list_data.branch_asal_name,
M_BranchCode: context.state.selected_list_data.branch_asal_code,
}
context.commit("form/update_selected_branch_asal", branch_asal, { root: true });
let branch_tujuan = {
M_BranchID: context.state.selected_list_data.branch_tujuan_id,
M_BranchName: context.state.selected_list_data.branch_tujuan_name,
M_BranchCode: context.state.selected_list_data.branch_tujuan_code,
}
context.commit("form/update_selected_branch_tujuan", branch_tujuan, { root: true });
context.commit("form/update_note", context.state.selected_list_data.MutasiRequestNote, { root: true });
context.commit("form/update_list_mutasi_item", resp.data.records, { root: true });
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
async deleteMutasi(context) {
try {
let param = {
token: one_token(),
mutasiRequestID: context.state.selected_list_data.MutasiRequestID
}
const resp = await api.deleteMutasi(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.dispatch("search");
context.commit('update_dialog_delete', false)
context.commit("update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
});
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
},
};

View File

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