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/edit/deploy_zone-fixed.html | 87 ++++++++++++++++++++++++++ httemplate/edit/part_pkg.cgi | 37 ++++++----- httemplate/edit/process/deploy_zone-fixed.html | 9 +++ 3 files changed, 117 insertions(+), 16 deletions(-) create mode 100644 httemplate/edit/deploy_zone-fixed.html create mode 100644 httemplate/edit/process/deploy_zone-fixed.html (limited to 'httemplate/edit') 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 )] + }, +&> -- 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/edit/deploy_zone-fixed.html | 5 +++ httemplate/edit/process/bulk-part_pkg-fcc.html | 42 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 httemplate/edit/process/bulk-part_pkg-fcc.html (limited to 'httemplate/edit') 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'); + + -- 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/edit/deploy_zone-fixed.html | 9 ++- httemplate/edit/deploy_zone-mobile.html | 90 +++++++++++++++++++++++++ httemplate/edit/process/deploy_zone-mobile.html | 9 +++ 3 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 httemplate/edit/deploy_zone-mobile.html create mode 100644 httemplate/edit/process/deploy_zone-mobile.html (limited to 'httemplate/edit') 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 )] + }, +&> -- cgit v1.2.1