feat: show createdAt only when chrono application table view

This commit is contained in:
Sebastian Pravda 2023-02-15 15:53:57 +01:00
parent 6d1b3a86c0
commit c905effd92
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
2 changed files with 10 additions and 5 deletions

View file

@ -3,6 +3,7 @@
import type { CandidatePreview } from '$lib/stores/candidate';
export let candidates: Array<CandidatePreview> = [];
export let showCreatedAt: boolean;
const formatRustChronoDateTime = (date?: string) => {
if (!date) return '';
@ -24,7 +25,9 @@
<th scope="col"> Obor </th>
<th scope="col"> Rodné číslo </th>
<th scope="col"> Link </th>
<th scope="col"> Vytvořeno </th>
{#if showCreatedAt}
<th scope="col"> Vytvořeno </th>
{/if}
<th scope="col" />
</tr>
</thead>
@ -47,9 +50,11 @@
<td class="text-gray-900">
{candidate.relatedApplications?.filter((a) => a !== candidate.applicationId)}
</td>
<td class="text-gray-900">
{formatRustChronoDateTime(candidate.createdAt)}
</td>
{#if showCreatedAt}
<td class="text-gray-900">
{formatRustChronoDateTime(candidate.createdAt)}
</td>
{/if}
<td class="text-sm">
<Delete id={candidate.applicationId} on:delete value="Odstranit" />
</td>

View file

@ -155,7 +155,7 @@
</div>
{/if}
<Table candidates={candidatesTable} on:delete={(event) => deleteCandidate(event.detail.id)} />
<Table showCreatedAt={activeFilter.class === 'Chronologicky'} candidates={candidatesTable} on:delete={(event) => deleteCandidate(event.detail.id)} />
</div>
</div>
</div>