123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <script>
- export let schueler, privat, einstellungen = {};
- let teams_anzeigen = einstellungen.teams_anzeigen;
- let schueler_verbergen;
- let lehrer = []
- $: pool.query(`UPDATE einstellungen SET teams_anzeigen=$1`, [teams_anzeigen])
- const { Pool } = R("pg");
- const pool = new Pool({ connectionString: privat.mein_bk_db });
- const query = `SELECT * from lehrer`;
- pool.query(query).then(res => lehrer = res.rows)
- async function update_lehrer (l) {
- await pool.query(`UPDATE lehrer SET konto=$1 WHERE id=$2`, [!l.konto, l.id])
- l.konto = !l.konto
- lehrer = lehrer
- }
- async function update_schueler (s) {
- await pool.query(`UPDATE schueler SET konto=$1 WHERE id=$2`, [!s.konto, s.id])
- s.konto = !s.konto
- schueler = schueler
- }
- </script>
- <style>
- @import "./node_modules/bulma-tooltip/dist/css/bulma-tooltip.min.css";
- </style>
- <h3 class="title">Einverständniserklärungen Teams</h3>
- <div class="field">
- <label class="checkbox">
- <input type="checkbox" bind:checked={teams_anzeigen} />
- Teams-Seite für Schüler anzeigen
- </label>
- </div>
- <div class="field">
- <label class="checkbox">
- <input type="checkbox" bind:checked={schueler_verbergen} />
- Schüler verbergen
- </label>
- </div>
- {#if !schueler_verbergen}
- <div class="columns">
- <div class="column is-two-thirds">
- {#each Object.entries(schueler) as [klasse, schueler]}
- <h3 class="title">{klasse}</h3>
- <table class="table is-striped">
- <thead>
- <tr>
- <th>Name</th>
- <th>Vorname</th>
- <th>Auswahlstatus (Konto, Video, Audio)</th>
- </tr>
- </thead>
- <tbody>
- {#each schueler as s}
- <tr>
- <td>{s.Name}</td>
- <td>{s.Vorname}</td>
- <td class="is-clickable">
- <span
- class="tag"
- on:click={_=>update_schueler(s)}
- class:is-warning={s.konto === undefined || s.konto === null}
- class:is-danger={s.konto === false}
- class:is-success={s.konto}>Konto</span>
- </td>
- </tr>
- {/each}
- </tbody>
- </table>
- {/each}
- </div>
- </div>
- {/if}
- {#if lehrer}
- <div class="columns">
- <div class="column is-two-thirds">
- <h3 class="title">Lehrer</h3>
- <table class="table is-striped">
- <thead>
- <tr>
- <th>Name</th>
- <th>Auswahlstatus (Konto, Video, Audio)</th>
- </tr>
- </thead>
- <tbody>
- {#each lehrer as l}
- <tr>
- <td>{l.name}</td>
- <td class="is-clickable">
- <span
- class="tag"
- on:click={_=>update_lehrer(l)}
- class:is-warning={l.konto === undefined || l.konto === null}
- class:is-danger={l.konto === false}
- class:is-success={l.konto}>Konto</span>
- </td>
- </tr>
- {/each}
- </tbody>
- </table>
- </div>
- </div>
- {/if}
|