<script setup lang="ts">
import { ref } from "vue";
const dialog = ref(false)
defineExpose({
  dialog
});

// const model = defineModel<boolean>();

const props = defineProps({
  dialogTitle: {
    type: String,
    default: ''
  },

  dialogMessage: {
    type: String,
    default: ''
  }
});

const emit = defineEmits(['confirm']);

function handleConfirmDialog(data) {
  emit('confirm'); // Memberitahu parent untuk tambah data
  dialog.value = false; // Tutup dialog
}


</script>

<template>
  <v-dialog v-model="dialog" persistent class="dialog-mw" max-width="500">
    <v-card class="pa-6">
      <v-card-title class="text-h5">
        {{ dialogTitle}}
      </v-card-title>
      <v-card-text>{{ dialogMessage }}</v-card-text>
      <v-card-actions>
        <v-spacer></v-spacer>
        <v-btn color="error" variant="tonal" @click="dialog = false" flat>
          Tidak
        </v-btn>
        <v-btn color="success" variant="tonal" @click="handleConfirmDialog(1)" flat>
          Ya
        </v-btn>
      </v-card-actions>
    </v-card>
  </v-dialog>
</template>
