<template>
    <v-dialog v-model="show" max-width="500px">
        <v-card>
            <v-card-title class="headline">
                Konfirmasi
            </v-card-title>

            <v-card-text>
                {{ message }}
            </v-card-text>

            <v-card-actions>
                <v-spacer></v-spacer>
                <v-btn color="grey darken-1" flat @click="handleClose(false)">
                    Batal
                </v-btn>
                <v-btn color="primary" @click="handleClose(true)">
                    Ya
                </v-btn>
            </v-card-actions>
        </v-card>
    </v-dialog>
</template>

<script>
const _ = require('lodash')

module.exports = {
    name: 'ActionDialog',

    props: {
        value: {
            type: Boolean,
            default: false
        },
        message: {
            type: String,
            default: 'Apakah Anda yakin?'
        }
    },

    computed: {
        show: {
            get: function () {
                return this.value
            },
            set: function (value) {
                this.$emit('input', value)
            }
        }
    },

    methods: {
        handleClose: function (confirmed) {
            this.$emit('close', confirmed)
        }
    }
}
</script>