From 39808863565cc7c4dac3afeb59041b1ebdd3f04d Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 14 Oct 2016 16:02:15 -0500 Subject: [PATCH] Add ability to clone schedule data from another week --- tailbone/templates/shifts/schedule_edit.mako | 49 ++++++++++++++++++++ tailbone/views/shifts/schedule.py | 46 +++++++++++++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/shifts/schedule_edit.mako b/tailbone/templates/shifts/schedule_edit.mako index 4fd67c9c..c7d26774 100644 --- a/tailbone/templates/shifts/schedule_edit.mako +++ b/tailbone/templates/shifts/schedule_edit.mako @@ -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'); + } + } + ] + }); + }); + });