Compare commits

...

4 Commits

Author SHA1 Message Date
Renovate Bot
662e02f41a Update pnpm to v10.12.4
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 3m26s
Check usage of free licenses / build-static-assets (pull_request) Successful in 2m38s
Build Nginx-based docker image / build-static-assets (push) Successful in 48m42s
Playwright Tests / test (pull_request) Failing after 54m27s
2025-07-09 02:06:14 +00:00
fdffbdf5ef Merge pull request 'Generate invitations PDF asynchronously' (#311) from generate-invitations-doc-async into main
All checks were successful
Check usage of free licenses / build-static-assets (push) Successful in 36s
Playwright Tests / test (push) Successful in 3m52s
Build Nginx-based docker image / build-static-assets (push) Successful in 4m27s
Reviewed-on: #311
2025-07-08 17:49:17 +00:00
fba75025d4 Use a Toast to inform the user about the email that will be sent
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 1m3s
Check usage of free licenses / build-static-assets (pull_request) Successful in 2m2s
Build Nginx-based docker image / build-static-assets (push) Successful in 4m31s
Playwright Tests / test (pull_request) Successful in 11m42s
2025-07-08 19:37:01 +02:00
8f5c038f9c Modify the behavior of the download invitations button to send them via email 2025-07-08 19:26:38 +02:00
3 changed files with 23 additions and 4 deletions

View File

@ -10,6 +10,8 @@ export interface Api<T extends Entity> {
create(serializable: Serializable<T>, object: T, callback: (object: T) => void): void;
update(serializable: Serializable<T>, object: T, callback: () => void): void;
destroy(serializable: Serializable<T>, object: T, callback: () => void): void;
post(serializable: Serializable<T>, path: string, callback: () => void): void;
}
export interface Serializable<T> {
@ -98,4 +100,14 @@ export class AbstractApi<T extends Entity> implements Api<T> {
}).then(callback)
.catch((error) => console.error(error));
}
post(serializable: Serializable<T>, path: string, callback: () => void): void {
fetch(`/api/${getSlug()}/${serializable.apiPath()}/${path}`, {
method: 'POST',
headers: {
'X-CSRF-TOKEN': getCsrfToken(),
}
}).then(callback)
.catch((error) => console.error(error));
}
}

View File

@ -11,6 +11,7 @@ import { LinkIcon, TrashIcon } from "@heroicons/react/24/outline";
import { useEffect, useRef } from "react";
import { useState } from "react";
import { classNames } from "../components/button";
import { Toast } from "primereact/toast";
function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: {
invitation: Invitation,
@ -117,6 +118,7 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
guests: Array<Guest>,
invitations: Array<Invitation>
}) {
const toast = useRef<Toast>(null);
const api = new AbstractApi<Invitation>();
const serializer = new InvitationSerializer();
@ -146,14 +148,19 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
}
function handleDownloadQrCodes() {
api.getAllPdf(serializer, () => {
console.log("QR codes downloaded");
api.post(serializer, 'email', () => {
toast.current?.show({
severity: 'success',
summary: 'Email scheduled',
detail: 'A document with the QR codes will be sent to the organizer\'s email.'
});
})
}
return (
<div className="flex h-screen">
{/* Left Column: Guests */}
<Toast ref={toast} />
<div className="w-1/4 h-full overflow-auto border-r border-gray-300 p-4">
<h2 className="text-lg font-semibold mb-4">{unassignedGuests.length} guests without invitation</h2>
<div>
@ -180,7 +187,7 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
onClick={handleDownloadQrCodes}
className={classNames('primary')}
>
Download QR codes
Send QR codes via email
</button>

View File

@ -40,5 +40,5 @@
"engines": {
"node": ">=23.0.0"
},
"packageManager": "pnpm@10.12.3+sha512.467df2c586056165580ad6dfb54ceaad94c5a30f80893ebdec5a44c5aa73c205ae4a5bb9d5ed6bb84ea7c249ece786642bbb49d06a307df218d03da41c317417"
"packageManager": "pnpm@10.12.4+sha512.5ea8b0deed94ed68691c9bad4c955492705c5eeb8a87ef86bc62c74a26b037b08ff9570f108b2e4dbd1dd1a9186fea925e527f141c648e85af45631074680184"
}