<& /elements/header.html, '' &>
<& /elements/footer.html &> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List services'); my $conf = new FS::Conf; my $apikey = $conf->config('google_maps_api_key'); my @features; # geoJSON structure my @towers = qsearch('tower', { 'latitude' => { op=>'!=', value=>''}, 'longitude' => { op=>'!=', value=>''}, }); my %sectors; # towernum => arrayref my @towernums; foreach my $tower (@towers) { my $towernum = $tower->towernum; push @towernums, $towernum; my @coord = ( $tower->longitude + 0, $tower->latitude + 0, ); push @features, { type => 'Feature', id => 'tower/'.$towernum, geometry => { type => 'Point', coordinates => \@coord, }, properties => { style => { icon => { path => undef, url => $fsurl.'images/antenna-square-21x51.png', anchor => { x => 10, y => 4 }, strokeColor => ($tower->color || 'black'), }, }, content => include('.tower', $tower), }, }; $sectors{$towernum} = [ $tower->tower_sector ]; } # foreach $tower my $tower_data = { type => 'FeatureCollection', features => \@features }; <%def .tower> % my $tower = shift; % my $can_edit = $FS::CurrentUser::CurrentUser->access_right('Configuration');

% if ( $can_edit ) { % } Tower #<% $tower->towernum %> | <% $tower->towername %> % if ( $can_edit ) { % }

% my $count_query = 'SELECT COUNT(*) FROM svc_broadband LEFT JOIN addr_status using (ip_addr) JOIN tower_sector USING (sectornum) WHERE tower_sector.towernum = '.$tower->towernum; % my $num_down = FS::Record->scalar_sql("$count_query AND addr_status.up IS NULL AND addr_status._date IS NOT NULL"); % my $num_up = FS::Record->scalar_sql("$count_query AND addr_status.up IS NOT NULL"); <% emt('Show services') %> ( <% $num_up %> <% emt('UP') %> <% $num_down %> <% emt('DOWN') %> )
<% emt('Show coverage') %>