add unused_credit option on suspend reasons to browse and edit UI, #31702
[freeside.git] / httemplate / browse / tower.html
index 0de3b32..e2f9fd0 100644 (file)
@@ -8,11 +8,13 @@
                  'count_query' => 'SELECT COUNT(*) FROM tower',
                  'disableable' => 1,
                  'disabled_statuspos' => 1,
-                 'header'      => [ 'Name', 'Sectors', ],
+                 'header'      => [ 'Name', 'Location', 'Sectors', ],
                  'fields'      => [ $tower_sub,
+                                    $coord_sub,
                                     $sector_sub,
                                   ],
                  'links'       => [ ],
+                 'cell_style'    => [ $tagdesc_style ],
              )
 %>
 <%init>
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
+#false laziness w/ browse/part_tag.html
+my $tagdesc_style = sub { 'background-color:#'.shift->color };
+
 my $num_svc_links = sub {
   my ($query_string, $sectors) = @_;
+  return if !$sectors;
   my $num_svc_broadband = FS::svc_broadband->count("sectornum IN($sectors)");
   my $num_svc_acct =      FS::svc_acct->count("sectornum IN($sectors)");
 
@@ -48,12 +54,32 @@ my $num_svc_links = sub {
   },
 };
 
+my $coord_sub = sub {
+  my $tower = shift;
+
+  my $coords = $m->scomp("/elements/coord-links.html", $tower->latitude, $tower->longitude, $tower->towername);
+
+  [
+    [
+      { 'data' => "Latitude: ".              $tower->latitude.
+                  "<br>Longitude: ".         $tower->longitude.
+                  "<br>Altitude: ".          $tower->altitude.
+                  "<br>Height: ".            $tower->height.
+                  "<br>Veg. height: ". $tower->veg_height,
+      },
+      { 'data' => $coords, 'link' => "Coordinates", },
+    ],
+  ]
+};
+
 my $tower_sub = sub {
   my $tower = shift;
-  my $sectors = join(',', map { $_->sectornum } $tower->tower_sector);
+  my $sectors = join(',', 
+    map { $_->sectornum } $tower->tower_sector, $tower->default_sector
+  );
   [ #rows
     [
-      { 'data' => $tower->towername, },
+      { 'data' => $tower->towername. '&nbsp;', },
       { 'data' => ' (edit) ', size => '-1', 
         'link' => $p.'edit/tower.html?' . $tower->towernum },
     ],
@@ -72,7 +98,7 @@ my $sector_sub = sub {
       my $sectornum = $sector->sectornum;
       [
         {
-          'data' => $sector->sectorname,
+          'data' => $sector->sectorname. '&nbsp;',
           'link' => ( $sector->ip_addr ? 'http://'. $sector->ip_addr : '' ),
         },