Add ability to clone schedule data from another week

This commit is contained in:
Lance Edgar 2016-10-14 16:02:15 -05:00
parent c2503977ea
commit 3980886356
2 changed files with 94 additions and 1 deletions

View file

@ -199,6 +199,38 @@
}
});
$('#copy-week').datepicker({
dateFormat: 'mm/dd/yy'
});
$('.copy-schedule').click(function() {
$('#copy-details').dialog({
modal: true,
title: "Copy from Another Week",
width: '500px',
buttons: [
{
text: "Copy Schedule",
click: function(event) {
if (! $('#copy-week').val()) {
alert("You must specify the week from which to copy shift data.");
$('#copy-week').focus();
return;
}
$(event.target).button('disable').button('option', 'label', "Copying Schedule...");
$('#copy-schedule-form').submit();
}
},
{
text: "Cancel",
click: function() {
$('#copy-details').dialog('close');
}
}
]
});
});
});
</script>
<style type="text/css">
@ -254,6 +286,7 @@
<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>
<button type="button" class="copy-schedule">Copy Schedule From...</button>
</div>
</%def>
@ -270,6 +303,22 @@ ${h.end_form()}
<button type="button" id="add-shift">Add Shift</button>
</div>
<div id="copy-details" style="display: none;">
<p>
This tool will replace the currently visible schedule, with one from
another week.
</p>
<p>
<strong>NOTE:</strong>&nbsp; If you do this, all shifts in the current
schedule will be <em>removed</em>,
and then new shifts will be created based on the week you specify.
</p>
${h.form(url('schedule.edit'), id='copy-schedule-form')}
<label for="copy-week">Copy from week:</label>
${h.text('copy-week')}
${h.end_form()}
</div>
<div id="snippets">
<div class="shift" data-uuid="">
${h.text('edit_start_time')} thru ${h.text('edit_end_time')}