From a94df9de575bcd2e95994782c00616e6a96e7d0e Mon Sep 17 00:00:00 2001 From: tree Date: Sat, 30 Apr 2022 06:58:40 +0200 Subject: [PATCH] Update --- src/routes/specialni-vstupenky.svelte | 169 +++++++++++++++++--------- src/routes/vstupenky.svelte | 6 +- 2 files changed, 113 insertions(+), 62 deletions(-) diff --git a/src/routes/specialni-vstupenky.svelte b/src/routes/specialni-vstupenky.svelte index 3f16182..c620113 100644 --- a/src/routes/specialni-vstupenky.svelte +++ b/src/routes/specialni-vstupenky.svelte @@ -12,10 +12,31 @@ let lastUpdate = null; let data = null; let speakersWithoutTicket = null; + let selectedType = "all"; + + $: ticketTypes = { + all: { title: "Vše" }, + organizator: { title: "Organizátor" }, + speaker: { title: "Přednášející" }, + partner: { title: "Partner" }, + staff: { title: "Obsluha" }, + host: { title: "Host" }, + }; + + function countType(type = "all") { + if (!data) { + return null; + } + if (type === "all") { + return data.length; + } + const res = data.filter((i) => i.type === type); + return res ? res.length : null; + } async function loadData() { data = await api.apiCall("claims"); - speakersWithoutTicket = speakersWithoutTicketGen() + speakersWithoutTicket = speakersWithoutTicketGen(); lastUpdate = new Date(); } @@ -52,17 +73,17 @@ return arr; } - function speakersWithoutTicketGen () { + function speakersWithoutTicketGen() { if (!data) { - return null + return null; } - const wt = [] - $bundle.spec.speakers.forEach(sp => { - if (!data.find(i => i.link.type === 'speaker' && i.link.id === sp.id)) { - wt.push(sp) + const wt = []; + $bundle.spec.speakers.forEach((sp) => { + if (!data.find((i) => i.link.type === "speaker" && i.link.id === sp.id)) { + wt.push(sp); } - }) - return wt + }); + return wt; } onMount(() => { @@ -83,16 +104,42 @@ {#if speakersWithoutTicket}
-

Přednášející bez kódu ({speakersWithoutTicket.length})

+

+ Přednášející bez kódu ({speakersWithoutTicket.length}) +

- {#each speakersWithoutTicket as sp} -
 {sp.name}
- {/each} + {#each speakersWithoutTicket as sp} +
+
+ +
+  {sp.name}
+
+ {/each}
{/if}
-

Seznam všech speciálních vstupenek ({data.length})

+

+ Seznam všech speciálních vstupenek ({data.length}) +

+
+ {#each Object.keys(ticketTypes) as tid} +
+ +
+ {/each} +
@@ -104,52 +151,54 @@ {#each claimsMap(data) as claim} - - - - - + + + + - + + + {/if} {/each}
{claim.type} - -
- i.id === claim.link.id - )} - col={claim.linkInfo.col} - size="extra-small" - /> -
- {claim.linkInfo.title} - {#if claim.linkInfo.suffix} ({claim.linkInfo - .suffix}){/if} -
-
- {#if claim.claimed} - {claim.ticketId} ({fdate( - claim.claimedOn - )}){:else}-{/if} - - {#if claim.claimed && claim.ticketData} - {#if claim.ticketData.name} - {claim.ticketData.name} - {:else} - Anonym + {#if !selectedType || selectedType === "all" || (selectedType && selectedType === claim.type)} +
{claim.type} + +
+ i.id === claim.link.id + )} + col={claim.linkInfo.col} + size="extra-small" + /> +
+ {claim.linkInfo.title} + {#if claim.linkInfo.suffix} ({claim.linkInfo + .suffix}){/if} +
+
+ {#if claim.claimed} + {claim.ticketId} ({fdate( + claim.claimedOn + )}){:else}-{/if} + + {#if claim.claimed && claim.ticketData} + {#if claim.ticketData.name} + {claim.ticketData.name} + {:else} + Anonym + {/if} + {#if claim.ticketData.org} +  ({claim.ticketData.org}) + {/if} + {#if claim.ticketData.twitter} +   + {/if} {/if} - {#if claim.ticketData.org} -  ({claim.ticketData.org}) - {/if} - {#if claim.ticketData.twitter} -   - {/if} - {/if} -
@@ -158,4 +207,4 @@
Načítám ..
{/if} -
+
diff --git a/src/routes/vstupenky.svelte b/src/routes/vstupenky.svelte index 4229513..3dfccaf 100644 --- a/src/routes/vstupenky.svelte +++ b/src/routes/vstupenky.svelte @@ -37,7 +37,9 @@ public: "Běžná vstupenka", speaker: "Přednášející", organizator: "Organizátor", - host: "Doprovod", + staff: "Obsluha", + partner: "Partner", + host: "Host", }; let forceShow = false; @@ -414,7 +416,7 @@
{/if}
- {#if ticket.type === "speaker" && ticket.link && ticket.link.id} + {#if (ticket.type === "speaker" || ticket.type === "organizator") && ticket.link && ticket.link.id}