slightly more sane names for customer tickets hash, display ticket owners on customer...
[freeside.git] / httemplate / view / cust_main / tickets.html
1 <A NAME="tickets"><FONT SIZE="+2">Tickets</FONT></A>
2 <BR>
3
4 (<A HREF="<% $open_link %>">View <% $openlabel %> tickets for this customer</A>)
5 (<A HREF="<% $res_link  %>">View resolved tickets for this customer</A>)
6 <BR>
7 (<A HREF="<% $new_link  %>">Create new ticket for this customer</A>)
8
9 <% include("/elements/table-grid.html") %>
10 % my $bgcolor1 = '#eeeeee';
11 %   my $bgcolor2 = '#ffffff';
12 %   my $bgcolor = '';
13
14 <TR>
15   <TH CLASS="grid" BGCOLOR="#cccccc">#</TH>
16   <TH CLASS="grid" BGCOLOR="#cccccc">Subject</TH>
17   <TH CLASS="grid" BGCOLOR="#cccccc">Status</TH>
18   <TH CLASS="grid" BGCOLOR="#cccccc">Queue</TH>
19   <TH CLASS="grid" BGCOLOR="#cccccc">Owner</TH>
20   <TH CLASS="grid" BGCOLOR="#cccccc">Priority</TH>
21 </TR>
22
23 % foreach my $ticket ( @tickets ) {
24 %     my $href = FS::TicketSystem->href_ticket($ticket->{id});
25 %     if ( $bgcolor eq $bgcolor1 ) {
26 %       $bgcolor = $bgcolor2;
27 %     } else {
28 %       $bgcolor = $bgcolor1;
29 %     }
30
31   <TR>
32   
33     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
34       <A HREF=<%$href%>><% $ticket->{id} %></A>
35     </TD>
36   
37     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
38       <A HREF=<%$href%>><% $ticket->{subject} %></A>
39     </TD>
40   
41     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
42       <% $ticket->{status} %>
43     </TD>
44   
45     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
46       <% $ticket->{queue} %>
47     </TD>
48   
49     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
50       <% $ticket->{owner} %>
51     </TD>
52   
53     <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
54       <% $ticket->{content}
55            ? $ticket->{content}.' ('.$ticket->{priority}.')'
56            : $ticket->{priority}
57       %>
58     </TD>
59   
60   </TR>
61
62 % } 
63
64 </TABLE>
65
66 <%init>
67
68 my( $cust_main ) = @_;
69 my( @tickets )  = $cust_main->tickets;
70
71 my $open_link = FS::TicketSystem->href_customer_tickets($cust_main->custnum);
72 my $openlabel = join('/', FS::TicketSystem->statuses );
73
74 my $res_link  = FS::TicketSystem->href_customer_tickets(
75                   $cust_main->custnum,
76                   { 'statuses' => [ 'resolved' ] }
77                 );
78
79 my $new_link = FS::TicketSystem->href_new_ticket(
80                  $cust_main,
81                  join(', ', $cust_main->invoicing_list_emailonly )
82                );
83
84 </%init>