Add body text

This commit is contained in:
Ramon Wenger 2023-05-02 15:32:27 +02:00
parent 17028b8905
commit ba2d4df639
2 changed files with 12 additions and 8 deletions

View File

@ -5,7 +5,7 @@
<DialogPanel class="w-full max-w-2xl bg-white pt-8"> <DialogPanel class="w-full max-w-2xl bg-white pt-8">
<div class="px-8 pb-4"> <div class="px-8 pb-4">
<DialogTitle class="relative mb-8 flex flex-row">{{ title }}</DialogTitle> <DialogTitle class="relative mb-8 flex flex-row">{{ title }}</DialogTitle>
Hallo Velo <p v-html="content" />
</div> </div>
<div class="flex flex-row-reverse gap-x-4 border-t border-t-gray-500 p-4"> <div class="flex flex-row-reverse gap-x-4 border-t border-t-gray-500 p-4">
<button class="btn-primary" @click="confirm">Löschen</button> <button class="btn-primary" @click="confirm">Löschen</button>
@ -22,6 +22,7 @@ import { Dialog, DialogPanel, DialogTitle } from "@headlessui/vue";
defineProps<{ defineProps<{
isOpen: boolean; isOpen: boolean;
title: string; title: string;
content: string;
}>(); }>();
const emit = defineEmits(["confirm", "close"]); const emit = defineEmits(["confirm", "close"]);

View File

@ -66,7 +66,8 @@
</ItModal> </ItModal>
<ConfirmDialog <ConfirmDialog
:is-open="showConfirm" :is-open="showConfirm"
title="Heyho" :title="$t('circlePage.documents.deleteModalTitle')"
:content="$t('circlePage.documents.deleteModalWarning', { title: documentName })"
@close="close" @close="close"
@confirm="confirm" @confirm="confirm"
/> />
@ -109,13 +110,16 @@ const dropdownLearningSequences = computed(() =>
name: sequence.title, name: sequence.title,
})) }))
); );
type ResolveReject = (v: any) => void; // confirm dialog
// todo: refactor to own service
type ResolveReject = (v: unknown) => void;
const showConfirm = ref(false); const showConfirm = ref(false);
const confirm = ref<ResolveReject | undefined>(); const confirm = ref<ResolveReject | undefined>();
const close = ref<ResolveReject | undefined>(); const close = ref<ResolveReject | undefined>();
const documentName = ref("");
const deleteDocument = (doc: CircleDocument) => { const deleteDocument = (doc: CircleDocument) => {
// courseSessionsStore.removeDocument(doc.id);
showConfirm.value = true; showConfirm.value = true;
documentName.value = doc.name;
const modalDialog = new Promise((resolve, reject) => { const modalDialog = new Promise((resolve, reject) => {
confirm.value = resolve; confirm.value = resolve;
close.value = reject; close.value = reject;
@ -123,16 +127,15 @@ const deleteDocument = (doc: CircleDocument) => {
modalDialog modalDialog
.then( .then(
() => { () => {
console.log("confirmed");
courseSessionsStore.removeDocument(doc.id); courseSessionsStore.removeDocument(doc.id);
showConfirm.value = false;
}, },
() => { () => {
console.log("just closing"); showConfirm.value = false;
} }
) )
.finally(() => { .finally(() => {
console.log("closing"); documentName.value = "";
showConfirm.value = false;
}); });
}; };
watch(showUploadModal, () => (showUploadErrorMessage.value = false)); watch(showUploadModal, () => (showUploadErrorMessage.value = false));