|
@@ -37,14 +37,20 @@ class DateTimePicker extends HTML_QuickForm_text
|
|
|
$value = api_format_date($value, DATE_TIME_FORMAT_LONG_24H);
|
|
|
}
|
|
|
|
|
|
- return $this->getElementJS() . '
|
|
|
+ return '
|
|
|
<div class="input-group">
|
|
|
<span class="input-group-addon">
|
|
|
<input ' . $this->_getAttrString($this->_attributes) . '>
|
|
|
</span>
|
|
|
<input class="form-control" type="text" readonly id="' . $id . '_alt" value="' . $value . '">
|
|
|
+ <span class="input-group-btn">
|
|
|
+ <button class="btn btn-default" type="button">
|
|
|
+ <span class="fa fa-times text-danger" aria-hidden="true"></span>
|
|
|
+ <span class="sr-only">' . get_lang('Reset') . '</span>
|
|
|
+ </button>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- ';
|
|
|
+ ' . $this->getElementJS();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -71,22 +77,35 @@ class DateTimePicker extends HTML_QuickForm_text
|
|
|
//timeFormat: 'hh:mm'
|
|
|
$js .= "<script>
|
|
|
$(function() {
|
|
|
- $('#$id').hide().datetimepicker({
|
|
|
- defaultDate: '" . $this->getValue() . "',
|
|
|
- dateFormat: 'yy-mm-dd',
|
|
|
- timeFormat: 'HH:mm',
|
|
|
- altField: '#{$id}_alt',
|
|
|
- altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
|
|
|
- altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\",
|
|
|
- altSeparator: \" " . get_lang('AtTime') . " \",
|
|
|
- altFieldTimeOnly: false,
|
|
|
- showOn: 'both',
|
|
|
- buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
|
|
|
- buttonImageOnly: true,
|
|
|
- buttonText: '" . get_lang('SelectDate') . "',
|
|
|
- changeMonth: true,
|
|
|
- changeYear: true
|
|
|
- });
|
|
|
+ var txtDateTime = $('#$id'),
|
|
|
+ inputGroup = txtDateTime.parents('.input-group');
|
|
|
+
|
|
|
+ txtDateTime
|
|
|
+ .hide()
|
|
|
+ .datetimepicker({
|
|
|
+ defaultDate: '" . $this->getValue() . "',
|
|
|
+ dateFormat: 'yy-mm-dd',
|
|
|
+ timeFormat: 'HH:mm',
|
|
|
+ altField: '#{$id}_alt',
|
|
|
+ altFormat: \"" . get_lang('DateFormatLongNoDayJS') . "\",
|
|
|
+ altTimeFormat: \"" . get_lang('TimeFormatNoSecJS') . "\",
|
|
|
+ altSeparator: \" " . get_lang('AtTime') . " \",
|
|
|
+ altFieldTimeOnly: false,
|
|
|
+ showOn: 'both',
|
|
|
+ buttonImage: '" . Display::return_icon('attendance.png', null, [], ICON_SIZE_TINY, true, true) . "',
|
|
|
+ buttonImageOnly: true,
|
|
|
+ buttonText: '" . get_lang('SelectDate') . "',
|
|
|
+ changeMonth: true,
|
|
|
+ changeYear: true
|
|
|
+ });
|
|
|
+
|
|
|
+ inputGroup
|
|
|
+ .find('button')
|
|
|
+ .on('click', function (e) {
|
|
|
+ e.preventDefault();
|
|
|
+
|
|
|
+ $('#$id, #{$id}_alt').val('');
|
|
|
+ });
|
|
|
});
|
|
|
</script>";
|
|
|
|