summaryrefslogtreecommitdiff
path: root/httemplate/search/sector.html
blob: 636935489e5c771fd2c5fd44974defb6710c2e5b (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
<& /elements/header.html, {
  'title'       => 'Sector coverage maps',
  }
&>
<style>
  a.createmap {
    font-weight: bold;
    color: blue;
  }
  a.viewmap {
    font-weight: bold;
    color: green;
  }
  .grid th {
    padding-left: 3px;
    padding-right: 3px;
    padding-bottom: 2px;
    border: none;
    empty-cells: show;
    font-size:90%;
    border-bottom: 1px solid #999999;
  }
  .grid td {
    padding-left: 3px;
    padding-right: 3px;
    padding-bottom: 2px;
    border: none;
    empty-cells: show;
  }
</style>
<table class="grid" style="border-spacing: 0px">
  <thead>
    <tr>
      <th>Tower / sector</th>
      <th colspan=3>
    </tr>
  </thead>
  <tbody>
% my $row = 0;
% foreach my $sector (@sectors) {
%   my $sectornum = $sector->sectornum;
  <tr class="row<% $row % 2 %>">
    <td>
      <a href="<% $fsurl %>edit/tower.html?<% $sector->towernum |h %>">
        <% $sector->description |h %>
      </a>
    </td>

%     my @need_fields = $sector->need_fields_for_coverage;
%     if ( @need_fields ) {
    <td>Need fields:</td>
    <td>
        <% join('<br>', @need_fields) %>
    </td>
%     } else {
    <td colspan="2" style="text-align: center">
%       my $text = 'Create map';
%       if ( length($sector->image) > 0 ) {
%         $text = 'Reprocess';
%       }
        <form name="create_<% $sectornum |h %>">
        <input type="hidden" name="sectornum" value="<% $sectornum |h %>">
        <& /elements/progress-init.html,
          'create_'.$sectornum,
          [ 'sectornum' ],
          $fsurl.'misc/sector-create_map.html',
          { 'message' => 'Map generated',
            'url' => $cgi->self_url },
          "sector$sectornum"
        &>
        <a class="createmap" href="#" onclick="sector<% $sectornum %>process()">
          <% $text %>
        </a>
        </form>
%     }
    </td>
    <td>
%   if ( length($sector->image) > 0 ) {
      <a class="viewmap" href="<% $fsurl %>search/svc_broadband-map.html?sectornum=<% $sectornum %>">
        View map&mdash;<% $sector->margin %>dB margin
      </a>
%   }
    </td>
  </tr>
%   $row++;
% } # foreach $sector
  </tbody>
</table>
<& /elements/footer.html &>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $query = {
  table   => 'tower_sector',
  select  => 'tower_sector.*,
              tower.latitude, tower.longitude, tower.color, tower.towername',
  extra_sql => ' WHERE tower.disabled is null',
  addl_from => ' JOIN tower USING (towernum)',
  order_by  => ' ORDER BY towername, sectorname',
};

my @sectors = qsearch($query);
</%init>