Optimize "Customer has a referring customer" condition, RT#74452
[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
23     'fields'        => [
24         { field         => 'zonetype',
25           type          => 'hidden',
26           value         => 'B'
27         },
28         { field         => 'is_broadband',
29           type          => 'hidden',
30           value         => 'Y',
31         },
32         'description',
33         { field         => 'active_date',
34           type          => 'input-date-field',
35           curr_value_callback => sub {
36             my ($cgi, $object) = @_;
37             $cgi->param('active_date') || $object->active_date || time;
38           },
39         },
40         { field         => 'agentnum',
41           type          => 'select-agent',
42           disable_empty => 1,
43           viewall_right => 'Edit FCC report configuration for all agents',
44         },
45         'dbaname',
46         { field         => 'technology',
47           type          => 'select',
48           options       => [ map { @$_ } values(%$media_types) ],
49           labels        => $technology_labels,
50         },
51         { field         => 'is_consumer', type => 'checkbox', value=>'Y' },
52         { field         => 'is_business', type => 'checkbox', value=>'Y' },
53         { type => 'tablebreak-tr-title',
54           value => 'Advertised maximum speed (Mbps)' },
55         'adv_speed_down',
56         'adv_speed_up',
57         { type => 'tablebreak-tr-title',
58           value => 'Contractually guaranteed speed (Mbps)' },
59         'cir_speed_down',
60         'cir_speed_up',
61         { type => 'tablebreak-tr-title', value => 'Footprint'},
62         { field               => 'vertices',
63           type                => 'polygon',
64           curr_value_callback => sub {
65             my ($cgi, $object) = @_;
66             $cgi->param('vertices') || $object->vertices_json;
67           },
68         }
69 #
70 #        { type => 'tablebreak-tr-title', value => 'Census blocks'},
71 #        { field => 'file',
72 #          type  => 'file-upload',
73 #        },
74 #        { field => 'format',
75 #          type  => 'hidden',
76 #          value => 'plain',
77 #        },
78 #        { field => 'censusyear',
79 #          type  => 'hidden',
80 #          options => [ '', qw( 2013 2012 2011 ) ],
81 #        },
82 #
83 #        { type => 'tablebreak-tr-title', value => '', },
84 #        { field => 'blocknum',
85 #          type              => 'deploy_zone_block',
86 #          o2m_table         => 'deploy_zone_block',
87 #          m2_label          => ' ',
88 #          m2_error_callback => $m2_error_callback,
89 #        },
90     ],
91 &>
92 <%init>
93 my $curuser = $FS::CurrentUser::CurrentUser;
94 die "access denied"
95   unless $curuser->access_right([
96     'Edit FCC report configuration',
97     'Edit FCC report configuration for all agents',
98   ]);
99
100 my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
101 my $media_types = FS::part_pkg_fcc_option->media_types;
102 delete $media_types->{'Mobile Wireless'}; # cause this is the fixed zone page
103
104 #my $m2_error_callback = sub {
105 #  my ($cgi, $deploy_zone) = @_;
106 #  my @blocknums = grep {
107 #    /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
108 #  } $cgi->param;
109 #
110 #  sort { $a->censusblock <=> $b->censusblock }
111 #  map {
112 #    my $k = $_;
113 #    FS::deploy_zone_block->new({
114 #      blocknum    => scalar($cgi->param($k)),
115 #      zonenum     => $deploy_zone->zonenum,
116 #      censusblock => scalar($cgi->param($k.'_censusblock')),
117 #      censusyear  => scalar($cgi->param($k.'_censusyear')),
118 #    })
119 #  } @blocknums;
120 #};
121
122 </%init>