Fotoliste.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {#await fotos}
  2. {:then fotosFertig}
  3. {#each R.lodash.chunk(schueler, 25) as slice}
  4. <div class="page grid" orientation="portrait" size="A4">
  5. <div class="main">
  6. <h5>{slice[0].Klasse}</h5>
  7. Stand: {datum}
  8. <div class="grid">
  9. {#each slice as s}
  10. <div>
  11. <img src="data:image/jpg;base64,{fotosFertig[s.ID]}" alt="Foto" style="width: 120px">
  12. <br>
  13. {s.Name}, {s.Vorname}
  14. </div>
  15. {/each}
  16. </div>
  17. </div>
  18. </div>
  19. {/each}
  20. {/await}
  21. <style>
  22. @import 'css/main.css';
  23. .grid {
  24. display: grid;
  25. grid-template-columns: repeat(5, 1fr);
  26. grid-gap: 10px;
  27. }
  28. </style>
  29. <script>
  30. const SchuelerFoto = R.models.Schuelerfoto
  31. export default {
  32. computed: {
  33. fotos: async ({schueler, knexConfig}) => {
  34. let f = {}
  35. const knex = await R.knex(knexConfig)
  36. await SchuelerFoto.knex(knex)
  37. const schuelerfotos = await SchuelerFoto.query().whereIn('Schueler_ID', schueler.map(s => s.ID))
  38. schuelerfotos.forEach(element => {
  39. f[element.Schueler_ID] = Buffer.from(element.Foto, 'binary').toString('base64')
  40. })
  41. return f
  42. }
  43. },
  44. data () { return { datum: new Date().toLocaleDateString('de', {day: '2-digit', month: '2-digit', year: 'numeric'}) } },
  45. helpers: { R },
  46. }
  47. </script>