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