v4 style
[freeside.git] / httemplate / elements / did_order_item.html
index 0f5a765..d1f90f3 100644 (file)
@@ -4,24 +4,72 @@
 
   <TABLE>
     <TR>
-%     foreach my $field ( @textfields ) {
-%
-%       my $value = '';
-%         $value = $item->get($field);
+%     my $value = '';
 
-        <TD>
+%     $value = $item->get('quantity');
+      <TD>
           <INPUT TYPE  = "text"
-                 NAME  = "<%$name%>_<%$field%>"
-                 ID    = "<%$id%>_<%$field%>"
-                 SIZE  = "<% $size{$field} || 15 %>"
-                 VALUE = "<% scalar($cgi->param($name."_$field"))
+                 NAME  = "<%$name%>_quantity"
+                 ID    = "<%$id%>_quantity"
+                 SIZE  = "3"
+                 VALUE = "<% scalar($cgi->param($name."_quantity"))
                              || $value |h %>"
                  <% $onchange %>
           >
-          <BR><FONT SIZE="-1"><% $label{$field} %></FONT>
-        </TD>
-%     }
-%     my $value = '';
+          <BR><FONT SIZE="-1">Quantity</FONT>
+      </TD>
+      
+%     $value = $item->get('npa');
+      <TD>
+          <INPUT TYPE  = "text"
+                 NAME  = "<%$name%>_npa"
+                 ID    = "<%$id%>_npa"
+                 SIZE  = "3"
+                 VALUE = "<% scalar($cgi->param($name."_npa"))
+                             || $value |h %>"
+                 <% $onchange %>
+          >
+          <BR><FONT SIZE="-1">NPA</FONT>
+      </TD>
+
+%     $value = $item->get('ratecenternum');
+      <TD>
+        <% include('/elements/select-table.html',
+                         'name_col'      => 'description',
+                         'table'         => 'rate_center',
+                         'disable_empty' => 0,
+                         'empty_label'   => ' ',
+                         'field'         => "${name}_ratecenternum",
+                         'id'            => "${id}_ratecenternum",
+                         'curr_value'    => scalar($cgi->param("${name}_ratecenternum"))
+                                             || $value,
+                         'post_options'  => [ 0 => 'Add new...' ],
+                         onchange        => 'ratecenter_changed',
+                  )
+         %>
+        <BR><FONT SIZE="-1">Rate Center</FONT>
+        <div style="display:none; font-size: 80%" id="<%$id%>_rc_div">
+             - add new: <INPUT TYPE  = "text"
+                 NAME  = "<%$name%>_rc_new"
+                 ID    = "<%$id%>_rc_new">
+        </div>
+      </TD>
+
+%     $value = $item->get('msanum');
+      <TD>
+        <% include('/elements/select-table.html',
+                         'name_col'      => 'description',
+                         'table'         => 'msa',
+                         'disable_empty' => 0,
+                         'empty_label'   => ' ',
+                         'field'         => "${name}_msanum",
+                         'curr_value'    => scalar($cgi->param("${name}_msanum"))
+                                             || $value,
+                   )
+         %>
+        <BR><FONT SIZE="-1">MSA</FONT>
+      </TD>
+
 %     $value = $item->get('latanum');
       <TD><% include('/elements/select-table.html',
                          'name_col'      => 'description',
                          'field'         => "${name}_latanum",
                          'curr_value'    => scalar($cgi->param("${name}_latanum"))
                                              || $value,
-                      )
+                     )
             %>
         <BR><FONT SIZE="-1">LATA #</FONT>
       </TD>
+
 %     $value = $item->get('state');
       <TD><% include('/elements/select-state.html',
                          'disable_empty' => 0,
                          'prefix'        => "${name}_",
                          'state'         => scalar($cgi->param("${name}_state"))
                                             || $value,
-                      )
+                     )
             %>
           <BR><FONT SIZE="-1">State</FONT>
       </TD>
+
+%     $value = $item->get('custnum');
+      <TD><INPUT TYPE  = "text"
+                 NAME  = "<%$name%>_custnum"
+                 ID    = "<%$id%>_custnum"
+                 SIZE  = "7"
+                 VALUE = "<% scalar($cgi->param($name."_custnum"))
+                             || $value |h %>"
+                 <% $onchange %>
+          >
+          <BR><FONT SIZE="-1">Customer #</FONT>
+      </TD>
+
     </TR>
   </TABLE>
 
@@ -67,7 +129,7 @@ if ( $opt{'onchange'} ) {
   $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
   $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack.  all onchange
                                         #callbacks should act the same
 $onchange = 'onChange="'. $onchange. '"';
+ $onchange = 'onChange="'. $onchange. '"';
 }
 
 my $item;
@@ -77,15 +139,4 @@ if ( $curr_value ) {
   $item = new FS::did_order_item {};
 }
 
-my %size = ( 'npa' => 3, 
-            'quantity' => 3,);
-
-tie my %label, 'Tie::IxHash',
-  'quantity' => 'Quantity',
-  'npa'        => 'NPA',
-  'ratecenter'        => 'Rate Center',
-  'msa'        => 'MSA',
-;
-my @textfields = keys %label;
-
 </%init>