From 8240403713de07e6b9c1d8a645838791e80823b7 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 6 Jul 2013 17:30:47 -0700 Subject: delayed package start option, #20686 --- httemplate/elements/order_pkg.js | 25 ++++++++++++++++-------- httemplate/elements/select-part_pkg.html | 1 - httemplate/elements/tr-select-cust-part_pkg.html | 13 +++++++++--- 3 files changed, 27 insertions(+), 12 deletions(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js index 1069a0ee4..762b2ddde 100644 --- a/httemplate/elements/order_pkg.js +++ b/httemplate/elements/order_pkg.js @@ -4,9 +4,15 @@ function pkg_changed () { if ( form.pkgpart.selectedIndex > 0 ) { + var opt = form.pkgpart.options[form.pkgpart.selectedIndex]; + var date_button = document.getElementById('start_date_button'); + var date_button_disabled = document.getElementById('start_date_button_disabled'); + var date_text = document.getElementById('start_date_text'); + + form.submitButton.disabled = false; if ( discountnum ) { - if ( form.pkgpart.options[form.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { + if ( opt.getAttribute('data-can_discount') == 1 ) { form.discountnum.disabled = false; discountnum_changed(form.discountnum); } else { @@ -15,14 +21,17 @@ function pkg_changed () { } } - if ( form.pkgpart.options[form.pkgpart.selectedIndex].getAttribute('data-can_start_date') == 1 ) { - form.start_date_text.disabled = false; - form.start_date.style.backgroundColor = '#ffffff'; - form.start_date_button.style.display = ''; + form.start_date_text.value = opt.getAttribute('data-start_date'); + if ( opt.getAttribute('data-can_start_date') == 1 ) { + date_text.style.backgroundColor = '#ffffff'; + date_text.disabled = false; + date_button.style.display = ''; + date_button_disabled.style.display = 'none'; } else { - form.start_date_text.disabled = true; - form.start_date.style.backgroundColor = '#dddddd'; - form.start_date_button.style.display = 'none'; + date_text.style.backgroundColor = '#dddddd'; + date_text.disabled = true; + date_button.style.display = 'none'; + date_button_disabled.style.display = ''; } } else { diff --git a/httemplate/elements/select-part_pkg.html b/httemplate/elements/select-part_pkg.html index 439c4b53e..9d41b07dc 100644 --- a/httemplate/elements/select-part_pkg.html +++ b/httemplate/elements/select-part_pkg.html @@ -23,7 +23,6 @@ Example: 'empty_label' => 'Select package', #should this be the default? 'label_callback' => sub { shift->pkg_comment }, 'hashref' => \%hash, - 'extra_option_attributes' => [ 'can_discount', 'can_start_date' ], %opt, ) %> diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index 848ab0a4b..b9dc5a75a 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -7,10 +7,11 @@ -- cgit v1.2.1 From 8297a6375be5e9f0fed712745d15ef0b4907da00 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 6 Jul 2013 17:30:55 -0700 Subject: minor UI fix --- httemplate/elements/tr-select-cust-part_pkg.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index b9dc5a75a..c9c50d27e 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -11,7 +11,7 @@ var optionName = new Option(text, value, false, false); optionName.setAttribute('data-can_discount', can_discount); optionName.setAttribute('data-can_start_date', can_start_date); - optionName.setAttribute('data-start_date', start_date); + optionName.setAttribute('data-start_date', start_date || ''); var length = what.length; what.options[length] = optionName; } -- cgit v1.2.1 From 8fbc05bbaf97373d061ccb52f3a5e227237980bb Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 10 Jul 2013 15:58:34 -0700 Subject: make it harder to create supplemental packages by accident, #20689 --- httemplate/elements/tr-justtitle.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/tr-justtitle.html b/httemplate/elements/tr-justtitle.html index e9eda8b18..b87f7e128 100644 --- a/httemplate/elements/tr-justtitle.html +++ b/httemplate/elements/tr-justtitle.html @@ -1,5 +1,5 @@ - ALIGN="left"> + ALIGN="left" <%$id%>> <% $opt{value} %> @@ -7,5 +7,6 @@ <%init> my %opt = @_; +my $id = 'ID="'.$opt{id}.'"' if $opt{id}; -- cgit v1.2.1 From 2c62268f304f1ec6e8baf89043eb1bd1197bb9a6 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Mon, 15 Jul 2013 18:37:26 -0700 Subject: future package change, #20687 --- httemplate/elements/tr-select-cust-part_pkg.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index c9c50d27e..488f04a13 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -20,7 +20,7 @@ what.form.pkgpart.disabled = 'disabled'; //disable part_pkg dropdown var submitButton = what.form.submitButton; // || what.form.submit; - if ( submitButton ) { + if ( submitButton && <% $opt{'curr_value'} ? 0 : 1 %> ) { submitButton.disabled = true; //disable the submit button } var discountnum = what.form.discountnum; @@ -51,6 +51,9 @@ } what.form.pkgpart.disabled = ''; //re-enable part_pkg dropdown +% if ( $opt{'curr_value'} ) { + what.form.pkgpart.value = <% $opt{'curr_value'} %>; +% } } -- cgit v1.2.1