From ce167066f4d0fddf73f038961eb38220558e5ef7 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 20 Nov 2017 13:15:01 +0100 Subject: [PATCH] Refactor --- forms/ecomerce/checkout/checkout.js | 18 +++-- forms/ecomerce/checkout/locale/ca.json | 1 + forms/ecomerce/checkout/locale/en.json | 1 + forms/ecomerce/checkout/locale/es.json | 1 + forms/ecomerce/checkout/locale/fr.json | 1 + forms/ecomerce/checkout/locale/mn.json | 1 + forms/ecomerce/checkout/locale/pt.json | 1 + forms/ecomerce/checkout/style.css | 2 +- forms/ecomerce/checkout/ui.xml | 22 ++--- image/icon/light/access-log.svg | 20 ++--- image/icon/light/add.svg | 12 +-- image/icon/light/down.svg | 60 ++++++++++++++ js/db/lot.js | 46 +++++++++++ js/hedera/gui.js | 2 - js/hedera/style.css | 53 ++++++------ js/htk/field.js | 33 ++++---- js/htk/field/calendar.js | 4 +- js/htk/field/check.js | 4 +- js/htk/field/combo.js | 107 ++++++++++++++++--------- js/htk/field/date-chooser.js | 8 +- js/htk/field/entry.js | 4 +- js/htk/field/html.js | 2 +- js/htk/field/image.js | 2 +- js/htk/field/label.js | 4 +- js/htk/field/radio.js | 2 +- js/htk/field/search-entry.js | 4 +- js/htk/field/spin.js | 4 +- js/htk/field/text-area.js | 4 +- js/htk/field/text.js | 4 +- js/htk/popup.js | 2 - js/htk/style.css | 40 +++++---- js/htk/toast.js | 35 -------- js/vn/iterator-iface.js | 46 ----------- js/vn/param-iface.js | 15 +++- 34 files changed, 322 insertions(+), 243 deletions(-) create mode 100644 image/icon/light/down.svg diff --git a/forms/ecomerce/checkout/checkout.js b/forms/ecomerce/checkout/checkout.js index 1021bf16..5e2c9b2f 100644 --- a/forms/ecomerce/checkout/checkout.js +++ b/forms/ecomerce/checkout/checkout.js @@ -2,7 +2,7 @@ var methodsData = { AGENCY: { - steps: ['method', 'date', 'address', 'agency', 'confirm'], + steps: ['method', 'date', 'address', 'delivery', 'confirm'], isDelivery: true, textId: 'agencyText' }, @@ -12,10 +12,10 @@ var methodsData = { textId: 'deliveryText' }, PICKUP: { - steps: ['method', 'date', 'address', 'pickup', 'confirm'], + steps: ['method', 'date', 'address', 'delivery', 'confirm'], isDelivery: false, textId: 'pickupText' - } + } }; Hedera.Checkout = new Class @@ -125,11 +125,13 @@ Hedera.Checkout = new Class case 'date': var dateQuestion = methodData.isDelivery ? 'OrderDateDeliveryQuestion' : 'OrderDatePickupQuestion'; - Vn.Node.setText (_(dateQuestion)); + Vn.Node.setText (this.$.dateQuestion, _(dateQuestion)); this.$.calendar.goToSelectedMonth (); break; - case 'agency': - case 'pickup': + case 'delivery': + var whQuestion = methodData.isDelivery ? + 'AgencyQuestion' : 'PickupWarehouseQuestion'; + Vn.Node.setText (this.$.whQuestion, _(whQuestion)); this.$.agencies.refresh (); break; case 'confirm': @@ -144,9 +146,9 @@ Hedera.Checkout = new Class return stepName; } - ,onFieldChange: function () + ,onFieldChange: function (_, value) { - if (!this.autoStepLocked) + if (!this.autoStepLocked && value != null) setTimeout (this.goNextStep.bind (this), 75); } diff --git a/forms/ecomerce/checkout/locale/ca.json b/forms/ecomerce/checkout/locale/ca.json index 3f0764fc..b05a6655 100755 --- a/forms/ecomerce/checkout/locale/ca.json +++ b/forms/ecomerce/checkout/locale/ca.json @@ -8,6 +8,7 @@ ,"ReceiveThroughtAgency": "Rebre per agència" ,"ReceiveThroughtRoute": "Repartiment Verdnatura" ,"PickupInStore": "Recollir en magatzem" + ,"Select agency": "Selecciona agencia" ,"OrderDateDeliveryQuestion": "Quin dia vols rebre la comanda?" ,"OrderDatePickupQuestion": "Quin dia vols recollir la comanda?" diff --git a/forms/ecomerce/checkout/locale/en.json b/forms/ecomerce/checkout/locale/en.json index 9ba28bcc..e5874979 100755 --- a/forms/ecomerce/checkout/locale/en.json +++ b/forms/ecomerce/checkout/locale/en.json @@ -8,6 +8,7 @@ ,"ReceiveThroughtAgency": "Receive by agency" ,"ReceiveThroughtRoute": "Verdnatura delivery" ,"PickupInStore": "Store pickup" + ,"Select agency": "Select agency" ,"OrderDateDeliveryQuestion": "What day you want to receive the order?" ,"OrderDatePickupQuestion": "What day you want to pickup your order?" diff --git a/forms/ecomerce/checkout/locale/es.json b/forms/ecomerce/checkout/locale/es.json index b2f1bcab..eadf3ee9 100755 --- a/forms/ecomerce/checkout/locale/es.json +++ b/forms/ecomerce/checkout/locale/es.json @@ -8,6 +8,7 @@ ,"ReceiveThroughtAgency": "Recibir por agencia" ,"ReceiveThroughtRoute": "Reparto Verdnatura" ,"PickupInStore": "Recoger en almacén" + ,"Select agency": "Selecciona agencia" ,"OrderDateDeliveryQuestion": "¿Qué día quieres recibir el pedido?" ,"OrderDatePickupQuestion": "¿Qué día quieres recoger el pedido?" diff --git a/forms/ecomerce/checkout/locale/fr.json b/forms/ecomerce/checkout/locale/fr.json index 13be44cc..61f32277 100755 --- a/forms/ecomerce/checkout/locale/fr.json +++ b/forms/ecomerce/checkout/locale/fr.json @@ -8,6 +8,7 @@ ,"ReceiveThroughtAgency": "Recevez par l'agence" ,"ReceiveThroughtRoute": "Livraison par Verdnatura" ,"PickupInStore": "Livraison en magasin" + ,"Select agency": "Sélectionnez une agence" ,"OrderDateDeliveryQuestion": "Date de livraison?" ,"OrderDatePickupQuestion": "Date retrait commande?" diff --git a/forms/ecomerce/checkout/locale/mn.json b/forms/ecomerce/checkout/locale/mn.json index 9ba28bcc..e5874979 100755 --- a/forms/ecomerce/checkout/locale/mn.json +++ b/forms/ecomerce/checkout/locale/mn.json @@ -8,6 +8,7 @@ ,"ReceiveThroughtAgency": "Receive by agency" ,"ReceiveThroughtRoute": "Verdnatura delivery" ,"PickupInStore": "Store pickup" + ,"Select agency": "Select agency" ,"OrderDateDeliveryQuestion": "What day you want to receive the order?" ,"OrderDatePickupQuestion": "What day you want to pickup your order?" diff --git a/forms/ecomerce/checkout/locale/pt.json b/forms/ecomerce/checkout/locale/pt.json index 7d511ba3..b43120a1 100644 --- a/forms/ecomerce/checkout/locale/pt.json +++ b/forms/ecomerce/checkout/locale/pt.json @@ -8,6 +8,7 @@ ,"ReceiveThroughtAgency": "Receber por agência" ,"ReceiveThroughtRoute": "Transporte Verdnatura" ,"PickupInStore": "Recolher no armazém" + ,"Select agency": "Selecione uma agência" ,"OrderDateDeliveryQuestion": "Que dia queres receber o pedido?" ,"OrderDatePickupQuestion": "Que dia queres recolher o pedido?" diff --git a/forms/ecomerce/checkout/style.css b/forms/ecomerce/checkout/style.css index 37ed975d..31a120f3 100644 --- a/forms/ecomerce/checkout/style.css +++ b/forms/ecomerce/checkout/style.css @@ -16,7 +16,7 @@ { font-size: 1.3em; } -.answers .htk-select +.answers .htk-combo { max-width: 10em; display: block; diff --git a/forms/ecomerce/checkout/ui.xml b/forms/ecomerce/checkout/ui.xml index bb1872df..f7b0c533 100755 --- a/forms/ecomerce/checkout/ui.xml +++ b/forms/ecomerce/checkout/ui.xml @@ -69,7 +69,7 @@ -

_OrderDateDeliveryQuestion

+

- -

_AgencyQuestion

+ +

-
- - -

_PickupWarehouseQuestion

-
- @@ -142,7 +132,7 @@ _ReceiveThroughtRoute

- _Warehouse {{warehouse.description}} + _Warehouse {{agency.description}}