diff options
Diffstat (limited to 'httemplate/elements/dashboard-toplist.html')
-rw-r--r-- | httemplate/elements/dashboard-toplist.html | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/httemplate/elements/dashboard-toplist.html b/httemplate/elements/dashboard-toplist.html new file mode 100644 index 0000000..d8cd7f3 --- /dev/null +++ b/httemplate/elements/dashboard-toplist.html @@ -0,0 +1,113 @@ +% if ( $conf->exists('dashboard-toplist') ) { + + <% include('/elements/table-grid.html') %> + +% my $bgcolor1 = '#eeeeee'; +% my $bgcolor2 = '#ffffff'; +% my $bgcolor = $bgcolor2; + +% foreach my $line ( $conf->config('dashboard-toplist') ) { +% +% if ( $bgcolor eq $bgcolor1 ) { +% $bgcolor = $bgcolor2; +% } else { +% $bgcolor = $bgcolor1; +% } + +% if ( $line =~ /^\s*cust_main:\s*(\d+)\s*$/ ) { #customer line +% my $custnum = $1; +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); +% if ( $cust_main ) { + + <TR> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <A HREF="view/cust_main.cgi?<% $custnum %>"><% $cust_main->name %></A> + </TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + <% include('/elements/mcp_lint.html', 'cust_main'=>$cust_main) %> + </TD> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="right"> + <FONT SIZE="-1"><A HREF="<% FS::TicketSystem->href_new_ticket($cust_main, join(', ', grep { $_ !~ /^(POST|FAX)$/ } $cust_main->invoicing_list ) ) %>">(new ticket)</A></FONT> + </TD> + +% foreach my $priority ( @custom_priorities, '' ) { +% my $num = +% FS::TicketSystem->num_customer_tickets($custnum,$priority); +% my $ahref = ''; +% $ahref= '<A HREF="'. +% FS::TicketSystem->href_customer_tickets($custnum,$priority). +% '">' +% if $num; + + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="right"> + <% $ahref.$num %></A> + </TD> +% } + </TR> + +% } else { + + <TR> + <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> + Unknown customer number <% $custnum %> + </TD> + </TR> + +% } +% +% } elsif ( $line =~ /^\-\-+$/ ) { #divider +% + <TR> + <TH CLASS="grid" COLSPAN="<% scalar(@custom_priorities) + 4 %>"></TH> + </TR> + +% next; +% +% } elsif ( $line =~ /^\s*$/ ) { + + <TR> + <TD CLASS="grid" COLSPAN="<% scalar(@custom_priorities) + 4 %>" BGCOLOR="<% $bgcolor %>"> </TD> + </TR> + +% } elsif ( $line =~ /^\S/ ) { #label line + + <TR> + <TH CLASS="grid" BGCOLOR="#cccccc"><% $line %></TH> + <TH CLASS="grid" BGCOLOR="#cccccc">Lint</TH> + <TH CLASS="grid" BGCOLOR="#cccccc"></TH> +% foreach my $priority ( @custom_priorities, '' ) { + <TH CLASS="grid" BGCOLOR="#cccccc"> + <% $priority || '<i>(none)</i>'%> + </TH> +% } + </TR> + +% } else { #regular line + + <TR> + <TD CLASS="grid" COLSPAN="<% scalar(@custom_priorities) + 4 %>" BGCOLOR="<% $bgcolor %>"><% $line %></TD> + </TR> + +% } + +% +% } + + </TABLE> + <BR> + +% } +<%init> + +my $conf = new FS::Conf; + +#false laziness w/httemplate/search/cust_main.cgi... care if +# custom_priority_field becomes anything but a local hack... +my @custom_priorities = (); +if ( $conf->config('ticket_system-custom_priority_field') + && @{[ $conf->config('ticket_system-custom_priority_field-values') ]} ) { + @custom_priorities = + $conf->config('ticket_system-custom_priority_field-values'); +} + +</%init> |