Browse Source

teams verwalten

hmt 3 years ago
parent
commit
51c0cf4238
2 changed files with 117 additions and 0 deletions
  1. 115 0
      components/teams.svelte
  2. 2 0
      Übersicht.svelte

+ 115 - 0
components/teams.svelte

@@ -0,0 +1,115 @@
+<script>
+  export let schueler, privat;
+  let teams_anzeigen;
+  let schueler_verbergen;
+  $: pool.query(`UPDATE einstellungen SET teams_anzeigen=$1`, [teams_anzeigen])
+  const { Pool } = R("pg");
+  const pool = new Pool({ connectionString: privat.mein_bk_db });
+  async function hole_lehrer() {
+    const query = `SELECT * from lehrer`;
+    try {
+      const res = await pool.query(query);
+      console.log(res.rows);
+      return res.rows;
+    } catch (e) {
+      console.log(e);
+      return [];
+    }
+  }
+</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>
+                  <span
+                    class="tag"
+                    class:is-danger={!s.konto}
+                    class:is-success={s.konto}>Konto</span>
+                  <span
+                    class="tag"
+                    class:is-danger={!s.video}
+                    class:is-success={s.video}>Video</span>
+                  <span
+                    class="tag"
+                    class:is-danger={!s.audio}
+                    class:is-success={s.audio}>Audio</span>
+                </td>
+              </tr>
+            {/each}
+          </tbody>
+        </table>
+      {/each}
+    </div>
+  </div>
+{/if}
+{#await hole_lehrer()}
+  Hole Lehrerdaten
+{:then 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>
+                <span
+                class="tag"
+                class:is-danger={!l.konto}
+                class:is-success={l.konto}>Konto</span>
+              <span
+                class="tag"
+                class:is-danger={!l.video}
+                class:is-success={l.video}>Video</span>
+              <span
+                class="tag"
+                class:is-danger={!l.audio}
+                class:is-success={l.audio}>Audio</span>
+              </td>
+            </tr>
+          {/each}
+        </tbody>
+      </table>
+    </div>
+  </div>
+{/await}

+ 2 - 0
Übersicht.svelte

@@ -24,6 +24,7 @@
         <li class:is-active={active === SVWahl} on:click={() => active=SVWahl}>SV-Wahl</li>
         <li class:is-active={active === Einstellungen} on:click={() => active=Einstellungen}>Einstellungen</li>
         <li class:is-active={active === Infos} on:click={() => active=Infos}>Infos</li>
+        <li class:is-active={active === Teams} on:click={() => active=Teams}>Teams</li>
       </ul>
     </div>
     <svelte:component this={active} schueler={schueler_filter} {privat} {einstellungen} {knexConfig}/>
@@ -66,6 +67,7 @@
   import SVWahl from './components/svwahl.svelte'
   import Einstellungen from './components/einstellungen.svelte'
   import Infos from './components/infos.svelte'
+  import Teams from './components/teams.svelte'
   export let knexConfig, privat
   let active = ProjektwocheDrucksache
   let suche = ''