Checkout improved, refactor

This commit is contained in:
Juan Ferrer Toribio 2018-01-19 15:59:44 +01:00
parent 5ddfaf1d6c
commit 3d222a5d53
10 changed files with 47 additions and 40 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.405.71) stable; urgency=low
hedera-web (1.405.72) stable; urgency=low
* Initial Release.

View File

@ -80,7 +80,7 @@ Hedera.Checkout = new Class
else
Htk.Toast.showMessage (_('OrderStarted'));
this.hash.set ({'form': 'ecomerce/catalog'});
this.hash.set ({form: 'ecomerce/catalog'});
}
,onCancelClick: function ()
@ -92,31 +92,12 @@ Hedera.Checkout = new Class
}
,agencySteps: ['method', 'date', 'address', 'agency', 'confirm-agency']
,deliverySteps: ['method', 'date', 'address', null, 'confirm-delivery']
,pickupSteps: ['method', 'date', 'address', 'pickup', 'confirm-pickup']
,stepFunc: function (stepIndex)
{
var steps;
var isDelivery;
switch (this.$('rg-method').value)
{
case 'AGENCY':
steps = this.agencySteps;
isDelivery = true;
break;
case 'DELIVERY':
steps = this.deliverySteps;
isDelivery = true;
break;
case 'PICKUP':
default:
steps = this.pickupSteps;
isDelivery = false;
break;
}
var isDelivery = this.$('rg-method').value == 'AGENCY';
var steps = isDelivery ? this.agencySteps : this.pickupSteps;
var stepId = steps[stepIndex];
if (!stepId)
@ -130,6 +111,11 @@ Hedera.Checkout = new Class
_('OrderDatePickupQuestion'));
this.$('calendar').goToSelectedMonth ();
break;
case 'address':
Vn.Node.setText (this.$('address-question'), isDelivery ?
_('AddressQuestion'):
_('AddressQuestionPickup'));
break;
case 'agency':
this.$('agencies').refresh ();
break;
@ -144,7 +130,7 @@ Hedera.Checkout = new Class
,onFieldChange: function ()
{
if (!this.autoStepLocked)
setTimeout (this.goNextStep.bind (this), 75);
this.$('assistant').moveNext ();
}
,goNextStep: function ()

View File

@ -12,6 +12,7 @@
,"OrderDateDeliveryQuestion": "Quin dia vols rebre la comanda?"
,"OrderDatePickupQuestion": "Quin dia vols recollir la comanda?"
,"AddressQuestion": "On vols rebre la comanda?"
,"AddressQuestionPickup": "A què direcció vols associar la comanda? (Opcional)"
,"AgencyQuestion": "Per quina agència vols rebre la comanda?"
,"PickupWarehouseQuestion": "En quin magatzem vols recollir la comanda?"

View File

@ -12,6 +12,7 @@
,"OrderDateDeliveryQuestion": "What day you want to receive the order?"
,"OrderDatePickupQuestion": "What day you want to pickup your order?"
,"AddressQuestion": "Where do you want to receive the order?"
,"AddressQuestionPickup": "To which address do you want to associate the order? (Optional)"
,"AgencyQuestion": "By wich agency you want to receive the order?"
,"PickupWarehouseQuestion": "What store you want to pickup your order?"

View File

@ -12,6 +12,7 @@
,"OrderDateDeliveryQuestion": "¿Qué día quieres recibir el pedido?"
,"OrderDatePickupQuestion": "¿Qué día quieres recoger el pedido?"
,"AddressQuestion": "¿Dónde quieres recibir el pedido?"
,"AddressQuestionPickup": "¿A qué dirección quieres asociar el pedido? (Opcional)"
,"AgencyQuestion": "¿Por qué agencia quieres recibir el pedido?"
,"PickupWarehouseQuestion": "¿En qué almacén quieres recoger el pedido?"

View File

@ -12,6 +12,7 @@
,"OrderDateDeliveryQuestion": "Date de livraison?"
,"OrderDatePickupQuestion": "Date retrait commande?"
,"AddressQuestion": "Adresse livraison?"
,"AddressQuestionPickup": "À quelle adresse voulez-vous associer la commande? (Optionnel)"
,"AgencyQuestion": "Pour quelle agence vous souhaitez recevoir la commande?"
,"PickupWarehouseQuestion": "Dans quel magasin vuoulez-vous retirer votre commande?"

View File

@ -12,6 +12,7 @@
,"OrderDateDeliveryQuestion": "Que dia queres receber a encomenda?"
,"OrderDatePickupQuestion": "Que dia queres levantar a encomenda?"
,"AddressQuestion": "Onde queres receber a encomenda?"
,"AddressQuestionPickup": "Para qual endereço deseja associar o pedido? (Opcional)"
,"AgencyQuestion": "Por qual agência queres receber a encomenda?"
,"PickupWarehouseQuestion": "Em qual armazém queres levantar a encomenda?"

View File

@ -21,9 +21,20 @@
</custom>
</db-model>
</db-form>
<db-model id="agencies" auto-load="false" on-status-changed="onAgenciesReady">
<db-model id="agencies"
auto-load="false"
result-index="1"
on-status-changed="onAgenciesReady">
<custom>
CALL vn.agencyListForMethod(#date, #address, 'AGENCY')
CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a
JOIN vn.agencyMode m
ON m.agencyFk = a.agencyFk
JOIN vn.deliveryMethod d
ON d.id = m.deliveryMethodFk
WHERE d.code IN ('AGENCY', 'DELIVERY');
DROP TEMPORARY TABLE tmp.agencyAvailable;
</custom>
<sql-batch property="batch">
<custom>
@ -32,9 +43,20 @@
</custom>
</sql-batch>
</db-model>
<db-model id="warehouses" auto-load="false" on-status-changed="onWarehousesReady">
<db-model id="warehouses"
auto-load="false"
result-index="1"
on-status-changed="onWarehousesReady">
<custom>
CALL vn.agencyListForMethod(#date, #address, 'PICKUP')
CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a
JOIN vn.agencyMode m
ON m.agencyFk = a.agencyFk
JOIN vn.deliveryMethod d
ON d.id = m.deliveryMethodFk
WHERE d.code IN ('PICKUP');
DROP TEMPORARY TABLE tmp.agencyAvailable;
</custom>
<sql-batch property="batch">
<custom>
@ -73,10 +95,6 @@
<htk-radio radio-group="rg-method" value="AGENCY"/>
<label><t>ReceiveThroughtAgency</t></label>
</div>
<div>
<htk-radio radio-group="rg-method" value="DELIVERY"/>
<label><t>ReceiveThroughtRoute</t></label>
</div>
<div>
<htk-radio radio-group="rg-method" value="PICKUP"/>
<label><t>PickupInStore</t></label>
@ -84,7 +102,7 @@
</div>
</div>
<div id="date-step">
<h2 id="date-question"><t>OrderDateDeliveryQuestion</t></h2>
<h2 id="date-question"/>
<div class="answers">
<htk-calendar
id="calendar"
@ -95,7 +113,7 @@
</div>
</div>
<div id="address-step">
<h2><t>AddressQuestion</t></h2>
<h2 id="address-question"/>
<db-form id="address-form" model="addresses"/>
<div class="answers target">
<htk-repeater

View File

@ -223,10 +223,8 @@ input[type=checkbox],
input[type=radio]
{
cursor: pointer;
margin: 0.2em;
padding: 0.3em;
width: 0.8em;
height: 0.8em;
margin: .2em;
padding: .3em;
}
select
{
@ -256,7 +254,7 @@ input[type=reset]
{
border: none;
background-color: transparent;
padding: 0.5em;
padding: .5em;
cursor: pointer;
border-radius: 0.1em;
margin: -0.5em;

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.405.71",
"version": "1.405.72",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {