From 1ec49b28c30c84962670d80d1c143e65b5b9370a Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 15 Dec 2006 12:43:44 +0000 Subject: [PATCH] add a quick start at a "dashboard" customer list, mostly for internal use for starters --- FS/FS/Conf.pm | 7 +++ httemplate/elements/dashboard-toplist.html | 98 ++++++++++++++++++++++++++++++ httemplate/index.html | 21 +++---- 3 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 httemplate/elements/dashboard-toplist.html diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 270b61c9f..f2fda8016 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1995,6 +1995,13 @@ httemplate/docs/config.html 'select_enum' => \@card_types, }, + { + 'key' => 'dashboard-toplist', + 'section' => 'UI', + 'description' => 'List of items to display on the top of the front page', + 'type' => 'textarea', + }, + ); 1; diff --git a/httemplate/elements/dashboard-toplist.html b/httemplate/elements/dashboard-toplist.html new file mode 100644 index 000000000..6276f9fd3 --- /dev/null +++ b/httemplate/elements/dashboard-toplist.html @@ -0,0 +1,98 @@ +% 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 ) { + + + + <% $cust_main->name %> + +% foreach my $priority ( @custom_priorities, '' ) { +% my $num = +% FS::TicketSystem->num_customer_tickets($custnum,$priority); +% my $ahref = ''; +% $ahref= '' +% if $num; + + + <% $ahref.$num %> + +% } + + +% } else { + + + + Unknown customer number <% $custnum %> + + + +% } +% +% } elsif ( $line =~ /^\-\-+$/ ) { #divider +% + + + + +% next; +% +% } elsif ( $line =~ /^\s*$/ ) { + + +   + + +% } else { #label line + + + <% $line %> +% foreach my $priority ( @custom_priorities, '' ) { + + <% $priority || '(none)'%> + +% } + + +% } + +% +% } + + +
+ +% } +<%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'); +} + + diff --git a/httemplate/index.html b/httemplate/index.html index 57d85a9fb..60ab26f86 100644 --- a/httemplate/index.html +++ b/httemplate/index.html @@ -1,8 +1,9 @@ % my $conf = new FS::Conf; <% include('/elements/header.html', 'Billing Main' ) %> -% -% + +<% include('/elements/dashboard-toplist.html') %> + % my $sth = dbh->prepare( % #"SELECT DISTINCT custnum FROM h_cust_main JOIN cust_main USING ( custnum ) % "SELECT custnum FROM h_cust_main JOIN cust_main USING ( custnum ) @@ -19,29 +20,25 @@ % @custnums = splice(@custnums, 0, 10); % % if ( @custnums ) { -% -% - <% include('/elements/table-grid.html') %> + % my $bgcolor1 = '#eeeeee'; % my $bgcolor2 = '#ffffff'; -% my $bgcolor; -% - +% my $bgcolor = $bgcolor2; Customers I recently added or modified + % foreach my $custnum ( @custnums ) { % my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); % next unless $cust_main; - <% $custnum %>: <% $cust_main->name %> -% + % if ( $bgcolor eq $bgcolor1 ) { % $bgcolor = $bgcolor2; % } else { @@ -50,10 +47,8 @@ % % } - -% } +% } <% include('/elements/footer.html') %> - -- 2.11.0