Default agency when none is available
This commit is contained in:
parent
8cc05e174e
commit
28146b08ef
|
@ -1,4 +1,4 @@
|
|||
hedera-web (1.406.21) stable; urgency=low
|
||||
hedera-web (1.406.22) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -25,11 +25,23 @@ Hedera.Checkout = new Class ({
|
|||
} else
|
||||
var i = defaultsForm;
|
||||
|
||||
if (!date || date.getTime() <(new Date()).getTime()) {
|
||||
if (!date || date.getTime() < (new Date()).getTime()) {
|
||||
date = new Date();
|
||||
var addDays = 0;
|
||||
|
||||
switch(date.getDay()) {
|
||||
case 6: // Saturday
|
||||
addDays += 2;
|
||||
break;
|
||||
case 0: // Sunday
|
||||
addDays++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i.get('deliveryMethod') != 'PICKUP')
|
||||
date.setTime(date.getTime() + 86400000);
|
||||
addDays++;
|
||||
|
||||
date.setTime(date.getTime() + addDays * 86400000);
|
||||
}
|
||||
|
||||
this.$('date').value = date;
|
||||
|
@ -175,7 +187,26 @@ Hedera.Checkout = new Class ({
|
|||
},
|
||||
|
||||
onAgenciesReady: function(model) {
|
||||
if (model.ready && model.numRows == 0)
|
||||
if (!model.ready) return;
|
||||
|
||||
if (model.numRows > 0) {
|
||||
var agency;
|
||||
var defaults = [
|
||||
this.$('order-form').get('agencyModeFk'),
|
||||
this.$('defaults').get('agencyModeFk'),
|
||||
this.$('defaults').get('defaultAgencyFk')
|
||||
];
|
||||
|
||||
for (var i = 0; i < defaults.length; i++) {
|
||||
agency = defaults[i];
|
||||
if (model.search('id', agency) !== -1)
|
||||
break;
|
||||
}
|
||||
|
||||
this.autoStepLocked = true;
|
||||
this.$('agency').value = agency;
|
||||
this.autoStepLocked = false;
|
||||
} else
|
||||
Htk.Toast.showError(_('NoAgeciesAvailableForDate'));
|
||||
},
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<vn-param id="address" on-changed="onAddressChange"/>
|
||||
<db-form id="defaults" on-ready="onValuesReady">
|
||||
<db-model property="model">
|
||||
SELECT deliveryMethod, agencyModeFk, addressFk
|
||||
SELECT deliveryMethod, agencyModeFk, addressFk, defaultAgencyFk
|
||||
FROM myBasketDefaults
|
||||
</db-model>
|
||||
</db-form>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "1.406.21",
|
||||
"version": "1.406.22",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue