summaryrefslogtreecommitdiff
path: root/httemplate/misc/recharge_svc.html
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/misc/recharge_svc.html')
-rwxr-xr-xhttemplate/misc/recharge_svc.html105
1 files changed, 105 insertions, 0 deletions
diff --git a/httemplate/misc/recharge_svc.html b/httemplate/misc/recharge_svc.html
new file mode 100755
index 0000000..d8a8faa
--- /dev/null
+++ b/httemplate/misc/recharge_svc.html
@@ -0,0 +1,105 @@
+<% include('/elements/header-popup.html', 'Recharge Service' ) %>
+
+<% include('/elements/error.html') %>
+
+<FORM NAME="recharge_popup" ACTION="<% popurl(1) %>process/recharge_svc.html" METHOD=POST>
+<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
+
+<BR><BR>
+<% "Recharge $svcnum: $label - $value" %>
+<% ntable("#cccccc", 2) %>
+
+<SCRIPT>
+ function toggle_prep(what) {
+ if (what.value == "PREP"){
+ what.form.prepaid.disabled = false;
+ }else{
+ what.form.prepaid.disabled = true;
+ }
+ }
+</SCRIPT>
+<TR>
+ <TD><INPUT TYPE="radio" NAME="payby" onchange="toggle_prep(this)" VALUE="PREP" <% $payby eq "PREP" ? 'checked' : '' %> <% $recharge_label ? '' : 'disabled' %>></TD>
+ <TD>Prepaid Card</TD>
+% if ($recharge_label) {
+ <TD><INPUT TYPE="radio" NAME="payby" onchange="toggle_prep(this)" VALUE="<% $cust_svc->cust_pkg->cust_main->payby %>" <% $payby eq "PREP" ? '' : 'checked' %>></TD>
+ <TD><% $recharge_label %></TD>
+% }
+</TR>
+<TR>
+ <TD>Enter prepaid card: </TD>
+ <TD><INPUT TYPE="text" NAME="prepaid" VALUE="<% $prepaid |h %>" <% $payby eq "PREP" ? '' : 'disabled' %>></TD>
+</TR>
+
+</TABLE>
+
+<BR>
+<INPUT TYPE="submit" NAME="submit" VALUE="Recharge">
+
+</FORM>
+
+<% include('/elements/footer.html') %>
+
+<%once>
+
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
+
+</%once>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Recharge customer service');
+
+my($svcnum, $prepaid, $payby);
+if ( $cgi->param('error') ) {
+ $svcnum = $cgi->param('svcnum');
+ $prepaid = $cgi->param('prepaid');
+ $payby = $cgi->param('payby');
+} elsif ( $cgi->param('svcnum') =~ /^(\d+)$/ ) {
+ $svcnum = $1;
+ $prepaid = '';
+} else {
+ die "illegal query ". $cgi->keywords;
+}
+
+my $title = 'Recharge Service';
+
+my $cust_svc = qsearchs('cust_svc', {'svcnum' => $svcnum});
+die "No such service: $svcnum" unless $cust_svc;
+
+my($label, $value) = $cust_svc->label;
+
+$payby = $cust_svc->cust_pkg->cust_main->payby unless $payby;
+my $part_pkg = $cust_svc->cust_pkg->part_pkg;
+my $amount = $part_pkg->option('recharge_amount', 1) || 0;
+
+my $recharge_label = "Charge $money_char$amount for ";
+
+$recharge_label .= $part_pkg->option('recharge_seconds', 1) . 's '
+ if $part_pkg->option('recharge_seconds', 1);
+
+
+$recharge_label .= FS::UI::bytecount::display_bytecount(
+ $part_pkg->option('recharge_upbytes', 1) )
+ . ' up '
+ if $part_pkg->option('recharge_upbytes', 1);
+
+
+$recharge_label .= FS::UI::bytecount::display_bytecount(
+ $part_pkg->option('recharge_downbytes', 1) )
+ . ' down '
+ if $part_pkg->option('recharge_downbytes', 1);
+
+
+$recharge_label .= FS::UI::bytecount::display_bytecount(
+ $part_pkg->option('recharge_totalbytes', 1) )
+ . ' total '
+ if $part_pkg->option('recharge_totalbytes', 1);
+
+
+$recharge_label = ''
+ unless ($recharge_label ne "Charge $money_char$amount for ");
+
+</%init>
+