aboutsummaryrefslogtreecommitdiff
path: root/src/components/PeerTeachers/PeerTeachers.svelte
blob: 28648d5286b6508c6fba4ce6b77beaa8a879683a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<script lang="ts">
  import { each } from "svelte/internal";
  import { labStore, ptStore } from "../../stores";
  import type PeerTeacher from "src/models/PeerTeacher";

  $: peerTeachers = [...$ptStore.values()].sort((a, b) =>
    a.lastname.toUpperCase() === b.lastname.toUpperCase()
      ? a.firstname.toUpperCase().localeCompare(b.firstname.toUpperCase())
      : a.lastname.toUpperCase().localeCompare(b.lastname.toUpperCase())
  );
  const headers = ["", "Name", "UIN", "Labs"];
</script>

<div class="overflow-scroll">
  <div class="overflow-auto ">
    <table class="table w-full">
      <!-- head -->
      <thead>
        <tr>
          {#each headers as header}
            <th>{header}</th>
          {/each}
        </tr>
      </thead>
      <tbody>
        {#each peerTeachers as pt, i}
          <tr>
            <th>{i + 1}</th>
            <th>{pt.name}</th>
            <th>{pt.id}</th>
            <th>
              {#each Array.from(pt.labs) as lab_id}
                {lab_id}, 
              {/each}
            </th>
          </tr>
        {/each}
      </tbody>
    </table>
  </div>
</div>