<template>
    <v-dialog v-model="dialogConfirmHandover" persistent width="40vw">
        <v-card>
            <v-card-title class="headline grey lighten-2" primary-title>
                KONFIRMASI TERIMA BARANG INVENTARIS
            </v-card-title>

            <v-card-text>
                <p>Apakah Anda yakin ingin melakukan konfirmasi terima barang inventaris ?</p>
            </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="saveConfirmHandOver()">Ya, Konfirmasi Terima</v-btn>
            </v-card-actions>
        </v-card>
    </v-dialog>
</template>

<script>
module.exports = {
    data() {
        return {
        }
    },
    computed: {
        dialogConfirmHandover: {
            get() {
                return this.$store.state.requester.dialogConfirmHandover
            },
            set(val) {
                this.$store.commit("requester/updateDialogConfirmHandover", val)
            }
        },
        selected_main: {
            get() {
                return this.$store.state.requester.selectedMainTable
            },
            set(val) {
                this.$store.commit("requester/updateSelectedMainTable", val)
            }
        },
    },
    methods: {
        closeHandOver() {
            this.dialogConfirmHandover = false
        },
        async saveConfirmHandOver() {
            let prm = {
                purchaseRequestID: this.selected_main.prId,
            }
            await this.$store.dispatch("requester/confirmHandOver", prm);
        },
    },
}
</script>