|
|
@ -5,6 +5,7 @@ const props = defineProps<{ |
|
|
|
visible: boolean |
|
|
|
visible: boolean |
|
|
|
entityName: string |
|
|
|
entityName: string |
|
|
|
onDelete: () => Promise<void> |
|
|
|
onDelete: () => Promise<void> |
|
|
|
|
|
|
|
deleteLabel?: string | undefined |
|
|
|
}>() |
|
|
|
}>() |
|
|
|
|
|
|
|
|
|
|
|
const emits = defineEmits(['update:visible']) |
|
|
|
const emits = defineEmits(['update:visible']) |
|
|
@ -12,6 +13,10 @@ const visible = useVModel(props, 'visible', emits) |
|
|
|
|
|
|
|
|
|
|
|
const isLoading = ref(false) |
|
|
|
const isLoading = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const { t } = useI18n() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const deleteLabel = computed(() => props.deleteLabel ?? t('general.delete')) |
|
|
|
|
|
|
|
|
|
|
|
const onDelete = async () => { |
|
|
|
const onDelete = async () => { |
|
|
|
isLoading.value = true |
|
|
|
isLoading.value = true |
|
|
|
try { |
|
|
|
try { |
|
|
@ -43,11 +48,15 @@ onKeyStroke('Enter', () => { |
|
|
|
<GeneralModal v-model:visible="visible" size="small" centered> |
|
|
|
<GeneralModal v-model:visible="visible" size="small" centered> |
|
|
|
<div class="flex flex-col p-6"> |
|
|
|
<div class="flex flex-col p-6"> |
|
|
|
<div class="flex flex-row pb-2 mb-4 font-medium text-lg border-b-1 border-gray-50 text-gray-800"> |
|
|
|
<div class="flex flex-row pb-2 mb-4 font-medium text-lg border-b-1 border-gray-50 text-gray-800"> |
|
|
|
{{ $t('general.delete') }} {{ props.entityName }} |
|
|
|
{{ deleteLabel }} {{ props.entityName }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="mb-3 text-gray-800"> |
|
|
|
<div class="mb-3 text-gray-800"> |
|
|
|
{{ $t('msg.areYouSureUWantTo') }}<span class="ml-1">{{ props.entityName.toLowerCase() }}?</span> |
|
|
|
{{ |
|
|
|
|
|
|
|
$t('msg.areYouSureUWantToDeleteLabel', { |
|
|
|
|
|
|
|
deleteLabel: deleteLabel.toLowerCase(), |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}}<span class="ml-1">{{ props.entityName.toLowerCase() }}?</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<slot name="entity-preview"></slot> |
|
|
|
<slot name="entity-preview"></slot> |
|
|
@ -65,7 +74,7 @@ onKeyStroke('Enter', () => { |
|
|
|
data-testid="nc-delete-modal-delete-btn" |
|
|
|
data-testid="nc-delete-modal-delete-btn" |
|
|
|
@click="onDelete" |
|
|
|
@click="onDelete" |
|
|
|
> |
|
|
|
> |
|
|
|
{{ `${$t('general.delete')} ${props.entityName}` }} |
|
|
|
{{ `${deleteLabel} ${props.entityName}` }} |
|
|
|
<template #loading> |
|
|
|
<template #loading> |
|
|
|
{{ $t('general.deleting') }} |
|
|
|
{{ $t('general.deleting') }} |
|
|
|
</template> |
|
|
|
</template> |
|
|
|