Skip to content

Commit

Permalink
crf-devs#128 changes hourselect to display only even hours
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelie.gramusset committed Apr 5, 2020
1 parent b49cf48 commit e344c08
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion assets/js/planning.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function initDatesRange($picker, $from, $to, withTime) {
showDropdowns: false,
timePicker: !!withTime,
timePicker24Hour: true,
timePickerIncrement: 30,
timePickerIncrement: 60,
applyClass: 'btn-sm btn-primary',
cancelClass: 'btn-sm btn-default',
locale: {
Expand Down Expand Up @@ -43,13 +43,28 @@ function initDatesRange($picker, $from, $to, withTime) {
$to.val(picker.endDate.format('YYYY-MM-DDTHH:mm'));
});

$picker.on('showCalendar.daterangepicker', function () {
hourselectOnlyEvenHour();
});

$picker.on('cancel.daterangepicker', function () {
$picker.val('');
$from.val('');
$to.val('');
});
}

function hourselectOnlyEvenHour() {
let allSelectHours = document.getElementsByClassName('hourselect');
console.log(allSelectHours);
allSelectHours.forEach((selectHours) => {
selectHours.options.length = 0;
for (let i = 0; i <= 11; i++) {
selectHours.options[i] = new Option((i * 2).toString(), (i * 2).toString());
}
});
}

function hideUselessFilters() {
$('.search [data-hide="users"]').css('visibility', $('#hideUsers').prop('checked') ? 'hidden' : 'visible');
$('.search [data-hide="assets"]').css('visibility', $('#hideAssets').prop('checked') ? 'hidden' : 'visible');
Expand Down

0 comments on commit e344c08

Please sign in to comment.