0f14f26fd3
- replace hardcoded ROLE_ADMIN check with usePermissions().can('directory.{clients,prospects}.manage')
- rename misleading isAdmin prop to canManage in CommercialReportTab and ReportDocumentList
- add busy guard on delete confirmation modal to prevent duplicate DELETE on double-click
62 lines
2.0 KiB
Vue
62 lines
2.0 KiB
Vue
<template>
|
|
<Teleport v-if="modelValue" to="body">
|
|
<Transition name="modal" appear>
|
|
<div class="fixed inset-0 z-[70] flex items-center justify-center">
|
|
<div class="absolute inset-0 bg-black/30" @click.stop="cancel" />
|
|
<div class="relative z-10 w-full max-w-md rounded-lg bg-white p-6 shadow-xl">
|
|
<h3 class="text-lg font-bold text-neutral-900">{{ $t('directory.reports.confirmDeleteTitle') }}</h3>
|
|
<p class="mt-3 text-sm text-neutral-600">
|
|
{{ $t('directory.reports.confirmDeleteMessage') }}
|
|
</p>
|
|
<div class="mt-6 flex justify-end gap-3">
|
|
<MalioButton
|
|
variant="tertiary"
|
|
:label="$t('common.cancel')"
|
|
button-class="w-auto px-4"
|
|
:disabled="busy"
|
|
@click="cancel"
|
|
/>
|
|
<MalioButton
|
|
variant="danger"
|
|
:label="$t('common.delete')"
|
|
button-class="w-auto px-4"
|
|
:disabled="busy"
|
|
@click="$emit('confirm')"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Transition>
|
|
</Teleport>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const props = defineProps<{
|
|
modelValue: boolean
|
|
// Suppression en cours : on désactive les actions pour éviter un double envoi.
|
|
busy?: boolean
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'update:modelValue', value: boolean): void
|
|
(e: 'confirm'): void
|
|
}>()
|
|
|
|
function cancel() {
|
|
if (props.busy) return
|
|
emit('update:modelValue', false)
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.modal-enter-active,
|
|
.modal-leave-active {
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
.modal-enter-from,
|
|
.modal-leave-to {
|
|
opacity: 0;
|
|
}
|
|
</style>
|