Files
fe-accone/test/vuex/acc-one-receive-item-po-inventaris/components/dialogHandOver.vue

129 lines
4.7 KiB
Vue

<template>
<v-dialog v-model="dialog_handover" persistent width="40vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
SERAH TERIMA BARANG INVENTARIS
</v-card-title>
<v-card-text>
<p>Apakah Anda yakin ingin melakukan serah terima barang inventaris kepada user pemohon</p>
<v-data-table :headers="headers" :items="items" hide-actions class="elevation-1">
<template v-slot:items="props">
<tr>
</tr>
</template>
</v-data-table>
<v-form ref="formhandover" lazy-validation v-model="valid_formhandover">
<v-layout row mt-2>
<v-flex xs6 pr-1>
<v-autocomplete v-model="selected_ruangan" :items="list_lokasi" label="Lokasi Penerima*"
outline item-value="M_RuanganID" item-text="M_RuanganName"></v-autocomplete>
</v-flex>
<v-flex xs6 pl-1>
<v-autocomplete label="Staff Penerima*" outline :rules="rules_staff" return-object
v-model="selected_staff" :items="list_staff" item-text="M_UserUsername"
item-value="M_UserID"></v-autocomplete>
</v-flex>
</v-layout>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="closeHandOver()">Batal</v-btn>
<v-btn color="green" flat outline @click="simpanHandOver()">Ya, Serahkan Barang</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
selected_ruangan: 0,
temp_list: [
{ M_RuanganID: 1, M_RuanganName: "bonde" }
],
valid_formhandover: true,
rules_staff: [v => (v && Object.keys(v).length > 0) || 'Staff harus diisi'],
headers: [
{
text: "ITEM", align: "center", sortable: false, value: "itemname",
width: "60%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY", align: "center", sortable: false, value: "qtyitem",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "HANDOVER", align: "center", sortable: false, value: "qtysend",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
],
items: []
}
},
computed: {
dialog_handover: {
get() {
return this.$store.state.ro.dialog_handover
},
set(val) {
this.$store.commit("ro/update_dialog_handover", val)
}
},
selected_staff: {
get() {
return this.$store.state.ro.selected_staff
},
set(val) {
this.$store.commit("ro/update_selected_staff", val)
}
},
selected_item_received: {
get() {
return this.$store.state.form.selected_item_received
},
set(val) {
this.$store.commit("form/update_selected_item_received", val)
}
},
selected_ro: {
get() {
return this.$store.state.ro.selected_ro
},
set(val) {
this.$store.commit("ro/update_selected_ro", val);
}
},
list_staff() {
return this.$store.state.ro.list_staff
},
list_lokasi() {
return this.$store.state.ro.list_lokasi
},
},
methods: {
closeHandOver() {
this.$store.commit("ro/update_selected_staff", {});
this.dialog_handover = false
this.$refs.formhandover.resetValidation();
},
async simpanHandOver() {
if (this.$refs.formhandover.validate()) {
let prm = {
staffID: this.selected_staff.M_UserID,
receiveOrderPoID: this.selected_ro.ReceiveOrderPoID,
ruanganID: this.selected_ro.M_RuanganID
}
await this.$store.dispatch("ro/saveHandover", prm);
this.$refs.formhandover.resetValidation();
}
},
},
}
</script>