);
</%doc>
+% 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;
+
+</%init>
+<%method not_porting>
% if ( $use_selector ) {
+% if ( $export->option('restrict_selection') eq 'non-tollfree'
+% || !$export->option('restrict_selection') ) {
<TABLE>
-
<TR>
- <TD>
+
+% 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.'_',
'country' => $country,
+ 'svcpart' => $svcpart,
'disable_empty' => 0,
'empty_label' => 'Select state',
+ 'disabled' => ( $manual_checked ? 1 : 0 ),
)
%>
+ <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>State</FONT>
</TD>
- <TD>
- <% include('/elements/select-areacode.html',
- 'state_prefix' => 'phonenum_', #$field.'_',
- 'svcpart' => $svcpart,
- 'empty' => 'Select area code',
- )
- %>
- </TD>
- <TD>
- <% include('/elements/select-exchange.html',
- 'svcpart' => $svcpart,
- 'empty' => 'Select exchange',
- )
- %>
- </TD>
- <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.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" 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',
+ 'svcpart' => $svcpart,
+ 'empty' => 'Select phone number',
+ 'bulknum' => $bulknum,
+ 'multiple' => $multiple,
+ 'region' => ! $export->get_dids_npa_select,
)
%>
+ <BR><FONT SIZE="-1" ID="phonenum_phonenum_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Phone number</FONT>
</TD>
- </TR>
- <TR>
- <TD><FONT SIZE="-1">State</FONT></TD>
- <TD><FONT SIZE="-1">Area code</FONT></TD>
- <TD><FONT SIZE="-1">City / Exchange</FONT></TD>
- <TD><FONT SIZE="-1">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')
+% )
+% and $export->get_dids_can_tollfree
+% ) {
+ <font size="-1">Toll-free</font>
+ <% include('/elements/select-phonenum.html',
+ 'svcpart' => $svcpart,
+ 'empty' => 'Select phone number',
+ 'tollfree' => 1,
+ 'prefix' => 'tollfree',
+ 'bulknum' => 0,
+ )
+ %>
+% }
+
+% if ( $bulknum ) {
+ <div id="bulkdid" style="padding-top: 11px">
+% my $i;
+% for($i=0; $i < $bulknum; $i++) {
+ <div id="bulkdid_<%$i%>" style="display: none">
+ <input type="checkbox" id="checkbox_bulkdid_<%$i%>"
+ name="bulkdid" value="">
+ <label for="checkbox_bulkdid_<%$i%>"
+ id="label_bulkdid_<%$i%>"></label>
+ </div>
+% }
+ </div>
+% }
+
% } else {
<% include( '/elements/input-text.html', %opt, 'type'=>'text' ) %>
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
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';
</%init>
+</%method>