diff options
author | Mark Wells <mark@freeside.biz> | 2014-07-31 22:54:08 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-07-31 22:54:08 -0700 |
commit | 0f359d5480aa1621d73ee802f420e8951abc620d (patch) | |
tree | 4bab32c865f9ef7b2bb03247a6be75215cfebf85 /httemplate/browse | |
parent | 6c284750de8fe49d7d4cdc6a9a4fb618697780e2 (diff) |
new 477 report: deployment info, combined browse-edit UI, #24047
Diffstat (limited to 'httemplate/browse')
-rw-r--r-- | httemplate/browse/deploy_zone.html | 72 | ||||
-rwxr-xr-x | httemplate/browse/part_pkg-fcc.html | 215 |
2 files changed, 287 insertions, 0 deletions
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', +&> +<P><FONT SIZE="+1"><B>Fixed Broadband Zones</B></FONT></P> +<& 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; +</%init> 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 = + "<BR>( 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 { + '<INPUT TYPE="checkbox" NAME="pkgpart" VALUE=' . $_[0]->pkgpart .'>'; +}; +unshift @links, ''; +$align = 'c'.$align; + + +$html_form = qq!<FORM ACTION="${p}edit/process/bulk-part_pkg-fcc.html" METHOD="POST">!; +$html_foot = qq! + <INPUT TYPE="submit" VALUE="Save changes"> + </FORM>!; + +my @menubar = + ( 'Package definitions' => $p.'browse/part_pkg.cgi' ); + +</%init> +<%def .style> +<style> + ul.fcc_options { + text-align: left; + } + ul.fcc_options li { + } + button.edit_fcc_options { + float: right; + } +</style> +</%def> |