<script setup>
import { useQuasar } from "quasar";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const props = defineProps({
  to: [String, Object],
  icon: { type: String, default: "sym_o_delete" },
  tooltip: { type: String, default: "" }
});
const emit = defineEmits(["submit"]);
const qua = useQuasar();
const onDelete = () => {
  qua.dialog({
    title: t("Delete"),
    message: t("Are you sure you want to delete this record?"),
    cancel: true,
    persistent: true,
    color: "negative"
  }).onOk(async () => {
    emit("submit");
  });
};
</script>

<template>
    <q-btn flat round :icon="icon" @click="onDelete">
        <q-tooltip v-if="tooltip">{{ tooltip }}</q-tooltip>
    </q-btn>
</template>
