<template>
    <v-dialog v-model="dialog_deletepojasa" persistent width="40vw">
        <v-card>
            <v-card-title class="headline grey lighten-2">DELETE REQUEST PO JASA</v-card-title>
            <v-card-text>
                <v-layout row wrap>
                    <v-flex xs3 class="pr-2"><strong>Nomor</strong></v-flex>
                    <v-flex xs9>: {{ deleted_pojasa.PurchaseOrderNumber }}</v-flex>

                    <v-flex xs3 class="pr-2"><strong>Tanggal</strong></v-flex>
                    <v-flex xs9>: {{ deleted_pojasa.PurchaseOrderDate }}</v-flex>

                    <v-flex xs3 class="pr-2"><strong>Cabang</strong></v-flex>
                    <v-flex xs9>: {{ deleted_pojasa.M_BranchName }}</v-flex>

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

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

<script>
module.exports = {
    data() {
        return {
            
        }
    },
    computed: {
        dialog_deletepojasa: {
            get() {
                return this.$store.state.poservice.dialog_deletepojasa
            },
            set(val) {
                this.$store.commit("poservice/update_dialog_deletepojasa", val)
            }
        },
        deleted_pojasa: {
            get() {
                return this.$store.state.poservice.deleted_pojasa
            },
            set(val) {
                this.$store.commit("poservice/update_deleted_pojasa", val)
            }
        },
        loading_process() {
            return this.$store.state.poservice.loading_process
        }
    },
    methods: {
        batalDELJasa() {
            this.deleted_pojasa = {}
            this.dialog_deletepojasa = false
        },
        DeletePOJasa() {
            if (!this.loading_process) {
                this.$store.dispatch("poservice/deletePOJasa")
            } else {
                let snac = {color: 'warning', msg: 'proses sedang berjalan', state: true}
                this.$store.commit('poservice/update_snackbar', snac)
            }
        }
    },
}
</script>