4a31b125892bd6f6180635297b0d995e7d42e00f
[freeside.git] / fs_selfservice / FS-SelfService / cgi / myaccount_menu.html
1 <%= $url = "$selfurl?session=$session_id;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?menu_top_image"></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 if ( $balance > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
27
28   #XXXFIXME still a bit sloppy for multi-gateway of differing namespace
29   my $i = 0;
30   while($i < scalar(@cust_paybys)) { last if $cust_paybys[$i] =~ /^CARD/; $i++ }
31   if ( $cust_paybys[$i] && $cust_paybys[$i] =~ /^CARD/ ) {
32     push @menu, { title  => 'Recharge my account with a credit card',
33                   url    => $hide_payment_fields[$i]
34                               ? 'make_thirdparty_payment&payby_method=CC'
35                               : 'make_payment',
36                   indent => 2,
37                  }
38   }
39
40   $i = 0;
41   while($i < scalar(@cust_paybys)) { last if $cust_paybys[$i] =~ /^CHEK/; $i++ }
42   if ( $cust_paybys[$i] && $cust_paybys[$i] =~ /^CHEK/ ) {
43     push @menu, { title  => 'Recharge my account with a check',
44                   url    => $hide_payment_fields[$i]
45                               ? 'make_thirdparty_payment&payby_method=ECHECK'
46                               : 'make_ach_payment',
47                   indent => 2,
48                 }
49   }
50
51   push @menu, { title  => 'Recharge my account with a prepaid card',
52                 url    => 'recharge_prepay',
53                 indent => 2,
54               }
55     if grep(/^PREP/, @cust_paybys);
56
57 }
58
59 push @menu,
60   { title=>' ' },
61   { title=>'View my usage', url=>'view_usage', size=>'+1', },
62   { title=>'Create a ticket', url=>'tktcreate', size=>'+1', },
63 ;
64
65 unless ( $access_pkgnum ) {
66   push @menu,
67     { title=>'Setup my services', url=>'provision', size=>'+1', },
68   ;
69 }
70
71 push @menu,
72   { title=>' ' };
73
74 push @menu,
75   { title=>'Change my information', size=>'+1', };
76
77 unless ( $access_pkgnum ) {
78   push @menu,
79     { title=>'Change billing address',      url=>'change_bill',     indent=>2 },
80     { title=>'Change service address',      url=>'change_ship',     indent=>2 },
81     { title=>'Change payment information',  url=>'change_pay',      indent=>2 },
82   ;
83 }
84
85 push @menu,
86   { title=>'Change password(s)',          url=>'change_password', indent=>2 },
87   { title=>' ' },
88   { title=>'Logout',   url=>'logout', size=>'+1', },
89 ;
90
91 my %menu_disable = map { $_=>1 } @menu_disable;
92 foreach my $item ( @menu ) {
93
94   next if ( $menu_skipblanks && $item->{'title'} =~ /^\s*$/ )
95        || ( $menu_skipheadings && ! $item->{'url'} )
96        || $menu_disable{$item->{'title'}};
97   
98   $OUT .= '<TR><TD'; 
99   if ( $menu_body_image ) {
100     if ( exists $item->{'url'} && $action eq $item->{'url'} ) {
101       $OUT .= #' BGCOLOR="'. ( $body_bgcolor || '#eeeeee' ). '" '.
102               ' STYLE="background: url(image.cgi?menu_body_image) 0 bottom; '.
103               '        color:#3366CC"; '. #XXX config
104               ' " ';
105     } else {
106       $OUT .= ' STYLE="background: url(image.cgi?menu_body_image) 0 bottom" ';
107     }
108   } else {
109     if ( exists $item->{'url'} && $action eq $item->{'url'} ) {
110       $OUT .= ' BGCOLOR="'. ( $body_bgcolor || '#eeeeee' ). '" '.
111               ' STYLE="border-top: 1px solid black;'.
112                      ' border-left: 1px solid black;'.
113                      ' border-bottom: 1px solid black"';
114     } else {
115       $OUT .= ' STYLE="border-right: 1px solid black"';
116     }
117   }
118   $OUT.='>';
119
120   if ( $menu_skipheadings ) {
121     $OUT .= '&nbsp;&nbsp;';
122   } else {
123     $OUT .= '&nbsp;' x $item->{'indent'}
124       if exists $item->{'indent'};
125   }
126
127   $OUT .= '<A HREF="'. $url. $item->{'url'}. '">'
128     if exists $item->{'url'} && $action ne $item->{'url'};
129
130   $OUT .= '<FONT SIZE="'. ( $menu_fontsize || $item->{'size'} ). '">'
131     if $menu_fontsize || exists($item->{'size'});
132
133   $item->{'title'} =~ s/ /&nbsp;/g;
134   $OUT .= $item->{'title'};
135
136   $OUT .= '</FONT>'
137     if exists $item->{'size'};
138
139   $OUT .= '</A>'
140     if exists $item->{'url'} && $action ne $item->{'url'};
141
142   $OUT .= '</TD></TR>';
143
144 }
145
146 if ( $menu_bottom_image ) {
147   $OUT .= '<TR><TD STYLE="padding:0px"><IMG SRC="image.cgi?menu_bottom_image"></TD></TR>';
148 } else {
149   $OUT .= '<TR><TD STYLE="border-right: 1px solid black" HEIGHT="100%"><BR><BR><BR><BR></TD></TR>';
150 }
151
152 %>
153
154 </TABLE>
155
156 </TD>