<template>
<div>
    <!-- dialog konfirmasi -->
    <v-dialog v-model="dialog_confirmation" persistent width="500">
        <v-card>
            <v-card-title class="headline grey lighten-2" primary-title>
                KONFIRMASI 
                <p class="mb-0 p-0">{{ selected_ro.ReceiveOrderPoNumber }}</p>
            </v-card-title>
            <v-card-text>
                <p>
                Setelah dikonfirmasi RO
                <span class="font-weight-bold">{{ selected_ro.ReceiveOrderPoNumber }}</span>
                tidak bisa di edit dan auto buat jurnal, apakah anda yakin ?
                </p>
            </v-card-text>
            <v-divider></v-divider>
            <v-card-actions>
                <v-spacer></v-spacer>
                <v-btn color="red" flat  @click="dialog_confirmation = false">
                    TIDAK
                </v-btn>
                <v-btn color="green" flat  @click="konfirmRO()">
                    YA
                </v-btn>
            </v-card-actions>
        </v-card>
    </v-dialog>

    <!-- dialog delete -->
    <v-dialog v-model="dialog_delete" persistent width="500">
        <v-card>
            <v-card-title class="headline grey lighten-2" primary-title>
                KONFIRMASI HAPUS 
                <p class="mb-0 p-0">{{ selected_ro.ReceiveOrderPoNumber }}</p>
            </v-card-title>
            <v-card-text>
                <p>
                  Apakah anda yakin menghapus data berikut
                  <span class="font-weight-bold">{{ selected_ro.ReceiveOrderPoNumber }}</span>
                  ?
                </p>
            </v-card-text>
            <v-divider></v-divider>
            <v-card-actions>
                <v-spacer></v-spacer>
                <v-btn color="red" flat outline @click="dialog_delete = false">
                    TIDAK
                </v-btn>
                <v-btn color="green" flat outline @click="deleteRO()">
                    YA
                </v-btn>
            </v-card-actions>
        </v-card>
    </v-dialog>
</div>
</template>

<script>
module.exports = {
    data() {
        return {
            
        }
    },
    computed: {
        dialog_confirmation: {
            get() {
                return this.$store.state.ro.dialog_confirmation;
            },
            set(val) {
                this.$store.commit("ro/update_dialog_confirmation", val);
            }
        },
        dialog_delete: {
            get() {
                return this.$store.state.ro.dialog_delete;
            },
            set(val) {
                this.$store.commit("ro/update_dialog_delete", val);
            }
        },
        selected_ro() {
            return this.$store.state.ro.selected_ro;
        }
    },
    methods: {
        konfirmRO() {
            this.$store.dispatch("form/confirmRO");
        },
        deleteRO() {
            this.$store.dispatch("ro/deleteRO");
        }
    },
}
</script>