Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / fs_selfservice / FS-SelfService / cgi / myaccount.html
index d1f5671..524be1f 100644 (file)
@@ -1,59 +1,83 @@
-<HTML><HEAD><TITLE>MyAccount</TITLE></HEAD>
-<BODY BGCOLOR="#eeeeee"><FONT SIZE=5>MyAccount</FONT><BR><BR>
-<%= $url = "$selfurl?session=$session_id;action="; ''; %>
-<%= include('myaccount_menu') %>
-<TD VALIGN="top">
+<%= $url = "$selfurl?action="; ''; %>
+<%= include('header', 'My Account') %>
 
 Hello <%= $name %>!<BR><BR>
-<%= $small_custview %>
+
+<%= include('small_custview') %>
+
 <BR>
+
+<%=
+  $OUT .= qq! <B><A HREF="${url}invoices">View All Invoices</A></B> &nbsp; &nbsp; !;
+%>
+
 <%= if ( $balance > 0 ) {
-  $OUT .= qq! <B><A HREF="${url}make_payment">Make a payment</A></B><BR><BR>!;
+  if (scalar(grep $_, @hide_payment_fields)) { # this sucks
+    $OUT .= qq! <B><A HREF="${url}make_thirdparty_payment&payby_method=CC">Make a payment</A></B><BR><BR>!;
+  } else {
+    $OUT .= qq! <B><A HREF="${url}make_payment">Make a payment</A></B><BR>!;
+    foreach my $term ( sort { $b <=> $a } keys %discount_terms_hash ) {
+      my $saved = $discount_terms_hash{$term}->[1];
+      my $amount = $discount_terms_hash{$term}->[2];
+      my $savings = ( $amount + $saved > 0 )
+                    ? sprintf('%d', $saved / ( $amount + $saved ) * 100 ) : '0';
+      $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>!;
+    }
+    $OUT .= qq! <BR>!;
+  }
 } %>
 <%=
   if ( @open_invoices ) {
-    $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
-            '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>';
-    my $link = qq!<A HREF="<%= $url %>myaccount!;
-    my $col1 = "ffffff";
-    my $col2 = "dddddd";
+    my $th  = q!<TH STYLE="background: #ff9999; text-align: left; padding: .1em .5em;">!;
+    my $thr = q!<TH STYLE="background: #ff9999; text-align: right; padding: .1em .5em;">!;
+    $OUT .= '<TABLE STYLE="border: 0;" CELLSPACING="0">'.
+            '<TR><TH BGCOLOR="#ff6666" COLSPAN="4">Open Invoices</TH></TR>'.
+            '<TR>'.$th.'Invoice #</TH>'.$th.'Date</TH>'.$thr.'Charges</TH>'
+            .$thr.'Owed</TH></TR>';
+    my $col1 = "#ffffff";
+    my $col2 = "#dddddd";
     my $col = $col1;
 
     foreach my $invoice ( @open_invoices ) {
-      my $td = qq!<TD BGCOLOR="#$col">!;
+      my $td  = qq!<TD STYLE="background: $col; padding: .1em .5em;">!;
+      my $tdr = qq!<TD STYLE="background: $col; padding: .1em .5em; text-align: right;">!;
       my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">';
       $OUT .=
-        "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td</TD>".
-        "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>".
-        qq!<TD BGCOLOR="#$col" ALIGN="right">$a\$!. $invoice->{'owed'}.
-          '</A></TD>'.
+        "<TR>".
+        $td . $a . $invoice->{'invnum'}. "</A></TD>" .
+        $td . $a . $invoice->{'date'} . "</A></TD>" .
+        $tdr . $a . $money_char . $invoice->{'charged'} . "</A></TD>" .
+        $tdr . $a . $money_char . $invoice->{'owed'} . "</A></TD>" .
         '</TR>';
       $col = $col eq $col1 ? $col2 : $col1;
     }
     $OUT .= '</TABLE><BR>';
   } else {
-    $OUT .= 'You have no outstanding invoices.<BR><BR>';
+    $OUT .= '<P>You have no outstanding invoices.</P>';
   }
 %>
 
+<%= $announcement || '' %>
+
 <%=
   if ( @support_services ) {
     $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
             '<TR><TH BGCOLOR="#ff6666" COLSPAN="3">Support Time Remaining</TH>'.
-            '</TR><TR><TH ALIGN="left">#</TH><TH>Package</TH>'.
+            '</TR><TR><TH>Package</TH><TH></TH>'.
             '<TH>Time Remaining</TH></TR>';
-    my $col1 = "ffffff";
-    my $col2 = "dddddd";
+    my $col1 = $stripe1_bgcolor || '#ffffff';
+    my $col2 = $stripe2_bgcolor || '#dddddd';
     my $col = $col1;
 
     foreach my $support ( @support_services ) {
-      my $td = qq!<TD BGCOLOR="#$col">!;
+      my $td = qq!<TD BGCOLOR="$col">!;
       my $a = qq!<A HREF="${url}view_support_details;svcnum=!.
               $support->{'svcnum'}. '">';
       $OUT .=
-        "<TR>$td$a". $support->{'pkgnum'}. "</A></TD>".
-        $td.$a. $support->{'pkg'}. "</A></TD>".
-        $td.$a. $support->{'time'}. "</A></TD>".
+        "<TR>".
+          $td.$a. $support->{'pkg'}. "</A></TD>".
+          $td.'&nbsp;</TD>'.
+          $td.$a. $support->{'time'}. "</A></TD>".
         '</TR>';
       $col = $col eq $col1 ? $col2 : $col1;
     }
@@ -63,37 +87,11 @@ Hello <%= $name %>!<BR><BR>
   }
 %>
 
-<%=
-  if ( @tickets ) {
-    $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
-            '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Tickets</TH></TR>'.
-            '<TR><TH>#</TH><TH>Subject</TH><TH>Priority</TH><TH>Queue</TH>'.
-            '<TH>Status</TH></TR>';
-    my $col1 = "ffffff";
-    my $col2 = "dddddd";
-    my $col = $col1;
-
-    foreach my $ticket ( @tickets ) {
-      my $td = qq!<TD BGCOLOR="#$col">!;
-      $OUT .=
-        "<TR>$td". $ticket->{'id'}. "</TD>".
-        $td. $ticket->{'subject'}. "</TD>".
-        $td. ($ticket->{'content'} || $ticket->{'priority'}). "</TD>".
-        $td. $ticket->{'queue'}. "</TD>".
-        $td. $ticket->{'status'}. "</TD>".
-        '</TR>';
-      $col = $col eq $col1 ? $col2 : $col1;
+<%= if (@tickets) {
+      $OUT .= include('ticket_summary');
+    } else {
+      $OUT .= '';
     }
-    $OUT .= '</TABLE>';
-  } else {
-    $OUT .= '';
-  }
 %>
 
-</TD></TR></TABLE>
-<HR>
-<FONT SIZE="-2">powered by <a href="http://www.sisd.com/freeside">freeside</a></FONT>
-</BODY></HTML>
-
-
-
+<%= include('footer') %>