<%init> my %opt = @_; my $tower = $opt{'object'}; my $towernum = $tower->towernum; my $cgi = $opt{'cgi'}; my $tabcounter = 0; my @fields = qw( sectorname ip_addr height freq_mhz direction width tilt v_width db_high db_low sector_range ); my @sectors; if ( $cgi->param('error') ) { foreach my $k ($cgi->param) { if ($k =~ /^sectornum\d+$/) { my $sectornum = $cgi->param($k); my $sector = FS::tower_sector->new({ 'sectornum' => $sectornum, 'towernum' => $towernum, map { $_ => scalar($cgi->param($k.'_'.$_)) } @fields, }); push @sectors, $sector if length($sector->sectorname); } } } elsif ( $towernum ) { @sectors = $tower->tower_sector; } # else new mode, no sectors yet my $id = $opt{id} || $opt{field} || 'sectornum'; <& tablebreak-tr-title.html, value => 'Sectors' &> %# prototypes
<& .tab, id => $id . '_P' &> <& .panel, id => $id . '_P' &>
%# main container
% $tabcounter = 0; % foreach my $sector (@sectors) { <& .panel, sector => $sector, id => $id . $tabcounter &> % $tabcounter++; % }
<%def .tab> % my %opt = @_; % my $sector = $opt{sector}; % my $id = $opt{id}; % my $title = $sector ? $sector->sectorname : mt('Add new');
  • <% $title |h %>
  • <%def .panel> % my %opt = @_; % my $sector = $opt{sector} || FS::tower_sector->new({}); % my $id = $opt{id}; # sectornumX
    % # no id on this one, the panel gets the "sectornumX" id

    <% emt('feet above ground') %>

    ° °

    <% emt('MHz') %>

    ° °

    <% emt('dB (high quality)') %>
    <% emt('dB (low quality)') %>