19118ea2762e921d9f8d4bf2f386490b1a6bcff7
[freeside.git] / httemplate / view / cust_main / contacts_new.html
1 <BR>
2 <FONT CLASS="fsinnerbox-title">Contacts</FONT>
3 <A HREF="<%$p%>edit/cust_main-contacts.html?<% $cust_main->custnum %>">Edit contacts</A>
4
5 <& /elements/table-grid.html &>
6 % my $bgcolor1 = '#eeeeee';
7 %     my $bgcolor2 = '#ffffff';
8 %     my $bgcolor = $bgcolor2;
9 %     my $count = 0;
10 <TR>
11   <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Type</TH>
12   <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Contact</TH>
13   <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Email</TH>
14   <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Self-service</TH>
15 % foreach my $phone_type (@phone_type) {
16     <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc"><% $phone_type->typename |h %> phone</TD>
17 % }
18 </TR>
19
20 %   foreach my $contact ( @contacts ) {
21       <TR>
22         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact->contact_classname |h %></TD>
23         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact->line |h %></TD>
24
25 %       my @contact_email = $contact->contact_email;
26         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% join(', ', map $_->emailaddress, @contact_email) %></TD>
27
28         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
29 %         if ( $contact->selfservice_access ) {
30             Enabled
31 %#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
32 %#                            <A HREF="XXX">re-email</A></FONT>
33             <FONT SIZE="-1">
34               <& /elements/change_password.html,
35                 'contact_num'      => $contact->contactnum,
36                 'custnum'          => $contact->custnum,
37                 'no_label_display' => '',
38                 'label'            => 'change password',
39                 'curr_value'       => '',
40                 'pre_pwd_field_label' => 'contact'.$count.'_',
41               &>
42             </FONT>
43 %         } else {
44             Disabled
45 %#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
46 %        }
47        </TD>
48
49 %       foreach my $phone_type (@phone_type) {
50 %         my $contact_phone =
51 %           qsearchs('contact_phone', {
52 %                      'contactnum'   => $contact->contactnum,
53 %                      'phonetypenum' => $phone_type->phonetypenum,
54 %                   });
55           <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
56 %       }
57
58       </TR>
59
60 %     if ( $bgcolor eq $bgcolor1 ) {
61 %        $bgcolor = $bgcolor2;
62 %      } else {
63 %        $bgcolor = $bgcolor1;
64 %      }
65 %     $count++;
66 %   }
67 </TABLE>
68 <%once>
69
70 my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'});
71
72 </%once>
73 <%init>
74
75 my( $cust_main ) = @_;
76 #my $conf = new FS::Conf;
77
78 my @contacts = $cust_main->cust_contact;
79 my $display = scalar(@contacts) > 0;
80
81 </%init>