diff options
author | ivan <ivan> | 2006-04-22 00:58:40 +0000 |
---|---|---|
committer | ivan <ivan> | 2006-04-22 00:58:40 +0000 |
commit | 1a033848671cad2cbe7687b37fc718b3b2a68b83 (patch) | |
tree | 01fc1ca352726cdc5786e0ccaf78515e9326ba84 /httemplate/browse/inventory_class.html | |
parent | 303cb4ce4b6ce634e108e3b7a0b43086a5e4f184 (diff) |
start of package class web UI (add/edit package classes, package class selection in package def edit)
Diffstat (limited to 'httemplate/browse/inventory_class.html')
-rw-r--r-- | httemplate/browse/inventory_class.html | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/httemplate/browse/inventory_class.html b/httemplate/browse/inventory_class.html new file mode 100644 index 000000000..6da3c9e3c --- /dev/null +++ b/httemplate/browse/inventory_class.html @@ -0,0 +1,89 @@ +<% + +tie my %labels, 'Tie::IxHash', + 'num_avail' => 'Available', # <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>', + 'num_used' => 'In use', #'Used', #'Allocated', + 'num_total' => 'Total', +; + +my %link = ( + 'num_avail' => ';avail=1', + 'num_used' => ';avail=1', + 'num_total' => '', +); + +my %inv_action_link = ( + 'num_avail' => [ 'upload batch', + $p.'misc/inventory_item-import.html?classnum=', + 'classnum' + ], +); + +my $link = [ "${p}edit/inventory_class.html?", 'classnum' ]; + +%><%= include( 'elements/browse.html', + 'title' => 'Inventory Classes', + 'name' => 'inventory classes', + 'menubar' => [ 'Add a new inventory class' => + $p.'edit/inventory_class.html', + ], + 'query' => { 'table' => 'inventory_class', }, + 'count_query' => 'SELECT COUNT(*) FROM inventory_class', + 'header' => [ '#', 'Inventory class', 'Inventory' ], + 'fields' => [ 'classnum', + 'classname', + sub { + #my $inventory_class = shift; + my $i_c = shift; + + my $link = + $p. 'search/inventory_item.html?'. + 'classnum='. $i_c->classnum; + + my %actioncol = (); + foreach ( keys %inv_action_link ) { + my($label, $baseurl, $method) = + @{ $inv_action_link{$_} }; + my $url = $baseurl. $i_c->$method(); + $actioncol{$_} = + '<FONT SIZE="-1">'. + '('. + '<A HREF="'.$url.'">'. + $label. + '</A>'. + ')'. + '</FONT>'; + } + + my %num = map { + $_ => $i_c->$_(); + } keys %labels; + + [ map { + [ + { + 'data' => '<B>'. $num{$_}. '</B>', + 'align' => 'right', + }, + { + 'data' => $labels{$_}, + 'align' => 'left', + 'link' => ( $num{$_} + ? $link.$link{$_} + : '' + ), + }, + { 'data' => $actioncol{$_}, + 'align' => 'left', + }, + ] + } keys %labels + ]; + }, + ], + 'links' => [ $link, + $link, + '', + ], + ) +%> |