From 155a44f5e924df42156e97cb816d7a89c285f901 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Fri, 16 Apr 2021 06:48:30 +0000
Subject: [PATCH] Geraete-Liste zum Ein- und Ausschalten (in Arbeit)

---
 www/ui/js/app.js |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/www/ui/js/app.js b/www/ui/js/app.js
index 0ef4266..1d00a77 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();
     });
   };
 
@@ -539,8 +556,6 @@
     event.preventDefault();
     const data = new FormData(event.target);
     const value = Object.fromEntries(data.entries());
-    //console.log({ value });
-    //console.log(JSON.stringify(value));
     var daten = JSON.stringify(value);
     var formkey = document.querySelector(keySelector).value;
     formkey = formkey.replace(' ', '').replace(/[\W]+/g, '');

--
Gitblit v1.9.3