diff --git a/src/routes/console/project-[project]/messaging/create.svelte b/src/routes/console/project-[project]/messaging/create.svelte index 7cf554d2a..8d137a0fc 100644 --- a/src/routes/console/project-[project]/messaging/create.svelte +++ b/src/routes/console/project-[project]/messaging/create.svelte @@ -148,6 +148,8 @@ } ] }); + + $wizard.finalAction = create; - + diff --git a/src/routes/console/project-[project]/messaging/wizard/step3.svelte b/src/routes/console/project-[project]/messaging/wizard/step3.svelte index 47b9c2b2e..f240a4041 100644 --- a/src/routes/console/project-[project]/messaging/wizard/step3.svelte +++ b/src/routes/console/project-[project]/messaging/wizard/step3.svelte @@ -5,6 +5,9 @@ import { MessagingProviderType } from '@appwrite.io/console'; import { messageParams, providerType } from './store'; import { isSameDay, toLocaleDateISO, toLocaleTimeISO } from '$lib/helpers/date'; + import { wizard } from '$lib/stores/wizard'; + import { Modal } from '$lib/components'; + import { topicsById } from '../store'; let when: 'now' | 'later' = 'now'; let now = new Date(); @@ -13,6 +16,21 @@ let time: string; let dateTime: Date; let docsUrl = `https://appwrite.io/docs/products/messaging`; + let showConfimation = false; + + let totalTargets = $messageParams[$providerType].targets?.length ?? 0; + + const topics = $messageParams[$providerType].topics; + + for (const topic of topics) { + if ($providerType == MessagingProviderType.Push) { + totalTargets += $topicsById[topic].pushTotal; + } else if ($providerType == MessagingProviderType.Email) { + totalTargets += $topicsById[topic].emailTotal; + } else if ($providerType == MessagingProviderType.Sms) { + totalTargets += $topicsById[topic].smsTotal; + } + } switch ($providerType) { case MessagingProviderType.Email: @@ -40,6 +58,18 @@ timeZoneName: 'longGeneric' }; + async function askForConfirmation() { + $wizard.interceptorNotificationEnabled = false; + showConfimation = true; + throw 'Show confirmation'; + } + + async function submit() { + $wizard.interceptorNotificationEnabled = true; + await $wizard.finalAction(); + showConfimation = false; + } + $: if (when === 'now') { date = time = ''; } @@ -56,7 +86,7 @@ } - + Schedule Schedule the time you want to deliver this message. Learn more in our