This commit is contained in:
tree 2022-04-30 06:58:40 +02:00
rodič ca115f880e
revize a94df9de57
2 změnil soubory, kde provedl 113 přidání a 62 odebrání

Zobrazit soubor

@ -12,10 +12,31 @@
let lastUpdate = null; let lastUpdate = null;
let data = null; let data = null;
let speakersWithoutTicket = 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() { async function loadData() {
data = await api.apiCall("claims"); data = await api.apiCall("claims");
speakersWithoutTicket = speakersWithoutTicketGen() speakersWithoutTicket = speakersWithoutTicketGen();
lastUpdate = new Date(); lastUpdate = new Date();
} }
@ -54,15 +75,15 @@
function speakersWithoutTicketGen() { function speakersWithoutTicketGen() {
if (!data) { if (!data) {
return null return null;
} }
const wt = [] const wt = [];
$bundle.spec.speakers.forEach(sp => { $bundle.spec.speakers.forEach((sp) => {
if (!data.find(i => i.link.type === 'speaker' && i.link.id === sp.id)) { if (!data.find((i) => i.link.type === "speaker" && i.link.id === sp.id)) {
wt.push(sp) wt.push(sp);
} }
}) });
return wt return wt;
} }
onMount(() => { onMount(() => {
@ -83,16 +104,42 @@
</div> </div>
{#if speakersWithoutTicket} {#if speakersWithoutTicket}
<div class="mt-10"> <div class="mt-10">
<h2 class="text-lg font-semibold uppercase">Přednášející bez kódu ({speakersWithoutTicket.length})</h2> <h2 class="text-lg font-semibold uppercase">
Přednášející bez kódu ({speakersWithoutTicket.length})
</h2>
<div class="flex gap-4 flex-wrap mt-4"> <div class="flex gap-4 flex-wrap mt-4">
{#each speakersWithoutTicket as sp} {#each speakersWithoutTicket as sp}
<div><a href="/lide?id={sp.id}"><div class="inline-block align-middle"><Avatar speaker={sp} size="extra-small" /></div>&nbsp;{sp.name}</a></div> <div>
<a href="/lide?id={sp.id}"
><div class="inline-block align-middle">
<Avatar speaker={sp} size="extra-small" />
</div>
&nbsp;{sp.name}</a
>
</div>
{/each} {/each}
</div> </div>
</div> </div>
{/if} {/if}
<div class="mt-10"> <div class="mt-10">
<h2 class="text-lg font-semibold uppercase">Seznam všech speciálních vstupenek ({data.length})</h2> <h2 class="text-lg font-semibold uppercase">
Seznam všech speciálních vstupenek ({data.length})
</h2>
<div class="mt-4 flex gap-4">
{#each Object.keys(ticketTypes) as tid}
<div>
<label class="cursor-pointer"
><input
type="radio"
bind:group={selectedType}
name="type"
value={tid}
/>
{ticketTypes[tid].title} ({countType(tid)})</label
>
</div>
{/each}
</div>
<table class="table-auto mt-6 w-full" cellpadding="6"> <table class="table-auto mt-6 w-full" cellpadding="6">
<thead> <thead>
<tr class="text-xs uppercase text-blue-web/80"> <tr class="text-xs uppercase text-blue-web/80">
@ -104,6 +151,7 @@
</thead> </thead>
<tbody> <tbody>
{#each claimsMap(data) as claim} {#each claimsMap(data) as claim}
{#if !selectedType || selectedType === "all" || (selectedType && selectedType === claim.type)}
<tr <tr
class={claim.claimed class={claim.claimed
? "hover:bg-blue-500/10" ? "hover:bg-blue-500/10"
@ -150,6 +198,7 @@
{/if} {/if}
</td> </td>
</tr> </tr>
{/if}
{/each} {/each}
</tbody> </tbody>
</table> </table>
@ -158,4 +207,4 @@
<div>Načítám ..</div> <div>Načítám ..</div>
{/if} {/if}
</section> </section>
<section class="h-20"></section> <section class="h-20" />

Zobrazit soubor

@ -37,7 +37,9 @@
public: "Běžná vstupenka", public: "Běžná vstupenka",
speaker: "Přednášející", speaker: "Přednášející",
organizator: "Organizátor", organizator: "Organizátor",
host: "Doprovod", staff: "Obsluha",
partner: "Partner",
host: "Host",
}; };
let forceShow = false; let forceShow = false;
@ -414,7 +416,7 @@
</div> </div>
{/if} {/if}
<div class="flex gap-3 text-sm"> <div class="flex gap-3 text-sm">
{#if ticket.type === "speaker" && ticket.link && ticket.link.id} {#if (ticket.type === "speaker" || ticket.type === "organizator") && ticket.link && ticket.link.id}
<a href="/lide?id={ticket.link.id}" <a href="/lide?id={ticket.link.id}"
><Avatar ><Avatar
speaker={$bundle.spec.speakers.find( speaker={$bundle.spec.speakers.find(