communigate (phase 2): rules: show conditions/actions on rule browse, fix rule edit...
[freeside.git] / httemplate / browse / rate_detail.html
index 36e808f..3371926 100644 (file)
                            'Region',
                            'Prefix(es)',
                            'Included<BR>minutes',
+                           'Connection<BR>charge',
                            'Charge per<BR>minute',
                            'Granularity',
+                           'Usage class',
                          ],
      'fields'         => [
                            'regionname',
                            sub { shift->dest_region->prefixes_short },
-                           sub { shift->min_included.
-                                 '&nbsp;<FONT SIZE="-1">(edit)</FONT>';
-                               },
-                           sub { $money_char. shift->min_charge.
-                                 '&nbsp;<FONT SIZE="-1">(edit)</FONT>';
-                               },
+                           sub { shift->min_included. $edit_hint },
+                           $conn_charge_sub,
+                           sub { $money_char. shift->min_charge. $edit_hint },
                            sub { $granularity{ shift->sec_granularity } },
+                           'classname',
                          ],
-     'links'          => [ '', '', $edit_link,    $edit_link,    '' ],
-     'link_onclicks'  => [ '', '', $edit_onclick, $edit_onclick, '' ],
-     'align'          => 'llrrc',
+     'links'          => [ '', '', $edit_link,    $edit_link,    '', '' ],
+     'link_onclicks'  => [ '', '', $edit_onclick, $edit_onclick, '', '' ],
+     'align'          => 'llrrcc',
    )
 %>
 <%once>
 
 tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
+tie my %conn_secs,   'Tie::IxHash', FS::rate_detail::conn_secs();
 
 my $conf = new FS::Conf;
 my $money_char = $conf->config('money_char') || '$';
@@ -57,6 +58,15 @@ my $edit_onclick = sub {
              #default# 'color'       => '#333399',
          );
 };
+my $edit_hint = '&nbsp;<FONT SIZE="-1">(edit)</FONT>';
+
+my $conn_charge_sub = sub {
+   my $rate_detail = shift;
+   #return '' unless $rate_detail->conn_charge > 0 || $rate_detail->conn_sec;
+   $money_char. $rate_detail->conn_charge.
+     ($rate_detail->conn_sec ? ' for '.$conn_secs{$rate_detail->conn_sec} : '').
+     $edit_hint;
+};
 
 </%once>
 <%init>