From 60ad1d127de7f35c2afb81e3168149f0f3941a3b Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 27 Oct 2024 19:24:21 +0100 Subject: [PATCH] Include transitions to confirmed and declined --- app/ui/guests/table.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/ui/guests/table.tsx b/app/ui/guests/table.tsx index 5eb896e..f760e18 100644 --- a/app/ui/guests/table.tsx +++ b/app/ui/guests/table.tsx @@ -26,12 +26,15 @@ export default function guestsTable() { }); }; + const handleInviteGuest = (e: React.MouseEvent) => handleGuestChange(e, 'invited'); + const handleConfirmGuest = (e: React.MouseEvent) => handleGuestChange(e, 'confirmed'); + const handleDeclineGuest = (e: React.MouseEvent) => handleGuestChange(e, 'declined'); - const handleInviteGuest = (e: React.MouseEvent) => { + const handleGuestChange = (e: React.MouseEvent, status:string) => { fetch("/api/guests/bulk_update.json", { method: 'POST', - body: JSON.stringify({ properties: { status: "invited" }, guest_ids: [e.currentTarget.getAttribute('data-guest-id')] }), + body: JSON.stringify({ properties: { status: status }, guest_ids: [e.currentTarget.getAttribute('data-guest-id')] }), headers: { 'Content-Type': 'application/json', 'X-CSRF-TOKEN': getCsrfToken(), @@ -42,6 +45,7 @@ export default function guestsTable() { } guests.length === 0 && loadGuests(); + const ctaClassName = "text-white py-1 px-2 mx-1 rounded"; return (
@@ -97,9 +101,15 @@ export default function guestsTable() { - {guest.status === 'Considered' && ()} + {guest.status === 'Invited' && ()} + {guest.status === 'Invited' && ()} ))}