From f4a2473428138a76663bf6b7646c532313a31056 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 22 Sep 2015 09:20:47 +0200 Subject: [PATCH] Alpha 2, informes --- web/forms/admin/photos/send-data.php | 42 -- web/forms/admin/shelves/shelves.js | 24 + web/forms/admin/shelves/style.css | 45 ++ web/forms/admin/shelves/ui.xml | 73 +++ web/forms/ecomerce/catalog/catalog.js | 44 +- web/forms/ecomerce/catalog/style.css | 12 +- web/forms/ecomerce/catalog/ui.xml | 150 +++--- web/js/db/conn.js | 2 +- web/js/hedera/main.js | 1 + web/js/hedera/report.css | 17 + web/js/hedera/report.html | 14 + .../web/module.js => js/hedera/report.js} | 50 +- web/js/htk/full-image.js | 3 + web/js/htk/grid.js | 2 +- web/js/vn/node.js | 5 +- web/locale/ca/pages/login.json | 9 - web/locale/ca/pages/web.json | 4 - web/locale/es/pages/login.json | 9 - web/locale/es/pages/web.json | 4 - web/locale/fr/pages/login.json | 9 - web/locale/fr/pages/web.json | 4 - web/pages/login/head.php | 19 - web/pages/login/html.php | 67 --- web/pages/login/login.js | 33 -- web/pages/login/login.php | 24 - web/pages/login/style.css | 166 ------ web/pages/web/head.php | 21 - web/pages/web/html.php | 59 --- web/pages/web/mobile.css | 26 - web/pages/web/style.css | 282 ---------- web/pages/web/tpv.js | 124 ----- web/pages/web/web.js | 496 ------------------ web/pages/web/web.php | 11 - web/reports/shelves/report.xml | 10 + web/reports/shelves/shelves.js | 11 + web/reports/shelves/style.css | 6 + 36 files changed, 355 insertions(+), 1523 deletions(-) delete mode 100755 web/forms/admin/photos/send-data.php create mode 100755 web/forms/admin/shelves/shelves.js create mode 100755 web/forms/admin/shelves/style.css create mode 100755 web/forms/admin/shelves/ui.xml create mode 100755 web/js/hedera/report.css create mode 100755 web/js/hedera/report.html rename web/{pages/web/module.js => js/hedera/report.js} (55%) delete mode 100755 web/locale/ca/pages/login.json delete mode 100755 web/locale/ca/pages/web.json delete mode 100755 web/locale/es/pages/login.json delete mode 100755 web/locale/es/pages/web.json delete mode 100755 web/locale/fr/pages/login.json delete mode 100755 web/locale/fr/pages/web.json delete mode 100755 web/pages/login/head.php delete mode 100755 web/pages/login/html.php delete mode 100755 web/pages/login/login.js delete mode 100755 web/pages/login/login.php delete mode 100755 web/pages/login/style.css delete mode 100755 web/pages/web/head.php delete mode 100755 web/pages/web/html.php delete mode 100755 web/pages/web/mobile.css delete mode 100755 web/pages/web/style.css delete mode 100755 web/pages/web/tpv.js delete mode 100644 web/pages/web/web.js delete mode 100755 web/pages/web/web.php create mode 100755 web/reports/shelves/report.xml create mode 100755 web/reports/shelves/shelves.js create mode 100755 web/reports/shelves/style.css diff --git a/web/forms/admin/photos/send-data.php b/web/forms/admin/photos/send-data.php deleted file mode 100755 index b202eaef..00000000 --- a/web/forms/admin/photos/send-data.php +++ /dev/null @@ -1,42 +0,0 @@ -'); - - echo json_encode (TRUE); -} -else - echo json_encode (FALSE); - -unset ($_SESSION['captcha']); - -?> diff --git a/web/forms/admin/shelves/shelves.js b/web/forms/admin/shelves/shelves.js new file mode 100755 index 00000000..818cc849 --- /dev/null +++ b/web/forms/admin/shelves/shelves.js @@ -0,0 +1,24 @@ + +Vn.Shelves = new Class +({ + Extends: Vn.Module + + ,activate: function () + { + this.$('report-title').value = 'Anthuriums'; + this.$('warehouse').value = 1; + this.$('date').value = new Date (); + this.$('shelf').value = 1; + this.$('reign').value = 1; + this.$('family').value = 2; + this.$('filter').value = 'Ant %'; + this.$('max-amount').value = 50; + } + + ,onPreviewClick: function () + { + var report = new ShelvesReport (); + report.showWindow (); + } +}); + diff --git a/web/forms/admin/shelves/style.css b/web/forms/admin/shelves/style.css new file mode 100755 index 00000000..4a0d36a3 --- /dev/null +++ b/web/forms/admin/shelves/style.css @@ -0,0 +1,45 @@ + +.shelves +{ + padding: 1em; +} +.shelves .box +{ + max-width: 40em; + padding: 2em; +} +.shelves .body +{ + max-width: 20em; + margin: auto; + padding: 0; +} +.shelves .form-group +{ + padding: 0.4em; +} +.shelves form label +{ + display: block; + margin-bottom: 0.5em; +} +.shelves input, +.shelves select +{ + margin: 0; + width: 100%; +} + +/* Footer */ + +.shelves .footer +{ + text-align: center; + margin-top: 1.5em; +} +.shelves .footer > button +{ + margin: 0 .2em; + width: 5em; +} + diff --git a/web/forms/admin/shelves/ui.xml b/web/forms/admin/shelves/ui.xml new file mode 100755 index 00000000..feacf5a8 --- /dev/null +++ b/web/forms/admin/shelves/ui.xml @@ -0,0 +1,73 @@ + +
+

Shelves

+
+
+
+
+
+ + +
+
+ + + + SELECT id, name FROM vn2008.warehouse + WHERE reserve ORDER BY name + + +
+
+ + +
+
+ + + + SELECT id, name FROM vn2008.shelf + + +
+
+ + + + SELECT id, reino FROM vn2008.reinos + WHERE display != FALSE ORDER BY reino + + +
+
+ + + + SELECT tipo_id, Tipo FROM vn2008.Tipos + WHERE reino_id = #reign ORDER BY Tipo + + + + + +
+
+ + +
+
+ + +
+
+ +
+
+
diff --git a/web/forms/ecomerce/catalog/catalog.js b/web/forms/ecomerce/catalog/catalog.js index 6528432d..5349b2ac 100755 --- a/web/forms/ecomerce/catalog/catalog.js +++ b/web/forms/ecomerce/catalog/catalog.js @@ -24,6 +24,17 @@ Vn.Catalog = new Class this.conn.execQuery (query, this.onBasketForGuest.bind (this)); } } + + ,close: function () + { + if (this.node) + { + this.gui.$('top-bar').style.backgroundColor = ''; + Vn.Node.remove (this.$('right-panel')); + } + + this.parent (); + } ,onBasketForGuest: function () { @@ -42,13 +53,38 @@ Vn.Catalog = new Class this.popup = new Htk.Popup (); this.popup.setChildNode (this.$('lots-popup')); + + this.setView ('GRID'); } - ,deactivate: function () + ,onSwitchViewClick: function () { - this.parent (); - this.gui.$('top-bar').style.backgroundColor = ''; - Vn.Node.remove (this.$('right-panel')); + this.setView (this.view == 'LIST' ? 'GRID' : 'LIST'); + } + + ,setView: function (view) + { + if (this.viewNode) + { + Vn.Node.remove (this.viewNode); + this.viewHolder.model = null; + } + + if (view == 'GRID') + { + this.view = 'GRID'; + this.viewNode = this.$('grid-view').getNode (); + this.viewHolder = this.$('grid-view'); + } + else + { + this.view = 'LIST'; + this.viewNode = this.$('list-view'); + this.viewHolder = this.$('items-grid'); + } + + this.$('main').appendChild (this.viewNode); + this.viewHolder.model = this.$('items-model'); } ,typeRenderer: function (builder, form) diff --git a/web/forms/ecomerce/catalog/style.css b/web/forms/ecomerce/catalog/style.css index f896ec78..691ab51a 100755 --- a/web/forms/ecomerce/catalog/style.css +++ b/web/forms/ecomerce/catalog/style.css @@ -180,18 +180,18 @@ button.confirm > img } .items > tbody > tr { - height: 6em; + height: 4em; } .items .icon { - width: 6em; - padding: .2em; - padding-right: .5em; + width: 4em; + padding: 0; } .items .icon > img { - max-height: 6em; - max-width: 6em; + max-height: 2.5em; + max-width: 2.5em; + border-radius: 50%; } td.second-category { diff --git a/web/forms/ecomerce/catalog/ui.xml b/web/forms/ecomerce/catalog/ui.xml index 457b9977..b04887c0 100755 --- a/web/forms/ecomerce/catalog/ui.xml +++ b/web/forms/ecomerce/catalog/ui.xml @@ -70,9 +70,10 @@
-
- - - -
+
+
+ + + + + + + + + +
+ + +
+ + + + + + + + + + Report + + + diff --git a/web/pages/web/module.js b/web/js/hedera/report.js similarity index 55% rename from web/pages/web/module.js rename to web/js/hedera/report.js index dae182b7..8142c43c 100755 --- a/web/pages/web/module.js +++ b/web/js/hedera/report.js @@ -1,18 +1,29 @@ -Vn.Module = new Class +Vn.Report = new Class ({ Extends: Vn.Object - ,initialize: function (gui, formInfo) + ,initialize: function (props) { - this.gui = gui; - this.conn = gui.conn; - this.hash = gui.hash; - this.formInfo = formInfo; + this.parent (props); + this.open (); + } + + ,showWindow: function () + { + var reportWindow = window.open ('js/hedera/report.html', reportPath, + 'resizable=yes,height=600,width=750,scrollbars=yes,menubar=no'); + //report.print (); + + Vn.includeCss ('reports/'+ reportPath +'/style.css'); + window.document.body.appendChild (this.node); + + var report = new Vn.Report (reportWindow.document.body); + return reportWindow; } /** - * Gets an object from the builder associated to this form. + * Gets an object from the builder associated to this report. * * @param {string} objectId The object identifier * @return {Object} The object, or %null if not found @@ -29,12 +40,10 @@ Vn.Module = new Class * Called when the form is opened. **/ ,open: function () - { - this.close (); - + { this.builder = new Vn.Builder (); this.builder.signalData = this; - this.builder.loadXml (Vn.getXml ('forms/'+ this.formInfo.path +'/ui.xml')); + this.builder.loadXml (Vn.getXml ('reports/'+ this.reportPath +'/report.xml')); this.node = this.builder.get ('form'); var models = this.builder.getObjects ('db-model'); @@ -46,30 +55,25 @@ Vn.Module = new Class for (var i = 0; i < queries.length; i++) queries[i].conn = this.conn; - - this.gui.formHolder.appendChild (this.node); } /** * Called when the form is activated. **/ ,activate: function () {} + + /** + * Called when the form is deactivated. + **/ + ,deactivate: function () {} /** * Called when the form is closed. **/ ,close: function () { - if (this.node) - { - Vn.Node.remove (this.node); - this.node = null; - } - if (this.builder) - { - this.builder.unref (); - this.builder = null; - } + this.builder.unref (); + this.builder = null; } ,_destroy: function () diff --git a/web/js/htk/full-image.js b/web/js/htk/full-image.js index ca30b63f..aab311e3 100755 --- a/web/js/htk/full-image.js +++ b/web/js/htk/full-image.js @@ -45,7 +45,10 @@ Htk.FullImage = new Class ,show: function (src) { if (this.closed && this.src == src) + { + this.closed = false; return; + } this.cancelHide (); this.loadingBox.style.left = this.getLeft (40); diff --git a/web/js/htk/grid.js b/web/js/htk/grid.js index efe1ba91..63b411cd 100755 --- a/web/js/htk/grid.js +++ b/web/js/htk/grid.js @@ -151,7 +151,7 @@ Htk.Grid = new Class ,onUpdatableChange: function () { - if (this._model.updatable) + if (this._model && this._model.updatable) { if (!this.internalColumn) { diff --git a/web/js/vn/node.js b/web/js/vn/node.js index f785f474..cb32ce36 100755 --- a/web/js/vn/node.js +++ b/web/js/vn/node.js @@ -55,10 +55,7 @@ Vn.Node = ,show: function (node) { - var style = window.getComputedStyle (node); - - if (style.display === 'none') - node.style.display = 'initial'; + node.style.display = 'block'; } }; diff --git a/web/locale/ca/pages/login.json b/web/locale/ca/pages/login.json deleted file mode 100755 index 02719668..00000000 --- a/web/locale/ca/pages/login.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "User": "Usuari" - ,"Password": "Contrasenya" - ,"NotCloseSession": "No tancar sessió" - ,"IWantToKnowMore": "Vull saber-ne més!" - ,"Enter": "Entrar" - ,"LoginMail": "clientes@verdnatura.es" - ,"LoginPhone": "+34 607 562 391" -} diff --git a/web/locale/ca/pages/web.json b/web/locale/ca/pages/web.json deleted file mode 100755 index 42bc0f69..00000000 --- a/web/locale/ca/pages/web.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Welcome": "Benvingut/da" - ,"Exit": "Eixir" -} diff --git a/web/locale/es/pages/login.json b/web/locale/es/pages/login.json deleted file mode 100755 index aee401e2..00000000 --- a/web/locale/es/pages/login.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "User": "Usuario" - ,"Password": "Contraseña" - ,"NotCloseSession": "No cerrar sesión" - ,"IWantToKnowMore": "¡Quiero saber más!" - ,"Enter": "Entrar" - ,"LoginMail": "clientes@verdnatura.es" - ,"LoginPhone": "+34 963 242 100" -} diff --git a/web/locale/es/pages/web.json b/web/locale/es/pages/web.json deleted file mode 100755 index c8651115..00000000 --- a/web/locale/es/pages/web.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Welcome": "Bienvenido/a" - ,"Exit": "Salir" -} diff --git a/web/locale/fr/pages/login.json b/web/locale/fr/pages/login.json deleted file mode 100755 index 1fd9db08..00000000 --- a/web/locale/fr/pages/login.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "User": "Utilisateur" - ,"Password": "Mot de passe" - ,"NotCloseSession": "Garder ma session active" - ,"IWantToKnowMore": "En savoir plus!" - ,"Enter": "Entrer" - ,"LoginMail": "ruben@verdnatura.es" - ,"LoginPhone": "+33 781 533 900" -} diff --git a/web/locale/fr/pages/web.json b/web/locale/fr/pages/web.json deleted file mode 100755 index dff01b04..00000000 --- a/web/locale/fr/pages/web.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Welcome": "Bienvenue" - ,"Exit": "Sortir" -} diff --git a/web/pages/login/head.php b/web/pages/login/head.php deleted file mode 100755 index 21855b37..00000000 --- a/web/pages/login/head.php +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/web/pages/login/html.php b/web/pages/login/html.php deleted file mode 100755 index 6861c554..00000000 --- a/web/pages/login/html.php +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - Login - Verdnatura - - - -
-
-
-
- -
-
-
-
- - -
-
- - -
-
-
- - -
-
- -
-
-

-

-
- -
-
-
-
- - diff --git a/web/pages/login/login.js b/web/pages/login/login.js deleted file mode 100755 index 01a96306..00000000 --- a/web/pages/login/login.js +++ /dev/null @@ -1,33 +0,0 @@ - -window.addEventListener ('load', function () { - var web = new Vn.Login (); -}); - -Vn.Login = new Class -({ - Extends: Vn.Object - - ,initialize: function () - { - Vn.Hash.initialize (); - - switch (Vn.Hash.get ('error')) - { - case 'badLogin': - alert (_('InvalidLogin')); - break; - case 'sessionExpired': - alert (_('SessionExpired')); - break; - } - - var userEntry = document.getElementById ('user'); - - if (Vn.Cookie.check ('vn_user')) - userEntry.value = Vn.Cookie.get ('vn_user'); - - userEntry.focus (); - userEntry.select (); - } -}); - diff --git a/web/pages/login/login.php b/web/pages/login/login.php deleted file mode 100755 index 6792e06c..00000000 --- a/web/pages/login/login.php +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/web/pages/login/style.css b/web/pages/login/style.css deleted file mode 100755 index e5f4b1aa..00000000 --- a/web/pages/login/style.css +++ /dev/null @@ -1,166 +0,0 @@ -body -{ - position: absolute; - margin: 0; - height: 100%; - width: 100%; - z-index: -2; - background-color: #EEE; -} -body, -label, -button, -input, -textarea, -p, -a -{ - font-size: 1.2em; - font-weight: normal; - color: #333; -/* text-shadow: 0 0.2em 0.2em #AAA; */ -} - -/* Header */ - -#header -{ - z-index: 10; - position: absolute; - background-color: #333; - width: 100%; - height: 3.5em; - -} -#header div -{ - margin-top: 1em; - text-align: center; -} -#header a -{ - color: white; -} - -/* Body */ - -#body -{ - position: absolute; - top: 3.5em; - left: 0; - right: 0; - bottom: 0; -/* background-image: url("background.png"); - background-repeat: repeat; -*/ -} -#column -{ - position: relative; - margin: 0 auto; - overflow: auto; - max-width: 40em; - height: 100%; - background-color: white; - box-shadow: 0 0.2em 0.2em #DDD; -} - -/* Login */ - -#login -{ - position: absolute; - margin-top: -17em; - padding: 1em; - max-width: 45em; - top: 50%; - left: 0; - right: 0; - -} -#logo img -{ - display: block; - margin: 0.5em auto; - min-width: 24em; - width: 75%; -} -#version-code -{ - color: red; - text-align: right; - margin: 0.2em auto; - font-weight: bold; - height: 2em; -} -#form-inputs -{ - margin: 0 auto; - max-width: 16em; -} -div.form-group label -{ - display: block; -} -input -{ - border-radius: 0.1em; - box-shadow: 0 0.1em 0.1em #AAA; - margin: 0.3em; -} -input[type=text], -input[type=password] -{ - margin: 0.5em 0; - margin-bottom: 0.5em; - padding: 0.5em; - width: 100%; - border: 1px solid #AAA; -} -td.entry -{ - text-align: left; -} -input[type=submit] -{ - display: block; - margin: 0 auto; - background-color: #AD4; - border: 1px solid #8B2; - height: 2.4em; - width: 8em; - color: #250; -} -input[type=submit]:hover -{ - background-color: #9C3; -} -#bottom -{ - text-align: center; - padding: 1em; -} - -/* Info */ - -#info -{ - margin-top: 2.5em; - text-align: center; -} -#info p -{ - margin: 0.5em; -} -#links -{ - margin: 0 auto; - margin-top: 2em; - text-align: center; -} -#links img -{ - height: 1.8em; -} - diff --git a/web/pages/web/head.php b/web/pages/web/head.php deleted file mode 100755 index 2356c610..00000000 --- a/web/pages/web/head.php +++ /dev/null @@ -1,21 +0,0 @@ - diff --git a/web/pages/web/html.php b/web/pages/web/html.php deleted file mode 100755 index ce1554d2..00000000 --- a/web/pages/web/html.php +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - Verdnatura - - - - - -
-
- -
-
-
-
-
-
- - diff --git a/web/pages/web/mobile.css b/web/pages/web/mobile.css deleted file mode 100755 index 6b2c72fc..00000000 --- a/web/pages/web/mobile.css +++ /dev/null @@ -1,26 +0,0 @@ - -#menu-button -{ - display: block; -} -#menu-box -{ - display: none; -} -#form-holder -{ - left: 0; -} -ul.submenu -{ - display: block; - position: relative; - border: none; - border-radius: 0; - background-color: white; - box-shadow: none; -} -.htk-toast -{ - margin-left: -11em; -} diff --git a/web/pages/web/style.css b/web/pages/web/style.css deleted file mode 100755 index ca2ad951..00000000 --- a/web/pages/web/style.css +++ /dev/null @@ -1,282 +0,0 @@ - -body -{ - position: absolute; - margin: 0; - height: 100%; - width: 100%; - background-color: #EEE; - -} - -/* Font */ - -#welcome, -#exit span, -#menu-title, -#menu a -{ - font-size: 1.1em; -} - -/* Header */ - -#header, -#exit -{ - height: 4.2em; -} -#header -{ - position: relative; - background-color: #333; - width: 100%; - z-index: 1; -} -#header * -{ - color: white; -} -#header-bar -{ - position: relative; - height: 100%; - overflow: hidden; -} -#logo -{ - width: 16em; - float: left; - padding: 1em; - padding-top: 1.2em; -} -#loader -{ - float: left; - margin-left: 0.4em; - margin-top: 1.4em; - visibility: hidden; -} -#welcome -{ - float: right; - padding: 0 1.5em; -} -#welcome span -{ - font-size: 1em; -} -#welcome, -#exit span -{ - margin-top: 2em; -} -#exit -{ - float: right; - background-color: #FC9900; - width: 4em; - text-align: center; -} -#exit:hover -{ - background-color: #FCA910; -} -#exit span -{ - display: block; -} -#header, -#content -{ - margin: auto; - width: 100%; -} - -/* Body */ - -#body -{ - position: absolute; - top: 4.2em; - bottom: 0; - left: 0; - right: 0; -} -#content -{ - position: relative; - height: 100%; -} - -/* Top bar */ - -#top-bar -{ - height: 3em; - overflow: hidden; - background-color: #CE8; -} - -/* Left panel */ - -#menu-button -{ - display: none; - float: left; - border: none; - background-color: transparent; - padding: 0; - margin: 0; - margin-left: 0.6em; - height: 4.2em; -} -#menu-button img -{ - height: 2em; -} -#background -{ - z-index: 10; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background-color: rgba(10, 10, 10, 0.6); - display: none; -} -#menu-box, -#menu > li, -ul.submenu -{ - width: 15em; -} -#menu-box -{ - z-index: 20; - position: absolute; - left: 0; - bottom: 0; - top: 0; - background-color: white; - z-index: 20; - box-shadow: 0 0.2em 0.2em #AAA; -} -#menu-overflow -{ - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 4em; - overflow: auto; -} - -/* Test link */ - -#test-link -{ - display: block; - margin: 1em auto; - max-width: 70%; - background-color: #3f51b5; - color: white; - padding: 0 1em; - line-height: 2em; - border-radius: 0.1em; - text-align: center; -} -#test-link:hover -{ - background-color: #4f61c5; -} - -/* Menu */ - -#menu -{ - list-style-type: none; - padding: 0; - margin: 0; -} -#menu > li -{ - display: block; - float: left; - clear: both; - padding: 0; -} -#menu > li > a -{ - line-height: 2.8em; - width: 70%; - padding: 0 15%; -} -#menu a -{ - float: left; -} -#menu a:hover -{ - background-color: #DDD /* #AC6 */; -} -#menu a.selected -{ - background-color: #EEE; -} -ul.submenu -{ - display: none; - position: fixed; - border: none; - border-radius: 1px; - background-color: white; - box-shadow: 0 0.2em 0.2em #CCC; - z-index: 50; - list-style-type: none; - padding-left: 0; -} -ul.submenu a -{ - width: 60%; - padding: 0.7em 20%; -} - -/* Links */ - -#links -{ - position: absolute; - bottom: 0; - right: 0; - padding: 0.8em; -} -#links a -{ - padding: 0.1em; - display: block; - float: left; - max-width: 2.2em; -} -#links img -{ - height: 1.8em; -} - -/* Form holder */ - -#form-holder -{ - position: absolute; - top: 0em; - bottom: 0; - right: 0; - left: 15em; - overflow: auto; -} -.htk-toast -{ - margin-left: -3em; -} - diff --git a/web/pages/web/tpv.js b/web/pages/web/tpv.js deleted file mode 100755 index 562e6380..00000000 --- a/web/pages/web/tpv.js +++ /dev/null @@ -1,124 +0,0 @@ - -Vn.Tpv = -{ - check: function (conn) - { - var tpvStatus = Vn.Hash.get ('tpv_status'); - - if (tpvStatus) - { - var batch = new Sql.Batch (); - batch.addValue ('transaction', Vn.Hash.get ('tpv_order')); - batch.addValue ('status', tpvStatus); - - var query = 'CALL transaction_end (#transaction, #status)'; - - conn.execQuery (query, null, batch); - } - } - - ,pay: function (conn, amount, company) - { - if (amount > 0) - { - var query = 'CALL transaction_start (#company, #amount)'; - - var batch = new Sql.Batch (); - batch.addValue ('company', company); - batch.addValue ('amount', parseInt (amount * 100)); - - conn.execQuery (query, - this._onTransactionStart.bind (this), batch); - } - else if (!isNaN (amount)) - Htk.Toast.showError (_('AmountError')); - } - - ,_onTransactionStart: function (resultSet) - { - var res = resultSet.fetchResult (); - - if (res && res.next ()) - { - var form = document.createElement ('form'); - form.method = 'post'; - form.action = res.get ('url'); - document.body.appendChild (form); - - var fieldsMap = - { - 'Ds_Merchant_Amount': 'amount' - ,'Ds_Merchant_Order': 'ds_order' - ,'Ds_Merchant_MerchantCode': 'id' - ,'Ds_Merchant_Currency': 'currency' - ,'Ds_Merchant_TransactionType': 'transaction_type' - ,'Ds_Merchant_Terminal': 'terminal' - ,'Ds_Merchant_MerchantURL': 'merchant_url' - ,'Ds_Merchant_MerchantSignature': 'signature' - ,'Ds_Merchant_UrlOK': null - ,'Ds_Merchant_UrlKO': null - }; - - for (var field in fieldsMap) - { - var input = document.createElement ('input'); - input.type = 'hidden'; - input.name = field; - form.appendChild (input); - - if (fieldsMap[field]) - input.value = res.get (fieldsMap[field]); - } - - var transactionId = res.get ('ds_order'); - form['Ds_Merchant_UrlOK'].value = this._makeUrl ('ok', transactionId); - form['Ds_Merchant_UrlKO'].value = this._makeUrl ('ko', transactionId); - - form.submit (); - } - else - Htk.Toast.showWarning (_('PayError')); - } - - ,_makeUrl: function (status, order) - { - var path = location.protocol +'//'+ location.host; - path += location.port ? ':'+ location.port : ''; - path += location.pathname; - path += location.search ? location.search : ''; - path += Vn.Hash.make ({ - 'form': 'ecomerce/orders', - 'tpv_status': status, - 'tpv_order': order - }, true); - - return path; - } -}; - -Vn.BasketChecker = -{ - check: function (conn, callback) - { - conn.execQuery ('CALL basket_check ()', - this._onBasketCheck.bind (this, callback)); - } - - ,_onBasketCheck: function (callback, resultSet) - { - var status = resultSet.fetchValue (); - - if (!status) - return; - - var isOk = status == 'UPDATED' || status == 'OK'; - - if (status == 'UPDATED') - Htk.Toast.showWarning (_('OrderItemsUpdated')); - if (callback) - callback (isOk); - if (!isOk) - Vn.Hash.set ({'form': 'ecomerce/checkout'}); - } -}; - diff --git a/web/pages/web/web.js b/web/pages/web/web.js deleted file mode 100644 index 4d0b900c..00000000 --- a/web/pages/web/web.js +++ /dev/null @@ -1,496 +0,0 @@ - -window.addEventListener ('load', function () { - var web = new Vn.Web (); -}); - -Vn.Web = new Class -({ - Extends: Htk.Widget - - ,forms: {} - ,activeForm: null - ,activeCss: null - ,requestedForm: null - ,menuShown: false - ,menuOptions: {} - ,choosedOption: null - - ,initialize: function () - { - window.onerror = function (message, file, line) - { - var error = new Error (message); - error.fileName = file; - error.lineNumber = line; - - Htk.Toast.showError (_('InternalError')); - this.notifyError (error); - }.bind (this); - - this.loadingCount = 0; - this.loader = $('loader'); - this.formHolder = $('form-holder'); - - Vn.Hash.initialize (); - this.hash = Vn.Hash; - - this.hashParam = new Vn.HashParam ({key: 'form'}); - this.hashParam.on ('changed', this.onFormChange, this); - - $('background').onclick = function () {}; - - $('menu-button').addEventListener ('click', function (event) - { - event.stopPropagation (); - - if (!this.menuShown) - this.showMenu (); - else - this.hideMenu (); - }.bind (this)); - - $('menu-box').addEventListener ('click', function (event) - { - event.stopPropagation (); - }); - - if (!Vn.Cookie.check ('hedera_cookies')) - { - Vn.Cookie.set ('hedera_cookies', true); - Htk.Toast.showWarning (_('CookiesNotification')); - } - - this.conn = new Db.Conn (); - this.conn.on ('error', this.onConnError, this); - this.conn.on ('loading-changed', this.onConnLoading, this); -// this.conn.open (null, null, null, this.connOpened.bind (this)); - - var sql = 'SELECT default_form, image_dir FROM config;' - +'SELECT production_domain, test_domain FROM config;' - +'SELECT name FROM customer_view;' - +'CALL form_list ();'; - this.conn.execQuery (sql, this.onMainQueryDone.bind (this)); - } - - ,showBackground: function () - { - Vn.Node.show ($('background')); - } - - ,hideBackground: function () - { - Vn.Node.hide ($('background')); - } - - ,showMenu: function () - { - this.showBackground (); - Vn.Node.show ($('menu-box')); - this.menuShown = true; - - this.hideMenuCallback = this.hideMenu.bind (this); - document.addEventListener ('click', this.hideMenuCallback); - } - - ,hideMenu: function () - { - this.hideBackground (); - Vn.Node.hide ($('menu-box')); - $('menu-button').style.display = 'initial'; - this.menuShown = false; - - document.removeEventListener ('click', this.hideMenuCallback); - this.hideMenuCallback = null; - } - - ,onMainQueryDone: function (resultSet) - { - // Retrieving configuration parameters - - var res = resultSet.fetchResult (); - var columns = res.columns; - - if (res.next ()) - for (var i = 0; i < res.columns.length; i++) - Vn.Config[columns[i].name] = res.get (columns[i].name); - - // Retrieving configuration parameters - - var res = resultSet.fetchResult (); - - if (res.next () && res.get ('test_domain')) - { - if (location.host != res.get ('production_domain')) - { - var linkText = 'ReturnToOldWebsite'; - var linkField = 'production_domain'; - } - else - { - var linkText = 'TestTheNewWebsite'; - var linkField = 'test_domain'; - } - - Vn.Node.setText ($('test-link'), _(linkText)); - $('test-link').href = '//'+ res.get (linkField); - } - else - Vn.Node.hide ($('test-link')); - - // Retrieving the user name - - var userName = resultSet.fetchValue (); - - if (userName) - { - var span = $('user-name'); - span.appendChild (document.createTextNode (', '+ userName)); - } - - // Retrieving menu sections - - var res = resultSet.fetchResult (); - var sectionMap = {}; - - if (res) - for (var i = 0; res.next (); i++) - { - var parent = res.get ('parent'); - - if (!sectionMap[parent]) - sectionMap[parent] = []; - - sectionMap[parent].push (i); - } - - this.createMenu (res, sectionMap, null, $('menu')); - - // Loading the default form - - this.onFormChange (); - } - - ,notifyError: function (error) - { - if (error instanceof Error) - { - var httpRequest = new Vn.HttpRequest () - httpRequest.add - ({ - 'file': error.fileName - ,'line': error.lineNumber - ,'message': error.message - ,'stack': error.stack - }); - httpRequest.send ('log.php'); - } - } - - ,errorHandler: function (error) - { - if (error instanceof Vn.Error) - switch (error.domain) - { - case 'Auth': - this.unload (); - location.assign ('?page=login#!error='+ error.code); - break; - case 'Version': - this.newVersion (error); - break; - case 'User': - Htk.Toast.showError (error.message); - break; - default: - console.error (error.message); - Htk.Toast.showError (_('InternalError')); - } - else - { - console.error (error); - Htk.Toast.showError (_('InternalError')); - this.notifyError (error); - } - } - - ,onConnError: function (conn, error) - { - this.errorHandler (error); - } - - ,onConnLoading: function (conn, isLoading) - { - if (isLoading) - this.loaderPush (); - else - this.loaderPop (); - } - - ,loaderPush: function () - { - this.loadingCount++; - - if (this.loadingCount == 1) - this.loader.style.visibility = 'visible'; - } - - ,loaderPop: function () - { - if (this.loadingCount == 0) - return; - - this.loadingCount--; - - if (this.loadingCount == 0) - this.loader.style.visibility = 'hidden'; - } - - ,newVersion: function (error) - { - if (this.newVersionBlock || this.skipVersion) - return; - - this.newVersionBlock = true; - - var reload; - var message = _('NewVersionAvailable') +"\n\n"+ error.message; - - if (error.code == 'criticalVersion') - { - alert (message) - reload = true; - } - else - { - reload = confirm (message); - this.skipVersion = true; - } - - if (reload) - { - this.unload (); - location.reload (); - } - - this.newVersionBlock = false; - } - - ,createMenu: function (res, sectionMap, parent, ul) - { - var sections = sectionMap[parent]; - - for (var i = 0; i < sections.length; i++) - { - res.row = sections[i]; - - var li = document.createElement ('li'); - ul.appendChild (li); - - var a = document.createElement ('a'); - a.href = Vn.Hash.make ({'form': res.get ('path')}); - this.menuOptions[res.get ('path')] = a; - li.appendChild (a); - - var text = document.createTextNode (_(res.get ('description'))); - a.appendChild (text); - - var formId = res.get ('id'); - - if (sectionMap[formId]) - { - var submenu = document.createElement ('ul'); - submenu.className = 'submenu'; - li.appendChild (submenu); - - li.addEventListener ('mouseover', - this.onLiMouseHover.bind (this, submenu, a)); - li.addEventListener ('mouseout', - this.onLiMouseOut.bind (this)); - - this.createMenu (res, sectionMap, formId, submenu); - } - } - } - - ,onLiMouseHover: function (submenu, parent) - { - if (Vn.isMobile ()) - return; - - this.hideSubmenu (); - this.activeSubmenu = submenu; - - var rect = parent.getBoundingClientRect (); - submenu.style.display = 'inline'; - submenu.style.left = rect.right +'px'; - submenu.style.top = rect.top +'px'; - } - - ,onLiMouseOut: function () - { - this.timeout = setTimeout (this.hideSubmenu.bind (this), 160); - } - - ,hideSubmenu: function () - { - var submenu = this.activeSubmenu; - - if (submenu) - { - submenu.style.display = 'none'; - clearTimeout (this.timeout); - this.activeSubmenu = null; - this.timeout = 0; - } - } - - ,onFormChange: function () - { - var formPath = this.hashParam.value; - this.openForm (formPath ? formPath : Vn.Config['default_form'], null); - } - - ,openForm: function (formPath, callback) - { - if (Vn.isMobile ()) - this.hideMenu (); - - this.loaderPush (); - - this.requestedForm = formPath; - - var formInfo = this.forms[formPath]; - var path = 'forms/'+ formPath; - - if (this.activeForm) - { - this.activeForm.close (); - this.activeForm.unref (); - this.activeForm = null; - } - - if (this.activeCss) - { - Vn.excludeCss (this.activeCss +'/style.css'); - - if (Vn.isMobile ()) - Vn.excludeCss (this.activeCss +'/mobile.css'); - } - - this.activeCss = path; - - Vn.includeCss (this.activeCss +'/style.css'); - - if (Vn.isMobile ()) - Vn.includeCss (this.activeCss +'/mobile.css'); - - if (!formInfo) - { - var aux = formPath.split ('/'); - var formName = aux[aux.length - 1]; - - var klass = 'Vn.'+ formName.charAt (0).toUpperCase (); - klass += formName.substr (1).replace (/\w\-\w/g, function (token) - { - return token.charAt (0) + token.charAt (2).toUpperCase (); - }); - - formInfo = { - path: formPath - ,klass: klass - ,localeReady: false - ,jsReady: false - ,uiReady: false - ,error: false - ,ready: false - ,callbacks: [] - }; - - Vn.Locale.load (path, - this.onFormLocaleReady.bind (this, formInfo)); - Vn.includeJs (path +'/'+ formName +'.js', - this.onFormJsReady.bind (this, formInfo)); - Vn.loadXml ('forms/'+ formPath +'/ui.xml', - this.onFormUiReady.bind (this, formInfo)); - - this.forms[formPath] = formInfo; - } - - var newChoosedOption = this.menuOptions[formInfo.path]; - - if (newChoosedOption) - { - if (this.choosedOption) - this.choosedOption.className = null; - - newChoosedOption.className = 'selected'; - this.choosedOption = newChoosedOption; - } - - if (callback) - formInfo.callbacks.push (callback); - if (formInfo.ready) - this.onFormReady (formInfo); - } - - ,onFormLocaleReady: function (formInfo, success) - { - formInfo.localeReady = true; - this.onFormReady (formInfo); - } - - ,onFormJsReady: function (formInfo, success) - { - formInfo.jsReady = true; - formInfo.error = !success; - this.onFormReady (formInfo); - } - - ,onFormUiReady: function (formInfo, success) - { - formInfo.uiReady = true; - formInfo.error = !success; - this.onFormReady (formInfo); - } - - ,onFormReady: function (formInfo) - { - if (!(formInfo.localeReady && formInfo.jsReady && formInfo.uiReady)) - return; - - formInfo.ready = true; - - if (!formInfo.error) - { - if (formInfo.path == this.requestedForm) - try { - var klass = eval (formInfo.klass); - this.activeForm = new klass (this, formInfo); - this.activeForm.open (); - this.activeForm.activate (); - } - catch (e) { - formInfo.error = true; - this.errorHandler (error); - } - } - else - Htk.Toast.showError (_('ErrorLoadingForm')); - - var callbacks = formInfo.callbacks; - formInfo.callbacks = []; - - for (var i = 0; i < callbacks.length; i++) - callbacks[i] (this.activeForm); - - this.loaderPop (); - } - - ,unload: function () - { - this.hashParam.unref (); - this.conn.disconnect ('error', this.onConnError, this); - this.conn.disconnect ('loading-changed', this.onConnLoading, this); - } -}); - diff --git a/web/pages/web/web.php b/web/pages/web/web.php deleted file mode 100755 index d227eb57..00000000 --- a/web/pages/web/web.php +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/web/reports/shelves/report.xml b/web/reports/shelves/report.xml new file mode 100755 index 00000000..4874b410 --- /dev/null +++ b/web/reports/shelves/report.xml @@ -0,0 +1,10 @@ + +
+

+ +

+
+ +
+
+
diff --git a/web/reports/shelves/shelves.js b/web/reports/shelves/shelves.js new file mode 100755 index 00000000..e7cf88ae --- /dev/null +++ b/web/reports/shelves/shelves.js @@ -0,0 +1,11 @@ + +Vn.ShelvesReport = new Class +({ + Extends: Vn.Report + + ,open: function () + { + this.parent (); + Vn.Node.setText (this.$('title'), this.title); + } +}); diff --git a/web/reports/shelves/style.css b/web/reports/shelves/style.css new file mode 100755 index 00000000..014dd922 --- /dev/null +++ b/web/reports/shelves/style.css @@ -0,0 +1,6 @@ + +.shelves +{ + padding: 1em; +} +