Add ability to clear current schedule when editing

This commit is contained in:
Lance Edgar 2016-10-14 14:45:04 -05:00
parent 9e7cb532c8
commit c2503977ea
2 changed files with 41 additions and 5 deletions

View file

@ -190,6 +190,15 @@
location.href = '${url('schedule.edit')}';
});
$('.clear-schedule').click(function() {
if (confirm("This will remove all shifts from the schedule you're " +
"currently viewing.\n\nAre you sure you wish to do this?")) {
$(this).button('disable').button('option', 'label', "Clearing...");
okay_to_leave = true;
$('#clear-schedule-form').submit();
}
});
});
</script>
<style type="text/css">
@ -236,21 +245,26 @@
% endfor
</%def>
<%def name="edit_form()">
${h.form(url('schedule.edit'), id='schedule-form')}
</%def>
<%def name="edit_tools()">
<div class="buttons">
<button type="button" class="save-changes" disabled="disabled">Save Changes</button>
<button type="button" class="undo-changes" disabled="disabled">Undo Changes</button>
<button type="button" class="clear-schedule">Clear Schedule</button>
</div>
</%def>
<%def name="edit_form()">
${h.form(url('schedule.edit'), id='schedule-form')}
</%def>
${self.timesheet(edit_form=edit_form, edit_tools=edit_tools)}
${edit_tools()}
${h.form(url('schedule.edit'), id="clear-schedule-form")}
${h.hidden('clear-schedule', value='clear')}
${h.end_form()}
<div id="day-editor" style="display: none;">
<div class="shifts"></div>
<button type="button" id="add-shift">Add Shift</button>