diff options
Diffstat (limited to 'httemplate/elements/select-did.html')
-rw-r--r-- | httemplate/elements/select-did.html | 222 |
1 files changed, 204 insertions, 18 deletions
diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html index a69450c2a..c39603156 100644 --- a/httemplate/elements/select-did.html +++ b/httemplate/elements/select-did.html @@ -16,8 +16,32 @@ Example: % if ( $export->option('restrict_selection') eq 'non-tollfree' % || !$export->option('restrict_selection') ) { <TABLE> - <TR> + +% my( $phonenum_checked, $manual_checked ) = ( '', '' ); +% if ( $export->get_dids_can_manual ) { +% #not 100% perfect UI on error handling, but it'll do +% if ( $opt{'curr_value'} ) { +% $phonenum_checked = ''; +% $manual_checked = 'CHECKED'; +% } else { +% $phonenum_checked = 'CHECKED'; +% $manual_checked = ''; +% } + + <TD VALIGN="top"> + <INPUT TYPE = "radio" + NAME = "phonenum_which" + VALUE = "phonenum" + onChange = "phonenum_which_changed(this)" + onClick = "phonenum_which_changed(this)" + <% $phonenum_checked %> + > Inventory + </TD> +% } + +% if ( $export->get_dids_npa_select ) { + <TD VALIGN="top"> <% include('/elements/select-state.html', 'prefix' => 'phonenum_', #$field.'_', @@ -25,44 +49,206 @@ Example: 'svcpart' => $svcpart, 'disable_empty' => 0, 'empty_label' => 'Select state', + 'disabled' => ( $manual_checked ? 1 : 0 ), ) %> - <BR><FONT SIZE="-1">State</FONT> - </TD> - <TD VALIGN="top"> - <% include('/elements/select-areacode.html', - 'state_prefix' => 'phonenum_', #$field.'_', - 'svcpart' => $svcpart, - 'empty' => 'Select area code', - ) - %> - <BR><FONT SIZE="-1">Area code</FONT> + <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>State</FONT> </TD> + + <TD VALIGN="top"> + <% include('/elements/select-areacode.html', + 'state_prefix' => 'phonenum_', #$field.'_', + 'svcpart' => $svcpart, + 'empty' => 'Select area code', + ) + %> + <BR><FONT SIZE="-1" ID="areacode_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Area code</FONT> + </TD> + + <TD VALIGN="top"> + <% include('/elements/select-exchange.html', + 'svcpart' => $svcpart, + 'empty' => 'Select exchange', + ) + %> + <BR><FONT SIZE="-1" ID="exchange_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>City / Exchange</FONT> + </TD> + +% } else { +% +% #this code path currently only being used by fibernetics +% # should change "Province" label to "State" or make it configurable +% # if/when other folks need an areacode-less DID selector that goes +% # directly from state to region + <TD VALIGN="top"> - <% include('/elements/select-exchange.html', - 'svcpart' => $svcpart, - 'empty' => 'Select exchange', + <% include('/elements/select.html', + 'field' => 'phonenum_state', + 'id' => 'phonenum_state', + 'options' => [ '', @{ $export->get_dids } ], + 'labels' => { '' => 'Select province' }, + 'onchange' => 'phonenum_state_changed(this);', + 'disabled' => ( $manual_checked ? 1 : 0 ), ) %> - <BR><FONT SIZE="-1">City / Exchange</FONT> + <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Province</FONT> </TD> + + <TD VALIGN="top"> + <% include('/elements/select-region.html', + 'state_prefix' => 'phonenum_', #$field.'_', + 'svcpart' => $svcpart, + 'empty' => 'Select region', + ) + %> + <BR><FONT SIZE="-1" ID="region_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Region</FONT> + </TD> + +% } + <TD VALIGN="top"> <% include('/elements/select-phonenum.html', 'svcpart' => $svcpart, 'empty' => 'Select phone number', 'bulknum' => $bulknum, 'multiple' => $multiple, + 'region' => ! $export->get_dids_npa_select, ) %> - <BR><FONT SIZE="-1">Phone number</FONT> + <BR><FONT SIZE="-1" ID="phonenum_phonenum_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Phone number</FONT> </TD> + </TR> +% if ( $export->get_dids_can_manual ) { + <TR> + + <TD VALIGN="top"> + <INPUT TYPE = "radio" + NAME = "phonenum_which" + VALUE = "phonenum_manual" + onChange = "phonenum_which_changed(this)" + onClick = "phonenum_which_changed(this)" + <% $manual_checked %> + > Manual entry + </TD> + + <TD VALIGN="top" COLSPAN=4> + <& /elements/input-text.html, + %opt, + field => 'phonenum_manual', + id => 'phonenum_manual', + type => 'text', + disabled => ( $phonenum_checked ? 1 : 0 ), + &> + </TD> + </TR> + + <SCRIPT TYPE="text/javascript"> + function phonenum_which_changed(what) { + + if ( what.value == 'phonenum' && what.checked ) { + + what.form.phonenum_manual.disabled = true; + what.form.phonenum_manual.style.backgroundColor = '#dddddd'; + + what.form.phonenum_state.disabled = false; + + document.getElementById('phonenum_state_label').style.color = '#000000'; + if ( document.getElementById('areacode_label') ) { + document.getElementById('areacode_label').style.color = '#000000'; + } + if ( document.getElementById('exchange_label') ) { + document.getElementById('exchange_label').style.color = '#000000'; + } + if ( document.getElementById('region_label') ) { + document.getElementById('region_label').style.color = '#000000'; + } + document.getElementById('phonenum_phonenum_label').style.color = '#000000'; + + var value = what.form.phonenum_state.options[ what.form.phonenum_state.selectedIndex].value; + + if ( value != '' ) { + + if ( what.form.areacode ) { + what.form.areacode.disabled = false; + + var areacode_value = what.form.areacode.options[ what.form.areacode.selectedIndex].value; + + if ( areacode_value != '' ) { + what.form.exchange.disabled = false; + + var exchange_value = what.form.exchange.options[ what.form.exchange.selectedIndex].value; + + if ( exchange_value != '' ) { + what.form.phonenum.disabled = false; + } + + } + + } + if ( what.form.region ) { + what.form.region.disabled = false; + + var region_value = what.form.region.options[ what.form.region.selectedIndex].value; + + if ( region_value != '' ) { + what.form.phonenum.disabled = false; + } + + } + + } + + } + + if ( what.value == 'phonenum_manual' && what.checked ) { + + what.form.phonenum_manual.disabled = false; + what.form.phonenum_manual.style.backgroundColor = '#ffffff'; + + what.form.phonenum_state.disabled = true; + + document.getElementById('phonenum_state_label').style.color = '#999999'; + if ( document.getElementById('areacode_label') ) { + document.getElementById('areacode_label').style.color = '#999999'; + } + if ( document.getElementById('exchange_label') ) { + document.getElementById('exchange_label').style.color = '#999999'; + } + if ( document.getElementById('region_label') ) { + document.getElementById('region_label').style.color = '#999999'; + } + document.getElementById('phonenum_phonenum_label').style.color = '#999999'; + + if ( what.form.areacode ) { + what.form.areacode.disabled = true; + } + + if ( what.form.exchange ) { + what.form.exchange.disabled = true; + } + + if ( what.form.region ) { + what.form.region.disabled = true; + } + + what.form.phonenum.disabled = true; + } + + } + </SCRIPT> + +% } + </TABLE> % } -% if ( $export->option('restrict_selection') eq 'tollfree' -% || !$export->option('restrict_selection') ) { +% if ( ( $export->option('restrict_selection') eq 'tollfree' +% || !$export->option('restrict_selection') +% ) +% and $export->get_dids_can_tollfree +% ) { <font size="-1">Toll-free</font> <% include('/elements/select-phonenum.html', 'svcpart' => $svcpart, |