summaryrefslogtreecommitdiff
path: root/httemplate/browse/rate_tier.html
blob: d840808572b1ee0d7fe53fc00132af53baaa612c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<% include( 'elements/browse.html',
              'title'         => 'Tiering plans',
              'name_singular' => 'tiering plan',
              'menubar'       => [ 'Add a new tier plan' =>
                                     $p.'edit/rate_tier.html',
                                 ],
              'query'         => { 'table' => 'rate_tier', },
              'count_query'   => 'SELECT COUNT(*) FROM rate_tier',
              'header'        => [ 'Plan', 'Tiers', ],
              'fields'        => [ 'tiername',
                                   $details_sub,
                                 ],
              'links'         => [ $link, ],
              #'disableable'   => 1,
              #'disabled_statuspos' => 1,
          )
%>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Configuration');

my $conf = new FS::Conf;
my $money_char = $conf->config('money_char') || '$';

my $link = [ "${p}edit/rate_tier.html?", 'tiernum' ];

my $details_sub = sub {
  my $rate_tier = shift;

  [ [ { 'data'  => 'Minimum quantity',
        'align' => 'center',
      },
      { 'data'  => 'Charge per minute/call',
        'align' => 'center',
      },
    ],
    map { my $rate_tier_detail = $_;
          [
            { 'data'  => $rate_tier_detail->min_quan,
              'align' => 'right',
            },
            { 'data'  => $money_char. $rate_tier_detail->min_charge,
              'align' => 'right',
            },
          ];
        }
      $rate_tier->rate_tier_detail
  ];

};

</%init>