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,307 @@
<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 QTY", align: "center", sortable: false, value: "qty",
width: "12%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA", 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);
}
},
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,304 @@
<template>
<v-dialog v-model="dialog_form_mutasi_approve" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM APPROVE MUTASI INVENTARIS & ASSET
<v-spacer></v-spacer>
<v-icon @click="batalApprove()" color="black" right dark>close</v-icon>
</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-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>
</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="btnReject()">Reject</v-btn>
<v-btn color="green" flat outline @click="btnApprove()">Approve</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: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "30%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA BY BARCODE", align: "center", sortable: false, value: "qty",
width: "15%", 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",
}
]
}
},
computed: {
dialog_form_mutasi_approve: {
get() {
return this.$store.state.form.dialog_form_mutasi_approve;
},
set(val) {
this.$store.commit('form/update_dialog_form_mutasi_approve', 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}`;
},
batalApprove() {
this.list_mutasi_item = [];
this.dialog_form_mutasi_approve = 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();
}
},
async btnApprove() {
try {
let selected = this.$store.state.mutasi.selected_list_data
if (selected.MutasiRequestID != '') {
await this.$store.dispatch("mutasi/approveMutasiRequest", {mutasiRequestID: selected.MutasiRequestID});
}
} catch (error) {
console.error("Error approve mutasi:", error);
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: 'Gagal Approve mutasi request',
isOpen: true
});
}
},
btnReject() {
this.$store.commit("mutasi/update_dialog_reject", true)
this.$store.commit('form/update_dialog_form_mutasi_approve', false);
}
},
watch: {
dialog_form_mutasi(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formmutasi?.resetValidation();
});
}
}
},
}
</script>

View File

@@ -0,0 +1,304 @@
<template>
<v-dialog v-model="dialog_form_mutasi_verif" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM VERIFIKASI MUTASI INVENTARIS & ASSET
<v-spacer></v-spacer>
<v-icon @click="batalVerif()" color="black" right dark>close</v-icon>
</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-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>
</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="btnReject()">Reject</v-btn>
<v-btn color="green" flat outline @click="btnVerif()">Verifikasi</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: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "30%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA BY BARCODE", align: "center", sortable: false, value: "qty",
width: "15%", 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",
}
]
}
},
computed: {
dialog_form_mutasi_verif: {
get() {
return this.$store.state.form.dialog_form_mutasi_verif;
},
set(val) {
this.$store.commit('form/update_dialog_form_mutasi_verif', 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}`;
},
batalVerif() {
this.list_mutasi_item = [];
this.dialog_form_mutasi_verif = 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();
}
},
async btnVerif() {
try {
let selected = this.$store.state.mutasi.selected_list_data
if (selected.MutasiRequestID != '') {
await this.$store.dispatch("mutasi/verifMutasiRequest", {mutasiRequestID: selected.MutasiRequestID});
}
} catch (error) {
console.error("Error verif mutasi:", error);
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: 'Gagal verifikasi mutasi request',
isOpen: true
});
}
},
btnReject() {
this.$store.commit("mutasi/update_dialog_reject", true)
this.$store.commit('form/update_dialog_form_mutasi_verif', false);
}
},
watch: {
dialog_form_mutasi(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formmutasi?.resetValidation();
});
}
}
},
}
</script>

View File

@@ -0,0 +1,301 @@
<template>
<v-dialog v-model="dialog_form_mutasi_view" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
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-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>
</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="btnClose()">Tutup</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: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "30%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "TOTAL STOCK", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA BY BARCODE", align: "center", sortable: false, value: "qty",
width: "15%", 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",
}
]
}
},
computed: {
dialog_form_mutasi_view: {
get() {
return this.$store.state.mutasi.dialog_form_mutasi_view;
},
set(val) {
this.$store.commit('mutasi/update_dialog_form_mutasi_view', 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}`;
},
batalApprove() {
this.list_mutasi_item = [];
this.dialog_form_mutasi_view = 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();
}
},
async btnApprove() {
try {
let selected = this.$store.state.mutasi.selected_list_data
if (selected.MutasiRequestID != '') {
await this.$store.dispatch("mutasi/approveMutasiRequest", {mutasiRequestID: selected.MutasiRequestID});
}
} catch (error) {
console.error("Error approve mutasi:", error);
this.$store.commit("mutasi/update_snackbar", {
color: 'error',
msg: 'Gagal Approve mutasi request',
isOpen: true
});
}
},
btnClose() {
this.$store.commit("mutasi/update_dialog_form_mutasi_view", false)
}
},
watch: {
dialog_form_mutasi(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formmutasi?.resetValidation();
});
}
}
},
}
</script>

View File

@@ -0,0 +1,78 @@
<template>
<div>
<!-- dialog delete -->
<v-dialog v-model="dialog_reject" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
KONFIRMASI REJECT
</v-card-title>
<v-card-text>
<p>
Isi alasan reject
<span class="font-weight-bold"> {{ selected_list_data.MutasiRequestNumber }} </span>
?
</p>
<v-layout row wrap>
<v-flex xs12>
<v-textarea
v-model="note_reject" hide-details
auto-grow rows="1" label="Catatan" outline
></v-textarea>
</v-flex>
</v-layout>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="dialog_reject = false">
TIDAK
</v-btn>
<v-btn color="green" flat outline @click="btnDoReject()">
YA
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
module.exports = {
data() {
return {
}
},
computed: {
dialog_reject: {
get() {
return this.$store.state.mutasi.dialog_reject;
},
set(val) {
this.$store.commit("mutasi/update_dialog_reject", val);
}
},
note_reject: {
get() {
return this.$store.state.mutasi.note_reject;
},
set(val) {
this.$store.commit("mutasi/update_note_reject", val);
}
},
selected_list_data() {
return this.$store.state.mutasi.selected_list_data;
}
},
methods: {
btnDoReject() {
let selected = this.$store.state.mutasi.selected_list_data
this.$store.dispatch("mutasi/rejectMutasiRequest", {
mutasiRequestID: selected.MutasiRequestID,
reject_note: this.note_reject
});
}
},
}
</script>

View File

@@ -0,0 +1,342 @@
<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 QTY", align: "left", sortable: false, value: "ItemUnitName",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA", 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 QTY", align: "left", sortable: false, value: "ItemUnitName",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY TERSEDIA", 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));
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,598 @@
<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"
>APPROVED 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' || props.item.MutasiRequestStatus === 'Verified'">
<v-btn
:disabled="props.item.MutasiRequestStatus == 'Verified' || approve_level != '1'"
@click="verifMR(props.item)" round depressed color="primary" small :outline="isApproved(props.item, 'M')"
>
Verif (Manager)
<v-icon small right dark>done_all</v-icon>
</v-btn>
<v-btn
:disabled="props.item.MutasiRequestStatus !== 'Verified' || approve_level != '2'"
@click="approveMR(props.item)" round depressed color="primary" small :outline="isApproved(props.item, 'K')"
>
Approved (Kepala Cab)
<v-icon small right dark>done_all</v-icon>
</v-btn>
</div>
<div v-show="props.item.MutasiRequestStatus != 'Draft' && props.item.MutasiRequestStatus != 'Verified'">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="openView(props.item)" color="blue lighten-2"
class="mt-1 mb-1"
>
<v-icon small color="blue" v-on="on">visibility</v-icon>
</v-btn>
</template>
<span>Lihat Detail</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-verif-mutasi></one-dialog-form-verif-mutasi>
<one-dialog-form-approve-mutasi></one-dialog-form-approve-mutasi>
<one-dialog-reject-layout></one-dialog-reject-layout>
<one-dialog-view-layout></one-dialog-view-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-verif-mutasi": httpVueLoader("./dialogFormMutasiVerif.vue"),
"one-dialog-form-approve-mutasi": httpVueLoader("./dialogFormMutasiApprove.vue"),
"one-dialog-reject-layout": httpVueLoader("./dialogNoteRejected.vue"),
"one-dialog-view-layout": httpVueLoader("./dialogFormMutasiView.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");
this.$store.dispatch("mutasi/getApproveLevel");
},
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);
}
},
approve_level() {
return this.$store.state.mutasi.approve_level
}
},
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");
},
deleteRM(data) {
this.$store.commit("mutasi/update_selected_list_data", data);
this.$store.commit("mutasi/update_dialog_delete", true);
},
verifMR(data) {
this.$store.commit("form/update_dialog_form_mutasi_verif", 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");
},
approveMR(data) {
this.$store.commit("form/update_dialog_form_mutasi_approve", 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");
},
isApproved(data, type) {
if (!data) {
return false
}
if (data.MutasiRequestStatus == 'Approved') {
return false
}
if (type == 'M' && data.MutasiRequestIsVerif == 'N') {
return true
} else if (type == 'K' && data.MutasiRequestIsApproved == 'N') {
return true
} else {
return false
}
},
openView(data) {
this.$store.commit("mutasi/update_dialog_form_mutasi_view", 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");
}
},
};
</script>