summaryrefslogtreecommitdiff
path: root/httemplate/edit/deploy_zone-fixed.html
blob: 24e03b01a4479d3e7f16737209996722da872654 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<& elements/edit.html,
    'name_singular' => 'deployment zone',
    'table'         => 'deploy_zone',
    'post_url'      => popurl(1).'process/deploy_zone-fixed.html',
    'viewall_dir'   => 'browse',
    'labels'        => {
        'description'     => 'Description',
        'agentnum'        => 'Agent',
        'dbaname'         => 'Business name (if different from agent)',
        'technology'      => 'Technology',
        'adv_speed_up'    => 'Upstream',
        'adv_speed_down'  => 'Downstream',
        'cir_speed_up'    => 'Upstream',
        'cir_speed_down'  => 'Downstream',
        'is_consumer'     => 'Consumer/mass market',
        'is_business'     => 'Business/government',
        'blocknum'        => '',
        'active_date'     => 'Active since',
        'file'            => 'Import blocks from text file',
        'censusyear'      => 'as census year',
    },

    'fields'        => [
        { field         => 'zonetype',
          type          => 'hidden',
          value         => 'B'
        },
        { field         => 'is_broadband',
          type          => 'hidden',
          value         => 'Y',
        },
        'description',
        { field         => 'active_date',
          type          => 'input-date-field',
          curr_value_callback => sub {
            my ($cgi, $object) = @_;
            $cgi->param('active_date') || $object->active_date || time;
          },
        },
        { field         => 'agentnum',
          type          => 'select-agent',
          disable_empty => 1,
          viewall_right => 'Edit FCC report configuration for all agents',
        },
        'dbaname',
        { field         => 'technology',
          type          => 'select',
          options       => [ map { @$_ } values(%$media_types) ],
          labels        => $technology_labels,
        },
        { field         => 'is_consumer', type => 'checkbox', value=>'Y' },
        { field         => 'is_business', type => 'checkbox', value=>'Y' },
        { type => 'tablebreak-tr-title',
          value => 'Advertised maximum speed (Mbps)' },
        'adv_speed_down',
        'adv_speed_up',
        { type => 'tablebreak-tr-title',
          value => 'Contractually guaranteed speed (Mbps)' },
        'cir_speed_down',
        'cir_speed_up',
        { type => 'tablebreak-tr-title', value => 'Footprint'},
        { field               => 'vertices',
          type                => 'polygon',
          curr_value_callback => sub {
            my ($cgi, $object) = @_;
            $cgi->param('vertices') || $object->vertices_json;
          },
        }
#
#        { type => 'tablebreak-tr-title', value => 'Census blocks'},
#        { field => 'file',
#          type  => 'file-upload',
#        },
#        { field => 'format',
#          type  => 'hidden',
#          value => 'plain',
#        },
#        { field => 'censusyear',
#          type  => 'hidden',
#          options => [ '', qw( 2013 2012 2011 ) ],
#        },
#
#        { type => 'tablebreak-tr-title', value => '', },
#        { field => 'blocknum',
#          type              => 'deploy_zone_block',
#          o2m_table         => 'deploy_zone_block',
#          m2_label          => ' ',
#          m2_error_callback => $m2_error_callback,
#        },
    ],
&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
  unless $curuser->access_right([
    'Edit FCC report configuration',
    'Edit FCC report configuration for all agents',
  ]);

my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
my $media_types = FS::part_pkg_fcc_option->media_types;
delete $media_types->{'Mobile Wireless'}; # cause this is the fixed zone page

#my $m2_error_callback = sub {
#  my ($cgi, $deploy_zone) = @_;
#  my @blocknums = grep {
#    /^blocknum\d+/ and length($cgi->param($_.'_censusblock'))
#  } $cgi->param;
#
#  sort { $a->censusblock <=> $b->censusblock }
#  map {
#    my $k = $_;
#    FS::deploy_zone_block->new({
#      blocknum    => scalar($cgi->param($k)),
#      zonenum     => $deploy_zone->zonenum,
#      censusblock => scalar($cgi->param($k.'_censusblock')),
#      censusyear  => scalar($cgi->param($k.'_censusyear')),
#    })
#  } @blocknums;
#};

</%init>