summaryrefslogtreecommitdiff
path: root/httemplate/edit/deploy_zone-mobile.html
blob: 8cec298bf22aa79db993fa6948a74b253894463c (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
<& elements/edit.html,
    'name_singular' => 'deployment zone',
    'table'         => 'deploy_zone',
    'post_url'      => popurl(1).'process/deploy_zone-mobile.html',
    'viewall_dir'   => 'browse',
    'labels'        => {
        'description'     => 'Description',
        'agentnum'        => 'Agent',
        'dbaname'         => 'Business name (if different from agent)',
        'technology'      => 'Technology',
        'spectrum'        => 'Spectrum',
        'is_broadband',   => 'Broadband Internet',
        'adv_speed_up'    => 'Upstream',
        'adv_speed_down'  => 'Downstream',
        'is_voice',       => 'Voice',
        'vertexnum'       => '',
        'active_date'     => 'Active since',
    },
    'fields'        => [
        { field         => 'zonetype',
          type          => 'hidden',
          value         => 'P'
        },
        'description',
        { field         => 'active_date',
          type          => 'fixed-date',
          value         => time,
        },
        { field         => 'agentnum',
          type          => 'select-agent',
          disable_empty => 1,
          viewall_right => 'Edit FCC report configuration for all agents',
        },
        'dbaname',
        { field         => 'technology',
          type          => 'select',
          options       => $media_types->{'Mobile Wireless'},
          labels        => $technology_labels,
        },
        { field         => 'spectrum',
          type          => 'select',
          options       => [ keys %$spectrum_labels ],
          labels        => $spectrum_labels,
        },
        { field         => 'is_broadband', type => 'checkbox', value=>'Y' },
        { field         => 'is_voice', type => 'checkbox', value=>'Y' },
        { type => 'tablebreak-tr-title',
          value => 'Advertised minimum speed (Mbps)' },
        'adv_speed_down',
        'adv_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;
          },
        }

#        { field => 'vertexnum',
#          type              => 'deploy_zone_vertex',
#          o2m_table         => 'deploy_zone_vertex',
#          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 $spectrum_labels = FS::part_pkg_fcc_option->spectrum_labels;
my $media_types = FS::part_pkg_fcc_option->media_types;

my $m2_error_callback = sub {
  my ($cgi, $deploy_zone) = @_;
  my @vertexnums = sort { $a <=> $b } grep {
    /^vertexnum\d+/ and length($cgi->param($_.'_latitude'))
  } $cgi->param;

  map {
    my $k = $_;
    my $s = 0;
    FS::deploy_zone_vertex->new({
      vertexnum   => scalar($cgi->param($k)),
      zonenum     => $deploy_zone->zonenum,
      latitude    => scalar($cgi->param($k.'_latitude')),
      longitude   => scalar($cgi->param($k.'_longitude')),
    })
  } @vertexnums;
};

</%init>