From 7355557164a8af44adad3db95b11833bc9ddf10c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 10 Jul 2015 14:30:08 +0200 Subject: [PATCH] Version alpha2 del bionic --- .../forms/account/address/address.js | 3 +- .../hedera-web/forms/account/address/ui.xml | 2 +- .../forms/ecomerce/basket/basket.js | 35 +++-- .../hedera-web/forms/ecomerce/basket/ui.xml | 8 +- .../forms/ecomerce/catalog/catalog.js | 68 +-------- .../forms/ecomerce/catalog/style.css | 4 - .../hedera-web/forms/ecomerce/catalog/ui.xml | 61 ++++---- .../forms/ecomerce/checkout/checkout.js | 140 +++++++++++------- .../hedera-web/forms/ecomerce/checkout/ui.xml | 65 ++++---- .../forms/ecomerce/confirm/confirm.js | 99 ------------- .../forms/ecomerce/orders/orders.js | 117 +-------------- .../forms/ecomerce/orders/style.css | 4 - .../hedera-web/forms/ecomerce/orders/tpv.js | 0 .../hedera-web/forms/ecomerce/orders/ui.xml | 34 +---- .../usr/share/hedera-web/js/db/iterator.js | 1 + package/usr/share/hedera-web/js/db/model.js | 40 ++++- .../share/hedera-web/js/htk/field/select.js | 5 +- .../usr/share/hedera-web/js/htk/repeater.js | 5 + package/usr/share/hedera-web/js/vn/builder.js | 3 + .../locale/es/forms/ecomerce/basket.json | 3 +- .../locale/es/forms/ecomerce/checkout.json | 5 +- .../locale/es/forms/ecomerce/orders.json | 2 + .../usr/share/hedera-web/locale/es/js/htk.js | 3 +- .../usr/share/hedera-web/pages/web/head.php | 1 + package/usr/share/hedera-web/pages/web/tpv.js | 100 +++++++++++++ package/usr/share/php/vn/hedera/web.php | 2 + 26 files changed, 353 insertions(+), 457 deletions(-) delete mode 100755 package/usr/share/hedera-web/forms/ecomerce/orders/tpv.js create mode 100755 package/usr/share/hedera-web/pages/web/tpv.js diff --git a/package/usr/share/hedera-web/forms/account/address/address.js b/package/usr/share/hedera-web/forms/account/address/address.js index f85218fb..f6e890f4 100755 --- a/package/usr/share/hedera-web/forms/account/address/address.js +++ b/package/usr/share/hedera-web/forms/account/address/address.js @@ -5,7 +5,6 @@ Vn.Address = new Class ,activate: function () { - this.$('model').mode = Db.Model.Mode.ON_DEMAND; this.$('model').setInfo ('a', 'address_view', 'hedera', ['id'], 'id'); this.$('model').setDefault ('customer_id', 'a', new Sql.Func ({schema: 'account', name: 'user_get_id'})); @@ -13,7 +12,7 @@ Vn.Address = new Class ,onStatusChange: function (form) { - if (this.$('address').value == 0) + if (form.ready && this.$('address').value == 0) form.insertRow (); } diff --git a/package/usr/share/hedera-web/forms/account/address/ui.xml b/package/usr/share/hedera-web/forms/account/address/ui.xml index 00290182..3db114cb 100755 --- a/package/usr/share/hedera-web/forms/account/address/ui.xml +++ b/package/usr/share/hedera-web/forms/account/address/ui.xml @@ -5,7 +5,7 @@ - + SELECT a.id, a.name, a.consignee, a.city, a.zip_code, a.province_id, c.Id country_id FROM address_view a LEFT JOIN vn2008.province p ON p.province_id = a.province_id diff --git a/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js b/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js index fa842274..c5715677 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js +++ b/package/usr/share/hedera-web/forms/ecomerce/basket/basket.js @@ -2,23 +2,34 @@ Vn.Basket = new Class ({ Extends: Vn.Module - - ,orderId: null - ,activate: function () {} - - ,onCatalogClick: function () + ,activate: function () { - Vn.Cookie.set ('order', this.$('order').value); - this.hash.set ({'form': 'ecomerce/catalog'}); + var query = 'CALL basket_check ()'; + this.conn.execQuery (query, this.onBasketCheck.bind (this)); + } + + ,onBasketCheck: function (resultSet) + { + var res = resultSet.fetchResult (); + + if (!res.next()) + return; + + if (res.get ('order_id')) + { + if (res.get ('refresh') && res.get ('nrows') > 0) + (new Htk.Toast ()).showWarning (_('OrderItemsUpdated')); + + this.$('order').value = res.get ('order_id'); + } + else + this.hash.set ({'form': 'ecomerce/checkout'}); } ,onConfigureClick: function () { - this.hash.set ({ - 'form': 'ecomerce/checkout', - 'order': this.$('order').value - }); + this.hash.set ({'form': 'ecomerce/checkout'}); } ,onCheckoutClick: function () @@ -80,3 +91,5 @@ Vn.Basket = new Class } }); + + diff --git a/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml index e42dfa70..4960551a 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/basket/ui.xml @@ -1,8 +1,6 @@ - - - + SELECT id, date_send, agency_id, wh_id @@ -21,7 +19,7 @@

ShoppingBasket

- @@ -30,7 +28,7 @@ Checkout
-
+
diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js b/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js index 6a45e91d..79cce795 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js +++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/catalog.js @@ -7,30 +7,17 @@ Vn.Catalog = new Class ,activate: function () { - this.$('items-model').setInfo ('m', 'order_row_view', 'hedera', ['id'], 'id'); - this.$('items-model').setInfo ('a', 'Articles', 'vn2008', ['Id_Article']); - this.popup = new Htk.Popup (); this.popup.setChildNode (this.$('lots-popup')); - - this.$('warehouse').value = 1; - this.$('date').value = new Date (); - - var orderId = Vn.Cookie.getInt ('order'); - - if (!orderId) - this.configureView (); - else - this.$('order-batch').addValue ('order', orderId); } ,onRealmsReload: function (model, status) { - if (status == Db.Model.Status.READY) - { - this.onRealmChange (); - this.onTypeChange (); - } + if (status != Db.Model.Status.READY) + return; + + this.onRealmChange (); + this.onTypeChange (); } ,onRealmChange: function () @@ -132,49 +119,9 @@ Vn.Catalog = new Class this.hideMenuCallback = null; } - ,configureView: function () - { - var orderId = 0; - var grid = this.$('items-grid'); - var orderForm = this.$('order-form'); - - if (orderForm.numRows > 0) - { - orderForm.row = 0; - orderId = orderForm.get ('id'); - - Vn.Node.setText (this.$('basket-button'), _('ShoppingBasket')); - - var items = this.$('items-model'); -/* items.updatable = true; - items.setDefaultFromColumn ('item_id', 'm', 'Id_Article'); - items.setDefaultFromValue ('order_id', 'm', orderId); -*/ - this.$('warehouse').master = orderForm.getParam ('wh_id'); - this.$('date').master = orderForm.getParam ('date_send'); - } - else - Vn.Cookie.unset ('order'); - - this.$('order').value = orderId; - this.$('basket-button').disabled = false; - } - - ,onOrderFormChange: function (form) - { - if (form.ready) - this.configureView (); - } - ,onBasketClick: function () { - if (Vn.Cookie.check ('order')) - this.hash.set ({ - 'form': 'ecomerce/basket', - 'order': Vn.Cookie.get ('order') - }); - else - this.hash.set ({'form': 'ecomerce/checkout'}); + this.hash.set ({'form': 'ecomerce/basket'}); } ,featuresRender: function (renderer, form) @@ -315,8 +262,9 @@ Htk.Realm = new Class ,_model: null ,selectedImg: null - ,initialize: function (mod) + ,initialize: function (props) { + this.parent (props); this.createElement ('div'); this.node.className = 'htk-realm'; } diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css b/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css index a570051d..961f078f 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css +++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/style.css @@ -249,10 +249,6 @@ button.confirm > img { background-color: #777; } -.items > thead th:hover -{ - background-color: #333; -} .items > tbody > tr { height: 6em; diff --git a/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml b/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml index 9475fcbc..a9e29ba9 100755 --- a/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml +++ b/package/usr/share/hedera-web/forms/ecomerce/catalog/ui.xml @@ -3,20 +3,11 @@ - - - SELECT id, reino, color FROM vn2008.reinos WHERE display != FALSE ORDER BY reino - - - SELECT id, date_send, wh_id FROM order_view WHERE id = #order - - - @@ -53,30 +44,6 @@ -
- - - - - -
- - - -
-
@@ -122,8 +89,8 @@
+
+ + + + + +
+ + + +
+