From 3e5a56229e91e42b8080dc7ee5f9461774cf2879 Mon Sep 17 00:00:00 2001 From: ulrich Date: Fri, 16 Apr 2021 06:46:34 +0000 Subject: [PATCH] Geraete-Liste zum Ein- und Ausschalten (in Arbeit) --- www/ui/data/tpl/form_geraet_status.txt | 10 +++++ www/ui/data/tpl/form_abspielliste.txt | 4 +- www/ui/app.css | 10 +++++ www/ui/data/menu/hauptmenue.json | 5 ++ www/ui/data/tpl/geraet_schalt_liste.txt | 9 ++++ www/ui/data/tpl/form_ablageort.txt | 4 +- www/ui/data/tpl/form_einstellung.txt | 4 +- www/ui/data/tpl/form_geraet.txt | 4 +- www/ui/js/app.js | 18 +++++++++ www/ui/data/tpl/form_abspieler.txt | 4 +- www/ui/data/tpl/form_livestream.txt | 4 +- 11 files changed, 64 insertions(+), 12 deletions(-) diff --git a/www/ui/app.css b/www/ui/app.css index fee32a3..b177dfa 100644 --- a/www/ui/app.css +++ b/www/ui/app.css @@ -167,6 +167,16 @@ font-size: smaller; } +.geraet-schalt-eintrag { + display: flex; + flex-flow: row; + font-size: smaller; +} + +.schalt-geraet-name { + / * background-color: red; */ +} + .entity-liste-kopf { display: flex; flex-flow: row; diff --git a/www/ui/data/menu/hauptmenue.json b/www/ui/data/menu/hauptmenue.json index b177874..c32ac21 100644 --- a/www/ui/data/menu/hauptmenue.json +++ b/www/ui/data/menu/hauptmenue.json @@ -23,6 +23,11 @@ "funktion": "app.titel_liste" }, { + "titel": "Geräte", + "umenue": false, + "funktion": "app.geraet_schalt_liste" + }, + { "titel": "Einstellungen", "umenue": true, "verweis": "einstellungen.json" diff --git a/www/ui/data/tpl/form_ablageort.txt b/www/ui/data/tpl/form_ablageort.txt index dd81148..eb6196b 100644 --- a/www/ui/data/tpl/form_ablageort.txt +++ b/www/ui/data/tpl/form_ablageort.txt @@ -5,8 +5,8 @@ <input name="url" class="entity-form-element" type="text" id="ablageort-url" placeholder="URL" value="{{url}}" /> <div class="entity-buttons"> <button type="submit" class="button-primary" id="ok-btn">Speichern</button> - <button class="button" id="cancel-btn">Abbrechen</button> - <button class="button" id="loeschen-btn">Löschen</button> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <button type="button" class="button" id="loeschen-btn">Löschen</button> </div> </div> </form> \ No newline at end of file diff --git a/www/ui/data/tpl/form_abspieler.txt b/www/ui/data/tpl/form_abspieler.txt index edfdec9..47ad55c 100644 --- a/www/ui/data/tpl/form_abspieler.txt +++ b/www/ui/data/tpl/form_abspieler.txt @@ -4,8 +4,8 @@ <input name="url" class="entity-form-element" type="text" id="abspieler-url" placeholder="URL" value="{{url}}" /> <div class="entity-buttons"> <button type="submit" class="button-primary" id="ok-btn">Speichern</button> - <button class="button" id="cancel-btn">Abbrechen</button> - <button class="button" id="loeschen-btn">Löschen</button> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <button type="button" class="button" id="loeschen-btn">Löschen</button> </div> </div> </form> \ No newline at end of file diff --git a/www/ui/data/tpl/form_abspielliste.txt b/www/ui/data/tpl/form_abspielliste.txt index 443cf4d..6fa92eb 100644 --- a/www/ui/data/tpl/form_abspielliste.txt +++ b/www/ui/data/tpl/form_abspielliste.txt @@ -3,8 +3,8 @@ <input name="name" class="entity-form-element" type="text" id="abspielliste-name" placeholder="Name" value="{{name}}" /> <div class="entity-buttons"> <button type="submit" class="button-primary" id="ok-btn">Speichern</button> - <button class="button" id="cancel-btn">Abbrechen</button> - <button class="button" id="loeschen-btn">Löschen</button> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <button type="button" class="button" id="loeschen-btn">Löschen</button> </div> </div> </form> \ No newline at end of file diff --git a/www/ui/data/tpl/form_einstellung.txt b/www/ui/data/tpl/form_einstellung.txt index c2bf86c..ee8f407 100644 --- a/www/ui/data/tpl/form_einstellung.txt +++ b/www/ui/data/tpl/form_einstellung.txt @@ -4,8 +4,8 @@ <input name="value" class="entity-form-element" type="text" id="einstellung-value" placeholder="Wert" value="{{value}}" /> <div class="entity-buttons"> <button type="submit" class="button-primary" id="ok-btn">Speichern</button> - <button class="button" id="cancel-btn">Abbrechen</button> - <button class="button" id="loeschen-btn">Löschen</button> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <button type="button" class="button" id="loeschen-btn">Löschen</button> </div> </div> </form> \ No newline at end of file diff --git a/www/ui/data/tpl/form_geraet.txt b/www/ui/data/tpl/form_geraet.txt index b0e28ba..8772037 100644 --- a/www/ui/data/tpl/form_geraet.txt +++ b/www/ui/data/tpl/form_geraet.txt @@ -6,8 +6,8 @@ <input name="statusUrl" class="entity-form-element" type="text" id="geraet-statusurl" placeholder="URL (Status)" value="{{statusUrl}}" /> <div class="entity-buttons"> <button type="submit" class="button-primary" id="ok-btn">Speichern</button> - <button class="button" id="cancel-btn">Abbrechen</button> - <button class="button" id="loeschen-btn">Löschen</button> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <button type="button" class="button" id="loeschen-btn">Löschen</button> </div> </div> </form> \ No newline at end of file diff --git a/www/ui/data/tpl/form_geraet_status.txt b/www/ui/data/tpl/form_geraet_status.txt new file mode 100644 index 0000000..d4b5bc6 --- /dev/null +++ b/www/ui/data/tpl/form_geraet_status.txt @@ -0,0 +1,10 @@ +<form> + <div class="entity-formular"> + <p>Der Gerätestatus ist noch nicht gebaut.</p> + <div class="entity-buttons"> + <!-- <button type="submit" class="button-primary" id="ok-btn">Speichern</button> --> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <!-- <button class="button" id="loeschen-btn">Löschen</button> --> + </div> + </div> +</form> diff --git a/www/ui/data/tpl/form_livestream.txt b/www/ui/data/tpl/form_livestream.txt index 8afa3c2..d9799f2 100644 --- a/www/ui/data/tpl/form_livestream.txt +++ b/www/ui/data/tpl/form_livestream.txt @@ -4,8 +4,8 @@ <input name="url" class="entity-form-element" type="text" id="livestream-url" placeholder="Pfad" value="{{url}}" /> <div class="entity-buttons"> <button type="submit" class="button-primary" id="ok-btn">Speichern</button> - <button class="button" id="cancel-btn">Abbrechen</button> - <button class="button" id="loeschen-btn">Löschen</button> + <button type="button" class="button" id="cancel-btn">Abbrechen</button> + <button type="button" class="button" id="loeschen-btn">Löschen</button> </div> </div> </form> diff --git a/www/ui/data/tpl/geraet_schalt_liste.txt b/www/ui/data/tpl/geraet_schalt_liste.txt new file mode 100644 index 0000000..b5b3648 --- /dev/null +++ b/www/ui/data/tpl/geraet_schalt_liste.txt @@ -0,0 +1,9 @@ +<div class='entity-formular'> + {{#ArrayList}} + <div class='geraet-schalt-eintrag'> + <button class="button schalt-btn" id="ein-btn">Ein</button> + <button class="button schalt-btn" id="aus-btn">Aus</button> + <div class='schalt-geraet-name entity-eintrag'>{{.}}</div> + </div> + {{/ArrayList}} +</div> \ No newline at end of file diff --git a/www/ui/js/app.js b/www/ui/js/app.js index 0ef4266..489cad0 100644 --- a/www/ui/js/app.js +++ b/www/ui/js/app.js @@ -155,6 +155,15 @@ } }; + this.geraet_schalt_liste = function() { + self.entitaet_liste('Geräte schalten','../api/store/Geraet/liste/', + "data/tpl/geraet_schalt_liste.txt", '../api/store/Geraet/', + "self.form_geraet_status", function(responseText) { + var geraet = JSON.parse(responseText); + self.geraet_status_form(geraet); + }); + }; + this.geraet_liste = function() { self.entitaet_liste('Geräte','../api/store/Geraet/liste/', "data/tpl/geraet_liste.txt", '../api/store/Geraet/', @@ -246,6 +255,14 @@ "data/tpl/form_geraet.txt", '../api/store/Geraet/', '#geraet-name', function() { self.geraet_liste(); + }); + }; + + this.geraet_status_form = function(ge) { + self.entitaet_form('Gerät', ge, ge.name, + "data/tpl/form_geraet_status.txt", '../api/store/Geraet/', + '#geraet-name', function() { + self.geraet_schalt_liste(); }); }; @@ -537,6 +554,7 @@ */ this.handle_submit = function(event, existingKey, putUrl, keySelector, cb) { event.preventDefault(); + console.log('handle submit, key: ' + event.target.id); const data = new FormData(event.target); const value = Object.fromEntries(data.entries()); //console.log({ value }); -- Gitblit v1.9.3