web/app/components/DeleteDialog.vue
Yoga Pangestu a71be47b58 feat: update sidebar and header layout; fix dnd-kit-vue import error
- Fixed import error for `dnd-kit-vue` by installing the package.
- Moved user navigation from sidebar to header, adding a dropdown for account options.
- Added homepage and notification icons to the header.
- Implemented sticky header functionality during scroll.
- Grouped sidebar menu items under a "Master" label for better organization.
- Updated relevant components and package.json to include new dependencies.
2026-07-24 11:47:46 +07:00

60 lines
1.6 KiB
Vue

<script setup lang="ts">
import { Loader2 } from '@lucide/vue'
import { Button } from '@/components/ui/button'
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog'
const props = defineProps<{
open: boolean
title?: string
description?: string
itemName?: string
loading?: boolean
}>()
const emit = defineEmits<{
'update:open': [value: boolean]
confirm: []
}>()
const dialogTitle = computed(() => props.title ?? 'Hapus Item')
const dialogDescription = computed(() => {
if (props.description) return props.description
if (props.itemName) {
return `Apakah Anda yakin ingin menghapus "${props.itemName}"? Tindakan ini tidak dapat dibatalkan.`
}
return 'Apakah Anda yakin ingin menghapus item ini? Tindakan ini tidak dapat dibatalkan.'
})
function handleClose() {
emit('update:open', false)
}
</script>
<template>
<Dialog :open="open" @update:open="emit('update:open', $event)">
<DialogContent class="sm:max-w-[400px]">
<DialogHeader>
<DialogTitle>{{ dialogTitle }}</DialogTitle>
<DialogDescription>{{ dialogDescription }}</DialogDescription>
</DialogHeader>
<DialogFooter>
<DialogClose as-child>
<Button variant="outline" :disabled="loading">Batal</Button>
</DialogClose>
<Button variant="destructive" :disabled="loading" @click="emit('confirm')">
<Loader2 v-if="loading" class="h-4 w-4 mr-1 animate-spin" />
Hapus
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>