diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/did_order_item.html | 69 | ||||
-rw-r--r-- | httemplate/elements/tr-did_order_item.html | 24 |
2 files changed, 93 insertions, 0 deletions
diff --git a/httemplate/elements/did_order_item.html b/httemplate/elements/did_order_item.html new file mode 100644 index 000000000..263826ecc --- /dev/null +++ b/httemplate/elements/did_order_item.html @@ -0,0 +1,69 @@ +% unless ( $opt{'js_only'} ) { + + <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>"> + + <TABLE> + <TR> +% foreach my $field ( @fields ) { +% +% my $value = ''; +% $value = $item->get($field); + + <TD> + <INPUT TYPE = "text" + NAME = "<%$name%>_<%$field%>" + ID = "<%$id%>_<%$field%>" + SIZE = "<% $size{$field} || 15 %>" + VALUE = "<% scalar($cgi->param($name."_$field")) + || $value |h %>" + <% $onchange %> + ><BR> + <FONT SIZE="-1"><% $label{$field} %></FONT> + </TD> +% } + </TR> + </TABLE> + +% } +<%init> + +my( %opt ) = @_; + +my $name = $opt{'element_name'} || $opt{'field'} || 'orderitemnum'; +my $id = $opt{'id'} || 'orderitemnum'; + +my $curr_value = $opt{'curr_value'} || $opt{'value'}; + +my $onchange = ''; +if ( $opt{'onchange'} ) { + $onchange = $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. '"'; +} + +my $item; +if ( $curr_value ) { + $item = qsearchs('did_order_item', { 'orderitemnum' => $curr_value } ); +} else { + $item = new FS::did_order_item {}; +} + +my %size = ( 'npa' => 3, + 'latanum' => 3, + 'state' => 2, + 'quantity' => 3,); + +tie my %label, 'Tie::IxHash', + 'msa' => 'MSA', + 'npa' => 'NPA', + 'latanum' => 'LATA #', + 'rate_center' => 'Rate Center', + 'state' => 'State', + 'quantity' => 'Quantity', +; + +my @fields = keys %label; + +</%init> diff --git a/httemplate/elements/tr-did_order_item.html b/httemplate/elements/tr-did_order_item.html new file mode 100644 index 000000000..7824aee03 --- /dev/null +++ b/httemplate/elements/tr-did_order_item.html @@ -0,0 +1,24 @@ +% unless ( $opt{'js_only'} ) { + + <% include('tr-td-label.html', %opt) %> + <TD <% $cell_style %>> + +% } +% + <% include( '/elements/did_order_item.html', %opt ) %> +% +% unless ( $opt{'js_only'} ) { + + </TD> + </TR> + +% } +<%init> + +my( %opt ) = @_; + +my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; + +$opt{'label'} ||= 'Item'; + +</%init> |