new 477 report: deployment info, combined browse-edit UI, #24047
[freeside.git] / httemplate / edit / deploy_zone-fixed.html
1 <& elements/edit.html,
2     'name_singular' => 'deployment zone',
3     'table'         => 'deploy_zone',
4     'post_url'      => popurl(1).'process/deploy_zone-fixed.html',
5     'labels'        => {
6         'description'     => 'Description',
7         'agentnum'        => 'Agent',
8         'dbaname'         => 'Business name (if different from agent)',
9         'technology'      => 'Technology',
10         'adv_speed_up'    => 'Upstream',
11         'adv_speed_down'  => 'Downstream',
12         'cir_speed_up'    => 'Upstream',
13         'cir_speed_down'  => 'Downstream',
14         'is_consumer'     => 'Consumer/mass market',
15         'is_business'     => 'Business/government',
16         'blocknum'        => '',
17     },
18     'fields'        => [
19         { field         => 'zonetype',
20           type          => 'hidden',
21           value         => 'B'
22         },
23         { field         => 'servicetype',
24           type          => 'hidden',
25           value         => 'broadband'
26         },
27         'description',
28         { field         => 'agentnum',
29           type          => 'select-agent',
30           disable_empty => 1,
31           viewall_right => 'Edit FCC report configuration for all agents',
32         },
33         'dbaname',
34         { field         => 'technology',
35           type          => 'select',
36           options       => [ keys(%$technology_labels) ],
37           labels        => $technology_labels,
38         },
39         { field         => 'is_consumer', type => 'checkbox', value=>'Y' },
40         { field         => 'is_business', type => 'checkbox', value=>'Y' },
41         { type => 'tablebreak-tr-title',
42           value => 'Advertised maximum speed (Mbps)' },
43         'adv_speed_down',
44         'adv_speed_up',
45         { type => 'tablebreak-tr-title',
46           value => 'Contractually guaranteed speed (Mbps)' },
47         'cir_speed_down',
48         'cir_speed_up',
49
50         { type => 'tablebreak-tr-title', value => 'Census blocks'},
51         { field => 'blocknum',
52           type              => 'deploy_zone_block',
53           o2m_table         => 'deploy_zone_block',
54           m2_label          => ' ',
55           m2_error_callback => $m2_error_callback,
56         },
57     ],
58
59 &>
60 <%init>
61 my $curuser = $FS::CurrentUser::CurrentUser;
62 die "access denied"
63   unless $curuser->access_right([
64     'Edit FCC report configuration',
65     'Edit FCC report configuration for all agents',
66   ]);
67
68 my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
69
70 my $m2_error_callback = sub {
71   my ($cgi, $deploy_zone) = @_;
72   my @blocknums = grep {
73     /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
74   } $cgi->param;
75
76   map {
77     my $k = $_;
78     FS::deploy_zone_block->new({
79       blocknum    => scalar($cgi->param($k)),
80       zonenum     => $deploy_zone->zonenum,
81       censusblock => scalar($cgi->param($k.'_censusblock')),
82       censusyear  => scalar($cgi->param($k.'_censusyear')),
83     })
84   } @blocknums;
85 };
86
87 </%init>