diff --git a/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.css b/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.css
index da12d98330..7c62ee8454 100644
--- a/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.css
+++ b/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.css
@@ -4,8 +4,27 @@
.ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+.ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
+
+.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input { background: none; color: inherit; border: none; outline: none; border-bottom: solid 1px #555; width: 95%; }
+.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus { border-bottom-color: #aaa; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
-.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
\ No newline at end of file
+.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
+
+/* Shortened version style */
+.ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
+.ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
+.ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
+.ui-timepicker-div.ui-timepicker-oneLine dl dd,
+.ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
+.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
+.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }
diff --git a/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.js b/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.js
index 8f6eb19a87..d37bc02b48 100644
--- a/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.js
+++ b/frappe/public/js/lib/jquery/jquery.ui.timepicker-addon.js
@@ -1,7 +1,13 @@
-/*! jQuery Timepicker Addon - v1.4.3 - 2013-11-30
+/*! jQuery Timepicker Addon - v1.6.3 - 2016-04-20
* http://trentrichardson.com/examples/timepicker
-* Copyright (c) 2013 Trent Richardson; Licensed MIT */
-(function ($) {
+* Copyright (c) 2016 Trent Richardson; Licensed MIT */
+(function (factory) {
+ if (typeof define === 'function' && define.amd) {
+ define(['jquery', 'jquery-ui'], factory);
+ } else {
+ factory(jQuery);
+ }
+}(function ($) {
/*
* Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded"
@@ -16,11 +22,11 @@
*/
$.extend($.ui, {
timepicker: {
- version: "1.4.3"
+ version: "1.6.3"
}
});
- /*
+ /*
* Timepicker manager.
* Use the singleton instance of this class, $.timepicker, to interact with the time picker.
* Settings for (groups of) time pickers are maintained in an instance object,
@@ -48,6 +54,7 @@
this._defaults = { // Global defaults for all the datetime picker instances
showButtonPanel: true,
timeOnly: false,
+ timeOnlyShowDate: false,
showHour: null,
showMinute: null,
showSecond: null,
@@ -78,6 +85,8 @@
microsecMax: 999,
minDateTime: null,
maxDateTime: null,
+ maxTime: null,
+ minTime: null,
onSelect: null,
hourGrid: 0,
minuteGrid: 0,
@@ -90,6 +99,7 @@
altTimeFormat: null,
altSeparator: null,
altTimeSuffix: null,
+ altRedirectFocus: true,
pickerTimeFormat: null,
pickerTimeSuffix: null,
showTimepicker: true,
@@ -97,8 +107,10 @@
addSliderAccess: false,
sliderAccessArgs: null,
controlType: 'slider',
+ oneLine: false,
defaultValue: null,
- parse: 'strict'
+ parse: 'strict',
+ afterInject: null
};
$.extend(this._defaults, this.regional['']);
};
@@ -114,6 +126,8 @@
millisec_slider: null,
microsec_slider: null,
timezone_select: null,
+ maxTime: null,
+ minTime: null,
hour: 0,
minute: 0,
second: 0,
@@ -139,7 +153,7 @@
support: {},
control: null,
- /*
+ /*
* Override the default settings for all instances of the time picker.
* @param {Object} settings object - the new settings to use as defaults (anonymous object)
* @return {Object} the manager object
@@ -179,7 +193,7 @@
},
onChangeMonthYear: function (year, month, dp_inst) {
// Update the time as well : this prevents the time from disappearing from the $input field.
- tp_inst._updateDateTime(dp_inst);
+ // tp_inst._updateDateTime(dp_inst);
if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) {
tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
}
@@ -195,7 +209,7 @@
};
for (i in overrides) {
if (overrides.hasOwnProperty(i)) {
- fns[i] = opts[i] || null;
+ fns[i] = opts[i] || this._defaults[i] || null;
}
}
@@ -212,7 +226,7 @@
// detect which units are supported
tp_inst.support = detectSupport(
- tp_inst._defaults.timeFormat +
+ tp_inst._defaults.timeFormat +
(tp_inst._defaults.pickerTimeFormat ? tp_inst._defaults.pickerTimeFormat : '') +
(tp_inst._defaults.altTimeFormat ? tp_inst._defaults.altTimeFormat : ''));
@@ -260,11 +274,14 @@
tp_inst.$input = $input;
if (tp_inst._defaults.altField) {
- tp_inst.$altInput = $(tp_inst._defaults.altField).css({
- cursor: 'pointer'
- }).focus(function () {
- $input.trigger("focus");
- });
+ tp_inst.$altInput = $(tp_inst._defaults.altField);
+ if (tp_inst._defaults.altRedirectFocus === true) {
+ tp_inst.$altInput.css({
+ cursor: 'pointer'
+ }).focus(function () {
+ $input.trigger("focus");
+ });
+ }
}
if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) {
@@ -298,11 +315,12 @@
* add our sliders to the calendar
*/
_addTimePicker: function (dp_inst) {
- var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val();
+ var currDT = $.trim((this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val());
this.timeDefined = this._parseTime(currDT);
this._limitMinMaxDateTime(dp_inst, false);
this._injectTimePicker();
+ this._afterInject();
},
/*
@@ -339,6 +357,16 @@
}
},
+ /*
+ * Handle callback option after injecting timepicker
+ */
+ _afterInject: function() {
+ var o = this.inst.settings;
+ if ($.isFunction(o.afterInject)) {
+ o.afterInject.call(this);
+ }
+ },
+
/*
* generate and inject html for timepicker into ui datepicker
*/
@@ -357,9 +385,9 @@
// Prevent displaying twice
if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) {
- var noDisplay = ' style="display:none;"',
- html = '
' + '- ' + o.timeText + '
' +
- '';
+ var noDisplay = ' ui_tpicker_unit_hide',
+ html = '' + '- ' + o.timeText + '
' +
+ '';
// Create the markup
for (i = 0, l = this.units.length; i < l; i++) {
@@ -373,8 +401,8 @@
max[litem] = parseInt((o[litem + 'Max'] - ((o[litem + 'Max'] - o[litem + 'Min']) % o['step' + uitem])), 10);
gridSize[litem] = 0;
- html += '- ' + o[litem + 'Text'] + '
' +
- '- ';
+ html += '
- ' + o[litem + 'Text'] + '
' +
+ '- ';
if (show && o[litem + 'Grid'] > 0) {
html += '
';
@@ -397,11 +425,11 @@
}
html += '';
}
-
+
// Timezone
var showTz = o.showTimezone !== null ? o.showTimezone : this.support.timezone;
- html += '- ' + o.timezoneText + '
';
- html += '';
+ html += '- ' + o.timezoneText + '
';
+ html += '';
// Create the elements from string
html += '';
@@ -412,7 +440,7 @@
$tp.prepend('');
$dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
}
-
+
// add sliders, adjust grids, add events
for (i = 0, l = tp_inst.units.length; i < l; i++) {
litem = tp_inst.units[i];
@@ -447,7 +475,7 @@
}
}
}
-
+
tp_inst.control.value(tp_inst, tp_inst[f + '_slider'], litem, n);
tp_inst._onTimeChange();
@@ -484,9 +512,10 @@
this.timezone_select.change(function () {
tp_inst._onTimeChange();
tp_inst._onSelectHandler();
+ tp_inst._afterInject();
});
// End timezone options
-
+
// inject timepicker into datepicker
var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
if ($buttonPanel.length) {
@@ -495,7 +524,21 @@
$dp.append($tp);
}
- this.$timeObj = $tp.find('.ui_tpicker_time');
+ this.$timeObj = $tp.find('.ui_tpicker_time_input');
+ this.$timeObj.change(function () {
+ var timeFormat = tp_inst.inst.settings.timeFormat;
+ var parsedTime = $.datepicker.parseTime(timeFormat, this.value);
+ var update = new Date();
+ if (parsedTime) {
+ update.setHours(parsedTime.hour);
+ update.setMinutes(parsedTime.minute);
+ update.setSeconds(parsedTime.second);
+ $.datepicker._setTime(tp_inst.inst, update);
+ } else {
+ this.value = tp_inst.formattedTime;
+ this.blur();
+ }
+ });
if (this.inst !== null) {
var timeDefined = this.timeDefined;
@@ -508,7 +551,7 @@
var sliderAccessArgs = this._defaults.sliderAccessArgs,
rtl = this._defaults.isRTL;
sliderAccessArgs.isRTL = rtl;
-
+
setTimeout(function () { // fix for inline mode
if ($tp.find('.ui-slider-access').length === 0) {
$tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
@@ -660,6 +703,44 @@
}
}
+ if (dp_inst.settings.minTime!==null) {
+ var tempMinTime=new Date("01/01/1970 " + dp_inst.settings.minTime);
+ if (this.hourtempMaxTime.getHours()) {
+ this.hour=this._defaults.hourMax=tempMaxTime.getHours();
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else if (this.hour===tempMaxTime.getHours() && this.minute>tempMaxTime.getMinutes()) {
+ this.minute=this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else {
+ if (this._defaults.hourMax>tempMaxTime.getHours()) {
+ this._defaults.hourMax=tempMaxTime.getHours();
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else if (this._defaults.hourMax===tempMaxTime.getHours()===this.hour && this._defaults.minuteMax>tempMaxTime.getMinutes()) {
+ this._defaults.minuteMax=tempMaxTime.getMinutes();
+ } else {
+ this._defaults.minuteMax=59;
+ }
+ }
+ }
+
if (adjustSliders !== undefined && adjustSliders === true) {
var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)), 10),
minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)), 10),
@@ -668,23 +749,23 @@
microsecMax = parseInt((this._defaults.microsecMax - ((this._defaults.microsecMax - this._defaults.microsecMin) % this._defaults.stepMicrosec)), 10);
if (this.hour_slider) {
- this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax });
+ this.control.options(this, this.hour_slider, 'hour', { min: this._defaults.hourMin, max: hourMax, step: this._defaults.stepHour });
this.control.value(this, this.hour_slider, 'hour', this.hour - (this.hour % this._defaults.stepHour));
}
if (this.minute_slider) {
- this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax });
+ this.control.options(this, this.minute_slider, 'minute', { min: this._defaults.minuteMin, max: minMax, step: this._defaults.stepMinute });
this.control.value(this, this.minute_slider, 'minute', this.minute - (this.minute % this._defaults.stepMinute));
}
if (this.second_slider) {
- this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax });
+ this.control.options(this, this.second_slider, 'second', { min: this._defaults.secondMin, max: secMax, step: this._defaults.stepSecond });
this.control.value(this, this.second_slider, 'second', this.second - (this.second % this._defaults.stepSecond));
}
if (this.millisec_slider) {
- this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax });
+ this.control.options(this, this.millisec_slider, 'millisec', { min: this._defaults.millisecMin, max: millisecMax, step: this._defaults.stepMillisec });
this.control.value(this, this.millisec_slider, 'millisec', this.millisec - (this.millisec % this._defaults.stepMillisec));
}
if (this.microsec_slider) {
- this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax });
+ this.control.options(this, this.microsec_slider, 'microsec', { min: this._defaults.microsecMin, max: microsecMax, step: this._defaults.stepMicrosec });
this.control.value(this, this.microsec_slider, 'microsec', this.microsec - (this.microsec % this._defaults.stepMicrosec));
}
}
@@ -753,11 +834,11 @@
// If the update was done using the sliders, update the input field.
var hasChanged = (
hour !== parseInt(this.hour,10) || // sliders should all be numeric
- minute !== parseInt(this.minute,10) ||
- second !== parseInt(this.second,10) ||
- millisec !== parseInt(this.millisec,10) ||
- microsec !== parseInt(this.microsec,10) ||
- (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
+ minute !== parseInt(this.minute,10) ||
+ second !== parseInt(this.second,10) ||
+ millisec !== parseInt(this.millisec,10) ||
+ microsec !== parseInt(this.microsec,10) ||
+ (this.ampm.length > 0 && (hour < 12) !== ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1)) ||
(this.timezone !== null && timezone !== this.timezone.toString()) // could be numeric or "EST" format, so use toString()
);
@@ -796,17 +877,22 @@
this.formattedTime = $.datepicker.formatTime(o.timeFormat, this, o);
if (this.$timeObj) {
if (pickerTimeFormat === o.timeFormat) {
- this.$timeObj.text(this.formattedTime + pickerTimeSuffix);
+ this.$timeObj.val(this.formattedTime + pickerTimeSuffix);
}
else {
- this.$timeObj.text($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
+ this.$timeObj.val($.datepicker.formatTime(pickerTimeFormat, this, o) + pickerTimeSuffix);
+ }
+ if (this.$timeObj[0].setSelectionRange) {
+ var sPos = this.$timeObj[0].selectionStart;
+ var ePos = this.$timeObj[0].selectionEnd;
+ this.$timeObj[0].setSelectionRange(sPos, ePos);
}
}
this.timeDefined = true;
if (hasChanged) {
this._updateDateTime();
- this.$input.focus();
+ //this.$input.focus(); // may automatically open the picker on setDate
}
},
@@ -827,8 +913,8 @@
*/
_updateDateTime: function (dp_inst) {
dp_inst = this.inst || dp_inst;
- var dtTmp = (dp_inst.currentYear > 0?
- new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
+ var dtTmp = (dp_inst.currentYear > 0?
+ new Date(dp_inst.currentYear, dp_inst.currentMonth, dp_inst.currentDay) :
new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
dt = $.datepicker._daylightSavingAdjust(dtTmp),
//dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
@@ -838,7 +924,7 @@
timeAvailable = dt !== null && this.timeDefined;
this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
var formattedDateTime = this.formattedDate;
-
+
// if a slider was changed but datepicker doesn't have a value yet, set it
if (dp_inst.lastVal === "") {
dp_inst.currentYear = dp_inst.selectedYear;
@@ -848,16 +934,16 @@
/*
* remove following lines to force every changes in date picker to change the input value
- * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
+ * Bug descriptions: when an input field has a default value, and click on the field to pop up the date picker.
* If the user manually empty the value in the input field, the date picker will never change selected value.
*/
//if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0)) {
// return;
//}
- if (this._defaults.timeOnly === true) {
+ if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
formattedDateTime = this.formattedTime;
- } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
+ } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
}
@@ -871,9 +957,9 @@
} else if (this.$altInput) {
this.$input.val(formattedDateTime);
var altFormattedDateTime = '',
- altSeparator = this._defaults.altSeparator ? this._defaults.altSeparator : this._defaults.separator,
- altTimeSuffix = this._defaults.altTimeSuffix ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
-
+ altSeparator = this._defaults.altSeparator !== null ? this._defaults.altSeparator : this._defaults.separator,
+ altTimeSuffix = this._defaults.altTimeSuffix !== null ? this._defaults.altTimeSuffix : this._defaults.timeSuffix;
+
if (!this._defaults.timeOnly) {
if (this._defaults.altFormat) {
altFormattedDateTime = $.datepicker.formatDate(this._defaults.altFormat, (dt === null ? new Date() : dt), formatCfg);
@@ -887,7 +973,7 @@
}
}
- if (this._defaults.altTimeFormat) {
+ if (this._defaults.altTimeFormat !== null) {
altFormattedDateTime += $.datepicker.formatTime(this._defaults.altTimeFormat, this, this._defaults) + altTimeSuffix;
}
else {
@@ -940,7 +1026,7 @@
stop: function (event, ui) {
tp_inst._onSelectHandler();
}
- });
+ });
},
options: function (tp_inst, obj, unit, opts, val) {
if (tp_inst._defaults.isRTL) {
@@ -953,7 +1039,7 @@
}
return obj.slider(opts);
}
- var min = opts.min,
+ var min = opts.min,
max = opts.max;
opts.min = opts.max = null;
if (min !== undefined) {
@@ -985,7 +1071,7 @@
// select methods
select: {
create: function (tp_inst, obj, unit, val, min, max, step) {
- var sel = '