35 lines
1.6 KiB
JavaScript
35 lines
1.6 KiB
JavaScript
$(function() {
|
|
$('[data-total]').each(function() {
|
|
var total = $(this).data('total');
|
|
var booked = $(this).data('booked');
|
|
$(this).find('.occupation-bar').css('max-width', 100 * booked / total + '%');
|
|
});
|
|
$('.date-title').on('click', function() {
|
|
$(this).parent().find('.date-picker').toggle();
|
|
});
|
|
$('.date-picker button').on('click', function() {
|
|
if ($('[name=day]').val()) {
|
|
window.location = '../../../' + $('[name=year]').val() + '/' + $('[name=month]').val() + '/' + $('[name=day]').val() + '/';
|
|
} else {
|
|
window.location = '../../' + $('[name=year]').val() + '/' + $('[name=month]').val() + '/';
|
|
}
|
|
return false;
|
|
});
|
|
|
|
if (window.navigator.userAgent.indexOf('MSIE') > 0 || window.navigator.userAgent.match(/Trident.*rv\:11\./)) {
|
|
// IE doesn't support percentage units inside table cells so we have to go
|
|
// over all <div>s and convert the values to pixels.
|
|
var td_height = $('table.agenda-table tbody td').height();
|
|
$('table.agenda-table tbody td div').each(function(idx, elem) {
|
|
var parsed_height = $(elem).attr('style').match(/height: ([0-9]+)%/)[1];
|
|
$(elem).css('height', (parseInt(parsed_height) * td_height / 100) + 'px');
|
|
var parsed_top = $(elem).attr('style').match(/top: ([0-9]+)%/)[1];
|
|
$(elem).css('top', (parseInt(parsed_top) * td_height / 100) + 'px');
|
|
var parsed_min_height = $(elem).attr('style').match(/min-height: ([0-9]+)%/);
|
|
if (parsed_min_height) {
|
|
$(elem).css('min-height', (parseInt(parsed_min_height[1]) * td_height / 100) + 'px');
|
|
}
|
|
});
|
|
}
|
|
});
|