summaryrefslogtreecommitdiff
path: root/httemplate/browse
diff options
context:
space:
mode:
authorivan <ivan>2008-01-10 21:53:49 +0000
committerivan <ivan>2008-01-10 21:53:49 +0000
commitc371f6e225cfffa667815a51571203b034e4f75c (patch)
tree4f9e388935907076fe4eb595deb8e095dc22f064 /httemplate/browse
parent8baad1bb7327eb2f704bdcc5d040a24a94de8879 (diff)
new rate editor
Diffstat (limited to 'httemplate/browse')
-rw-r--r--httemplate/browse/rate.cgi76
1 files changed, 53 insertions, 23 deletions
diff --git a/httemplate/browse/rate.cgi b/httemplate/browse/rate.cgi
index 584891a..b20c45c 100644
--- a/httemplate/browse/rate.cgi
+++ b/httemplate/browse/rate.cgi
@@ -1,34 +1,64 @@
<% include( 'elements/browse.html',
- 'title' => 'Rate plans',
- 'menubar' => [ 'Main menu' => $p, ],
- 'html_init' => $html_init,
- 'name' => 'rate plans',
- 'query' => { 'table' => 'rate',
- 'hashref' => {},
- 'extra_sql' => 'ORDER BY ratenum',
- },
- 'count_query' => $count_query,
- 'header' => [ '#', 'Rate plan', ],
- 'fields' => [ 'ratenum', 'ratename' ],
- 'links' => [ $link, $link ],
- )
+ 'title' => 'Rate plans',
+ 'menubar' => [ 'Regions and Prefixes' =>
+ $p.'browse/rate_region.html',
+ ],
+ 'html_init' => $html_init,
+ 'name' => 'rate plans',
+ 'query' => { 'table' => 'rate',
+ 'hashref' => {},
+ 'extra_sql' => 'ORDER BY ratenum',
+ },
+ 'count_query' => $count_query,
+ 'header' => [ '#', 'Rate plan', 'Rates' ],
+ 'fields' => [ 'ratenum', 'ratename', $rates_sub ],
+ 'links' => [ $link, $link, '' ],
+ )
%>
+<%once>
+
+my $sth = dbh->prepare("SELECT DISTINCT(countrycode) FROM rate_prefix")
+ or die dbh->errstr;
+$sth->execute or die $sth->errstr;
+my @all_countrycodes = map $_->[0], @{ $sth->fetchall_arrayref };
+my $all_countrycodes = join("\n", map qq(<OPTION VALUE="$_">$_),
+ @all_countrycodes
+ );
+
+my $rates_sub = sub {
+ my $rate = shift;
+ my $ratenum = $rate->ratenum;
+
+ qq( <FORM METHOD="GET" ACTION="${p}browse/rate_detail.html">
+ <INPUT TYPE="hidden" NAME="ratenum" VALUE="$ratenum">
+ <SELECT NAME="countrycode" onChange="this.form.submit();">
+ <OPTION SELECTED>Select Country Code
+ <OPTION VALUE="">(all)
+ $all_countrycodes
+ </SELECT>
+ </FORM>
+ );
+
+
+};
+
+</%once>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my $html_init =
-'Rate plans, regions and prefixes for VoIP and call billing.<BR><BR>'.
-qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!.
-qq! | <A HREF="${p}edit/rate_region.cgi"><I>Add a region</I></A>!.
-'<BR><BR>
- <SCRIPT>
- function rate_areyousure(href) {
- if (confirm("Are you sure you want to delete this rate plan?") == true)
- window.location.href = href;
- }
- </SCRIPT>';
+ 'Rate plans for VoIP and call billing.<BR><BR>'.
+ qq!<A HREF="${p}edit/rate.cgi"><I>Add a rate plan</I></A>!.
+ '<BR><BR>
+ <SCRIPT>
+ function rate_areyousure(href) {
+ if (confirm("Are you sure you want to delete this rate plan?") == true)
+ window.location.href = href;
+ }
+ </SCRIPT>
+ ';
my $count_query = 'SELECT COUNT(*) FROM rate';