Compare commits
No commits in common. "main" and "invitations-download-pdf" have entirely different histories.
main
...
invitation
@ -10,8 +10,6 @@ export interface Api<T extends Entity> {
|
|||||||
create(serializable: Serializable<T>, object: T, callback: (object: T) => void): void;
|
create(serializable: Serializable<T>, object: T, callback: (object: T) => void): void;
|
||||||
update(serializable: Serializable<T>, object: T, callback: () => void): void;
|
update(serializable: Serializable<T>, object: T, callback: () => void): void;
|
||||||
destroy(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> {
|
export interface Serializable<T> {
|
||||||
@ -100,14 +98,4 @@ export class AbstractApi<T extends Entity> implements Api<T> {
|
|||||||
}).then(callback)
|
}).then(callback)
|
||||||
.catch((error) => console.error(error));
|
.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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ import { LinkIcon, TrashIcon } from "@heroicons/react/24/outline";
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { classNames } from "../components/button";
|
import { classNames } from "../components/button";
|
||||||
import { Toast } from "primereact/toast";
|
|
||||||
|
|
||||||
function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: {
|
function InvitationCard({ invitation, allGuests, onGuestAdded, onDestroy }: {
|
||||||
invitation: Invitation,
|
invitation: Invitation,
|
||||||
@ -118,7 +117,6 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
|||||||
guests: Array<Guest>,
|
guests: Array<Guest>,
|
||||||
invitations: Array<Invitation>
|
invitations: Array<Invitation>
|
||||||
}) {
|
}) {
|
||||||
const toast = useRef<Toast>(null);
|
|
||||||
const api = new AbstractApi<Invitation>();
|
const api = new AbstractApi<Invitation>();
|
||||||
const serializer = new InvitationSerializer();
|
const serializer = new InvitationSerializer();
|
||||||
|
|
||||||
@ -148,19 +146,14 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDownloadQrCodes() {
|
function handleDownloadQrCodes() {
|
||||||
api.post(serializer, 'email', () => {
|
api.getAllPdf(serializer, () => {
|
||||||
toast.current?.show({
|
console.log("QR codes downloaded");
|
||||||
severity: 'success',
|
|
||||||
summary: 'Email scheduled',
|
|
||||||
detail: 'A document with the QR codes will be sent to the organizer\'s email.'
|
|
||||||
});
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-screen">
|
<div className="flex h-screen">
|
||||||
{/* Left Column: Guests */}
|
{/* Left Column: Guests */}
|
||||||
<Toast ref={toast} />
|
|
||||||
<div className="w-1/4 h-full overflow-auto border-r border-gray-300 p-4">
|
<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>
|
<h2 className="text-lg font-semibold mb-4">{unassignedGuests.length} guests without invitation</h2>
|
||||||
<div>
|
<div>
|
||||||
@ -187,7 +180,7 @@ export default function InvitationsBoard({ guests, invitations: originalInvitati
|
|||||||
onClick={handleDownloadQrCodes}
|
onClick={handleDownloadQrCodes}
|
||||||
className={classNames('primary')}
|
className={classNames('primary')}
|
||||||
>
|
>
|
||||||
Send QR codes via email
|
Download QR codes
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"bcrypt": "^6.0.0",
|
"bcrypt": "^6.0.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"dompurify": "^3.2.6",
|
"dompurify": "^3.2.6",
|
||||||
"next": "15.4.5",
|
"next": "15.3.4",
|
||||||
"next-auth": "5.0.0-beta.29",
|
"next-auth": "5.0.0-beta.29",
|
||||||
"postcss": "8.5.6",
|
"postcss": "8.5.6",
|
||||||
"primeicons": "^7.0.0",
|
"primeicons": "^7.0.0",
|
||||||
@ -27,12 +27,12 @@
|
|||||||
"typescript": "5.8.3",
|
"typescript": "5.8.3",
|
||||||
"use-debounce": "^10.0.1",
|
"use-debounce": "^10.0.1",
|
||||||
"uuid": "11.1.0",
|
"uuid": "11.1.0",
|
||||||
"zod": "^4.0.0"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.52.0",
|
"@playwright/test": "^1.52.0",
|
||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
"@types/node": "24.3.1",
|
"@types/node": "24.0.7",
|
||||||
"@types/react": "18.3.23",
|
"@types/react": "18.3.23",
|
||||||
"@types/react-dom": "18.3.7",
|
"@types/react-dom": "18.3.7",
|
||||||
"wait-on": "^8.0.3"
|
"wait-on": "^8.0.3"
|
||||||
@ -40,5 +40,5 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=23.0.0"
|
"node": ">=23.0.0"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@10.13.1+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad"
|
"packageManager": "pnpm@10.12.3+sha512.467df2c586056165580ad6dfb54ceaad94c5a30f80893ebdec5a44c5aa73c205ae4a5bb9d5ed6bb84ea7c249ece786642bbb49d06a307df218d03da41c317417"
|
||||||
}
|
}
|
||||||
|
717
pnpm-lock.yaml
generated
717
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user