From 0f359d5480aa1621d73ee802f420e8951abc620d Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 31 Jul 2014 22:54:08 -0700 Subject: new 477 report: deployment info, combined browse-edit UI, #24047 --- httemplate/browse/deploy_zone.html | 72 +++++++++ httemplate/browse/part_pkg-fcc.html | 215 +++++++++++++++++++++++++ httemplate/edit/deploy_zone-fixed.html | 87 ++++++++++ httemplate/edit/part_pkg.cgi | 37 +++-- httemplate/edit/process/deploy_zone-fixed.html | 9 ++ httemplate/elements/deploy_zone_block.html | 47 ++++++ httemplate/elements/input-fcc_options.html | 108 +++++++++++++ httemplate/elements/tr-input-fcc_options.html | 4 +- httemplate/misc/part_pkg_fcc_options.html | 9 +- httemplate/search/477.html | 76 ++++----- httemplate/search/report_477.html | 8 +- 11 files changed, 612 insertions(+), 60 deletions(-) create mode 100644 httemplate/browse/deploy_zone.html create mode 100755 httemplate/browse/part_pkg-fcc.html create mode 100644 httemplate/edit/deploy_zone-fixed.html create mode 100644 httemplate/edit/process/deploy_zone-fixed.html create mode 100644 httemplate/elements/deploy_zone_block.html create mode 100644 httemplate/elements/input-fcc_options.html (limited to 'httemplate') diff --git a/httemplate/browse/deploy_zone.html b/httemplate/browse/deploy_zone.html new file mode 100644 index 000000000..489a22658 --- /dev/null +++ b/httemplate/browse/deploy_zone.html @@ -0,0 +1,72 @@ +<& /elements/header.html, 'Deployment zones' &> +<& /elements/menubar.html, + 'Add a new fixed broadband zone' => $p.'edit/deploy_zone-fixed.html', + 'Add a new mobile zone' => $p.'edit/deploy_zone-mobile.html', +&> +

Fixed Broadband Zones

+<& elements/browse.html, + name_singular => 'zone', + query => { table => 'deploy_zone', + hashref => { zonetype => 'B' }, + }, + count_query => "SELECT COUNT(*) FROM deploy_zone WHERE zonetype = 'B'", + agent_virt => 1, + header => [ '#', + 'Description', + 'Technology', + 'Market', + 'Advertised Mbps', + 'Contractual Mbps', + 'Census blocks', + ], + fields => [ 'zonenum', + 'description', + sub { my $self = shift; + $tech_label->{$self->technology} }, + sub { my $self = shift; + join( ' / ', + $self->is_consumer ? 'consumer' : (), + $self->is_business ? 'business' : () + ) + }, + sub { my $self = shift; + join( ' / ', grep $_, + $self->adv_speed_down, + $self->adv_speed_up + ) + }, + sub { my $self = shift; + join( ' / ', grep $_, + $self->cir_speed_down, + $self->cir_speed_up + ) + }, + sub { my $self = shift; + FS::deploy_zone_block->count('zonenum = '.$self->zonenum) + }, + ], + sort_fields => [ 'zonenum', + 'description', + 'technology', + 'is_consumer is not null, is_business is not null', + 'adv_speed_down, adv_speed_up', + 'cir_speed_down, cir_speed_up', + ], + links => [ '', $link_fixed, ], + align => 'clllllr', + nohtmlheader => 1, + disable_maxselect => 1, + disable_total => 1, +&> +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +my $acl_edit = $curuser->access_right('Edit FCC report configuration'); +my $acl_edit_global = $curuser->access_right('Edit FCC report configuration for all agents'); +die "access denied" + unless $acl_edit or $acl_edit_global; + +my $link_fixed = [ $p.'edit/deploy_zone-fixed.html?', 'zonenum' ]; +my $link_mobile= [ $p.'edit/deploy_zone-mobile.html', 'zonenum' ]; + +my $tech_label = FS::part_pkg_fcc_option->technology_labels; + diff --git a/httemplate/browse/part_pkg-fcc.html b/httemplate/browse/part_pkg-fcc.html new file mode 100755 index 000000000..9462c3248 --- /dev/null +++ b/httemplate/browse/part_pkg-fcc.html @@ -0,0 +1,215 @@ +<& elements/browse.html, + 'title' => 'Package Definitions - FCC Options', + '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, + 'query' => + { 'select' => $select, + 'table' => 'part_pkg', + 'addl_from' => $addl_from, + 'hashref' => \%hash, + 'extra_sql' => $extra_sql, + 'order_by' => "ORDER BY $orderby" + }, + 'count_query' => $count_query, + 'header' => \@header, + 'fields' => \@fields, + 'links' => \@links, + 'align' => $align, + 'link_field' => 'pkgpart', + 'html_foot' => $html_foot, +&> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +my $edit = 'Edit package definitions'; +my $edit_global = 'Edit global package definitions'; +my $acl_edit = $curuser->access_right($edit); +my $acl_edit_global = $curuser->access_right($edit_global); + +die "access denied" + unless $acl_edit || $acl_edit_global; + +my $conf = new FS::Conf; + +my $orderby = 'pkgpart'; +my %hash = (); +my $extra_count = ''; + +my @where = (); + +# only ever show recurring packages here +$hash{'freq'} = { op=>'!=', value=>'0' }; +$extra_count = " freq != '0' "; + +# filter by classnum +my $classnum = ''; +if ( $cgi->param('classnum') =~ /^(\d+)$/ ) { + $classnum = $1; + push @where, $classnum ? "classnum = $classnum" + : "classnum IS NULL"; +} +$cgi->delete('classnum'); + +# filter by agent permissions +push @where, FS::part_pkg->curuser_pkgs_sql + unless $acl_edit_global; + +my $extra_sql = scalar(@where) + ? ( scalar(keys %hash) ? ' AND ' : ' WHERE ' ). + join( 'AND ', @where) + : ''; + +# pull option values into the select +my @optionnames = ( qw( + media + is_consumer + is_broadband technology broadband_upstream broadband_downstream + is_phone phone_wholesale phone_vges phone_circuits + phone_lines phone_longdistance phone_localloop + is_voip voip_lastmile voip_sessions +) ); + +my $select = join(',', + 'part_pkg.*', + '(SELECT classname FROM pkg_class WHERE pkg_class.classnum = part_pkg.classnum) AS classname', # grr, disableable... + @optionnames +); + +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' ); +my @fields = ( 'pkgpart', 'pkg', 'comment' ,); +my $align = 'rll'; +my @links = ( $link, $link, '', ); + +unless ( length($classnum) ) { + push @header, 'Class'; + push @fields, 'classname'; + $align .= 'l'; +} + +# still include the report_option classes, to help with migration +# but not other plan options + +my %report_optionname_name = map { 'report_option_'.$_->num, $_->name } + qsearch('part_pkg_report_option', { disabled => '' }); + +push @header, 'Report classes'; + +push @fields, + sub { + my $part_pkg = shift; + my %options = $part_pkg->options; + # gather any options that are really report options, + # convert them to their user-friendly names, + # and sort them (I think?) + my @report_options = + sort { $a cmp $b } + map { $report_optionname_name{$_} } + grep { $options{$_} + and exists($report_optionname_name{$_}) } + keys %options; + + my @rows; + foreach (@report_options) { + push @rows, [ + { 'data' => $_, + 'align' => 'center', + 'colspan' => 2 + } + ]; + } # foreach @report_options + \@rows; + }; + +$align .= 'cr'; + +# -------- +# now the FCC option part +# -------- + +my @pkgparts; +push @header, 'FCC report parameters'; +push @fields, sub { + my $part_pkg = shift; + my %hash = $part_pkg->fcc_options; + include('/elements/input-fcc_options.html', + id => 'pkgpart'.$part_pkg->pkgpart, + curr_value => encode_json(\%hash), + html_only => 1 + ); +}; +$align .= 'l'; + +my $count_extra_sql = $extra_sql; +$count_extra_sql =~ s/^\s*AND /WHERE /i; +$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"; + +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; + + +$html_form = qq!
!; +$html_foot = qq! + +
!; + +my @menubar = + ( 'Package definitions' => $p.'browse/part_pkg.cgi' ); + + +<%def .style> + + diff --git a/httemplate/edit/deploy_zone-fixed.html b/httemplate/edit/deploy_zone-fixed.html new file mode 100644 index 000000000..ecec9c434 --- /dev/null +++ b/httemplate/edit/deploy_zone-fixed.html @@ -0,0 +1,87 @@ +<& elements/edit.html, + 'name_singular' => 'deployment zone', + 'table' => 'deploy_zone', + 'post_url' => popurl(1).'process/deploy_zone-fixed.html', + 'labels' => { + 'description' => 'Description', + 'agentnum' => 'Agent', + 'dbaname' => 'Business name (if different from agent)', + 'technology' => 'Technology', + 'adv_speed_up' => 'Upstream', + 'adv_speed_down' => 'Downstream', + 'cir_speed_up' => 'Upstream', + 'cir_speed_down' => 'Downstream', + 'is_consumer' => 'Consumer/mass market', + 'is_business' => 'Business/government', + 'blocknum' => '', + }, + 'fields' => [ + { field => 'zonetype', + type => 'hidden', + value => 'B' + }, + { field => 'servicetype', + type => 'hidden', + value => 'broadband' + }, + 'description', + { field => 'agentnum', + type => 'select-agent', + disable_empty => 1, + viewall_right => 'Edit FCC report configuration for all agents', + }, + 'dbaname', + { field => 'technology', + type => 'select', + options => [ keys(%$technology_labels) ], + labels => $technology_labels, + }, + { field => 'is_consumer', type => 'checkbox', value=>'Y' }, + { field => 'is_business', type => 'checkbox', value=>'Y' }, + { type => 'tablebreak-tr-title', + value => 'Advertised maximum speed (Mbps)' }, + 'adv_speed_down', + 'adv_speed_up', + { type => 'tablebreak-tr-title', + value => 'Contractually guaranteed speed (Mbps)' }, + 'cir_speed_down', + 'cir_speed_up', + + { type => 'tablebreak-tr-title', value => 'Census blocks'}, + { field => 'blocknum', + type => 'deploy_zone_block', + o2m_table => 'deploy_zone_block', + m2_label => ' ', + m2_error_callback => $m2_error_callback, + }, + ], + +&> +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right([ + 'Edit FCC report configuration', + 'Edit FCC report configuration for all agents', + ]); + +my $technology_labels = FS::part_pkg_fcc_option->technology_labels; + +my $m2_error_callback = sub { + my ($cgi, $deploy_zone) = @_; + my @blocknums = grep { + /^blocknum\d+/ and length($cgi->param($_.'_censusblock')) + } $cgi->param; + + map { + my $k = $_; + FS::deploy_zone_block->new({ + blocknum => scalar($cgi->param($k)), + zonenum => $deploy_zone->zonenum, + censusblock => scalar($cgi->param($k.'_censusblock')), + censusyear => scalar($cgi->param($k.'_censusyear')), + }) + } @blocknums; +}; + + diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 9e55d9f42..65eca6cf4 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -232,23 +232,26 @@ }, }, - { type => 'tablebreak-tr-title', - value => 'FCC Form 477 information', - }, - { field => 'fcc_options_string', - type => 'input-fcc_options', - curr_value_callback => sub { - my ($cgi, $part_pkg, $fref) = @_; - if ( $cgi->param('fcc_options_string') ) { - # error redirect - return $cgi->param('fcc_options_string'); - } - my %hash; - %hash = $part_pkg->fcc_options - if ($part_pkg->pkgpart); - return encode_json(\%hash); + ($fcc_opts ? ( + { type => 'tablebreak-tr-title', + value => 'FCC Form 477 information', }, - }, + { field => 'fcc_options_string', + type => 'input-fcc_options', + curr_value_callback => sub { + my ($cgi, $part_pkg, $fref) = @_; + if ( $cgi->param('fcc_options_string') ) { + # error redirect + return $cgi->param('fcc_options_string'); + } + my %hash; + %hash = $part_pkg->fcc_options + if ($part_pkg->pkgpart); + return encode_json(\%hash); + }, + }, + ) : () + ), { type => 'tablebreak-tr-title', value => 'External Links', #better name? @@ -405,6 +408,8 @@ my $agent_clone_extra_sql = my $conf = new FS::Conf; my $taxproducts = $conf->exists('enable_taxproducts'); +my $fcc_opts = $conf->exists('part_pkg-show_fcc_options'); + my @locales = grep { ! /^en_/i } $conf->config('available-locales'); #should filter from the default locale lang instead of en_ my %locale_labels = map { ( $_ => 'Package -- '. FS::Locales->description($_) ) diff --git a/httemplate/edit/process/deploy_zone-fixed.html b/httemplate/edit/process/deploy_zone-fixed.html new file mode 100644 index 000000000..c14c81c58 --- /dev/null +++ b/httemplate/edit/process/deploy_zone-fixed.html @@ -0,0 +1,9 @@ +<& elements/process.html, + error_redirect => popurl(2).'deploy_zone-fixed.html?', + table => 'deploy_zone', + viewall_dir => 'browse', + process_o2m => + { 'table' => 'deploy_zone_block', + 'fields' => [qw( censusblock censusyear )] + }, +&> diff --git a/httemplate/elements/deploy_zone_block.html b/httemplate/elements/deploy_zone_block.html new file mode 100644 index 000000000..9985944bd --- /dev/null +++ b/httemplate/elements/deploy_zone_block.html @@ -0,0 +1,47 @@ +% unless ( $opt{'js_only'} ) { + + + Block + + > +   + Year + + > +% } +<%init> + +my( %opt ) = @_; + +my $name = $opt{'element_name'} || $opt{'field'} || 'blocknum'; +my $id = $opt{'id'} || 'blocknum'; + +my $curr_value = $opt{'curr_value'} || $opt{'value'}; + +my $onchange = $opt{'onchange'}; +if ( $onchange ) { + $onchange =~ s/\(what\);/(this);/; + $onchange = 'onchange="'.$onchange.'"'; +} + +my $deploy_zone_block = $curr_value + ? FS::deploy_zone_block->by_key($curr_value) + : FS::deploy_zone_block->new; + + diff --git a/httemplate/elements/input-fcc_options.html b/httemplate/elements/input-fcc_options.html new file mode 100644 index 000000000..b191e1c07 --- /dev/null +++ b/httemplate/elements/input-fcc_options.html @@ -0,0 +1,108 @@ +% unless ($opt{js_only}) { +<& hidden.html, 'field' => $id, @_ &> +%# <& input-text.html, 'id' => $id, @_ &> # XXX debugging + + +% } +% unless ($opt{html_only}) { +% my $popup = $fsurl.'misc/part_pkg_fcc_options.html?id='; +% my $popup_name = 'popup-'.time. "-$$-". rand() * 2**32; + +% } +<%init> +my %opt = @_; +my $id = $opt{id} || $opt{field}; + diff --git a/httemplate/elements/tr-input-fcc_options.html b/httemplate/elements/tr-input-fcc_options.html index 11cb4a962..58f7247c4 100644 --- a/httemplate/elements/tr-input-fcc_options.html +++ b/httemplate/elements/tr-input-fcc_options.html @@ -41,9 +41,9 @@ function show_fcc_options() { } var media = String.toLowerCase(curr_values['media'] || 'unknown media'); if ( curr_values['is_consumer'] ) { - out += '
  • Consumer-grade service
  • >'; + out += '
  • Consumer-grade
  • >'; } else { - out += '
  • Business-grade service
  • '; + out += '
  • Business-grade
  • '; } if ( curr_values['is_broadband'] ) { out += '
  • Broadband via ' + tech + '' diff --git a/httemplate/misc/part_pkg_fcc_options.html b/httemplate/misc/part_pkg_fcc_options.html index f74328446..a5ecb12bc 100644 --- a/httemplate/misc/part_pkg_fcc_options.html +++ b/httemplate/misc/part_pkg_fcc_options.html @@ -90,6 +90,8 @@ <& .checkbox, 'is_voip' &>
    + + <& .checkbox, 'voip_lastmile' &>
    @@ -145,7 +147,7 @@ function save_changes() { } parent_input.value = JSON.stringify(data); // update the display - parent.show_fcc_options(); + parent.show_fcc_options(parent_input.id); parent.cClick(); //overlib } @@ -179,6 +181,11 @@ function enable_fieldset(fieldset_id) { form.elements['phone1'].disabled = (this.value == ''); } ); + addEventListener(form.elements['is_phone'], 'change', + function() { + form.elements['phone_wholesale'].dispatchEvent( new Event('change') ); + } + ); // load data from the parent form and trigger handlers for(var i = 0; i < form.elements.length; i++) { diff --git a/httemplate/search/477.html b/httemplate/search/477.html index 68493377d..26bd9f33b 100644 --- a/httemplate/search/477.html +++ b/httemplate/search/477.html @@ -36,20 +36,19 @@ a.download { float: right; } -% foreach my $partnum (@partnums) { -% $cgi->param('parts', $partnum); +% foreach my $partname (@partnames) { +% $cgi->param('parts', $partname); % $cgi->param('type', 'csv'); -% my $header = ".header$partnum"; -% my $data = $parts{$partnum}; +% my $header = ".header_$partname"; +% my $data = $parts{$partname}; <& $header &> -% #XXX column headings % foreach my $row (@$data) { % foreach my $item (@$row) { @@ -58,7 +57,7 @@ a.download { % }
    - Part <% $partnum %> + <% $parttitle{$partname} %> Download
    -% } # foreach $partnum +% } # foreach $partname <& /elements/footer.html &> <%init> die "access denied" @@ -80,10 +79,10 @@ if ($cgi->param('agentnum') =~ /^(\d+)$/ ) { $agentnum = $1; } my $date = parse_datetime($cgi->param('date')) || time; -my @partnums = grep /^\d+$/, $cgi->param('parts'); -foreach my $partnum (@partnums) { - my $method = "part$partnum"; - $parts{$partnum} ||= FS::Report::FCC_477->$method( +my @partnames = grep /^\w+$/, $cgi->param('parts'); +foreach my $partname (@partnames) { + my $method = "report_$partname"; + $parts{$partname} ||= FS::Report::FCC_477->$method( date => $date, agentnum => $agentnum ); @@ -93,11 +92,11 @@ $m->cache->set($session, \%parts, '1h'); my $title = 'FCC Form 477 Data - ' . time2str('%b %o, %Y', $date); if ( $cgi->param('type') eq 'csv' ) { - my $partnum = $partnums[0]; # ignore any beyond the first - my $data = $parts{$partnum}; + my $partname = $partnames[0]; # ignore any beyond the first + my $data = $parts{$partname}; my $csv = Text::CSV_XS->new({ eol => "\r\n" }); # i think - my $filename = time2str('%Y-%m-%d', $date) . '-part' . $partnum . '.csv'; + my $filename = time2str('%Y-%m-%d', $date) . '-'. $partname . '.csv'; http_header('Content-Type' => 'text/csv'); http_header('Content-Disposition' => qq(attachment;filename="$filename")); @@ -111,7 +110,7 @@ if ( $cgi->param('type') eq 'csv' ) { } -<%def .header6> +<%def .header_fixed_broadband> Census Tract Technology @@ -125,30 +124,18 @@ if ( $cgi->param('type') eq 'csv' ) { Consumer -<%def .header7> +<%def .header_fixed_voice> - State - Speed (Mbps) - Subscriptions + Census Tract + VoIP? + Lines/Subscriptions - Down - Up Total Consumer -<%def .header8> - - State - Subscriptions - - - Total - Direct - - -<%def .header9> +<%def .header_local_phone> State Wholesale @@ -183,7 +170,7 @@ if ( $cgi->param('type') eq 'csv' ) { Wireless -<%def .header10> +<%def .header_voip> State VoIP OTT @@ -206,14 +193,29 @@ if ( $cgi->param('type') eq 'csv' ) { Other -<%def .header11> +<%def .header_mobile_broadband> +%# unimplemented - Census Tract - VoIP? - Lines/Subscriptions + State + Speed (Mbps) + Subscriptions + Down + Up Total Consumer +<%def .header_mobile_voice> +%# unimplemented + + State + Subscriptions + + + Total + Direct + + + diff --git a/httemplate/search/report_477.html b/httemplate/search/report_477.html index e3ae69e6f..2a6878ef4 100755 --- a/httemplate/search/report_477.html +++ b/httemplate/search/report_477.html @@ -31,12 +31,12 @@ 'label' => 'Enable parts', 'field' => 'parts', 'labels' => { - 6 => 'Part 6 (Fixed Broadband Subscription)', + fixed_broadband => 'Fixed Broadband Subscription', #7 => 'Part 7 (Mobile Wireless Broadband Subscription), #8 => 'Part 8 (Mobile Local Telephone Subscription), - 9 => 'Part 9 (Local Exchange Telephone Subscription)', - 10 => 'Part 10 (Interconnected VoIP Subscription)', - 11 => 'Part 11 (Voice Telephone Subscription Detail)', + fixed_voice => 'Voice Telephone Subscription', + local_phone => 'Local Exchange Telephone Subscription', + voip => 'Interconnected VoIP Subscription', }, options => [ 6, 9, 10, 11 ], &> -- cgit v1.2.1 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 From 1ebcca94aba75c5901c6eefaf373f39e94b03cf0 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Wed, 6 Aug 2014 14:11:01 -0700 Subject: 477 report: mobile deployment info --- httemplate/browse/deploy_zone.html | 62 +++++++++++++++-- httemplate/browse/part_pkg-fcc.html | 4 +- httemplate/edit/deploy_zone-fixed.html | 9 ++- httemplate/edit/deploy_zone-mobile.html | 90 +++++++++++++++++++++++++ httemplate/edit/process/deploy_zone-mobile.html | 9 +++ httemplate/elements/deploy_zone_vertex.html | 45 +++++++++++++ httemplate/misc/part_pkg_fcc_options.html | 11 ++- httemplate/search/report_477.html | 5 +- 8 files changed, 224 insertions(+), 11 deletions(-) create mode 100644 httemplate/edit/deploy_zone-mobile.html create mode 100644 httemplate/edit/process/deploy_zone-mobile.html create mode 100644 httemplate/elements/deploy_zone_vertex.html (limited to 'httemplate') diff --git a/httemplate/browse/deploy_zone.html b/httemplate/browse/deploy_zone.html index 489a22658..ddfbde43d 100644 --- a/httemplate/browse/deploy_zone.html +++ b/httemplate/browse/deploy_zone.html @@ -48,9 +48,9 @@ sort_fields => [ 'zonenum', 'description', 'technology', - 'is_consumer is not null, is_business is not null', - 'adv_speed_down, adv_speed_up', - 'cir_speed_down, cir_speed_up', + '(is_consumer is not null, is_business is not null)', + '(adv_speed_down, adv_speed_up)', + '(cir_speed_down, cir_speed_up)', ], links => [ '', $link_fixed, ], align => 'clllllr', @@ -58,6 +58,59 @@ disable_maxselect => 1, disable_total => 1, &> +

    Mobile Zones

    +<& elements/browse.html, + name_singular => 'zone', + query => { table => 'deploy_zone', + hashref => { zonetype => 'P' }, + }, + count_query => "SELECT COUNT(*) FROM deploy_zone WHERE zonetype = 'P'", + agent_virt => 1, + header => [ '#', + 'Description', + 'Technology', + 'Spectrum', + 'Service Type', + 'Advertised Mbps', + 'Vertices', # number of vertices? not so useful + ], + fields => [ 'zonenum', + 'description', + sub { my $self = shift; + $tech_label->{$self->technology} }, + sub { my $self = shift; + $spec_label->{$self->spectrum} }, + sub { my $self = shift; + join( ' / ', + $self->is_voice ? 'voice' : (), + $self->is_broadband ? 'broadband' : (), + ) + }, + sub { my $self = shift; + join( ' / ', grep $_, + $self->adv_speed_down, + $self->adv_speed_up + ) + }, + sub { my $self = shift; + FS::deploy_zone_vertex->count('zonenum = '.$self->zonenum) + }, + ], + sort_fields => [ 'zonenum', + 'description', + 'technology', + 'spectrum', + '(is_voice is not null, is_broadband is not null)', + '(adv_speed_down, adv_speed_up)', + ], + links => [ '', $link_mobile, ], + align => 'clllllr', + nohtmlheader => 1, + disable_maxselect => 1, + disable_total => 1, +&> + +<& /elements/footer.html &> <%init> my $curuser = $FS::CurrentUser::CurrentUser; my $acl_edit = $curuser->access_right('Edit FCC report configuration'); @@ -66,7 +119,8 @@ die "access denied" unless $acl_edit or $acl_edit_global; my $link_fixed = [ $p.'edit/deploy_zone-fixed.html?', 'zonenum' ]; -my $link_mobile= [ $p.'edit/deploy_zone-mobile.html', 'zonenum' ]; +my $link_mobile= [ $p.'edit/deploy_zone-mobile.html?', 'zonenum' ]; my $tech_label = FS::part_pkg_fcc_option->technology_labels; +my $spec_label = FS::part_pkg_fcc_option->spectrum_labels; diff --git a/httemplate/browse/part_pkg-fcc.html b/httemplate/browse/part_pkg-fcc.html index 9facd10dc..14dfcba08 100755 --- a/httemplate/browse/part_pkg-fcc.html +++ b/httemplate/browse/part_pkg-fcc.html @@ -30,8 +30,8 @@ my $curuser = $FS::CurrentUser::CurrentUser; -my $edit = 'Edit package definitions'; -my $edit_global = 'Edit global package definitions'; +my $edit = 'Edit FCC report configuration'; +my $edit_global = 'Edit FCC report configuration for all agents'; my $acl_edit = $curuser->access_right($edit); my $acl_edit_global = $curuser->access_right($edit_global); diff --git a/httemplate/edit/deploy_zone-fixed.html b/httemplate/edit/deploy_zone-fixed.html index 8c6d54e5d..1a79500ff 100644 --- a/httemplate/edit/deploy_zone-fixed.html +++ b/httemplate/edit/deploy_zone-fixed.html @@ -21,9 +21,9 @@ type => 'hidden', value => 'B' }, - { field => 'servicetype', + { field => 'is_broadband', type => 'hidden', - value => 'broadband' + value => 'Y', }, 'description', { field => 'active_date', @@ -38,7 +38,7 @@ 'dbaname', { field => 'technology', type => 'select', - options => [ keys(%$technology_labels) ], + options => [ map { @$_ } values(%$media_types) ], labels => $technology_labels, }, { field => 'is_consumer', type => 'checkbox', value=>'Y' }, @@ -71,6 +71,8 @@ die "access denied" ]); my $technology_labels = FS::part_pkg_fcc_option->technology_labels; +my $media_types = FS::part_pkg_fcc_option->media_types; +delete $media_types->{'Mobile Wireless'}; # cause this is the fixed zone page my $m2_error_callback = sub { my ($cgi, $deploy_zone) = @_; @@ -78,6 +80,7 @@ my $m2_error_callback = sub { /^blocknum\d+/ and length($cgi->param($_.'_censusblock')) } $cgi->param; + sort { $a->censusblock <=> $b->censusblock } map { my $k = $_; FS::deploy_zone_block->new({ diff --git a/httemplate/edit/deploy_zone-mobile.html b/httemplate/edit/deploy_zone-mobile.html new file mode 100644 index 000000000..8e985b1c9 --- /dev/null +++ b/httemplate/edit/deploy_zone-mobile.html @@ -0,0 +1,90 @@ +<& elements/edit.html, + 'name_singular' => 'deployment zone', + 'table' => 'deploy_zone', + 'post_url' => popurl(1).'process/deploy_zone-mobile.html', + 'labels' => { + 'description' => 'Description', + 'agentnum' => 'Agent', + 'dbaname' => 'Business name (if different from agent)', + 'technology' => 'Technology', + 'spectrum' => 'Spectrum', + 'is_broadband', => 'Broadband Internet', + 'adv_speed_up' => 'Upstream', + 'adv_speed_down' => 'Downstream', + 'is_voice', => 'Voice', + 'vertexnum' => '', + 'active_date' => 'Active since', + }, + 'fields' => [ + { field => 'zonetype', + type => 'hidden', + value => 'P' + }, + 'description', + { field => 'active_date', + type => 'fixed-date', + value => time, + }, + { field => 'agentnum', + type => 'select-agent', + disable_empty => 1, + viewall_right => 'Edit FCC report configuration for all agents', + }, + 'dbaname', + { field => 'technology', + type => 'select', + options => $media_types->{'Mobile Wireless'}, + labels => $technology_labels, + }, + { field => 'spectrum', + type => 'select', + options => [ keys %$spectrum_labels ], + labels => $spectrum_labels, + }, + { field => 'is_broadband', type => 'checkbox', value=>'Y' }, + { field => 'is_voice', type => 'checkbox', value=>'Y' }, + { type => 'tablebreak-tr-title', + value => 'Advertised minimum speed (Mbps)' }, + 'adv_speed_down', + 'adv_speed_up', + { type => 'tablebreak-tr-title', value => 'Footprint'}, + { field => 'vertexnum', + type => 'deploy_zone_vertex', + o2m_table => 'deploy_zone_vertex', + m2_label => ' ', + m2_error_callback => $m2_error_callback, + }, + ], + +&> +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +die "access denied" + unless $curuser->access_right([ + 'Edit FCC report configuration', + 'Edit FCC report configuration for all agents', + ]); + +my $technology_labels = FS::part_pkg_fcc_option->technology_labels; +my $spectrum_labels = FS::part_pkg_fcc_option->spectrum_labels; +my $media_types = FS::part_pkg_fcc_option->media_types; + +my $m2_error_callback = sub { + my ($cgi, $deploy_zone) = @_; + my @vertexnums = sort { $a <=> $b } grep { + /^vertexnum\d+/ and length($cgi->param($_.'_latitude')) + } $cgi->param; + + map { + my $k = $_; + my $s = 0; + FS::deploy_zone_vertex->new({ + vertexnum => scalar($cgi->param($k)), + zonenum => $deploy_zone->zonenum, + latitude => scalar($cgi->param($k.'_latitude')), + longitude => scalar($cgi->param($k.'_longitude')), + }) + } @vertexnums; +}; + + diff --git a/httemplate/edit/process/deploy_zone-mobile.html b/httemplate/edit/process/deploy_zone-mobile.html new file mode 100644 index 000000000..c913c5cd6 --- /dev/null +++ b/httemplate/edit/process/deploy_zone-mobile.html @@ -0,0 +1,9 @@ +<& elements/process.html, + error_redirect => popurl(2).'deploy_zone-mobile.html?', + table => 'deploy_zone', + viewall_dir => 'browse', + process_o2m => + { 'table' => 'deploy_zone_vertex', + 'fields' => [qw( latitude longitude )] + }, +&> diff --git a/httemplate/elements/deploy_zone_vertex.html b/httemplate/elements/deploy_zone_vertex.html new file mode 100644 index 000000000..b3c8b31ea --- /dev/null +++ b/httemplate/elements/deploy_zone_vertex.html @@ -0,0 +1,45 @@ +% unless ( $opt{'js_only'} ) { + + + Latitude  + + > +   + Longitude  + + > +% } +<%init> + +my( %opt ) = @_; + +my $name = $opt{'element_name'} || $opt{'field'} || 'vertexnum'; +my $id = $opt{'id'} || 'vertexnum'; + +my $curr_value = $opt{'curr_value'} || $opt{'value'}; + +my $onchange = $opt{'onchange'}; +if ( $onchange ) { + $onchange =~ s/\(what\);/(this);/; + $onchange = 'onchange="'.$onchange.'"'; +} + +my $deploy_zone_vertex = $curr_value + ? FS::deploy_zone_vertex->by_key($curr_value) + : FS::deploy_zone_vertex->new; + + diff --git a/httemplate/misc/part_pkg_fcc_options.html b/httemplate/misc/part_pkg_fcc_options.html index a5ecb12bc..27b45e003 100644 --- a/httemplate/misc/part_pkg_fcc_options.html +++ b/httemplate/misc/part_pkg_fcc_options.html @@ -92,10 +92,19 @@
    +
    <& .checkbox, 'voip_lastmile' &>

    +

    + <& .checkbox, 'is_mobile' &> + +

    + + <& .checkbox, 'mobile_direct' &> +
    +

    @@ -168,7 +177,7 @@ function enable_fieldset(fieldset_id) { // set up all event handlers addEventListener(form, 'submit', save_changes); - var sections = [ 'broadband', 'phone', 'voip' ]; + var sections = [ 'broadband', 'phone', 'voip', 'mobile' ]; for(var i = 0; i < sections.length; i++) { var toggle = form.elements['is_'+sections[i]]; addEventListener(toggle, 'change', enable_fieldset(sections[i])); diff --git a/httemplate/search/report_477.html b/httemplate/search/report_477.html index 78ba35cfc..cbbd5d902 100755 --- a/httemplate/search/report_477.html +++ b/httemplate/search/report_477.html @@ -4,11 +4,13 @@ % $m->abort; % } <& /elements/header.html, 'FCC Form 477 Report' &> +% if ( $curuser->access_right('Edit FCC report configuration') ) { Preparation +% } @@ -48,8 +50,9 @@ <& /elements/footer.html &> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('List packages'); + unless $curuser->access_right('List packages'); my $conf = FS::Conf->new; -- cgit v1.2.1