Optimize "Customer has a referring customer" condition, RT#74452
[freeside.git] / httemplate / search / sector.html
1 <& /elements/header.html, {
2   'title'       => 'Sector coverage maps',
3   }
4 &>
5 <style>
6   a.createmap {
7     font-weight: bold;
8     color: blue;
9   }
10   a.viewmap {
11     font-weight: bold;
12     color: green;
13   }
14   .grid th {
15     padding-left: 3px;
16     padding-right: 3px;
17     padding-bottom: 2px;
18     border: none;
19     empty-cells: show;
20     font-size:90%;
21     border-bottom: 1px solid #999999;
22   }
23   .grid td {
24     padding-left: 3px;
25     padding-right: 3px;
26     padding-bottom: 2px;
27     border: none;
28     empty-cells: show;
29   }
30 </style>
31 <table class="grid" style="border-spacing: 0px">
32   <thead>
33     <tr>
34       <th>Tower / sector</th>
35       <th colspan=3>
36     </tr>
37   </thead>
38   <tbody>
39 % my $row = 0;
40 % foreach my $sector (@sectors) {
41 %   my $sectornum = $sector->sectornum;
42   <tr class="row<% $row % 2 %>">
43     <td>
44       <a href="<% $fsurl %>edit/tower.html?<% $sector->towernum |h %>">
45         <% $sector->description |h %>
46       </a>
47     </td>
48
49 %     my @need_fields = $sector->need_fields_for_coverage;
50 %     if ( @need_fields ) {
51     <td>Need fields:</td>
52     <td>
53         <% join('<br>', @need_fields) %>
54     </td>
55 %     } else {
56     <td colspan="2" style="text-align: center">
57 %       my $text = 'Create map';
58 %       if ( length($sector->image) > 0 ) {
59 %         $text = 'Reprocess';
60 %       }
61         <form name="create_<% $sectornum |h %>">
62         <input type="hidden" name="sectornum" value="<% $sectornum |h %>">
63         <& /elements/progress-init.html,
64           'create_'.$sectornum,
65           [ 'sectornum' ],
66           $fsurl.'misc/sector-create_map.html',
67           { 'message' => 'Map generated',
68             'url' => $cgi->self_url },
69           "sector$sectornum"
70         &>
71         <a class="createmap" href="#" onclick="sector<% $sectornum %>process()">
72           <% $text %>
73         </a>
74         </form>
75 %     }
76     </td>
77     <td>
78 %   if ( length($sector->image) > 0 ) {
79       <a class="viewmap" href="<% $fsurl %>search/svc_broadband-map.html?sectornum=<% $sectornum %>">
80         View map&mdash;<% $sector->margin %>dB margin
81       </a>
82 %   }
83     </td>
84   </tr>
85 %   $row++;
86 % } # foreach $sector
87   </tbody>
88 </table>
89 <& /elements/footer.html &>
90 <%init>
91
92 die "access denied"
93   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
94
95 my $query = {
96   table   => 'tower_sector',
97   select  => 'tower_sector.*,
98               tower.latitude, tower.longitude, tower.color, tower.towername',
99   extra_sql => ' WHERE tower.disabled is null',
100   addl_from => ' JOIN tower USING (towernum)',
101   order_by  => ' ORDER BY towername, sectorname',
102 };
103
104 my @sectors = qsearch($query);
105 </%init>