Medien.svelte 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <script>
  2. import { medien } from "./../../stores.js";
  3. import { group_by, chunk } from "./../../helpers.js";
  4. const anzahl = 30;
  5. $: medien_filter = group_by($medien, "medien_id");
  6. </script>
  7. {#each chunk(Object.entries(medien_filter), anzahl) as slice, i}
  8. <div class="page grid" orientation="portrait" size="A4">
  9. <div class="main">
  10. <h2 class="subtitle">
  11. Verfügbare Medien – {new Date().toLocaleDateString('de', { day: '2-digit', month: '2-digit', year: 'numeric' })}
  12. </h2>
  13. {#if $medien.length}
  14. <table class="table">
  15. <thead>
  16. <tr>
  17. <th />
  18. <th>Titel</th>
  19. <th>Verliehen/Gesamtbestand</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. {#each slice as [n, m], ii}
  24. <tr>
  25. <td>{i * anzahl + ii + 1}</td>
  26. <td>{m[0].medien_name}</td>
  27. <td>
  28. {m.filter(i => i.verliehen).length}/{m.filter(i => i.exemplar_id).length}
  29. </td>
  30. </tr>
  31. {/each}
  32. </tbody>
  33. </table>
  34. {:else}– Bibliothek? Es sind noch keine Medien eingetragen –{/if}
  35. </div>
  36. </div>
  37. {/each}