RT#29169: Show payment information in selfservice portal
[freeside.git] / fs_selfservice / FS-SelfService / cgi / myaccount_menu.html
1 <%= $url = "$selfurl?action="; ''; %>
2 <TABLE BORDER=0><TR>
3 <TD VALIGN="top" BGCOLOR="<%= $menu_bgcolor || $box_bgcolor || '#c0c0c0' %>">
4
5 <TABLE CELLSPACING=0 BORDER=0 HEIGHT="100%">
6
7 <%= 
8
9 if ( $menu_top_image ) {
10   $OUT .= '<TR><TD STYLE="padding:0px"><IMG SRC="image.cgi?name=menu_top_image;agentnum='. $agentnum. '"></TD></TR>';
11 }
12
13 my @menu = (
14   { title=>' ' },
15   { title=>'Overview', url=>'myaccount', size=>'+1', },
16   { title=>' ' },
17   { title=>'Purchase', size=>'+1', },
18 );
19
20 unless ( $access_pkgnum ) {
21   push @menu,
22     { title=>'Purchase additional package',
23       url=>'customer_order_pkg', 'indent'=>2 };
24 }
25
26 my %payby_mode;
27 @payby_mode{@cust_paybys} = @hide_payment_fields;
28 # $payby_mode{FOO} is true if FOO is thirdparty, false if it's B::OP,
29 # nonexistent if it's not supported
30
31 if ( ($balance || 0) > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
32
33   if ( exists( $payby_mode{CARD} ) ) {
34     push @menu, { title  => 'Recharge my account with a credit card',
35                   url    => $payby_mode{CARD}
36                               ? 'make_thirdparty_payment&payby_method=CC'
37                               : 'make_payment',
38                   indent => 2,
39                  }
40   }
41
42   if ( exists( $payby_mode{CHEK} ) ) {
43     push @menu, { title  => 'Recharge my account with a check',
44                   url    => $payby_mode{CHEK}
45                               ? 'make_thirdparty_payment&payby_method=ECHECK'
46                               : 'make_ach_payment',
47                   indent => 2,
48                 }
49   }
50
51   if ( exists( $payby_mode{PREPAY} ) ) {
52     push @menu, { title  => 'Recharge my account with a prepaid card',
53                   url    => 'recharge_prepay',
54                   indent => 2,
55                 }
56   }
57
58   if ( exists( $payby_mode{PPAL} ) ) {
59     push @menu, { title  => 'Recharge my account with PayPal',
60                   url    => 'make_thirdparty_payment&payby_method=PAYPAL',
61                   indent => 2,
62                 }
63   }
64 }
65
66 push @menu,
67   { title=>' ' };
68
69 push @menu,
70   { title=>'View Payment History', url=>'history', size=>'+1' },
71 ;
72
73 unless( $hide_usage ){
74   push @menu,
75     { title=>'View my usage', url=>'view_usage', size=>'+1', }
76 }
77
78 push @menu,
79   { title=>'Create a ticket', url=>'tktcreate', size=>'+1', },
80 ;
81
82 unless ( $access_pkgnum ) {
83   push @menu,
84     { title=>'Setup my services', url=>'provision', size=>'+1', },
85   ;
86 }
87
88 push @menu,
89   { title=>' ' };
90
91 push @menu,
92   { title=>'Change my information', size=>'+1', };
93
94 unless ( $access_pkgnum ) {
95   push @menu,
96     { title=>'Change billing address',      url=>'change_bill',     indent=>2 },
97     { title=>'Change service address',      url=>'change_ship',     indent=>2 },
98     { title=>'Change payment information',  url=>'change_pay',      indent=>2 },
99   ;
100 }
101
102 push @menu,
103   { title=>'Change password(s)',          url=>'change_password', indent=>2 },
104   { title=>' ' },
105   { title=>'Logout',   url=>'logout', size=>'+1', },
106 ;
107
108 my %menu_disable = map { $_=>1 } @menu_disable;
109 foreach my $item ( @menu ) {
110
111   next if ( $menu_skipblanks && $item->{'title'} =~ /^\s*$/ )
112        || ( $menu_skipheadings && ! $item->{'url'} )
113        || $menu_disable{$item->{'title'}};
114   
115   $OUT .= '<TR><TD'; 
116   if ( $menu_body_image ) {
117     if ( exists $item->{'url'} && $action eq $item->{'url'} ) {
118       $OUT .= #' BGCOLOR="'. ( $body_bgcolor || '#eeeeee' ). '" '.
119               ' STYLE="background: url(image.cgi?name=menu_body_image;agentnum='. $agentnum. ') 0 bottom; '.
120               '        color:#3366CC"; '. #XXX config
121               ' " ';
122     } else {
123       $OUT .= ' STYLE="background: url(image.cgi?name=menu_body_imagei;agentnum='. $agentnum. ') 0 bottom" ';
124     }
125   } else {
126     if ( exists $item->{'url'} && $action eq $item->{'url'} ) {
127       $OUT .= ' BGCOLOR="'. ( $body_bgcolor || '#eeeeee' ). '" '.
128               ' STYLE="border-top: 1px solid black;'.
129                      ' border-left: 1px solid black;'.
130                      ' border-bottom: 1px solid black"';
131     } else {
132       $OUT .= ' STYLE="border-right: 1px solid black"';
133     }
134   }
135   $OUT.='>';
136
137   if ( $menu_skipheadings ) {
138     $OUT .= '&nbsp;&nbsp;';
139   } else {
140     $OUT .= '&nbsp;' x $item->{'indent'}
141       if exists $item->{'indent'};
142   }
143
144   $OUT .= '<A HREF="'. $url. $item->{'url'}. '">'
145     if exists $item->{'url'} && $action ne $item->{'url'};
146
147   $OUT .= '<FONT SIZE="'. ( $menu_fontsize || $item->{'size'} ). '">'
148     if $menu_fontsize || exists($item->{'size'});
149
150   $item->{'title'} =~ s/ /&nbsp;/g;
151   $OUT .= $item->{'title'};
152
153   $OUT .= '</FONT>'
154     if exists $item->{'size'};
155
156   $OUT .= '</A>'
157     if exists $item->{'url'} && $action ne $item->{'url'};
158
159   $OUT .= '</TD></TR>';
160
161 }
162
163 if ( $menu_bottom_image ) {
164   $OUT .= '<TR><TD STYLE="padding:0px"><IMG SRC="image.cgi?name=menu_bottom_image;agentnum='. $agentnum. '"></TD></TR>';
165 } else {
166   $OUT .= '<TR><TD STYLE="border-right: 1px solid black" HEIGHT="100%"><BR><BR><BR><BR></TD></TR>';
167 }
168
169 %>
170
171 </TABLE>
172
173 </TD>