paedml Druckliste alle.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. {#await gruppe}
  2. {:then gruppeP}
  3. {#each Object.entries(gruppeP) as [klasse, schueler]}
  4. {#each R.lodash.chunk(schueler, 10) as slice}
  5. <div class="page" orientation="portrait" size="A4">
  6. <div class="grid">
  7. <b style="padding: 5px 0 0 5px">{klasse}</b>
  8. {#each slice as s}
  9. <div>
  10. <table style="width: 100%; margin-bottom: 15px; margin-left: 30px">
  11. <tr>
  12. <td style="width: 50%"><b>{s.Name}, {s.Vorname}</b></td>
  13. <td>Ihr Benutzername: b{s.ID}</td>
  14. </tr>
  15. <tr>
  16. <td></td>
  17. <td>Ihr Passwort: {h(s.ID)}</td>
  18. </tr>
  19. </table>
  20. </div>
  21. <hr>
  22. {/each}
  23. </div>
  24. </div>
  25. {/each}
  26. {/each}
  27. {/await}
  28. <style>
  29. @import 'daten/main.css';
  30. .page {padding: 0;}
  31. .grid {
  32. display: grid;
  33. grid-template-columns: repeat(1, 1fr);
  34. grid-gap: 20px;
  35. }
  36. </style>
  37. <script>
  38. import Hashids from 'hashids'
  39. const hashids = new Hashids('schild.report hashing salt', 8, 'abcdefghkmnpqrstuvwxyz23456789')
  40. function h (id) { return hashids.encode(id) }
  41. export default {
  42. computed: {
  43. gruppe: async ({schueler, knexConfig}) => {
  44. const Schueler = await R.models.Schueler
  45. const knex = await R.knex(knexConfig)
  46. Schueler.knex(knex)
  47. const klasse = await Schueler.query()
  48. .where('Status', '2')
  49. .andWhere('Geloescht', '-')
  50. .andWhere('Gesperrt', '-')
  51. .select('ID', 'Name', 'Vorname', 'Klasse')
  52. .orderBy('Klasse')
  53. .orderBy('Name')
  54. return R.lodash.groupBy(klasse, 'Klasse')
  55. }
  56. },
  57. helpers: { h, R },
  58. }
  59. </script>