From: Kilian Saffran Date: Thu, 10 Dec 2020 05:03:32 +0000 (+0100) Subject: v20201209 X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=50e76596420688d47e9a6059b67cf1f4e6005ee2;p=oldbell_lu.git v20201209 --- diff --git a/admin/db.php b/admin/db.php index 3a4a355..1196e50 100644 --- a/admin/db.php +++ b/admin/db.php @@ -28,7 +28,7 @@ } $params = array(); $html["session"] = $vars["session"]; - error_log(print_r($vars,true)); + //error_log(print_r($vars,true)); $params = json_decode(file_get_contents('php://input'), true); //$params =$_GET; $html["params"] = $params; @@ -67,7 +67,10 @@ } } elseif(isset($params["savefield"])){ - $html["data"] = $db->exec("UPDATE ".$params["table"]." set ".$params["column"]."=".$db->value($params["value"])." where id=".$db->value($params["id"]).";"); + $sql = "UPDATE ".$params["table"]." set ".$params["column"]."=".$db->value($params["value"])." where id=".$db->value($params["id"]).";"; + error_log($sql); + $html["sql"] = $sql; + $html["data"] = $db->exec($sql); } elseif(isset($params["saveform"])){ $updsql = $db->createUpdateDDL($params["schema"],$params["table"],$params["idents"],$params["data"]); diff --git a/admin/index.php b/admin/index.php index 2850bd0..01164a3 100644 --- a/admin/index.php +++ b/admin/index.php @@ -10,7 +10,7 @@ $vars["config"] = $cfg; $vars["requri"] = $_SERVER["REQUEST_URI"]; $postdata = []; - error_log(print_r(ini_get_all(),true)); + //error_log(print_r(ini_get_all(),true)); if (isset($_POST)){ $postdata = $_POST; } diff --git a/admin/js/dataform.js b/admin/js/dataform.js index 2d8551f..c9666f8 100644 --- a/admin/js/dataform.js +++ b/admin/js/dataform.js @@ -94,7 +94,7 @@ let dataform = { }, fillform: function(dataclass,choices,data){ var frm = document.querySelectorAll('.data_'+ dataclass); - //console.log("frmdata",frm); + console.log("frmdata",frm); if (data){ for (var f in frm){ @@ -105,7 +105,7 @@ let dataform = { tblid = frm[f].id.replace(dataclass + "_",""); frm[f].dataset.id=data['id']; } - //console.log(frm[f].id +'=>' +tblid + "=>" +data[tblid]); + console.log(frm[f].id +'=>' +tblid + "=>" +data[tblid]); if (tblid != null && data[tblid]){ if (frm[f].tagName == 'INPUT'){ @@ -136,12 +136,14 @@ let dataform = { } } if (frm[f].tagName == 'SELECT'){ - if (frm[f].multiple == true){ + console.log("fill select",frm[f].id,data[tblid]); + choices[frm[f].id].set(data[tblid]); + // if (frm[f].multiple == true){ - choices[frm[f].id].set(JSON.parse(data[tblid])); - } else { - frm[f].value=data[tblid]; - } + // choices[frm[f].id].set(JSON.parse(data[tblid])); + // } else { + // frm[f].value=data[tblid]; + // } } if (frm[f].tagName == "TEXTAREA"){ //console.log("Set TextArea: " + frm[f].id + " => "+ data[tblid]); @@ -198,7 +200,7 @@ let dataform = { } }, setValue: function(obj,newvalue){ - if (obj.tagName == 'INPUT' || obj.tagName == 'SELECT'){ + if (obj.tagName == 'INPUT'){ if (obj.type == 'checkbox' || obj.type == 'radio'){ obj.checked = true; }else { @@ -210,29 +212,32 @@ let dataform = { } dataform.savefield(obj); }, - savefield: function(obj){ + savefield: function(obj,value=null){ //if (obj.tagName == 'TextArea') fdata = obj.dataset; //fdata["save"] = "field"; //fdata["schemata"] = schemata; - if (obj.tagName == 'INPUT' || obj.tagName == 'SELECT' || obj.tagName == 'TEXTAREA'){ + if (obj.tagName == 'INPUT'){ if (obj.type == 'checkbox' || obj.type == 'radio'){ if (obj.checked == true){ - fdata["value"] = "'1'"; + fdata["value"] = 1; } else { - fdata["value"] = "null"; + fdata["value"] = null; } }else { if (obj.value == ''){ - fdata["value"] = 'null'; + fdata["value"] = null; } else { - fdata["value"] = "'" +obj.value + "'"; + fdata["value"] = obj.value; } - } } + if ((obj.tagName == 'SELECT' || obj.tagName == 'TEXTAREA') || (value != null)){ + fdata["value"] = value; + } fdata["savefield"] = 1; - postData({fdata}).then(ret => { + + postData(fdata).then(ret => { console.log(ret); }); return false; diff --git a/admin/js/modules/products.js b/admin/js/modules/products.js index 24122fb..8161e36 100644 --- a/admin/js/modules/products.js +++ b/admin/js/modules/products.js @@ -1,39 +1,41 @@ let products = { tbl: null, - selects: {"products_productgroup":null}, + selects: {"products_groupname":null}, init: function(){ flatpickr("#products_publishdate",{altInput: true, altFormat: "d.m.Y", dateFormat: "Y-m-d","locale": "fr", - onClose: function(selectedDates, dateStr, instance) {dataform.savefield(document.getElementById('products_publishdate'),null); } + onClose: function(selectedDates, dateStr, instance) {dataform.savefield(document.getElementById('products_publishdate'),document.getElementById('products_publishdate').value); } }); flatpickr("#products_unpublishdate",{altInput: true, altFormat: "d.m.Y",dateFormat: "Y-m-d","locale": "fr", - onClose: function(selectedDates, dateStr, instance) {dataform.savefield(document.getElementById('products_unpublishdate'),null);} + onClose: function(selectedDates, dateStr, instance) {dataform.savefield(document.getElementById('products_unpublishdate'),document.getElementById('products_unpublishdate').value);} }); - products.selects["products_productgroup"] = new SlimSelect({ - select: "#products_productgroup", + products.selects["products_groupname"] = new SlimSelect({ + select: "#products_groupname", allowDeselectOption: true, searchPlaceholder:"groupe...", placeholderText: "groupe...", searchText:"pas de groupe...", addable: function (value) {return value;/*return {text: value,value: value.toLowerCase()}*/}, afterClose: function(){ - //console.log("set timetrack"); - dataform.savefield(document.getElementById('products_productgroup'),null); - } - }); - products.selects["products_productoptions"] = new SlimSelect({ - select: "#products_productoptions", - searchPlaceholder:"options...", - placeholderText: "option...", - allowDeselectOption: true, - searchText:"pas d'options'...", - addable: function (value) {return value;/*return {text: value,value: value.toLowerCase()}*/}, - afterClose: function(){ - //console.log("set timetrack"); - dataform.savefield(document.getElementById('products_productoptions'),null); + + dataform.savefield(document.getElementById('products_groupname'),products.selects["products_groupname"].selected()); + products.gettabledata(); } }); + products.getProductGroups(); + // products.selects["products_productoptions"] = new SlimSelect({ + // select: "#products_productoptions", + // searchPlaceholder:"options...", + // placeholderText: "option...", + // allowDeselectOption: true, + // searchText:"pas d'options'...", + // addable: function (value) {return value;/*return {text: value,value: value.toLowerCase()}*/}, + // afterClose: function(){ + // //console.log("set timetrack"); + // dataform.savefield(document.getElementById('products_productoptions'),products.selects["products_productoptions"].selected()); + // } + // }); tinymce.init({ selector: '#products_description', plugins: 'paste importcss searchreplace autolink directionality visualblocks visualchars template charmap nonbreaking advlist lists textpattern noneditable charmap autoresize ', @@ -56,8 +58,8 @@ let products = { editor.on('blur', function(e) { console.log("tmce blur:",e.target.id); if (e.target.id == "products_description"){ - dataform.savefield(document.getElementById(e.id)); - console.log("TODO: savefield"); + dataform.savefield(document.getElementById(e.target.id),tinymce.get(e.target.id).getContent()); + //console.log("TODO: savefield"); } // //e.id @@ -71,7 +73,7 @@ let products = { responsiveLayout:true, selectable: 1, autoResize:false, - groupBy:["productgroup"], + groupBy:["groupname"], groupStartOpen:[true], groupHeader:[function(value, count, data){ return ((value)?value:"");}], rowClick:function(e, row){ @@ -80,25 +82,61 @@ let products = { rowContext:function(e, row){ e.preventDefault(); }, columns: [ - {title: "Produit", field: "name" ,width: 100}, + {title: "Produit", field: "product"}, ] }); + products.gettabledata(); }, gettabledata: function(){ + let sel = products.tbl.getSelectedData(); postData({"cl":"products","fn":"getAll"}).then(data => { - products.tbl.setData(data.data); + console.log("productdata",data.data); + products.tbl.setData(data.data).then(data => { + if (sel[0]){ + console.log("has selected data",sel[0]); + products.tbl.selectRow(sel[0].id); + } + }); }); }, calculate: function(){ - + let vnet=0.00,vtax=0.00,vvat=0.00,vgross=0.00; + let onet = document.getElementById("products_netprice"); + let otax = document.getElementById("products_taxpercent"); + let ovat = document.getElementById("products_vatprice"); + let ogross= document.getElementById("products_grossprice"); + if (onet.value){vnet= parseFloat(onet.value).toFixed(2);} + if (otax.value){ + vtax= parseFloat(otax.value).toFixed(2); + if (vtax != 0.00) { + vvat = (vnet * (vtax / 100)).toFixed(2); + + }; + }; + ovat.value=vvat; + vgross=(parseFloat(vnet) + parseFloat(vvat)).toFixed(2); + ogross.value=vgross; + dataform.savefield(onet,vnet); + dataform.savefield(otax,vtax); + dataform.savefield(ovat,vvat); + dataform.savefield(ogross,vgross); + }, + getProductGroups: function(){ + postData({"cl":"products","fn":"getGroups"}).then(data => { + dataform.fillselectlist(products.selects["products_groupname"],data.data,'groupname','groupname'); + }); }, edit: function(){ let sel = products.tbl.getSelectedData(); if (sel[0]){ dataform.cleanform("products"); - postData({"get":"products","fn":"get","id":sel[0].id}).then(data => { - dataform.fillform("products",data.data); + postData({"cl":"products","fn":"get","id":sel[0].id}).then(data => { + console.log("Product",data) + dataform.fillform("products",products.selects,data.data); + myapp.viewpanel("products"); }); + }else { + myapp.viewpanel("empty"); } }, add: function(){ diff --git a/admin/lib/database.php b/admin/lib/database.php index c873509..2d51294 100644 --- a/admin/lib/database.php +++ b/admin/lib/database.php @@ -28,7 +28,7 @@ class database { public function query($sql){ $result = array(); if ($this->debug == 1){ - error_log("QUERY:".$sql); + //error_log("QUERY:".$sql); } try { if ($this->conn){ @@ -47,7 +47,7 @@ class database { $result = null; $kresult = array(); if ($this->debug == 1){ - error_log("QUERYbykey: ".$sql); + //error_log("QUERYbykey: ".$sql); } try { if ($this->conn){ @@ -69,7 +69,7 @@ class database { public function queryarray($sql){ $result = null; if ($this->debug == 1){ - error_log("QUERYARRAY: ".$sql); + //error_log("QUERYARRAY: ".$sql); } try { if ($this->conn){ diff --git a/admin/lib/modules/products.php b/admin/lib/modules/products.php index 705a9c9..3f5cf8b 100644 --- a/admin/lib/modules/products.php +++ b/admin/lib/modules/products.php @@ -18,6 +18,10 @@ class products { return $this->dbh->query("select * from products where id=".$this->dbh->value($id).";"); } + public function getGroups(){ + return $this->dbh->queryarray("select distinct(groupname) from products;"); + } + public function add(){ $tblvals = array("id" => $this->dbh->newuuid(),"product" => "nouveau produit"); $sql = $this->dbh->createInsertDDL("public","products",$tblvals); diff --git a/admin/lib/session.php b/admin/lib/session.php index 558e3c3..8415a50 100644 --- a/admin/lib/session.php +++ b/admin/lib/session.php @@ -17,7 +17,7 @@ class session { } public function checkLogin($username,$password){ - error_log("check Login"); + //error_log("check Login"); $encpwd = hash('sha256', trim($password)); //echo "select id,username,usergroup from public.users where username='".$username."' and password='".$encpwd."';\n"; diff --git a/admin/tmpl/elements/panels/pnl_empty.html.mustache b/admin/tmpl/elements/panels/pnl_empty.html.mustache new file mode 100644 index 0000000..07fe9d4 --- /dev/null +++ b/admin/tmpl/elements/panels/pnl_empty.html.mustache @@ -0,0 +1,2 @@ +
+
\ No newline at end of file diff --git a/admin/tmpl/elements/panels/pnl_products.html.mustache b/admin/tmpl/elements/panels/pnl_products.html.mustache new file mode 100644 index 0000000..ca9732e --- /dev/null +++ b/admin/tmpl/elements/panels/pnl_products.html.mustache @@ -0,0 +1,63 @@ + \ No newline at end of file diff --git a/admin/tmpl/elements/panels/pnl_webarticle.html.mustache b/admin/tmpl/elements/panels/pnl_webarticle.html.mustache index c3e1bde..85d81ef 100644 --- a/admin/tmpl/elements/panels/pnl_webarticle.html.mustache +++ b/admin/tmpl/elements/panels/pnl_webarticle.html.mustache @@ -27,8 +27,18 @@
- +
+ + +
+
+
+ + +
+
+ diff --git a/admin/tmpl/pages/products.html.mustache b/admin/tmpl/pages/products.html.mustache index f883da4..57f8ff9 100644 --- a/admin/tmpl/pages/products.html.mustache +++ b/admin/tmpl/pages/products.html.mustache @@ -21,68 +21,13 @@
-
+
-
-
- -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
-
description - -
-
-
-
- - -
-
-
-
-
-
-
Images
- - -
-
+
+ {{> panels/pnl_empty.html.mustache }} + {{> panels/pnl_products.html.mustache }}
diff --git a/website/css/fonts/siteicons.eot b/website/css/fonts/siteicons.eot index f6d6786..fde3503 100644 Binary files a/website/css/fonts/siteicons.eot and b/website/css/fonts/siteicons.eot differ diff --git a/website/css/fonts/siteicons.svg b/website/css/fonts/siteicons.svg index 56d53a6..c81bc18 100644 --- a/website/css/fonts/siteicons.svg +++ b/website/css/fonts/siteicons.svg @@ -22,33 +22,114 @@ - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + - + + + + + + + + - - + + + + + + - - + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + diff --git a/website/css/fonts/siteicons.ttf b/website/css/fonts/siteicons.ttf index d24d084..df72514 100644 Binary files a/website/css/fonts/siteicons.ttf and b/website/css/fonts/siteicons.ttf differ diff --git a/website/css/fonts/siteicons.woff b/website/css/fonts/siteicons.woff index 0b2a161..f1e61eb 100644 Binary files a/website/css/fonts/siteicons.woff and b/website/css/fonts/siteicons.woff differ diff --git a/website/css/icons.css b/website/css/icons.css index 28c20b8..aba0c47 100644 --- a/website/css/icons.css +++ b/website/css/icons.css @@ -1,10 +1,10 @@ @font-face { font-family: 'siteicons'; - src: url('fonts/siteicons.eot?9mq9yx'); - src: url('fonts/siteicons.eot?9mq9yx#iefix') format('embedded-opentype'), - url('fonts/siteicons.ttf?9mq9yx') format('truetype'), - url('fonts/siteicons.woff?9mq9yx') format('woff'), - url('fonts/siteicons.svg?9mq9yx#siteicons') format('svg'); + src: url('fonts/siteicons.eot?dqz0d2'); + src: url('fonts/siteicons.eot?dqz0d2#iefix') format('embedded-opentype'), + url('fonts/siteicons.ttf?dqz0d2') format('truetype'), + url('fonts/siteicons.woff?dqz0d2') format('woff'), + url('fonts/siteicons.svg?dqz0d2#siteicons') format('svg'); font-weight: normal; font-style: normal; font-display: block; @@ -25,35 +25,182 @@ -moz-osx-font-smoothing: grayscale; } -.icon-events:before { +.icon-menu:before { content: "\e900"; } -.icon-rendezvous:before { +.icon-info:before { content: "\e901"; } -.icon-news:before { +.icon-help:before { content: "\e902"; } -.icon-home:before { +.icon-alert:before { content: "\e903"; } -.icon-image:before { +.icon-star:before { + content: "\e904"; +} +.icon-home:before { + content: "\e905"; +} +.icon-cart2:before { + content: "\e906"; +} +.icon-duplicate2:before { + content: "\e907"; +} +.icon-trash2:before { + content: "\e908"; +} +.icon-quote:before { + content: "\e909"; +} +.icon-pdf2:before { + content: "\e90a"; +} +.icon-access:before { + content: "\e90b"; +} +.icon-address:before { + content: "\e90c"; +} +.icon-apps:before { content: "\e90d"; } -.icon-images:before { +.icon-archive:before { content: "\e90e"; } -.icon-camera:before { +.icon-arrow-down:before { + content: "\ea36"; +} +.icon-arrow-left:before { + content: "\ea38"; +} +.icon-arrow-left1:before { + content: "\ea40"; +} +.icon-arrow-right:before { + content: "\ea34"; +} +.icon-arrow-right1:before { + content: "\ea3c"; +} +.icon-back:before { + content: "\e944"; +} +.icon-baggage:before { + content: "\e94e"; +} +.icon-barberscissor:before { content: "\e90f"; } -.icon-play:before { +.icon-box-add:before { + content: "\e95e"; +} +.icon-calendar2:before { + content: "\e953"; +} +.icon-camera:before { + content: "\e910"; +} +.icon-cart:before { + content: "\e93a"; +} +.icon-category:before { + content: "\e97d"; +} +.icon-checkbox-checked:before { + content: "\ea52"; +} +.icon-checkbox-unchecked:before { + content: "\ea53"; +} +.icon-checkmark:before { + content: "\ea10"; +} +.icon-circle-left:before { + content: "\ea44"; +} +.icon-circle-right:before { + content: "\ea42"; +} +.icon-clock:before { + content: "\e94f"; +} +.icon-clocktime:before { + content: "\e911"; +} +.icon-code:before { content: "\e912"; } -.icon-film:before { +.icon-coin:before { content: "\e913"; } -.icon-profile:before { - content: "\e923"; +.icon-copy:before { + content: "\e94b"; +} +.icon-credit-card:before { + content: "\e93f"; +} +.icon-cross:before { + content: "\ea0f"; +} +.icon-cube:before { + content: "\e914"; +} +.icon-dashboard:before { + content: "\e915"; +} +.icon-datarefresh:before { + content: "\e916"; +} +.icon-dataset:before { + content: "\e930"; +} +.icon-documentsave:before { + content: "\e917"; +} +.icon-download:before { + content: "\e918"; +} +.icon-download1:before { + content: "\e960"; +} +.icon-duplicate:before { + content: "\e949"; +} +.icon-duplicate1:before { + content: "\e919"; +} +.icon-edit:before { + content: "\e91a"; +} +.icon-entry:before { + content: "\e97a"; +} +.icon-envelop:before { + content: "\e945"; +} +.icon-erase:before { + content: "\e950"; +} +.icon-events:before { + content: "\e91b"; +} +.icon-excel:before { + content: "\e91c"; +} +.icon-exit:before { + content: "\e947"; +} +.icon-expand:before { + content: "\e91d"; +} +.icon-facebook:before { + content: "\ea91"; +} +.icon-file:before { + content: "\e91e"; } .icon-file-picture:before { content: "\e927"; @@ -61,108 +208,204 @@ .icon-file-play:before { content: "\e929"; } -.icon-copy:before { - content: "\e92c"; +.icon-film:before { + content: "\e91f"; } -.icon-paste:before { - content: "\e92d"; +.icon-folder:before { + content: "\e920"; } -.icon-cart:before { - content: "\e93a"; +.icon-folder_add:before { + content: "\e921"; } -.icon-coin-euro:before { - content: "\e93c"; +.icon-folder_delete:before { + content: "\e922"; } -.icon-credit-card:before { - content: "\e93f"; +.icon-folder_find:before { + content: "\e923"; } -.icon-phone:before { - content: "\e942"; +.icon-group:before { + content: "\e924"; } -.icon-envelop:before { - content: "\e945"; +.icon-history:before { + content: "\e925"; } -.icon-pushpin:before { - content: "\e946"; +.icon-image:before { + content: "\e926"; +} +.icon-images:before { + content: "\e928"; +} +.icon-inbox:before { + content: "\e92a"; +} +.icon-instagram:before { + content: "\ea92"; +} +.icon-key:before { + content: "\e948"; +} +.icon-library:before { + content: "\e92b"; +} +.icon-license:before { + content: "\e92c"; +} +.icon-list:before { + content: "\e92d"; } .icon-location:before { - content: "\e947"; + content: "\e94a"; +} +.icon-lock:before { + content: "\e97b"; +} +.icon-log:before { + content: "\e92e"; +} +.icon-logout:before { + content: "\e92f"; +} +.icon-mail:before { + content: "\ea83"; } .icon-map:before { content: "\e94c"; } -.icon-clock:before { - content: "\e94e"; +.icon-new-tab:before { + content: "\ea7e"; } -.icon-calendar:before { - content: "\e953"; +.icon-newspaper:before { + content: "\e931"; } -.icon-box-add:before { - content: "\e95e"; +.icon-next:before { + content: "\e946"; } -.icon-download:before { - content: "\e960"; +.icon-numberlist:before { + content: "\e932"; } -.icon-menu:before { - content: "\e9bd"; +.icon-package:before { + content: "\e933"; } -.icon-cross:before { - content: "\ea0f"; +.icon-paste1:before { + content: "\e934"; } -.icon-checkmark:before { - content: "\ea10"; +.icon-pause:before { + content: "\e935"; } -.icon-arrow-right:before { - content: "\ea34"; +.icon-pay:before { + content: "\e936"; } -.icon-arrow-down:before { - content: "\ea36"; +.icon-pdf:before { + content: "\e937"; } -.icon-arrow-left:before { - content: "\ea38"; +.icon-phone:before { + content: "\e942"; } -.icon-arrow-right1:before { - content: "\ea3c"; +.icon-pictures:before { + content: "\e938"; } -.icon-arrow-left1:before { - content: "\ea40"; +.icon-play:before { + content: "\e939"; } -.icon-circle-right:before { - content: "\ea42"; +.icon-plus:before { + content: "\e93b"; } -.icon-circle-left:before { - content: "\ea44"; +.icon-profile:before { + content: "\e93c"; } -.icon-checkbox-checked:before { - content: "\ea52"; +.icon-projects:before { + content: "\e954"; } -.icon-checkbox-unchecked:before { - content: "\ea53"; +.icon-pushpin:before { + content: "\e94d"; +} +.icon-razorblade:before { + content: "\e93d"; +} +.icon-remove:before { + content: "\e93e"; +} +.icon-rename:before { + content: "\e95d"; +} +.icon-rendezvous:before { + content: "\e940"; +} +.icon-replace:before { + content: "\e951"; +} +.icon-save:before { + content: "\e941"; +} +.icon-save2:before { + content: "\e975"; } .icon-section:before { content: "\ea76"; } +.icon-sector:before { + content: "\e97f"; +} +.icon-sendemail:before { + content: "\e952"; +} +.icon-settings:before { + content: "\e974"; +} .icon-share:before { content: "\ea7d"; } -.icon-new-tab:before { - content: "\ea7e"; +.icon-shop:before { + content: "\e943"; } -.icon-mail:before { - content: "\ea83"; +.icon-shopbasket:before { + content: "\e955"; } -.icon-facebook:before { - content: "\ea91"; +.icon-squares:before { + content: "\e976"; } -.icon-instagram:before { - content: "\ea92"; +.icon-staff:before { + content: "\e956"; } -.icon-whatsapp:before { - content: "\ea93"; +.icon-table:before { + content: "\e977"; +} +.icon-template:before { + content: "\e957"; +} +.icon-trash:before { + content: "\e958"; } .icon-twitter:before { content: "\ea96"; } +.icon-unlock:before { + content: "\e97c"; +} +.icon-upload:before { + content: "\e978"; +} +.icon-upload2:before { + content: "\e959"; +} +.icon-user:before { + content: "\e979"; +} +.icon-usertime:before { + content: "\e95a"; +} +.icon-vacancydays:before { + content: "\e97e"; +} +.icon-website:before { + content: "\e95b"; +} +.icon-week:before { + content: "\e95c"; +} +.icon-whatsapp:before { + content: "\ea93"; +} .icon-youtube:before { content: "\ea9d"; } diff --git a/website/img/noproductimg.png b/website/img/noproductimg.png new file mode 100644 index 0000000..249ee69 Binary files /dev/null and b/website/img/noproductimg.png differ diff --git a/website/js/main.js b/website/js/main.js index e2c0d5e..b6199f6 100644 --- a/website/js/main.js +++ b/website/js/main.js @@ -6,3 +6,4 @@ window.onload = () => { .register('./sw.js'); } } + diff --git a/website/js/rendezvous.js b/website/js/rendezvous.js index 1378218..f7b1620 100644 --- a/website/js/rendezvous.js +++ b/website/js/rendezvous.js @@ -40,7 +40,7 @@ let rendezvous = { selectable: 1, rowContext:function(e, row){ e.preventDefault(); }, columns: [ - {title: "heures disponibles", field: "starttime", resizable: false}, + {title: "heures disponibles", field: "rdvtime", resizable: false}, ] }); rendezvous.getServiceData(); @@ -51,7 +51,8 @@ let rendezvous = { viewDates: function(){ let sel = rendezvous.tblservices.getSelectedData(); if (sel[0]){ - postData({"get":"rdv_dates"}).then(data => { + postData({"cl":"rendezvous","fn":"getRDVDates"}).then(data => { + console.log(data); rendezvous.tbldates.setData(data.data); myapp.viewpanel('rdvdate'); }); @@ -60,7 +61,8 @@ let rendezvous = { viewHours: function(){ let sel = rendezvous.tbldates.getSelectedData(); if (sel[0]){ - postData({"get":"rdv_freehours"}).then(data => { + postData({"cl":"rendezvous","fn":"getRDVDayFreeTimes","rdvdate":sel[0].daydates}).then(data => { + console.log("times",data); rendezvous.tblhours.setData(data.data); }); myapp.viewpanel('rdvtime'); @@ -87,7 +89,7 @@ let rendezvous = { myapp.viewpanel('rdvsended'); }, getServiceData: function(){ - postData({"get":"rdv_services"}).then(data => { + postData({"cl":"rendezvous","fn":"getServices"}).then(data => { console.log(data); rendezvous.tblservices.setData(data.data); }); diff --git a/website/js/shop.js b/website/js/shop.js index e69de29..17044e2 100644 --- a/website/js/shop.js +++ b/website/js/shop.js @@ -0,0 +1,35 @@ +function initpage(){ + shop.getproducts(); +} + +let shop ={ + items: null, + cart: [], + order: null, + getproducts: function(){ + osi = document.getElementById("shopitems"); + osi.innerHTML =''; + postData({"cl":"shop","fn":"getShopItems"}).then(items => { + console.log(items); + shop.items = items.data; + for (var i in items.data){ + osi.insertAdjacentHTML('beforeend', items.data[i]); + // postData({"cl":"shop","fn":"getShopItemsbyGroup","groupname":data.data[g].groupname}).then(items => { + // console.log(items); + // for (var i in items.data){ + // osi.insertAdjacentHTML('beforeend', ); + // } + // // + // }); + } + + //osi.insertAdjacentHTML('beforeend', text); + }); + }, + addToCart: function(id){ + shop.cart.push(id); + }, + sendorder: function(){ + + } +} \ No newline at end of file diff --git a/website/lib/modules/RendezVous.php b/website/lib/modules/RendezVous.php index 57bce1f..6b859be 100644 --- a/website/lib/modules/RendezVous.php +++ b/website/lib/modules/RendezVous.php @@ -1,8 +1,13 @@ dbh = $dblink; + $this->cfg = $cfg; + } + public function __destruct(){ + $this->dbh = null; } public function getServices(){ @@ -11,20 +16,20 @@ public function getRDVDates(){ $startdate = date("Y-m-d"); - $rdvsql = "select * from defaultdata where id LIKE 'rendezvous_%';"; + $rdvsql = "select * from defaultdata where category='rendezvous';"; $rdvcfg = $this->dbh->querybykey('id',$rdvsql); - //error_log(print_r($rdvcfg,TRUE)); + error_log(print_r($rdvcfg,TRUE)); $sql = "select ad.weekday,ad.daydates,maxrdv.maxrdv::int4,coalesce(rdv.rdvcnt,0) as rdvcnt from ( - select date_part('isodow',dd)::integer as weekday,date(dd) as daydates from generate_series(date('".$startdate."')::timestamp,(date('".$startdate."') + interval '".$rdvcfg["rendezvous_maxdateinterval"]["pref"]."')::timestamp,interval '1 day') dd + select date_part('isodow',dd)::integer as weekday,date(dd) as daydates from generate_series(date('".$startdate."')::timestamp,(date('".$startdate."') + interval '".$rdvcfg["maxdateinterval"]["pref"]."')::timestamp,interval '1 day') dd ) ad left join ( select weekday,((date_part('hours',endtime-starttime) * 60) + date_part('minutes',endtime-starttime)) / ((date_part('hours',timesteps) * 60) + date_part('minutes',timesteps)) as maxrdv from rendezvoushours where daydate is null ) maxrdv on ad.weekday=maxrdv.weekday left join ( - select daydate,count(daydate) as rdvcnt from rendezvous where daydate between date('".$startdate."') and (date('".$startdate."') + interval '".$rdvcfg["rendezvous_maxdateinterval"]["pref"]."')::date and iscanceled is null group by daydate + select daydate,count(daydate) as rdvcnt from rendezvous where daydate between date('".$startdate."') and (date('".$startdate."') + interval '".$rdvcfg["maxdateinterval"]["pref"]."')::date and iscanceled is null group by daydate ) rdv on ad.daydates=rdv.daydate where ad.weekday in (select weekday from rendezvoushours where daydate is null) - and daydates not in (select daydate as daydates from rendezvoushours where daydate between date('".$startdate."') and (date('".$startdate."') + interval '".$rdvcfg["rendezvous_maxdateinterval"]["pref"]."')::date and starttime is null and endtime is null) + and daydates not in (select daydate as daydates from rendezvoushours where daydate between date('".$startdate."') and (date('".$startdate."') + interval '".$rdvcfg["maxdateinterval"]["pref"]."')::date and starttime is null and endtime is null) and (rdv.rdvcnt is null or rdv.rdvcntdbh->queryarray($sql); } @@ -38,9 +43,5 @@ where timestart is null"; return $this->dbh->queryarray($sql); } - - public function __destruct(){ - $this->dbh = null; - } } ?> \ No newline at end of file diff --git a/website/lib/modules/Shop.php b/website/lib/modules/Shop.php index dcd772c..e8146d5 100644 --- a/website/lib/modules/Shop.php +++ b/website/lib/modules/Shop.php @@ -1,24 +1,43 @@ dbh = $dblink; + $this->cfg = $cfg; } - public function getShop($id){ - + public function __destruct(){ + $this->dbh = null; } + - public function getShopItems($idg){ + public function getShopGroup(){ + return $this->dbh->queryarray("select distinct(groupname) as groupname from products where publishdate <= current_date and (unpublishdate is null or unpublishdate > current_date) order by groupname;"); + } + public function getShopItems(){ + + $retitems = array(); + $m = new Mustache_Engine(array( + 'loader' => new Mustache_Loader_FilesystemLoader($this->cfg["templatepath"].'/sections'), + 'partials_loader' => new Mustache_Loader_FilesystemLoader($this->cfg["templatepath"].'/blocks'), + 'escape' => function($value) {return $value;}, + 'entity_flags' => ENT_HTML5 + )); + if (file_exists($this->cfg["templatepath"].'/sections/shopitems.html.mustache')){ + $products = $this->dbh->queryarray("SELECT id, product, description, picture, netprice, vatprice, grossprice, groupname, publishdate, unpublishdate, taxpercent, shopvisible FROM public.products where publishdate <= current_date and (unpublishdate is null or unpublishdate > current_date) order by product;"); + foreach ($products as $k1 => $value){ + $value["version"] = date("YmdHis"); + $retitems[$value["id"]] = $m->render('shopitems.html',$value); + } + } + //error_log("sdata: ".print_r($retsections,true)); + return $retitems; } public function saveShopingCart($data){ } - public function __destruct(){ - $this->dbh = null; - } - } +} ?> \ No newline at end of file diff --git a/website/tmpl/index.html.mustache b/website/tmpl/index.html.mustache index 659994d..7997943 100644 --- a/website/tmpl/index.html.mustache +++ b/website/tmpl/index.html.mustache @@ -35,8 +35,8 @@ - -
+ +
{{pagedata}}
diff --git a/website/tmpl/pages/product.html.mustache b/website/tmpl/pages/product.html.mustache new file mode 100644 index 0000000..e69de29 diff --git a/website/tmpl/pages/rendezvous.html.mustache b/website/tmpl/pages/rendezvous.html.mustache index ae5ab3b..f5056c6 100644 --- a/website/tmpl/pages/rendezvous.html.mustache +++ b/website/tmpl/pages/rendezvous.html.mustache @@ -147,5 +147,5 @@
- + diff --git a/website/tmpl/pages/shop.html.mustache b/website/tmpl/pages/shop.html.mustache index 326a565..54d776b 100644 --- a/website/tmpl/pages/shop.html.mustache +++ b/website/tmpl/pages/shop.html.mustache @@ -1,16 +1,90 @@ +
-
retour
+
retour
Shop
+
-
- - -
+
+
- \ No newline at end of file +
+ + + + + \ No newline at end of file diff --git a/website/tmpl/sections/shopitems.html.mustache b/website/tmpl/sections/shopitems.html.mustache new file mode 100644 index 0000000..7b8f908 --- /dev/null +++ b/website/tmpl/sections/shopitems.html.mustache @@ -0,0 +1,28 @@ +
+
{{ product }}
+
+
+
+ {{^ picture}} + + {{/ picture}} + {{# picture}} + + {{/ picture}} +
+
+ {{ description }} +
+
+
+
{{ groupname }}
+
+ {{ grossprice }} € +
+
+ +
+ +
\ No newline at end of file