Skip to content

Commit

Permalink
Fix bugs in event console (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanyychen authored May 30, 2024
1 parent 54c2774 commit 831d2dc
Showing 1 changed file with 39 additions and 58 deletions.
97 changes: 39 additions & 58 deletions frontend/src/Components/Events/CustomizableEventConsole.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
onMount(fetchAllEventData);
// generate a console table
let selectedProperties = ["Name", "Check Off", "Points", "Edit Points", "Sign In Time", ];
let selectedProperties = ["Name", "Check Off", "Points", "Edit Points", "Sign In Time"];
let hiddenProperties = ["Email"]
filters = [(row) => row["Sign In Time"] != undefined];
Expand Down Expand Up @@ -203,13 +203,6 @@
hiddenElement.click();
}
let selectedProperties = [
"Name",
"Check Off",
"Points",
"Edit Points",
"Sign In Time",
];
filters = [(row) => row["Sign In Time"] != undefined];
</script>

Expand Down Expand Up @@ -346,68 +339,56 @@
</div>

<table style="margin-top: 0px;">
<tr>
{#each selectedProperties as property}
<th>{property}</th>
{/each}
</tr>
{#key sortedRows}
{#each sortedRows as object}
<thead>
<tr>
{#each selectedProperties as property}
<th>{property}</th>
{/each}
{#each hiddenProperties as property}
<th class="hidden">{property}</th>
{/each}
</tr>
{#each sortedRows as object}
</thead>
<tbody>
{#each sortedRows as object (object.id)}
<tr>
{#each selectedProperties as property}
{#if typeof object[property] == "object"}
<td>
{#if object[property].text == "Edit Points" & object["Check Off Id"] == undefined}
{#if object[property].text == "Edit Points" && object["Check Off Id"] == undefined}
<button
on:click={object[property].onclick.apply(
null,
object[property].args,
);
}}
disabled="true"
style="background-color: gray;"
>
{object[property].text}
</button>
{:else}
<button
on:click={() => {
object[property].onclick.apply(
null,
object[property].args,
).then(
(value) => fetchAllEventData(),
(reason) => fetchAllEventData()
)
}}
>
{object[property].text}
</button>
{/if}
</td>
{:else}
<td
>{object[property] === undefined
? "N/A"
: object[property]}</td
>
{/if}
{/each}
{#each hiddenProperties as property}
<td class="hidden">{object[property] === undefined ? "N/A" : object[property]}</td>
{/each}
</tr>
{/each}
{/key}
object[property].args
)}
disabled="true"
style="background-color: gray;"
>
{object[property].text}
</button>
{:else}
<button
on:click={() => {
object[property].onclick.apply(
null,
object[property].args
).then(
(value) => fetchAllEventData(),
(reason) => fetchAllEventData()
)
}}
>
{object[property].text}
</button>
{/if}
</td>
{:else}
<td>{object[property] === undefined ? "N/A" : object[property]}</td>
{/if}
{/each}
{#each hiddenProperties as property}
<td class="hidden">{object[property] === undefined ? "N/A" : object[property]}</td>
{/each}
</tr>
{/each}
</tbody>
</table>

<button id="downloadButton" type="button" on:click={() => download_table()}>
Expand Down

0 comments on commit 831d2dc

Please sign in to comment.