better display/edit of contacts on customer view, RT#16819
[freeside.git] / httemplate / view / cust_main / contacts_new.html
index bd812c7..155490f 100644 (file)
@@ -1,17 +1,44 @@
-% if ( @contacts ) {
 <BR>
-Contacts
-<% ntable("#cccccc",2) %>
+<FONT CLASS="fsinnerbox-title">Contacts</FONT>
+<A HREF="<%$p%>/edit/cust_main-contacts.html?<% $cust_main->custnum %>">Edit contacts</A>
+<TABLE CLASS="fsinnerbox">
 %   foreach my $contact ( @contacts ) {
+%     #XXX maybe this should be a table with alternating colors instead
       <TR>
-        <TD ALIGN="right">Contact</TD>
+        <TD ALIGN="right"><% $contact->contact_classname %> Contact</TD>
         <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
+
+%       my @contact_email = $contact->contact_email;
+%       if (@contact_email) {
+          <TD ALIGN="right">&nbsp;&nbsp;&nbsp;Email</TD>
+          <TD BGCOLOR="#FFFFFF"><% join(', ', map $_->emailaddress, @contact_email) %></TD>
+%       }
+
+%       foreach my $phone_type (@phone_type) {
+%         my $contact_phone =
+%           qsearchs('contact_phone', {
+%                      'contactnum'   => $contact->contactnum,
+%                      'phonetypenum' => $phone_type->phonetypenum,
+%                   })
+%           or next;
+          <TD ALIGN="right">&nbsp;&nbsp;&nbsp;<% $phone_type->typename %> phone</TD>
+          <TD BGCOLOR="#FFFFFF"><% $contact_phone->phonenum |h %></TD>
+%       }
+
+%       if ( $contact->comment ) {
+          <TD ALIGN="right">&nbsp;&nbsp;&nbsp;Comment</TD>
+          <TD BGCOLOR="#FFFFFF"><% $contact->comment |h %></TD>
+
+%       }
+
       </TR>
 %   }
 </TABLE>
+<%once>
 
-% }
+my @phone_type = qsearch({table=>'phone_type', order_by=>'weight'});
 
+</%once>
 <%init>
 
 my( $cust_main ) = @_;