<template>
    <v-dialog v-model="dialog_deletero" persistent width="40vw">
        <v-card>
            <v-card-title class="headline grey lighten-2">DELETE RECEIVE ORDER JASA</v-card-title>
            <v-card-text>
                <v-layout row wrap>
                    <v-flex xs3 class="pr-2"><strong>Tanggal</strong></v-flex>
                    <v-flex xs9>: {{ selected_rojasa.ReceiveOrderPoIDate }}</v-flex>

                    <v-flex xs3 class="pr-2"><strong>Nomor</strong></v-flex>
                    <v-flex xs9>: {{ selected_rojasa.ReceiveOrderPoNumber }}</v-flex>

                    <v-flex xs3 class="pr-2"><strong>Nomor Referensi</strong></v-flex>
                    <v-flex xs9>: {{ selected_rojasa.ReceiveOrderPoRefNumber }}</v-flex>

                    <v-flex xs3 class="pr-2"><strong>Supplier</strong></v-flex>
                    <v-flex xs9>: {{ selected_rojasa.SupplierName }}</v-flex>

                    <v-flex xs3 class="pr-2"><strong>Catatan</strong></v-flex>
                    <v-flex xs9>: {{ selected_rojasa.ReceiveOrderPoNote }}</v-flex>
                </v-layout>
            </v-card-text>
            <v-card-actions>
                <v-spacer></v-spacer>
                <v-btn @click="batalDelete()" color="error" class="white--text">Batal</v-btn>
                <v-btn @click="confirmDelete()" color="primary" class="white--text">Hapus</v-btn>
            </v-card-actions>
        </v-card>
    </v-dialog>
</template>

<script>
module.exports = {
    data() {
        return {
            
        }
    },
    computed: {
        dialog_deletero: {
            get() {
                return this.$store.state.roservice.dialog_deletero
            },
            set(val) {
                this.$store.commit("roservice/update_dialog_deletero", val)
            }
        },
        selected_rojasa: {
            get() {
                return this.$store.state.roservice.selected_rojasa
            },
            set(val) {
                this.$store.commit("roservice/update_selected_rojasa", val)
            }
        },
        loading_process() {
            return this.$store.state.roservice.loading_process
        }
    },
    methods: {
        batalDelete() {
            this.selected_rojasa = {}
            this.dialog_deletero = false
        },
        confirmDelete() {
            if (!this.loading_process) {
                this.$store.dispatch("roservice/deleteReceiveOrder")
            } else {
                let snac = {color: 'warning', msg: 'proses sedang berjalan', state: true}
                this.$store.commit('roservice/update_snackbar', snac)
            }
        }
    },
}
</script>