|
@@ -1,31 +1,44 @@
|
|
|
<script>
|
|
|
export let schueler, privat, einstellungen;
|
|
|
let schueler_verbergen;
|
|
|
- let lehrer = []
|
|
|
+ let lehrer = [];
|
|
|
+ let liste_export = false;
|
|
|
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_teams () {
|
|
|
- pool.query(`UPDATE einstellungen SET teams_anzeigen=$1`, [!einstellungen.teams_anzeigen])
|
|
|
- einstellungen.teams_anzeigen = !einstellungen.teams_anzeigen
|
|
|
- }
|
|
|
- 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
|
|
|
+ pool.query(query).then((res) => (lehrer = res.rows));
|
|
|
+ async function update_teams() {
|
|
|
+ pool.query(`UPDATE einstellungen SET teams_anzeigen=$1`, [
|
|
|
+ !einstellungen.teams_anzeigen,
|
|
|
+ ]);
|
|
|
+ einstellungen.teams_anzeigen = !einstellungen.teams_anzeigen;
|
|
|
}
|
|
|
- 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
|
|
|
+ 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>
|
|
|
|
|
|
<h3 class="title">Einverständniserklärungen Teams</h3>
|
|
|
<div class="field">
|
|
|
<label class="checkbox">
|
|
|
- <input type="checkbox" bind:checked={einstellungen.teams_anzeigen} on:click={update_teams} />
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ bind:checked={einstellungen.teams_anzeigen}
|
|
|
+ on:click={update_teams}
|
|
|
+ />
|
|
|
Teams-Seite für Schüler anzeigen
|
|
|
</label>
|
|
|
</div>
|
|
@@ -35,6 +48,16 @@
|
|
|
Schüler verbergen
|
|
|
</label>
|
|
|
</div>
|
|
|
+<div class="field">
|
|
|
+ <label class="checkbox">
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ bind:checked={liste_export}
|
|
|
+ on:click={(_) => (liste_export = !liste_export)}
|
|
|
+ />
|
|
|
+ Export anzeigen
|
|
|
+ </label>
|
|
|
+</div>
|
|
|
{#if !schueler_verbergen}
|
|
|
<div class="columns">
|
|
|
<div class="column is-two-thirds">
|
|
@@ -56,10 +79,11 @@
|
|
|
<td class="is-clickable">
|
|
|
<span
|
|
|
class="tag"
|
|
|
- on:click={_=>update_schueler(s)}
|
|
|
+ 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>
|
|
|
+ class:is-success={s.konto}>Konto</span
|
|
|
+ >
|
|
|
</td>
|
|
|
</tr>
|
|
|
{/each}
|
|
@@ -86,11 +110,12 @@
|
|
|
<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>
|
|
|
+ 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}
|
|
@@ -99,3 +124,15 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
{/if}
|
|
|
+{#if liste_export}
|
|
|
+<pre>
|
|
|
+{#each Object.entries(schueler) as [klasse, schueler]}
|
|
|
+{klasse}
|
|
|
+{#each schueler as s}
|
|
|
+{#if s.konto}
|
|
|
+{`b${s.id}@${privat.domain},${s.Name},${s.Vorname},${s.Vorname} ${s.Name},schueler,,,,,,,,Bielefeld,NW,,DE`}<br>
|
|
|
+{/if}
|
|
|
+{/each}
|
|
|
+{/each}
|
|
|
+</pre>
|
|
|
+{/if}
|