diff options
author | Ivan Kohler <ivan@freeside.biz> | 2016-02-05 10:45:12 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2016-02-05 10:45:12 -0800 |
commit | ff8a7535a81005b7c66e8e75e5cfa8449a8cef04 (patch) | |
tree | f87bcb2687b09b88d509201aeff3ba5bfcc3285f | |
parent | fcd7e712ea5286c418dd4f77c4faa41544d95f0b (diff) |
prevent changing Start before picking a package
-rw-r--r-- | httemplate/elements/order_pkg.js | 26 | ||||
-rw-r--r-- | httemplate/elements/tr-select-cust-part_pkg.html | 4 | ||||
-rw-r--r-- | httemplate/misc/order_pkg.html | 38 |
3 files changed, 50 insertions, 18 deletions
diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js index a850d2193..d8ee790c2 100644 --- a/httemplate/elements/order_pkg.js +++ b/httemplate/elements/order_pkg.js @@ -5,15 +5,15 @@ function pkg_changed () { usageprice_pkg_changed( opt.value ); - if ( form.pkgpart.selectedIndex > 0 ) { + var date_button = document.getElementById('start_date_button'); + var date_button_disabled = document.getElementById('start_date_disabled'); + var date_text = document.getElementById('start_date_text'); - var date_button = document.getElementById('start_date_button'); - var date_button_disabled = document.getElementById('start_date_disabled'); - 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_date = document.getElementById('start_on_date'); - var radio_now = document.getElementById('start_now'); - var radio_on_hold = document.getElementById('start_on_hold'); - var radio_on_date = document.getElementById('start_on_date'); + if ( form.pkgpart.selectedIndex > 0 ) { form.submitButton.disabled = false; if ( discountnum ) { @@ -39,8 +39,9 @@ function pkg_changed () { date_button_disabled.style.display = 'none'; if ( radio_on_date ) { // un-disable all the buttons that might get disabled - radio_on_date.disabled = false; radio_now.disabled = false; + radio_on_hold.disabled = false; + radio_on_date.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; @@ -72,6 +73,15 @@ function pkg_changed () { } else { form.submitButton.disabled = true; + + date_text.style.backgroundColor = '#dddddd'; + date_text.disabled = true; + date_button.style.display = 'none'; + date_button_disabled.style.display = ''; + radio_now.disabled = true; + radio_on_date.disabled = true; + radio_on_hold.disabled = true; + if ( discountnum ) { form.discountnum.disabled = true; } discountnum_changed(form.discountnum); } diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index 23916d9e2..6244b6cb7 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -53,9 +53,11 @@ what.form.pkgpart.disabled = ''; //re-enable part_pkg dropdown % if ( $opt{'curr_value'} ) { - what.form.pkgpart.value = <% $opt{'curr_value'} %>; + what.form.pkgpart.value = <% $opt{'curr_value'} %>; % } + pkg_changed(); + } get_part_pkg( <% $cust_main ? $cust_main->custnum : '0' %>, diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index e28250110..4e061e2f7 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -85,18 +85,38 @@ <TR> <TH ALIGN="right"><% mt('Start') |h %> </TD> <TD COLSPAN=6> - <INPUT TYPE="radio" NAME="start" ID="start_now" VALUE="" <% $cgi->param('start') eq '' ? 'CHECKED' : ''%>>Now + <INPUT TYPE = "radio" + NAME = "start" + ID = "start_now" + VALUE = "" + <% $cgi->param('start') eq '' ? 'CHECKED' : ''%> + <% $pkgpart ? '' : 'DISABLED' %> + >Now   - <INPUT TYPE="radio" NAME="start" ID="start_on_hold" VALUE="on_hold" <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%>>On hold + <INPUT TYPE = "radio" + NAME = "start" + ID = "start_on_hold" + VALUE = "on_hold" + <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%> + <% $pkgpart ? '' : 'DISABLED' %> + >On hold   - <INPUT TYPE="radio" NAME="start" ID="start_on_date" VALUE="on_date" <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%>>On date + <INPUT TYPE = "radio" + NAME = "start" + ID = "start_on_date" + VALUE = "on_date" + <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%> + <% $pkgpart ? '' : 'DISABLED' %> + >On date + + <& /elements/input-date-field.html, + { 'name' => 'start_date', + 'format' => $date_format, + 'value' => '', + 'noinit' => 1, + } + &> - <& /elements/input-date-field.html,{ - 'name' => 'start_date', - 'format' => $date_format, - 'value' => '', - 'noinit' => 1, - } &> </TD> </TR> |