add progressbar to service definition add - duplicate checking can take a while,...
[freeside.git] / httemplate / edit / rate.cgi
index 4fdc837..ce56768 100644 (file)
@@ -1,12 +1,7 @@
-<!-- mason kludge -->
 <%
 
 my $rate;
-if ( $cgi->param('error') ) {
-  $rate = new FS::rate ( {
-    map { $_, scalar($cgi->param($_)) } fields('rate')
-  } );
-} elsif ( $cgi->keywords ) {
+if ( $cgi->keywords ) {
   my($query) = $cgi->keywords;
   $query =~ /^(\d+)$/;
   $rate = qsearchs( 'rate', { 'ratenum' => $1 } );
@@ -37,12 +32,14 @@ END
     ))
 %>
 
-<% if ( $cgi->param('error') ) { %>
-<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT><BR>
-<% } %>
-
-<FORM ACTION="<%=$p1%>process/rate.cgi" METHOD=POST>
-
+<%= include('/elements/progress-init.html',
+              'OneTrueForm',
+              [ 'rate', 'min_', 'sec_' ],
+              'process/rate.cgi',
+              $p.'browse/rate.cgi',
+           )
+%>
+<FORM NAME="OneTrueForm">
 <INPUT TYPE="hidden" NAME="ratenum" VALUE="<%= $rate->ratenum %>">
 
 Rate plan
@@ -68,7 +65,7 @@ Rate plan
      my $n = $rate_region->regionnum;
      my $rate_detail =
        $rate->dest_detail($rate_region)
-       || new FS::rate_region { 'min_included'    => 0,
+       || new FS::rate_detail { 'min_included'    => 0,
                                 'min_charge'      => 0,
                                 'sec_granularity' => '60'
                               };
@@ -95,9 +92,9 @@ Rate plan
 
 </TABLE>
 
-<BR><INPUT TYPE="submit" VALUE="<%= 
+<BR><INPUT NAME="submit" TYPE="button" VALUE="<%= 
   $rate->ratenum ? "Apply changes" : "Add rate plan"
-%>">
+%>" onClick="document.OneTrueForm.submit.disabled=true; process();">
 
     </FORM>
   </BODY>