X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Fselect-did.html;h=60cfcabbab4eebec8616c5f29c014cc7f96d6725;hp=b62d6a089413cac9175a6e64d73424509497d4d0;hb=HEAD;hpb=acb1f7d01eb5300547fd8f105fe43ee88dd65e00 diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html index b62d6a089..60cfcabba 100644 --- a/httemplate/elements/select-did.html +++ b/httemplate/elements/select-did.html @@ -11,53 +11,309 @@ Example: ); +% if ( $conf->exists('svc_phone-lnp') ) { #ask exports if they can_lnp instead? + <& /elements/selectlayers.html, + 'field' => 'lnp_status', + 'curr_value' => $opt{'lnp_status'}, + 'options' => [ '', 'portingin', 'native', 'portedin', 'portingout', + 'portin-reject', 'portout-reject', + ], + 'labels' => { '' => 'Select new number', + 'portingin' => 'Port an existing number', + 'native' => 'Native', + 'portedin' => 'Ported In', + 'portingout' => 'Porting Out', + 'portin-reject' => 'Port-In Reject', + 'portout-reject' => 'Port-Out Reject', + }, + 'layer_callback' => sub { + my( $layer, $layer_fields, $layer_values, $layer_prefix ) = @_; + if ( $layer eq 'portingin' ) { + $m->scomp('/elements/input-text.html', %opt, 'type'=>'text' ); + } elsif ( $layer ne '' ) { + $m->scomp('/elements/hidden.html', %opt). + $m->scomp('/elements/phonenumber.html', $opt{'curr_value'}, 'callable' => 1); + } else { + $m->scomp('/elements/select-did.html:not_porting', %opt); + } + }, + &> + + +% } else { + <& /elements/select-did.html:not_porting, %opt &> +% } +<%init> + +my %opt = @_; + +my $conf = new FS::Conf; + + +<%method not_porting> % if ( $use_selector ) { +% if ( $export->option('restrict_selection') eq 'non-tollfree' +% || !$export->option('restrict_selection') ) { - - +% } + +% if ( $export->get_dids_npa_select ) { + + - - - + + + +% } 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 + + + + + +% } + + - - - - - - +% if ( $export->get_dids_can_manual ) { + + + + + + + + + +% } +
+ +% 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 = ''; +% } + + + + > Inventory + <% include('/elements/select-state.html', 'prefix' => 'phonenum_', #$field.'_', 'country' => $country, + 'svcpart' => $svcpart, 'disable_empty' => 0, 'empty_label' => 'Select state', + 'disabled' => ( $manual_checked ? 1 : 0 ), ) %> +
>State
- <% include('/elements/select-areacode.html', - 'state_prefix' => 'phonenum_', #$field.'_', - 'svcpart' => $svcpart, - 'empty' => 'Select area code', - ) - %> - - <% include('/elements/select-exchange.html', - 'svcpart' => $svcpart, - 'empty' => 'Select exchange', - ) - %> - + + + <% include('/elements/select-areacode.html', + 'state_prefix' => 'phonenum_', #$field.'_', + 'svcpart' => $svcpart, + 'empty' => 'Select area code', + ) + %> +
>Area code +
+ <% include('/elements/select-exchange.html', + 'svcpart' => $svcpart, + 'empty' => 'Select exchange', + ) + %> +
>City / 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 ), + ) + %> +
>Province +
+ <% include('/elements/select-region.html', + 'state_prefix' => 'phonenum_', #$field.'_', + 'svcpart' => $svcpart, + 'empty' => 'Select region', + ) + %> +
>Region +
<% include('/elements/select-phonenum.html', - 'svcpart' => $svcpart, - 'empty' => 'Select phone number', + 'svcpart' => $svcpart, + 'empty' => 'Select phone number', + 'bulknum' => $bulknum, + 'multiple' => $multiple, + 'region' => ! $export->get_dids_npa_select, ) %> +
>Phone number
StateArea codeCity / ExchangePhone number
+ + > Manual entry + + <& /elements/input-text.html, + %opt, + field => 'phonenum_manual', + id => 'phonenum_manual', + type => 'text', + disabled => ( $phonenum_checked ? 1 : 0 ), + &> +
+% } +% if ( ( $export->option('restrict_selection') eq 'tollfree' +% || !$export->option('restrict_selection') +% ) +% and $export->get_dids_can_tollfree +% ) { + Toll-free + <% include('/elements/select-phonenum.html', + 'svcpart' => $svcpart, + 'empty' => 'Select phone number', + 'tollfree' => 1, + 'prefix' => 'tollfree', + 'bulknum' => 0, + ) + %> +% } + +% if ( $bulknum ) { +
+% my $i; +% for($i=0; $i < $bulknum; $i++) { + +% } +
+% } + % } else { <% include( '/elements/input-text.html', %opt, 'type'=>'text' ) %> @@ -68,7 +324,6 @@ Example: my %opt = @_; my $conf = new FS::Conf; -my $country = $conf->config('countrydefault') || 'US'; #false laziness w/tr-select-did.html #XXX make sure this comes through on errors too @@ -83,9 +338,16 @@ my @exports = $part_svc->part_export_did; if ( scalar(@exports) > 1 ) { die "more than one DID-providing export attached to svcpart $svcpart"; } +my $export = scalar(@exports) ? $exports[0] : ''; my $use_selector = scalar(@exports) ? 1 : 0; -#my $field = $opt{'field'} || 'phonenum'; +my $bulknum = $opt{'bulknum'} || 0; #Bulk DID orders via ordering system, vs. +my $multiple = $opt{'multiple'} || 0; #just selecting a bunch at a time + +my $country = ( $export && $export->option('country') ) + || $conf->config('countrydefault') + || 'US'; +