Add a new table for inventory with for DIDs/serials/etc., and an additional
[freeside.git] / httemplate / search / inventory_class.html
1 <%
2
3 tie my %labels, 'Tie::IxHash',
4   'num_avail' => 'Available', #  <FONT SIZE="-1"><A HREF="eventually">(upload batch)</A></FONT>',
5   'num_used'  => 'In use', #'Used', #'Allocated',
6   'num_total' => 'Total',
7 ;
8 my %inv_action_link = (
9   'num_avail' => 'eventually'
10 );
11 my %inv_action_label = (
12   'num_avail' => 'upload_batch'
13 );
14
15 my $link = [ "${p}edit/inventory_class.html?", 'classnum' ];
16
17 %><%= include( 'elements/search.html',
18                  'title'       => 'Inventory Classes',
19                  'name'        => 'inventory classes',
20                  'menubar'     => [ 'Add a new inventory class' =>
21                                       $p.'edit/inventory_class.html',
22                                   ],
23                  'query'       => { 'table' => 'inventory_class', },
24                  'count_query' => 'SELECT COUNT(*) FROM inventory_class',
25                  'header'      => [ '#', 'Inventory class', 'Inventory' ],
26                  'fields'      => [ 'classnum',
27                                     'classname',
28                                     sub {
29                                           #my $inventory_class = shift;
30                                           my $i_c = shift;
31
32                                           [ map {
33                                                   [
34                                                     {
35                                                       'data'  => '<B>'. $i_c->$_(). '</B>',
36                                                       'align' => 'right',
37                                                     },
38                                                     {
39                                                       'data'  => $labels{$_},
40                                                       'align' => 'left',
41                                                     },
42                                                     { 'data'  => ( exists($inv_action_link{$_})
43                                                                    ? '<FONT SIZE="-1">(<A HREF="'. $inv_action_link{$_}. '">'. $inv_action_label{$_}. '</A>)</FONT>'
44                                                                    : ''
45                                                                  ),
46                                                       'align'  => 'left',
47                                                     },
48                                                   ]
49                                                 } keys %labels
50                                           ];
51                                         },
52                                   ],
53                  'links'       => [ $link,
54                                     $link,
55                                     '',
56                                   ],
57              )
58 %>