summaryrefslogtreecommitdiff
path: root/httemplate/search/inventory_class.html
blob: 1bf1bcbce625b94e9942b2bdbaadcb00ac2fcd1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<%

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 %inv_action_link = (
  'num_avail' => 'eventually'
);
my %inv_action_label = (
  'num_avail' => 'upload_batch'
);

my $link = [ "${p}edit/inventory_class.html?", 'classnum' ];

%><%= include( 'elements/search.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;

                                          [ map {
                                                  [
                                                    {
                                                      'data'  => '<B>'. $i_c->$_(). '</B>',
                                                      'align' => 'right',
                                                    },
                                                    {
                                                      'data'  => $labels{$_},
                                                      'align' => 'left',
                                                    },
                                                    { 'data'  => ( exists($inv_action_link{$_})
                                                                   ? '<FONT SIZE="-1">(<A HREF="'. $inv_action_link{$_}. '">'. $inv_action_label{$_}. '</A>)</FONT>'
                                                                   : ''
                                                                 ),
                                                      'align'  => 'left',
                                                    },
                                                  ]
                                                } keys %labels
                                          ];
                                        },
                                  ],
                 'links'       => [ $link,
                                    $link,
                                    '',
                                  ],
             )
%>