From 75500e2f75a32b3735999eaf5edde3e871911226 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 10 May 2003 06:45:45 +0000 Subject: [PATCH] first pass at new package list UI --- httemplate/view/cust_main.cgi | 137 ++++++++++++++++++++++++++++++++++++------ httemplate/view/cust_pkg.cgi | 2 +- 2 files changed, 119 insertions(+), 20 deletions(-) diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index d392f8a39..e820143aa 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -19,7 +19,6 @@ print < .package TH { font-size: medium } .package TR { font-size: smaller } -.package .datehdr TH { font-size: smaller } .package .pkgnum { font-size: medium } .package .provision { font-size: larger; color: red; font-weight: bold } @@ -377,17 +376,9 @@ if ( @$packages ) { %> - - - - - - - - - - - + + + <% foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { @@ -410,15 +401,119 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) { <%=$pkg->{pkg}%> - <%=$pkg->{comment}%> ( <%=pkg_details_link($pkg)%> )
<% unless ($pkg->{cancel}) { %> ( <%=pkg_change_link($pkg)%> ) - ( <%=($pkg->{susp}) ? pkg_unsuspend_link($pkg) : pkg_suspend_link($pkg)%> | <%=pkg_cancel_link($pkg)%> ) ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg)%> ) <% } %> <% - foreach (qw(setup last_bill next_bill susp expire cancel)) { - print qq! \n!; + #foreach (qw(setup last_bill next_bill susp expire cancel)) { + # print qq! \n!; + #} + print "'; + unless ( $pkg->{setup} ) { + print ''; + } else { + print "'; + print "' + if $pkg->{'last_bill'}; + print "' + if $pkg->{'susp'}; + } + + } else { + + if ( $pkg->{susp} ) { #status: suspended + print ''; + unless ( $pkg->{setup} ) { + print ''; + } else { + print "'; + } + print "' + if $pkg->{'last_bill'}; + # next bill ?? + print "' + if $pkg->{'expire'}; + print ''; + + } else { #status: active + + unless ( $pkg->{setup} ) { #not setup + + print ''; + print ''; + } + + } else { #setup + + unless ( $pkg->{freq} ) { + print "". + ''; + } else { + print ''. + ''; + } + + } + + print "' + if $pkg->{'last_bill'}; + print "' + if $pkg->{'next_bill'}; + print "' + if $pkg->{'expire'}; + if ( $pkg->{freq} ) { + print ''; + } + + } + + } + + print "
PackageDatesServices
SetupLast billNext billSusp.ExpireCancelPackageStatusServices
! . pkg_datestr($pkg,$_) . qq!! . pkg_datestr($pkg,$_) . qq!". &itable(''); + + #move + my %freq = ( + 1 => 'monthly', + 2 => 'bi-monthly', + 3 => 'quarterly', + 6 => 'semi-annually', + 12 => 'annually', + 24 => 'bi-annually', + 36 => 'tri-annually', + ); + + sub freq { + my $freq = shift; + exists $freq{$freq} ? $freq{$freq} : "every $freq months"; } + #eomove + + if ( $pkg->{cancel} ) { #status: cancelled + + print '
Cancelled '. + pkg_datestr($pkg,'cancel'). '
Never billed
Setup ". + pkg_datestr($pkg, 'setup'). '
Last bill ". + pkg_datestr($pkg, 'last_bill'). '
Suspended ". + pkg_datestr($pkg, 'susp'). '
Suspended '. + pkg_datestr($pkg,'susp'). '
Never billed
Setup ". + pkg_datestr($pkg, 'setup'). '
Last bill ". + pkg_datestr($pkg, 'last_bill'). '
Expires ". + pkg_datestr($pkg, 'expire'). '
( '. pkg_unsuspend_link($pkg). + ' | '. pkg_cancel_link($pkg). ' )
Not yet billed ('; + unless ( $pkg->{freq} ) { + print 'one-time charge)
( '. pkg_cancel_link($pkg). + ' )'; + } else { + print 'billed '. freq($pkg->{freq}). ')
One-time charge
Billed '. + pkg_datestr($pkg,'setup'). '
Active, '. + 'billed '. freq($pkg->{freq}). '
Setup '. + pkg_datestr($pkg, 'setup'). '
Last bill ". + pkg_datestr($pkg, 'last_bill'). '
Next bill ". + pkg_datestr($pkg, 'next_bill'). '
Expires ". + pkg_datestr($pkg, 'expire'). '
( '. pkg_suspend_link($pkg). + ' | '. pkg_cancel_link($pkg). ' )
\n"; + if ($rowspan == 0) { print qq!\n!; next; } my $cnt = 0; @@ -687,6 +782,7 @@ foreach my $cust_pkg (($conf->exists('hidecancelledpackages') ? ($cust_main->nca $pkg{pkg} = $part_pkg->pkg; $pkg{pkgpart} = $part_pkg->pkgpart; $pkg{comment} = $part_pkg->getfield('comment'); + $pkg{freq} = $part_pkg->freq; $pkg{setup} = $cust_pkg->getfield('setup'); $pkg{last_bill} = $cust_pkg->getfield('last_bill'); $pkg{next_bill} = $cust_pkg->getfield('bill'); @@ -776,10 +872,13 @@ sub pkgsort_pkgnum_cancel { } sub pkg_datestr { - my ($pkg,$field) = (shift,shift) or return ''; - return $pkg->{$field} ? time2str('%D
%l:%M:%S%P %z', - $pkg->{$field}) - : ' '; + my($pkg, $field) = @_ or return ''; + return ' ' unless $pkg->{$field}; + my $format = $conf->exists('pkg_showtimes') + ? '%D %l:%M:%S%P %z' + : '%b %o, %Y'; + ( my $strip = time2str($format, $pkg->{$field}) ) =~ s/ (\d)/$1/g; + $strip; } sub pkg_details_link { diff --git a/httemplate/view/cust_pkg.cgi b/httemplate/view/cust_pkg.cgi index c3880114c..5f0e6bffc 100755 --- a/httemplate/view/cust_pkg.cgi +++ b/httemplate/view/cust_pkg.cgi @@ -71,7 +71,7 @@ print &ntable("#cccccc"), '', &ntable("#cccccc",2), ( $setup ? time2str("%D",$setup) : "(Not setup)" ), ''; print 'Last bill date', - ( $cust_pkg->last_bill ? time2str("%D",$cust_pkg->last_bill) : " " ), + ( $cust_pkg->get('last_bill') ? time2str("%D",$cust_pkg->get('last_bill')) : " " ), '' if $cust_pkg->dbdef_table->column('last_bill'); -- 2.11.0