summaryrefslogtreecommitdiff
path: root/httemplate/edit/rate_time.cgi
blob: 230aef82d3c2cacb5d3b129ed299b9cdd4f33154 (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
<% include("/elements/header.html","$action Time Period", menubar(
      'Rate plans' => "${p}browse/rate.cgi",
    ) )
%>

<% include('/elements/error.html') %>

<FORM METHOD="POST" ACTION="<% "${p}edit/process/rate_time.cgi" %>">
<INPUT TYPE="hidden" NAME="ratetimenum" VALUE="<% $ratetimenum %>">
<% ntable('#cccccc',2) %>
<TABLE>
  <TR>
    <TH ALIGN="right">Period name</TH>
    <TD><INPUT TYPE="text" NAME="ratetimename" VALUE="<% $rate_time ? $rate_time->ratetimename : '' %>"></TD>
  </TR>
</TABLE>
<% include('/elements/auto-table.html', 
                      header => [ 'Start', 'End' ],
                      fields => [ 'stime', 'etime' ],
                      size   => [ 18, 18 ],
                      maxl   => [ 15, 15 ],
                      align  => [ 'right', 'right' ],
                      data   => \@data,
   ) %>
<INPUT TYPE="submit" VALUE="<% $rate_time ? 'Apply changes' : 'Add period'%>">
</FORM>
<BR>
<A HREF="<% "${p}edit/process/rate_time.cgi?ratetimenum=$ratetimenum;delete=1" %>">Delete this period</A>
<% include('/elements/footer.html') %>

<%init>
my $ratetimenum = ($cgi->keywords)[0] || '';
my $action = 'Add';
my $rate_time;
my @data = ();

if($ratetimenum) {
  $action = 'Edit';
  $rate_time = qsearchs('rate_time', {ratetimenum => $ratetimenum})
    or die "ratetimenum $ratetimenum not found";
  @data = $rate_time->description;
}

</%init>