X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=fs_selfservice%2FFS-SelfService%2Fcgi%2Fview_usage.html;h=c43f7d3dafb31899ce216dd024cc51a8ca5c8be3;hp=f7076684ecf2d0c541658e99ec6e050510b91eb1;hb=3a7f3a2e81cc7423ba9a08fd4b28b3b5f4f227a2;hpb=db5e7f34b1e17ae6ce8909062537cc2fb98ca30d diff --git a/fs_selfservice/FS-SelfService/cgi/view_usage.html b/fs_selfservice/FS-SelfService/cgi/view_usage.html index f7076684e..c43f7d3da 100644 --- a/fs_selfservice/FS-SelfService/cgi/view_usage.html +++ b/fs_selfservice/FS-SelfService/cgi/view_usage.html @@ -1,10 +1,25 @@ -<%= $url = "$selfurl?session=$session_id;action="; - @svc_acct = grep { $_->{svcdb} eq 'svc_acct' } @svcs; - @svc_phone = grep { $_->{svcdb} eq 'svc_phone' } @svcs; - @svc_port = grep { $_->{svcdb} eq 'svc_port' } @svcs; +<%= $url = "$selfurl?action="; + %by_pkg_label = (); # not used yet, but I'm sure it will be... + @svc_acct = (); + @svc_phone = (); + @svc_port = (); + + foreach (@svcs) { + $by_pkg_label{ $_->{pkg_label} } ||= []; + push @{ $by_pkg_label{ $_->{pkg_label} } }, $_; + if ( $_->{svcdb} eq 'svc_acct' ) { + push @svc_acct, $_; + } elsif ( $_->{svcdb} eq 'svc_phone' ) { + push @svc_phone, $_; + } elsif ( $_->{svcdb} eq 'svc_port' ) { + push @svc_port, $_; + } + } ''; %> <%= include('header', 'Account usage') %> +<%= if( $hide_usage ){ $OUT .= '<' . '!--' } %> + <%= if ( $error ) { $OUT .= qq!$error

!; @@ -67,7 +82,7 @@ $any{$dir} = grep { $_->{$dir} } @svc_phone; } $OUT.= 'Call usage

- +
'; if ( $any{outbound} ) { @@ -110,7 +125,42 @@ ''; %> -<%= scalar(@svc_phone) ? '
Number


' : '' %> +<%= if ( @usage_pools ) { + $OUT .= ' + + + '; + my $any_shared = 0; + foreach my $usage (@usage_pools) { + # false laziness with the back office side + my ($description, $remain, $total, $shared) = @$usage; + if ( $shared ) { + $any_shared = 1; + $description .= '*'; + } + my $ratio = 255 * ($remain/$total); + $ratio = 255 if $color > 255; + my $color = + sprintf('STYLE="font-weight: bold; color: #%02x%02x00"', + 255 - $ratio, $ratio); + $OUT .= + qq! + + + + + !; + } + if ( $any_shared ) { + $OUT .= ''. + ''; + } +} +if ( scalar(@svc_phone) or scalar(@usage_pools) ) { + $OUT .= '
Remaining minutes
$description$remain / $total
* shared among all your phone plans


'; +} +''; +%> <%= if ( @svc_port ) { $OUT.= 'Bandwidth Graphs

@@ -148,8 +198,7 @@ foreach my $svc_port ( @svc_port ) { $OUT .= ''. $svc_port->{'label'}. ': '. $svc_port->{'value'}.''; $OUT .= qq!
- - !; + !; $OUT .= preset_range($default_start,$default_end,'Last Day',$date_format,$svcnum) .' | '.preset_range($default_end-86400*7,$default_end,'Last Week',$date_format,$svcnum) .' | '.preset_range($default_end-86400*30,$default_end,'Last Month',$date_format,$svcnum) @@ -169,4 +218,6 @@ foreach my $svc_port ( @svc_port ) { +<%= if( $hide_usage ){ $OUT .= '--'. '>' } %> <%= include('footer') %> +