'use strict'; function toggleMode(speed) { if (typeof speed === 'undefined') { speed = 'slow'; } if ($('input:radio[name=area_enable_periods]:checked').val() === '0') { $('#book_ahead_periods_note').hide(speed); $('#time_settings').show(speed); $('#period_settings').hide(speed); $('input[name="area_periods[]"]').prop('required', false); } else { $('#book_ahead_periods_note').show(speed); $('#time_settings').hide(speed); $('#period_settings').show(speed); $('input[name="area_periods[]"]').prop('required', true); } } function getTimeString(time, twentyfourhour_format) { var ap, timeString, minutes = time % 60; time -= minutes; var hour = time/60; if (!twentyfourhour_format) { if (hour > 11) { ap = " 'a'), mktime(14, 0, 0)) ?>"; } else { ap = " 'a'), mktime(10, 0, 0)) ?>"; } if (hour > 12) { hour = hour - 12; } if (hour === 0) { hour = 12; } } if (hour < 10) { hour = "0" + hour; } if (minutes < 10) { minutes = "0" + minutes; } timeString = hour + ':' + minutes; if (!twentyfourhour_format) { timeString += ap; } return timeString; } // function getTimeString() function getResolutionMinutes() { return parseInt($('#area_res_mins').val(), 10); } function hhmmToMins(hhmm) { if (hhmm === null) { return null; } if (!.test(hhmm)) { return null; } var array = hhmm.split(':'); return (parseInt(array[0], 10) * 60) + parseInt(array[1], 10); } function getStartFirstSlot() { return hhmmToMins($('input[name="area_start_first_slot"]').val()); } function getStartLastSlot() { return hhmmToMins($('[name="area_start_last_slot"]').val()); } function generateLastSlotSelect() { var resMins, tCorrected, firstSlot, lastSlot, minsPerDay = ; resMins = getResolutionMinutes(); if (isNaN(resMins) || (resMins === null) || (resMins === 0)) { return; } firstSlot = getStartFirstSlot(); lastSlot = getStartLastSlot(); if (firstSlot === null) { return; } element. // We allow the "day" to go all the way past midnight and up to the start of the // next first slot. ?> var lastPossible = minsPerDay + firstSlot - resMins; var name = 'area_start_last_slot'; var element = $('[name="' + name + '"]'); var select = $('