5 %if ( $cgi->param('error') ) {
6 % $rate_region = new FS::rate_region ( {
7 % map { $_, scalar($cgi->param($_)) } fields('rate_region')
9 %} elsif ( $cgi->keywords ) {
10 % my($query) = $cgi->keywords;
11 % $query =~ /^(\d+)$/;
12 % $rate_region = qsearchs( 'rate_region', { 'regionnum' => $1 } );
14 % $rate_region = new FS::rate_region {};
16 %my $action = $rate_region->regionnum ? 'Edit' : 'Add';
25 %my @rate_prefix = $rate_region->rate_prefix;
26 %my $countrycode = '';
27 %if ( @rate_prefix ) {
28 % $countrycode = $rate_prefix[0]->countrycode;
29 % foreach my $rate_prefix ( @rate_prefix ) {
30 % eidiot 'multiple country codes per region not yet supported by web UI'
31 % unless $rate_prefix->countrycode eq $countrycode;
38 <% include("/elements/header.html","$action Region", menubar(
40 #'View all regions' => "${p}browse/rate_region.cgi",
43 % if ( $cgi->param('error') ) {
45 <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT><BR>
49 <FORM ACTION="<%$p1%>process/rate_region.cgi" METHOD=POST>
51 <INPUT TYPE="hidden" NAME="regionnum" VALUE="<% $rate_region->regionnum %>">
53 <% ntable('#cccccc') %>
55 <TH ALIGN="right">Region name</TH>
56 <TD><INPUT TYPE="text" NAME="regionname" SIZE=32 VALUE="<% $rate_region->regionname %>"></TR>
60 <TH ALIGN="right">Country code</TH>
61 <TD><INPUT TYPE="text" NAME="countrycode" SIZE=4 MAXLENGTH=3 VALUE="<% $countrycode %>"></TR>
66 <TH ALIGN="right">Prefixes</TH>
68 <TEXTAREA NAME="npa" WRAP=SOFT><% join(', ', map $_->npa, @rate_prefix ) %></TEXTAREA>
78 <TH><FONT SIZE=-1>Included<BR>minutes</FONT></TH>
79 <TH><FONT SIZE=-1>Charge per<BR>minute</FONT></TH>
80 <TH><FONT SIZE=-1>Granularity</FONT></TH>
82 % foreach my $rate ( qsearch('rate', {}) ) {
84 % my $n = $rate->ratenum;
85 % my $rate_detail = $rate->dest_detail($rate_region)
86 % || new FS::rate_region { 'min_included' => 0,
88 % 'sec_granularity' => '60'
94 <TD><A HREF="<%$p%>edit/rate.cgi?<% $rate->ratenum %>"><% $rate->ratename %></TD>
95 <TD><INPUT TYPE="text" SIZE=5 NAME="min_included<%$n%>" VALUE="<% $cgi->param("min_included$n") || $rate_detail->min_included %>"></TD>
96 <TD>$<INPUT TYPE="text" SIZE=4 NAME="min_charge<%$n%>" VALUE="<% sprintf('%.2f', $cgi->param("min_charge$n") || $rate_detail->min_charge ) %>"></TD>
98 <SELECT NAME="sec_granularity<%$n%>">
99 % foreach my $granularity ( keys %granularity ) {
101 <OPTION VALUE="<%$granularity%>"<% $granularity == ( $cgi->param("sec_granularity$n") || $rate_detail->sec_granularity ) ? ' SELECTED' : '' %>><%$granularity{$granularity}%>
111 <BR><BR><INPUT TYPE="submit" VALUE="<%
112 $rate_region->regionnum ? "Apply changes" : "Add region"