From b10e3bcba7a7b9de3e544fbd07a7ec1ac617cc13 Mon Sep 17 00:00:00 2001 From: Kilian Saffran Date: Sun, 3 Mar 2019 19:29:26 +0100 Subject: [PATCH] product list functions --- js/moduleglobal.js | 24 ++++ modules/products/index.html | 19 +-- modules/products/index.js | 110 +++++++++++------- modules/products/lib/product.js | 18 +-- modules/settings/form_datastore.html | 61 +--------- modules/settings/lib/datastore.js | 4 +- .../form_printtemplate.html | 0 .../form_printtemplate.js | 0 modules/templates/index.html | 34 ++++++ modules/templates/index.js | 5 + .../lib/printtemplate.js | 0 renderer.js | 2 +- 12 files changed, 155 insertions(+), 122 deletions(-) create mode 100644 js/moduleglobal.js rename modules/{settings => templates}/form_printtemplate.html (100%) rename modules/{settings => templates}/form_printtemplate.js (100%) create mode 100644 modules/templates/index.html create mode 100644 modules/templates/index.js rename modules/{settings => templates}/lib/printtemplate.js (100%) diff --git a/js/moduleglobal.js b/js/moduleglobal.js new file mode 100644 index 0000000..5efb098 --- /dev/null +++ b/js/moduleglobal.js @@ -0,0 +1,24 @@ +$( document ).ready(function() { + console.log( "Iframe "+ location.pathname.substring(location.pathname.lastIndexOf("/")) +" ready!" ); + mpref.loadconfig(); + initpage(); +}); + +var mpref ={ + cfg: null, + getSearchParams: function (k){ + //alert(location.href); + var p={}; + console.log("params =>" + location.search); + location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(s,k,v){p[k]=v}); + return k?p[k]:p; + }, + loadconfig: function(){ + this.cfg = this.getSearchParams(); + //var page = location.pathname.substring(location.pathname.lastIndexOf("/")); + //page = page.replace(/\.html/,''); + //apppref.getpreference(page); + //appdb.dbfile = this.cfg.dbfile; + appdb.url = decodeURIComponent(this.cfg.serviceurl) + 'sqlite/' + decodeURIComponent(this.cfg.dbfile); + } +} \ No newline at end of file diff --git a/modules/products/index.html b/modules/products/index.html index 547d184..3c12976 100644 --- a/modules/products/index.html +++ b/modules/products/index.html @@ -15,26 +15,27 @@ Produkte
- - - + + +
-
+
- + - - - - + + + +
ProduktGruppeNettoMwSt.BruttoGruppeNetto (€)MwSt. (%)Brutto (€)
+
diff --git a/modules/products/index.js b/modules/products/index.js index 026bc24..903fc88 100644 --- a/modules/products/index.js +++ b/modules/products/index.js @@ -1,68 +1,92 @@ +import { on } from "cluster"; + var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); var tblh = winh-54; function initpage(){ - + loaddatalist_productgroup(); + loaddatalist_vatpercent(); loadtable(); } - +$("input,select").on('focusout',function(){ + console.log($(this).attr("id")); +}); + +function loaddatalist_productgroup(){ + var sql = "select productgroup from products where productgroup is not null group by productgroup;"; + var data = appdb.dbquery(sql); + for (var i in data.sqldata){ + $("#productgroup").append('
- -
-
+
@@ -124,60 +119,6 @@
-
-
-
- - - - - - - - - - - -
NameTypStandard
-
-
-
-
Drucker
-
-
- - - -
-
- - - -
-
-
- - -
-
-
-
-
diff --git a/modules/settings/lib/datastore.js b/modules/settings/lib/datastore.js index 834821a..4aceded 100644 --- a/modules/settings/lib/datastore.js +++ b/modules/settings/lib/datastore.js @@ -29,8 +29,8 @@ var datastore = { dts[inp.attr("id")] = inp.val(); }); console.log(dts); - console.log(mpref); - if (mpref.cfg.id == ""){ + //console.log(mpref); + if ((!mpref) || (mpref.cfg.id == "")){ var keyname = dts['name'].toLowerCase(); console.log(keyname); keyname = keyname.replace(/[^a-z0-9-_]/g,""); diff --git a/modules/settings/form_printtemplate.html b/modules/templates/form_printtemplate.html similarity index 100% rename from modules/settings/form_printtemplate.html rename to modules/templates/form_printtemplate.html diff --git a/modules/settings/form_printtemplate.js b/modules/templates/form_printtemplate.js similarity index 100% rename from modules/settings/form_printtemplate.js rename to modules/templates/form_printtemplate.js diff --git a/modules/templates/index.html b/modules/templates/index.html new file mode 100644 index 0000000..55c4f51 --- /dev/null +++ b/modules/templates/index.html @@ -0,0 +1,34 @@ + + + + + + + + + + +Vorlagen + + + +
+ +
+ + + + + + + + + + + \ No newline at end of file diff --git a/modules/templates/index.js b/modules/templates/index.js new file mode 100644 index 0000000..62f7667 --- /dev/null +++ b/modules/templates/index.js @@ -0,0 +1,5 @@ +var winh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); + +function initpage(){ + +} diff --git a/modules/settings/lib/printtemplate.js b/modules/templates/lib/printtemplate.js similarity index 100% rename from modules/settings/lib/printtemplate.js rename to modules/templates/lib/printtemplate.js diff --git a/renderer.js b/renderer.js index 5459137..596f3dc 100644 --- a/renderer.js +++ b/renderer.js @@ -18,7 +18,7 @@ var usersystem = { return dialog.showOpenDialog({title: dlgtitle,defaultPath: lastpath, filters: filefilters, properties: ['openDirectory'] }); }, showMessage: function(msgTitle,msg,msgdetail,msgtype,msgButtons=["OK"],defautlbtnid=0,cancelbtnid){ - return dialog.showMessageBox({type: msgtype, // + return dialog.showMessageBox({type: msgtype, //"none", "info", "error", "question" or "warning" title: msgTitle, buttons:msgButtons, message: msg, -- 2.39.5