nuxt-prawo-jazdy/components/EndModal.vue
NetMan 59497e8b01 exam: warning on refresh and end-exam
warning on end-exam if it isn't the last question - otherwise exam ends without warning
2025-12-15 21:05:54 +01:00

29 lines
918 B
Vue

<script setup lang="ts">
const props = defineProps<{ showModal: boolean }>();
const endModal = useTemplateRef('endModal');
const emit = defineEmits(['hideEndModal', 'endExam']);
watchEffect(() => {
if (props.showModal && endModal.value?.open == false) {
endModal.value?.showModal();
emit('hideEndModal');
}
});
</script>
<template>
<dialog
ref="endModal"
class="flex justify-center items-center backdrop-blur-sm modal"
>
<div class="flex flex-col p-3 bg-base rounded-md gap-3 modal-box min-w-fit">
<h1 class="text-[1.5rem]">Koniec egzaminu</h1>
<div class="*:inline">Czy na pewno chcesz zakończyć egzamin?</div>
<div class="flex flex-row gap-2 justify-around">
<div class="btn btn-lg btn-success" @click="emit('endExam')">Tak</div>
<div class="btn btn-lg btn-error" @click="endModal?.close()">Nie</div>
</div>
</div>
</dialog>
</template>