self-service improvements, RT10883
[freeside.git] / fs_selfservice / FS-SelfService / cgi / myaccount.html
1 <%= $url = "$selfurl?session=$session_id;action="; ''; %>
2 <%= include('header', 'My Account') %>
3
4 Hello <%= $name %>!<BR><BR>
5 <%= $small_custview %>
6 <BR>
7 <%= if ( $access_pkgnum ) {
8       $OUT .= qq!Balance: <B>\$$balance</B><BR><BR>!;
9     }
10     '';
11 %>
12
13 <%=
14   $OUT .= qq! <B><A HREF="${url}invoices">View All Invoices</A></B> &nbsp; &nbsp; !;
15 %>
16
17 <%= if ( $balance > 0 ) {
18   if (scalar(grep $_, @hide_payment_fields)) {
19     $OUT .= qq! <B><A HREF="${url}make_thirdparty_payment&payby_method=CC">Make a payment</A></B><BR><BR>!;
20   } else {
21     $OUT .= qq! <B><A HREF="${url}make_payment">Make a payment</A></B><BR>!;
22     foreach my $term ( sort { $b <=> $a } keys %discount_terms_hash ) {
23       my $saved = $discount_terms_hash{$term}->[1];
24       my $amount = $discount_terms_hash{$term}->[2];
25       my $savings = ( $amount + $saved > 0 )
26                     ? sprintf('%d', $saved / ( $amount + $saved ) * 100 ) : '0';
27       $OUT .= qq! <B><A HREF="${url}make_term_payment;discount_term=$term;amount=$amount">Save $savings\% by paying for $term months: $amount</A></B><BR>!;
28     }
29     $OUT .= qq! <BR>!;
30   }
31 } %>
32 <%=
33   if ( @open_invoices ) {
34     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
35             '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>';
36     my $link = qq!<A HREF="<%= $url %>myaccount!;
37     my $col1 = "ffffff";
38     my $col2 = "dddddd";
39     my $col = $col1;
40
41     foreach my $invoice ( @open_invoices ) {
42       my $td = qq!<TD BGCOLOR="#$col">!;
43       my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">';
44       $OUT .=
45         "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td</TD>".
46         "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>".
47         qq!<TD BGCOLOR="#$col" ALIGN="right">$a\$!. $invoice->{'owed'}.
48           '</A></TD>'.
49         '</TR>';
50       $col = $col eq $col1 ? $col2 : $col1;
51     }
52     $OUT .= '</TABLE><BR>';
53   } else {
54     $OUT .= 'You have no outstanding invoices.<BR><BR>';
55   }
56 %>
57
58 <%=
59   if ( @support_services ) {
60     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
61             '<TR><TH BGCOLOR="#ff6666" COLSPAN="3">Support Time Remaining</TH>'.
62             '</TR><TR><TH ALIGN="left">#</TH><TH>Package</TH>'.
63             '<TH>Time Remaining</TH></TR>';
64     my $col1 = "ffffff";
65     my $col2 = "dddddd";
66     my $col = $col1;
67
68     foreach my $support ( @support_services ) {
69       my $td = qq!<TD BGCOLOR="#$col">!;
70       my $a = qq!<A HREF="${url}view_support_details;svcnum=!.
71               $support->{'svcnum'}. '">';
72       $OUT .=
73         "<TR>$td$a". $support->{'pkgnum'}. "</A></TD>".
74         $td.$a. $support->{'pkg'}. "</A></TD>".
75         $td.$a. $support->{'time'}. "</A></TD>".
76         '</TR>';
77       $col = $col eq $col1 ? $col2 : $col1;
78     }
79     $OUT .= '</TABLE><BR>';
80   } else {
81     $OUT .= '';
82   }
83 %>
84
85 <%=
86   if ( @tickets ) {
87     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
88             '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Tickets</TH></TR>'.
89             '<TR><TH>#</TH><TH>Subject</TH><TH>Priority</TH><TH>Queue</TH>'.
90             '<TH>Status</TH></TR>';
91     my $col1 = "ffffff";
92     my $col2 = "dddddd";
93     my $col = $col1;
94
95     foreach my $ticket ( @tickets ) {
96       my $td = qq!<TD BGCOLOR="#$col">!;
97       $OUT .=
98         "<TR>$td". $ticket->{'id'}. "</TD>".
99         $td. $ticket->{'subject'}. "</TD>".
100         $td. ($ticket->{'content'} || $ticket->{'priority'}). "</TD>".
101         $td. $ticket->{'queue'}. "</TD>".
102         $td. $ticket->{'status'}. "</TD>".
103         '</TR>';
104       $col = $col eq $col1 ? $col2 : $col1;
105     }
106     $OUT .= '</TABLE>';
107   } else {
108     $OUT .= '';
109   }
110 %>
111
112 <%= include('footer') %>