From edea94b6bd41a3fceac47267a3df3dc7fcf7c565 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 16 Sep 2014 14:54:44 -0700 Subject: package start_on_hold flag, and better behavior for automatic timers + packages on hold, #25853 --- httemplate/elements/order_pkg.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'httemplate/elements/order_pkg.js') diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js index a145cbb03..3586a54cb 100644 --- a/httemplate/elements/order_pkg.js +++ b/httemplate/elements/order_pkg.js @@ -10,7 +10,7 @@ function pkg_changed () { var date_text = document.getElementById('start_date_text'); var radio_now = document.getElementById('start_now'); - //var radio_on_hold = document.getElementById('start_on_hold'); + var radio_on_hold = document.getElementById('start_on_hold'); var radio_on_date = document.getElementById('start_on_date'); form.submitButton.disabled = false; @@ -36,23 +36,35 @@ function pkg_changed () { date_button.style.display = ''; date_button_disabled.style.display = 'none'; if ( radio_on_date ) { + // un-disable all the buttons that might get disabled radio_on_date.disabled = false; - if ( form.start_date_text.value.length > 0 && radio_now.checked ) { + radio_now.disabled = false; + // if a start date has been entered, assume the user wants it + if ( form.start_date_text.value.length > 0 ) { radio_now.checked = false; radio_on_date.checked = true; + } else { + // if not, default to now + radio_now.checked = true; } } - } else { + } else { // the package is either fixed start date or start-on-hold date_text.style.backgroundColor = '#dddddd'; date_text.disabled = true; date_button.style.display = 'none'; date_button_disabled.style.display = ''; if ( radio_on_date ) { - if ( radio_on_date.checked ) { - radio_on_date.checked = false; + if ( opt.getAttribute('data-start_on_hold') == 1 ) { + // disallow all options but "On hold" + radio_on_hold.checked = true; + radio_now.checked = false; + radio_now.disabled = true; + } else { + // disallow all options but "On date" + radio_on_hold.checked = false; radio_now.checked = true; + radio_now.disabled = false; } - radio_on_date.disabled = true; } } -- cgit v1.2.1