477 report: improve browse-edit UI
[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         'active_date'     => 'Active since',
18     },
19     'fields'        => [
20         { field         => 'zonetype',
21           type          => 'hidden',
22           value         => 'B'
23         },
24         { field         => 'servicetype',
25           type          => 'hidden',
26           value         => 'broadband'
27         },
28         'description',
29         { field         => 'active_date',
30           type          => 'fixed-date',
31           value         => time,
32         },
33         { field         => 'agentnum',
34           type          => 'select-agent',
35           disable_empty => 1,
36           viewall_right => 'Edit FCC report configuration for all agents',
37         },
38         'dbaname',
39         { field         => 'technology',
40           type          => 'select',
41           options       => [ keys(%$technology_labels) ],
42           labels        => $technology_labels,
43         },
44         { field         => 'is_consumer', type => 'checkbox', value=>'Y' },
45         { field         => 'is_business', type => 'checkbox', value=>'Y' },
46         { type => 'tablebreak-tr-title',
47           value => 'Advertised maximum speed (Mbps)' },
48         'adv_speed_down',
49         'adv_speed_up',
50         { type => 'tablebreak-tr-title',
51           value => 'Contractually guaranteed speed (Mbps)' },
52         'cir_speed_down',
53         'cir_speed_up',
54
55         { type => 'tablebreak-tr-title', value => 'Census blocks'},
56         { field => 'blocknum',
57           type              => 'deploy_zone_block',
58           o2m_table         => 'deploy_zone_block',
59           m2_label          => ' ',
60           m2_error_callback => $m2_error_callback,
61         },
62     ],
63
64 &>
65 <%init>
66 my $curuser = $FS::CurrentUser::CurrentUser;
67 die "access denied"
68   unless $curuser->access_right([
69     'Edit FCC report configuration',
70     'Edit FCC report configuration for all agents',
71   ]);
72
73 my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
74
75 my $m2_error_callback = sub {
76   my ($cgi, $deploy_zone) = @_;
77   my @blocknums = grep {
78     /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
79   } $cgi->param;
80
81   map {
82     my $k = $_;
83     FS::deploy_zone_block->new({
84       blocknum    => scalar($cgi->param($k)),
85       zonenum     => $deploy_zone->zonenum,
86       censusblock => scalar($cgi->param($k.'_censusblock')),
87       censusyear  => scalar($cgi->param($k.'_censusyear')),
88     })
89   } @blocknums;
90 };
91
92 </%init>