improve RADIUS data usage report: multiple export selection, optionally group by...
[freeside.git] / httemplate / edit / deploy_zone-mobile.html
1 <& elements/edit.html,
2     'name_singular' => 'deployment zone',
3     'table'         => 'deploy_zone',
4     'post_url'      => popurl(1).'process/deploy_zone-mobile.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         'spectrum'        => 'Spectrum',
12         'is_broadband',   => 'Broadband Internet',
13         'adv_speed_up'    => 'Upstream',
14         'adv_speed_down'  => 'Downstream',
15         'is_voice',       => 'Voice',
16         'vertexnum'       => '',
17         'active_date'     => 'Active since',
18     },
19     'fields'        => [
20         { field         => 'zonetype',
21           type          => 'hidden',
22           value         => 'P'
23         },
24         'description',
25         { field         => 'active_date',
26           type          => 'fixed-date',
27           value         => time,
28         },
29         { field         => 'agentnum',
30           type          => 'select-agent',
31           disable_empty => 1,
32           viewall_right => 'Edit FCC report configuration for all agents',
33         },
34         'dbaname',
35         { field         => 'technology',
36           type          => 'select',
37           options       => $media_types->{'Mobile Wireless'},
38           labels        => $technology_labels,
39         },
40         { field         => 'spectrum',
41           type          => 'select',
42           options       => [ keys %$spectrum_labels ],
43           labels        => $spectrum_labels,
44         },
45         { field         => 'is_broadband', type => 'checkbox', value=>'Y' },
46         { field         => 'is_voice', type => 'checkbox', value=>'Y' },
47         { type => 'tablebreak-tr-title',
48           value => 'Advertised minimum speed (Mbps)' },
49         'adv_speed_down',
50         'adv_speed_up',
51         { type => 'tablebreak-tr-title', value => 'Footprint'},
52         { field               => 'vertices',
53           type                => 'polygon',
54           curr_value_callback => sub {
55             my ($cgi, $object) = @_;
56             $cgi->param('vertices') || $object->vertices_json;
57           },
58         }
59
60 #        { field => 'vertexnum',
61 #          type              => 'deploy_zone_vertex',
62 #          o2m_table         => 'deploy_zone_vertex',
63 #          m2_label          => ' ',
64 #          m2_error_callback => $m2_error_callback,
65 #        },
66     ],
67 &>
68 <%init>
69 my $curuser = $FS::CurrentUser::CurrentUser;
70 die "access denied"
71   unless $curuser->access_right([
72     'Edit FCC report configuration',
73     'Edit FCC report configuration for all agents',
74   ]);
75
76 my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
77 my $spectrum_labels = FS::part_pkg_fcc_option->spectrum_labels;
78 my $media_types = FS::part_pkg_fcc_option->media_types;
79
80 my $m2_error_callback = sub {
81   my ($cgi, $deploy_zone) = @_;
82   my @vertexnums = sort { $a <=> $b } grep {
83     /^vertexnum\d+/ and length($cgi->param($_.'_latitude'))
84   } $cgi->param;
85
86   map {
87     my $k = $_;
88     my $s = 0;
89     FS::deploy_zone_vertex->new({
90       vertexnum   => scalar($cgi->param($k)),
91       zonenum     => $deploy_zone->zonenum,
92       latitude    => scalar($cgi->param($k.'_latitude')),
93       longitude   => scalar($cgi->param($k.'_longitude')),
94     })
95   } @vertexnums;
96 };
97
98 </%init>