RT# 77532 - created method to display phone types
[freeside.git] / httemplate / view / cust_main / contacts_new.html
index bd812c7..22968b6 100644 (file)
@@ -1,22 +1,81 @@
-% 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>
+
+<& /elements/table-grid.html &>
+% my $bgcolor1 = '#eeeeee';
+%     my $bgcolor2 = '#ffffff';
+%     my $bgcolor = $bgcolor2;
+%     my $count = 0;
+<TR>
+  <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Type</TH>
+  <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Contact</TH>
+  <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Email</TH>
+  <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc">Self-service</TH>
+% foreach my $phone_type (@phone_type) {
+    <TH CLASS="grid" ALIGN="left" BGCOLOR="#cccccc"><% $phone_type->typename |h %> phone</TD>
+% }
+</TR>
+
 %   foreach my $contact ( @contacts ) {
       <TR>
-        <TD ALIGN="right">Contact</TD>
-        <TD BGCOLOR="#FFFFFF"><% $contact->line %></TD>
+        <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact->contact_classname |h %></TD>
+        <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact->line |h %></TD>
+
+%       my @contact_email = $contact->contact_email;
+        <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% join(', ', map $_->emailaddress, @contact_email) %></TD>
+
+        <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+%         if ( $contact->selfservice_access ) {
+            Enabled
+%#            <FONT SIZE="-1"><A HREF="XXX">disable</A>
+%#                            <A HREF="XXX">re-email</A></FONT>
+            <FONT SIZE="-1">
+              <& /elements/change_password.html,
+                'contact_num'      => $contact->contactnum,
+                'custnum'          => $contact->custnum,
+                'no_label_display' => '',
+                'label'            => 'change password',
+                'curr_value'       => '',
+                'pre_pwd_field_label' => 'contact'.$count.'_',
+              &>
+            </FONT>
+%         } else {
+            Disabled
+%#            <FONT SIZE="-1"><A HREF="XXX">enable</A></FONT>
+%        }
+       </TD>
+
+%       foreach my $phone_type (@phone_type) {
+%         my $contact_phone =
+%           qsearchs('contact_phone', {
+%                      'contactnum'   => $contact->contactnum,
+%                      'phonetypenum' => $phone_type->phonetypenum,
+%                   });
+          <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $contact_phone ? $contact_phone->phonenum_pretty : '' |h %></TD>
+%       }
+
       </TR>
+
+%     if ( $bgcolor eq $bgcolor1 ) {
+%        $bgcolor = $bgcolor2;
+%      } else {
+%        $bgcolor = $bgcolor1;
+%      }
+%     $count++;
 %   }
 </TABLE>
+<%once>
 
-% }
+my @phone_type = FS::phone_type->get_phone_types();
 
+</%once>
 <%init>
 
 my( $cust_main ) = @_;
 #my $conf = new FS::Conf;
 
 my @contacts = $cust_main->cust_contact;
+my $display = scalar(@contacts) > 0;
 
 </%init>