From 7e6fe8f378a719e2a09842cb325ef8af8815172f Mon Sep 17 00:00:00 2001 From: "Keng Lien(Roger) Lin" Date: Thu, 11 Apr 2024 22:37:47 -0700 Subject: [PATCH 1/2] copy rsvp attendee's email when on rsvp tab --- .../Events/CustomizableEventConsole.svelte | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/frontend/src/Components/Events/CustomizableEventConsole.svelte b/frontend/src/Components/Events/CustomizableEventConsole.svelte index 7836b6ee..786af505 100644 --- a/frontend/src/Components/Events/CustomizableEventConsole.svelte +++ b/frontend/src/Components/Events/CustomizableEventConsole.svelte @@ -12,6 +12,7 @@ export let event; let eventid = event.pk; let emailsCheckedOff = []; + let emailsRsvp = []; async function isAdmin() { let response = await fetch(`/api/permissions/`).then(value => value.json()); @@ -33,6 +34,31 @@ } } + async function copyToClipboard(text, sign_tab) { + if(text.length == 0){ + alert("No checked off attendees!"); + }else{ + if(sign_tab){ + try { + await navigator.clipboard.writeText(text); + alert("Checked-Off attendee's email copied to clipboard!"); + } catch (err) { + console.error("Failed to copy:", err); + alert("Failed to copy text to clipboard."); + } + }else{ + try { + await navigator.clipboard.writeText(text); + alert("RSVP'd attendee's email copied to clipboard!"); + } catch (err) { + console.error("Failed to copy:", err); + alert("Failed to copy text to clipboard."); + } + } + + } + } + // This variable is used by the EditPointsModal to select a particular user // and edit that user's points. It is set to one of the rows of the table // during the Edit Points button on:click event. @@ -86,6 +112,7 @@ }); rows.forEach((row) => { + emailsRsvp.push(row["Email"]); if (row["Check Off Id"] !== undefined) { emailsCheckedOff.push(row["Email"]); } @@ -127,20 +154,6 @@ return rows; } - async function copyToClipboard(text) { - if(text.length == 0){ - alert("No checked off attendees!"); - }else{ - try { - await navigator.clipboard.writeText(text); - alert("Text copied to clipboard!"); - } catch (err) { - console.error("Failed to copy:", err); - alert("Failed to copy text to clipboard."); - } - } - } - // Filter Table let generateTablePromise = generateTable(); let indexedRows = new Map(); @@ -220,7 +233,6 @@ }}> RSVP List - + {#await generateTablePromise}

loading...

From b1eb38e498c3a88ad9ae1095bebc55b0d445c385 Mon Sep 17 00:00:00 2001 From: "Keng Lien(Roger) Lin" Date: Thu, 11 Apr 2024 22:40:27 -0700 Subject: [PATCH 2/2] Fix copy to clipboard alert, fix logic --- .../src/Components/Events/CustomizableEventConsole.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Components/Events/CustomizableEventConsole.svelte b/frontend/src/Components/Events/CustomizableEventConsole.svelte index 786af505..9459ab09 100644 --- a/frontend/src/Components/Events/CustomizableEventConsole.svelte +++ b/frontend/src/Components/Events/CustomizableEventConsole.svelte @@ -257,9 +257,9 @@