graphical selection of deployment zones and automatic block lookup, #30260
[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     'viewall_dir'   => 'browse',
6     'labels'        => {
7         'description'     => 'Description',
8         'agentnum'        => 'Agent',
9         'dbaname'         => 'Business name (if different from agent)',
10         'technology'      => 'Technology',
11         'adv_speed_up'    => 'Upstream',
12         'adv_speed_down'  => 'Downstream',
13         'cir_speed_up'    => 'Upstream',
14         'cir_speed_down'  => 'Downstream',
15         'is_consumer'     => 'Consumer/mass market',
16         'is_business'     => 'Business/government',
17         'blocknum'        => '',
18         'active_date'     => 'Active since',
19         'file'            => 'Import blocks from text file',
20         'censusyear'      => 'as census year',
21     },
22     'fields'        => [
23         { field         => 'zonetype',
24           type          => 'hidden',
25           value         => 'B'
26         },
27         { field         => 'is_broadband',
28           type          => 'hidden',
29           value         => 'Y',
30         },
31         'description',
32         { field         => 'active_date',
33           type          => 'fixed-date',
34           value         => time,
35         },
36         { field         => 'agentnum',
37           type          => 'select-agent',
38           disable_empty => 1,
39           viewall_right => 'Edit FCC report configuration for all agents',
40         },
41         'dbaname',
42         { field         => 'technology',
43           type          => 'select',
44           options       => [ map { @$_ } values(%$media_types) ],
45           labels        => $technology_labels,
46         },
47         { field         => 'is_consumer', type => 'checkbox', value=>'Y' },
48         { field         => 'is_business', type => 'checkbox', value=>'Y' },
49         { type => 'tablebreak-tr-title',
50           value => 'Advertised maximum speed (Mbps)' },
51         'adv_speed_down',
52         'adv_speed_up',
53         { type => 'tablebreak-tr-title',
54           value => 'Contractually guaranteed speed (Mbps)' },
55         'cir_speed_down',
56         'cir_speed_up',
57         { type => 'tablebreak-tr-title', value => 'Footprint'},
58         { field               => 'vertices',
59           type                => 'polygon',
60           curr_value_callback => sub {
61             my ($cgi, $object) = @_;
62             $cgi->param('vertices') || $object->vertices_json;
63           },
64         }
65 #
66 #        { type => 'tablebreak-tr-title', value => 'Census blocks'},
67 #        { field => 'file',
68 #          type  => 'file-upload',
69 #        },
70 #        { field => 'format',
71 #          type  => 'hidden',
72 #          value => 'plain',
73 #        },
74 #        { field => 'censusyear',
75 #          type  => 'hidden',
76 #          options => [ '', qw( 2013 2012 2011 ) ],
77 #        },
78 #
79 #        { type => 'tablebreak-tr-title', value => '', },
80 #        { field => 'blocknum',
81 #          type              => 'deploy_zone_block',
82 #          o2m_table         => 'deploy_zone_block',
83 #          m2_label          => ' ',
84 #          m2_error_callback => $m2_error_callback,
85 #        },
86     ],
87 &>
88 <%init>
89 my $curuser = $FS::CurrentUser::CurrentUser;
90 die "access denied"
91   unless $curuser->access_right([
92     'Edit FCC report configuration',
93     'Edit FCC report configuration for all agents',
94   ]);
95
96 my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
97 my $media_types = FS::part_pkg_fcc_option->media_types;
98 delete $media_types->{'Mobile Wireless'}; # cause this is the fixed zone page
99
100 #my $m2_error_callback = sub {
101 #  my ($cgi, $deploy_zone) = @_;
102 #  my @blocknums = grep {
103 #    /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
104 #  } $cgi->param;
105 #
106 #  sort { $a->censusblock <=> $b->censusblock }
107 #  map {
108 #    my $k = $_;
109 #    FS::deploy_zone_block->new({
110 #      blocknum    => scalar($cgi->param($k)),
111 #      zonenum     => $deploy_zone->zonenum,
112 #      censusblock => scalar($cgi->param($k.'_censusblock')),
113 #      censusyear  => scalar($cgi->param($k.'_censusyear')),
114 #    })
115 #  } @blocknums;
116 #};
117
118 </%init>