I am using delivery date extension which date & time options. Time options has 2 hours difference in each interval. I want to set order limit within time interval.
For example:
Time Interval:
9-11, 11-13, 13-15, 15-17
I want to set limit to maximum 10 orders within one time interval.
After 10 orders that specific time interval must be disabled.
How can I do this task? can anyone help to do this?
datepicker.js is used to change date. How can I call controller to add my php code or condition for this. Here is the datepicker.js code:
define([
'moment',
'ko',
'underscore',
'jquery',
'mage/translate',
'mage/calendar'
], function (moment, ko, _, $, $t) {
'use strict';
var defaults = {
dateFormat: 'mm\/dd\/yyyy',
showsTime: false,
timeFormat: null,
buttonImage: null,
buttonImageOnly: null,
buttonText: $t('Select Date')
};
ko.bindingHandlers.amastydatepicker = {
init: function (el, valueAccessor) {
var config = valueAccessor(),
observable,
options = {};
_.extend(options, defaults);
if (typeof config === 'object') {
observable = config.storage;
_.extend(options, config.options);
} else {
observable = config;
}
var date = moment(observable(), config.elem.pickerDateTimeFormat);
$(el).calendar(options);
observable() && $(el).datepicker('setDate', date.format('YYYY-MM-DD'));
$(el).blur();
ko.utils.registerEventHandler(el, 'change', function () {
=========================================================================
//alert(this.value);
// date changed from here. I want to call controller from here
=========================================================================
observable(this.value);
});
}
};
});