From d7cf0d6bb3b81b1c91ef1bcc3252d56f96b65b0f Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 5 Aug 2014 15:54:51 -0700 Subject: 477 report: improve browse-edit UI --- httemplate/browse/part_pkg-fcc.html | 67 +++++++++++++++----------- httemplate/edit/deploy_zone-fixed.html | 5 ++ httemplate/edit/process/bulk-part_pkg-fcc.html | 42 ++++++++++++++++ httemplate/elements/input-fcc_options.html | 2 +- httemplate/search/477.html | 34 ++++++++++--- httemplate/search/report_477.html | 21 ++++---- 6 files changed, 124 insertions(+), 47 deletions(-) create mode 100644 httemplate/edit/process/bulk-part_pkg-fcc.html (limited to 'httemplate') diff --git a/httemplate/browse/part_pkg-fcc.html b/httemplate/browse/part_pkg-fcc.html index 9462c3248..9facd10dc 100755 --- a/httemplate/browse/part_pkg-fcc.html +++ b/httemplate/browse/part_pkg-fcc.html @@ -3,14 +3,13 @@ 'menubar' => \@menubar, 'html_init' => $html_init, 'html_form' => $html_form, - 'html_posttotal' => $html_posttotal, 'name' => 'package definitions', 'disableable' => 1, 'disabled_statuspos' => 4, 'agent_virt' => 1, 'agent_null_right' => [ $edit, $edit_global ], 'agent_null_right_link' => $edit_global, - 'agent_pos' => 6, + 'agent_pos' => 3, 'query' => { 'select' => $select, 'table' => 'part_pkg', @@ -39,6 +38,14 @@ my $acl_edit_global = $curuser->access_right($edit_global); die "access denied" unless $acl_edit || $acl_edit_global; +if ( $cgi->param('redirect') ) { + my $session = $cgi->param('redirect'); + my $pref = $curuser->option("redirect$session"); + die "unknown redirect session $session\n" unless length($pref); + $cgi = new CGI($pref); + $cgi->param('redirect', $session); +} + my $conf = new FS::Conf; my $orderby = 'pkgpart'; @@ -88,22 +95,8 @@ my $select = join(',', my $addl_from = FS::Report::FCC_477::join_optionnames(@optionnames); -#restore this so pagination works $cgi->param('classnum', $classnum) if length($classnum); -#should hide this if there aren't any classes -my $html_posttotal = - "
( show class: ". - include('/elements/select-pkg_class.html', - #'curr_value' => $classnum, - 'value' => $classnum, #insist on 0 :/ - 'onchange' => 'filter_change()', - 'pre_options' => [ '-1' => 'all', - '0' => '(none)', ], - 'disable_empty' => 1, - ). - ' )'; - my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ]; my @header = ( '#', 'Package', 'Comment' ); @@ -176,24 +169,42 @@ $extra_count = ( $count_extra_sql ? ' AND ' : ' WHERE ' ). $extra_count if $extra_count; my $count_query = "SELECT COUNT(*) FROM part_pkg $count_extra_sql $extra_count"; +# in case of error redirect +if ( $cgi->param('redirect') ) { + push @header, ''; + push @fields, sub { + my $part_pkg = shift; + my $pkgpart = $part_pkg->pkgpart; + '' . $cgi->param("error$pkgpart") || '' . '' + }; + $align .= 'l'; +} + my $html_init = include('/elements/init_overlib.html') . include('/elements/input-fcc_options.html', js_only => 1) . include('.style'); -my $html_form = ''; -my $html_foot = ''; -# insert a checkbox column -unshift @header, ''; -unshift @fields, sub { - ''; -}; -unshift @links, ''; -$align = 'c'.$align; - +my $html_form = qq!
+ ( show class: !. + include('/elements/select-pkg_class.html', + #'curr_value' => $classnum, + 'value' => $classnum, #insist on 0 :/ + 'onchange' => 'filter_change()', + 'pre_options' => [ '-1' => 'all', + '0' => '(none)', ], + 'disable_empty' => 1, + ). + ' ) +

' . + qq!!; -$html_form = qq!!; -$html_foot = qq! +my $html_foot = qq!
!; diff --git a/httemplate/edit/deploy_zone-fixed.html b/httemplate/edit/deploy_zone-fixed.html index ecec9c434..8c6d54e5d 100644 --- a/httemplate/edit/deploy_zone-fixed.html +++ b/httemplate/edit/deploy_zone-fixed.html @@ -14,6 +14,7 @@ 'is_consumer' => 'Consumer/mass market', 'is_business' => 'Business/government', 'blocknum' => '', + 'active_date' => 'Active since', }, 'fields' => [ { field => 'zonetype', @@ -25,6 +26,10 @@ value => 'broadband' }, 'description', + { field => 'active_date', + type => 'fixed-date', + value => time, + }, { field => 'agentnum', type => 'select-agent', disable_empty => 1, diff --git a/httemplate/edit/process/bulk-part_pkg-fcc.html b/httemplate/edit/process/bulk-part_pkg-fcc.html new file mode 100644 index 000000000..17579aa61 --- /dev/null +++ b/httemplate/edit/process/bulk-part_pkg-fcc.html @@ -0,0 +1,42 @@ +% if ( keys %error ) { +% foreach my $pkgpart (keys %error) { +% # stuff all the errors back into $cgi +% $cgi->param("error$pkgpart", $error{$pkgpart}); +% } +% my $session = int(rand(4294967296)); #XXX +% my $pref = new FS::access_user_pref({ +% 'usernum' => $FS::CurrentUser::CurrentUser->usernum, +% 'prefname' => "redirect$session", +% 'prefvalue' => $cgi->query_string, +% 'expiration' => time + 3600, #1h? 1m? +% }); +% my $pref_error = $pref->insert; +% if ( $pref_error ) { +% die "FATAL: couldn't even set redirect cookie: $pref_error". +% " attempting to set redirect$session to ". $cgi->query_string."\n"; +% } +<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?redirect='.$session) %> +% } else { +<% $cgi->redirect($fsurl.'browse/part_pkg-fcc.html?classnum='.$classnum) %> +% } +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right('Bulk edit package definitions'); + +# non-atomic; report errors but allow successful changes to go through +# not that I even know how you'd get an error doing this + +my %error; +foreach my $param ($cgi->param) { + $param =~ /^pkgpart(\d+)$/ or next; + my $pkgpart = $1; + my $part_pkg = FS::part_pkg->by_key($pkgpart); + my $hashref = decode_json( $cgi->param($param) ); + my $error = $part_pkg->set_fcc_options($hashref); + $error{$pkgpart} = $error if $error; +} + +my $classnum = $cgi->param('classnum'); + + diff --git a/httemplate/elements/input-fcc_options.html b/httemplate/elements/input-fcc_options.html index b191e1c07..1d56cf274 100644 --- a/httemplate/elements/input-fcc_options.html +++ b/httemplate/elements/input-fcc_options.html @@ -39,7 +39,7 @@ function show_fcc_options(id) { } var media = String.toLowerCase(curr_values['media'] || 'unknown media'); if ( curr_values['is_consumer'] ) { - out += '
  • Consumer-grade service
  • >'; + out += '
  • Consumer-grade service
  • '; } else { out += '
  • Business-grade service
  • '; } diff --git a/httemplate/search/477.html b/httemplate/search/477.html index 26bd9f33b..fb85f1e09 100644 --- a/httemplate/search/477.html +++ b/httemplate/search/477.html @@ -41,7 +41,7 @@ a.download { % $cgi->param('type', 'csv'); % my $header = ".header_$partname"; @@ -81,8 +81,7 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/ ) { my $date = parse_datetime($cgi->param('date')) || time; my @partnames = grep /^\w+$/, $cgi->param('parts'); foreach my $partname (@partnames) { - my $method = "report_$partname"; - $parts{$partname} ||= FS::Report::FCC_477->$method( + $parts{$partname} ||= FS::Report::FCC_477->report( $partname, date => $date, agentnum => $agentnum ); @@ -109,8 +108,27 @@ if ( $cgi->param('type') eq 'csv' ) { $m->abort; } +my $part_titles = FS::Report::FCC_477->parts; + -<%def .header_fixed_broadband> +<%def .header_fbd> + + + + + + + + + + + + + + + + +<%def .header_fbs> @@ -124,7 +142,7 @@ if ( $cgi->param('type') eq 'csv' ) { -<%def .header_fixed_voice> +<%def .header_fvs> @@ -135,7 +153,7 @@ if ( $cgi->param('type') eq 'csv' ) { -<%def .header_local_phone> +<%def .header_lts> @@ -193,7 +211,7 @@ if ( $cgi->param('type') eq 'csv' ) { -<%def .header_mobile_broadband> +<%def .header_mbs> %# unimplemented @@ -207,7 +225,7 @@ if ( $cgi->param('type') eq 'csv' ) { -<%def .header_mobile_voice> +<%def .header_mvs> %# unimplemented diff --git a/httemplate/search/report_477.html b/httemplate/search/report_477.html index 2a6878ef4..78ba35cfc 100755 --- a/httemplate/search/report_477.html +++ b/httemplate/search/report_477.html @@ -4,7 +4,12 @@ % $m->abort; % } <& /elements/header.html, 'FCC Form 477 Report' &> - +Preparation + +
    - <% $parttitle{$partname} %> + <% $part_titles->{$partname} %> Download
    Census BlockDBA NameTechnologyConsumer?Advertised Speed (Mbps)Business?Contractual Speed (Mbps)
    DownUpDownUp
    Census Tract TechnologyConsumer
    Census Tract VoIP?Consumer
    State WholesaleOther
    StateConsumer
    State
    @@ -30,15 +35,8 @@ <& /elements/tr-checkbox-multiple.html, 'label' => 'Enable parts', 'field' => 'parts', - 'labels' => { - fixed_broadband => 'Fixed Broadband Subscription', - #7 => 'Part 7 (Mobile Wireless Broadband Subscription), - #8 => 'Part 8 (Mobile Local Telephone Subscription), - fixed_voice => 'Voice Telephone Subscription', - local_phone => 'Local Exchange Telephone Subscription', - voip => 'Interconnected VoIP Subscription', - }, - options => [ 6, 9, 10, 11 ], + 'labels' => $part_titles, + 'options' => [ keys %$part_titles ] &>
    @@ -54,4 +52,7 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List packages'); my $conf = FS::Conf->new; + +my $part_titles = FS::Report::FCC_477->parts; + -- cgit v1.2.1