2020-12-04 11:19:16 +01:00
|
|
|
<template>
|
|
|
|
<ConfirmModal
|
2023-08-03 18:28:50 +02:00
|
|
|
:confirm-text="t('general.discard')"
|
|
|
|
:cancel-text="t('general.stay')"
|
2022-05-17 19:11:31 +02:00
|
|
|
@confirm="emit('confirm')"
|
|
|
|
@hide="emit('close')"
|
2020-12-04 11:19:16 +01:00
|
|
|
>
|
2021-12-10 17:34:44 +01:00
|
|
|
<template #header>
|
2020-12-04 11:19:16 +01:00
|
|
|
<div class="d-flex">
|
2023-08-03 18:28:50 +02:00
|
|
|
<i class="mdi mdi-24px mdi-content-save-alert mr-1" /> {{ t('application.unsavedChanges') }}
|
2020-12-04 11:19:16 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
2021-12-10 17:34:44 +01:00
|
|
|
<template #body>
|
2020-12-04 11:19:16 +01:00
|
|
|
<div>
|
2023-08-03 18:28:50 +02:00
|
|
|
{{ t('application.discardUnsavedChanges') }}
|
2020-12-04 11:19:16 +01:00
|
|
|
</div>
|
2021-12-10 17:34:44 +01:00
|
|
|
</template>
|
2020-12-04 11:19:16 +01:00
|
|
|
</ConfirmModal>
|
|
|
|
</template>
|
|
|
|
|
2022-05-17 19:11:31 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { onBeforeUnmount } from 'vue';
|
2022-08-05 17:03:16 +02:00
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
|
2023-08-18 15:57:31 +02:00
|
|
|
import ConfirmModal from '@/components/BaseConfirmModal.vue';
|
|
|
|
|
2022-08-05 17:03:16 +02:00
|
|
|
const { t } = useI18n();
|
2020-12-04 11:19:16 +01:00
|
|
|
|
2022-05-17 19:11:31 +02:00
|
|
|
const emit = defineEmits(['confirm', 'close']);
|
|
|
|
|
|
|
|
const onKey = (e: KeyboardEvent) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
if (e.key === 'Escape')
|
|
|
|
emit('close');
|
2020-12-04 11:19:16 +01:00
|
|
|
};
|
2022-05-17 19:11:31 +02:00
|
|
|
|
|
|
|
window.addEventListener('keydown', onKey);
|
|
|
|
|
|
|
|
onBeforeUnmount(() => {
|
|
|
|
window.removeEventListener('keydown', onKey);
|
|
|
|
});
|
2020-12-04 11:19:16 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.modal-container {
|
|
|
|
max-width: 360px;
|
|
|
|
}
|
|
|
|
</style>
|