diff --git a/debian/changelog b/debian/changelog index 67fb73e3..ae27ee23 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.6.4) stable; urgency=low +hedera-web (23.6.5) stable; urgency=low * Initial Release. diff --git a/forms/ecomerce/basket/index.js b/forms/ecomerce/basket/index.js index 961b84a5..11c85586 100644 --- a/forms/ecomerce/basket/index.js +++ b/forms/ecomerce/basket/index.js @@ -5,21 +5,31 @@ export default new Class({ Template: require('./ui.xml'), async open() { - await Hedera.Form.prototype.open.call(this); - const basket = new Hedera.Basket(this.app); - - if (this.$.params.$.id) { - this.orderId = this.$.params.$.id; - } else if (await basket.check()) { - this.orderId = basket.orderId; + await this.loadOrder(); + if (this.orderId) { + await Hedera.Form.prototype.open.call(this); + this.$.lot.assign({id: this.orderId}); } + }, + activate() { + this.$.items.setInfo('bi', 'myOrderRow', 'hedera'); + }, + + async onHashChange() { + if (!this.isOpen) return; + await this.loadOrder(); if (this.orderId) this.$.lot.assign({id: this.orderId}); }, - - activate() { - this.$.items.setInfo('bi', 'myOrderRow', 'hedera'); + + async loadOrder() { + const basket = new Hedera.Basket(this.app); + if (this.hash.$.id) { + this.orderId = this.hash.$.id; + } else if (await basket.check()) { + this.orderId = basket.orderId; + } }, onOrderReady(form) { diff --git a/forms/ecomerce/basket/ui.xml b/forms/ecomerce/basket/ui.xml index 0ff8ea48..04b7af32 100644 --- a/forms/ecomerce/basket/ui.xml +++ b/forms/ecomerce/basket/ui.xml @@ -1,7 +1,4 @@ - - -

{{_(params.$.id ? 'Order' : 'ShoppingBasket')}}

@@ -20,6 +17,9 @@ on-click="this.onConfirmClick()"/> + + + @@ -50,7 +50,6 @@
DeliveryAddress
-

{{order.nickname}}

{{order.street}}

{{order.postalCode}}, {{order.city}}

diff --git a/forms/ecomerce/catalog/index.js b/forms/ecomerce/catalog/index.js index 062424a4..80e85d5b 100644 --- a/forms/ecomerce/catalog/index.js +++ b/forms/ecomerce/catalog/index.js @@ -10,7 +10,7 @@ const Catalog = new Class({ const basket = new Hedera.Basket(this.app); if (!localStorage.getItem('hederaGuest')) { - if (await basket.check()) + if (await basket.check('catalog')) this.orderId = basket.orderId; } else { const resultSet = await this.conn.execQuery( diff --git a/forms/ecomerce/checkout/index.js b/forms/ecomerce/checkout/index.js index 24bb2f26..d556c66d 100644 --- a/forms/ecomerce/checkout/index.js +++ b/forms/ecomerce/checkout/index.js @@ -81,21 +81,27 @@ export default new Class({ if (!resultSet.fetchResult()) return; + let redirect; + const basket = new Hedera.Basket(this.app); + if (id) { Htk.Toast.showMessage(_('OrderUpdated')); switch(this.hash.$.continue) { case 'catalog': - this.hash.setAll({form: 'ecomerce/catalog'}); + redirect = {form: 'ecomerce/catalog'}; break; default: - this.hash.setAll({form: 'ecomerce/basket', id}); + redirect = {form: 'ecomerce/basket'}; + if (id !== basket.orderId) + redirect.id = id; } } else { - const basket = new Hedera.Basket(this.app); basket.loadIntoBasket(resultSet.fetchValue()); - this.hash.setAll({form: 'ecomerce/catalog'}); + redirect = {form: 'ecomerce/catalog'}; } + + this.hash.setAll(redirect); }, onCancelClick() { diff --git a/js/hedera/basket.js b/js/hedera/basket.js index 0a20fcf6..b9a9a0b4 100644 --- a/js/hedera/basket.js +++ b/js/hedera/basket.js @@ -13,44 +13,52 @@ module.exports = class { ); resultSet.fetchValue(); } - async check() { + async check(checkoutContinue) { if (this.orderId) { - return await this.checkRedirect(); + return await this.checkRedirect(checkoutContinue); } else { - this.app.hash.setAll({form: 'ecomerce/checkout'}); + this.redirect(); return false; } } - async checkRedirect() { + async checkRedirect(checkoutContinue) { try { await this.checkOrder(this.orderId); return true; } catch(err) { if (err.exception == 'Vn.Lib.UserError') { - const dst = { - form: 'ecomerce/checkout', - continue: 'catalog' - }; - switch(err.code) { - case 'orderConfirmed': - case 'orderNotOwnedByUser': - this.constructor.unload(); - break; - default: - dst.id = this.orderId; - Htk.Toast.showError(err.message); + case 'orderConfirmed': + case 'orderNotOwnedByUser': + this.constructor.unload(); + await this.redirect(); + break; + default: + this.app.hash.setAll({ + form: 'ecomerce/checkout', + id: this.orderId, + continue: checkoutContinue + }); + Htk.Toast.showError(err.message); } - - this.app.hash.setAll(dst); return false; } else throw err; } } + async redirect() { + const resultSet = await this.app.conn.execQuery( + 'SELECT COUNT(*) > 0 FROM myOrder'); + if (resultSet.fetchValue()) { + this.app.hash.setAll({form: 'ecomerce/pending'}); + Htk.Toast.showMessage(_('Load an order')); + } else { + this.app.hash.setAll({form: 'ecomerce/checkout'}); + } + } async load(orderId) { this.loadIntoBasket(orderId); - if (await this.checkRedirect()) + if (await this.checkRedirect('catalog')) this.app.hash.setAll({ form: 'ecomerce/catalog' }); diff --git a/js/hedera/locale/ca.yml b/js/hedera/locale/ca.yml index 326e90ec..5ccdff26 100644 --- a/js/hedera/locale/ca.yml +++ b/js/hedera/locale/ca.yml @@ -63,3 +63,5 @@ Agencies: Agències Configuration: Configuració Account: Compte Addresses: Adreces + +Load an order: Si us plau carrega una comanda pendent a la cistella o en comença una de nova diff --git a/js/hedera/locale/en.yml b/js/hedera/locale/en.yml index f6add13c..17e10f8a 100644 --- a/js/hedera/locale/en.yml +++ b/js/hedera/locale/en.yml @@ -59,3 +59,5 @@ Agencies: Agencies Configuration: Configuration Account: Account Addresses: Addresses + +Load an order: Please load a pending order to the cart or start a new one diff --git a/js/hedera/locale/es.yml b/js/hedera/locale/es.yml index 9c6a656a..4fcf5573 100644 --- a/js/hedera/locale/es.yml +++ b/js/hedera/locale/es.yml @@ -63,3 +63,5 @@ Agencies: Agencias Configuration: Configuración Account: Cuenta Addresses: Direcciones + +Load an order: Por favor carga un pedido pendiente en la cesta o empieza uno nuevo diff --git a/js/hedera/locale/fr.yml b/js/hedera/locale/fr.yml index 37811b10..70c5d47b 100644 --- a/js/hedera/locale/fr.yml +++ b/js/hedera/locale/fr.yml @@ -63,3 +63,5 @@ Agencies: Agences Configuration: Configuration Account: Compte Addresses: Adresses + +Load an order: Veuillez télécharger une commande en attente dans le panier ou en démarrer une nouvelle diff --git a/js/hedera/locale/pt.yml b/js/hedera/locale/pt.yml index f8ed38db..8e3cfe61 100644 --- a/js/hedera/locale/pt.yml +++ b/js/hedera/locale/pt.yml @@ -61,3 +61,5 @@ Agencies: Agências Configuration: Configuração Account: Conta Addresses: Moradas + +Load an order: Carregue um pedido pendente no carrinho ou inicie um novo diff --git a/js/vn/date.js b/js/vn/date.js index 1a0c26b6..470315fb 100644 --- a/js/vn/date.js +++ b/js/vn/date.js @@ -55,7 +55,7 @@ module.exports = ,'Dec' ] - ,tokenD: '%A, %B %e' + ,tokenD: '%A, %B %e %Y' ,regexp: new RegExp('%[a-zA-Z]', 'g') @@ -101,7 +101,7 @@ module.exports = // Year with 4 digits case 'Y': return d.getFullYear(); - // Complete date without year + // Complete date case 'D': return _(this.tokenD).replace(this.regexp, this.regexpFunc.bind(this, d)); } diff --git a/js/vn/locale/ca.yml b/js/vn/locale/ca.yml index 8af6588c..868d0bd3 100644 --- a/js/vn/locale/ca.yml +++ b/js/vn/locale/ca.yml @@ -36,7 +36,7 @@ Sep: Set Oct: Oct Nov: Nov Dec: Des -'%A, %B %e': '%A, %e de %B' +'%A, %B %e %Y': '%A, %e de %B de %Y' Something went wrong: Alguna cosa ha anat malament 'The server does not respond, please check your Internet connection': 'El servidor no respon, si us plau comprova la teva connexió a Internet' Accept: Acceptar diff --git a/js/vn/locale/en.yml b/js/vn/locale/en.yml index 4ca5bcfa..c25d9d53 100644 --- a/js/vn/locale/en.yml +++ b/js/vn/locale/en.yml @@ -36,6 +36,6 @@ Sep: Sep Oct: Oct Nov: Nov Dec: Dic -'%A, %B %e': '%A, %B %e' +'%A, %B %e %Y': '%A, %B %e %Y' Something went wrong: Something went wrong 'The server does not respond, please check your Internet connection': 'The server does not respond, please check you Internet connection' diff --git a/js/vn/locale/es.yml b/js/vn/locale/es.yml index d9663c12..78a87817 100644 --- a/js/vn/locale/es.yml +++ b/js/vn/locale/es.yml @@ -36,7 +36,7 @@ Sep: Sep Oct: Oct Nov: Nov Dec: Dic -'%A, %B %e': '%A, %e de %B' +'%A, %B %e %Y': '%A, %e de %B de %Y' Something went wrong: Algo salió mal 'The server does not respond, please check your Internet connection': 'El servidor no responde, por favor comprueba tu conexión a Internet' Accept: Aceptar diff --git a/js/vn/locale/fr.yml b/js/vn/locale/fr.yml index a2789597..7eec4373 100644 --- a/js/vn/locale/fr.yml +++ b/js/vn/locale/fr.yml @@ -36,7 +36,7 @@ Sep: Sep Oct: Oct Nov: Nov Dec: Déc -'%A, %B %e': '%A, %B %e' +'%A, %B %e %Y': '%A, %B %e %Y' Something went wrong: Quelque-chose s'est mal passé 'The server does not respond, please check your Internet connection': 'Le serveur ne répond pas, s''il vous plaît vérifier votre connexion Internet' Accept: Accepter diff --git a/js/vn/locale/mn.yml b/js/vn/locale/mn.yml index 97eb4d32..5c1e2121 100644 --- a/js/vn/locale/mn.yml +++ b/js/vn/locale/mn.yml @@ -36,6 +36,6 @@ Sep: Есд Oct: Ара Nov: Арв Dec: Арв -'%A, %B %e': '%A, %B %e' +'%A, %B %e %Y': '%A, %B %e %Y' Something went wrong: Something went wrong 'The server does not respond, please check your Internet connection': 'The server does not respond, please check you Internet connection' diff --git a/js/vn/locale/pt.yml b/js/vn/locale/pt.yml index db6c2892..f8e4e4f4 100644 --- a/js/vn/locale/pt.yml +++ b/js/vn/locale/pt.yml @@ -36,7 +36,7 @@ Sep: Set Oct: Out Nov: Nov Dec: Dez -'%A, %B %e': '%A, %B %e' +'%A, %B %e %Y': '%A, %B %e %Y' Something went wrong: Algo deu errado 'The server does not respond, please check your Internet connection': 'O servidor não responde, por favor, verifique sua conexão com a Internet' Accept: Aceitar diff --git a/package.json b/package.json index 7e6484ab..37e1247e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "23.6.4", + "version": "23.6.5", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": {