From d769f3445ed4779715b5c2570731b4bb73d8d2aa Mon Sep 17 00:00:00 2001 From: ulrich Date: Tue, 20 Apr 2021 17:15:03 +0000 Subject: [PATCH] Geraete-Liste mit Status (in Arbeit) --- www/ui/js/app.js | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/www/ui/js/app.js b/www/ui/js/app.js index 489cad0..98a5675 100644 --- a/www/ui/js/app.js +++ b/www/ui/js/app.js @@ -161,6 +161,21 @@ "self.form_geraet_status", function(responseText) { var geraet = JSON.parse(responseText); self.geraet_status_form(geraet); + }, function() { + self.addEvtListener('#ein-btn', 'click', function (event) { + var geraetName = event.target.attributes.gname.nodeValue; + //var geraetName = document.querySelector('.schalt-geraet-name').textContent; + self.http_get('../api/gstrg/geraet/' + geraetName + "/ein", function(responseText) { + console.log(responseText); + }); + }); + self.addEvtListener('#aus-btn', 'click', function (event) { + var geraetName = event.target.attributes.gname.nodeValue; + //var geraetName = document.querySelector('.schalt-geraet-name').textContent; + self.http_get('../api/gstrg/geraet/' + geraetName + "/aus", function(responseText) { + console.log(responseText); + }); + }); }); }; @@ -493,7 +508,7 @@ * self.ablageort_form(ablageort); * }); */ - this.entitaet_liste = function(bname, listUrl, tpl, storeUrl, formFunc, cb) { + this.entitaet_liste = function(bname, listUrl, tpl, storeUrl, formFunc, cb, customListCode) { self.reset_top_buttons(); document.querySelector('.bereich-name').textContent = bname; var bb = document.querySelector('.breadcrumb-behaelter'); @@ -508,7 +523,12 @@ //self.addEvtListener('#neu-btn', 'click', function (event) { self.addEvtListener('#top-neu-btn', 'click', function(event) { eval(formFunc + "(this)"); - }); + }); + if(typeof(customListCode) !== 'function') { + // .. + } else { + customListCode(); + } }); }); }; @@ -554,11 +574,8 @@ */ 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 }); - //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