Bug 9573: Lost items report - Add a new "Export selected items" link
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / reports / itemslost.tt
1 [% USE AuthorisedValues %]
2 [% USE Branches %]
3 [% USE ColumnsSettings %]
4 [% USE KohaDates %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Reports &rsaquo; Lost items</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
10 </head>
11
12 <body id="rep_itemslost" class="rep">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
15
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_items ) %] &rsaquo; <a href="/cgi-bin/koha/reports/itemslost.pl">Lost items</a> &rsaquo; Results[% ELSE %] &rsaquo; Lost items[% END %]</div>
17
18 <div id="doc3" class="yui-t2">
19    
20    <div id="bd">
21         <div id="yui-main">
22         <div class="yui-b">
23
24 <h1>Lost items</h1>
25
26 [% IF ( get_items ) %]
27
28 <div class="results">
29     [% IF items.count%]
30         [% items.count %] lost items found
31     [% ELSE %]
32         No lost items found
33     [% END %]
34 </div>
35
36     [% IF items.count %]
37         <div class="lostitems-table_table_controls">
38                 | <a href="#" class="SelectAll"><i class="fa fa-check"></i> Select all</a> |
39                 <a href="#" class="ClearAll"><i class="fa fa-remove"></i> Clear all</a>
40                 <span class="itemselection_actions">
41                   | Actions:
42                   <a class="itemselection_action_export"><i class="fa fa-trash"></i> Export selected items</a>
43                 </span>
44         </div>
45
46         <table id="lostitems-table">
47             <thead>
48                 <tr>
49                     <th class="NoSort"></th>
50                     <th>Title</th>
51                     <th>Author</th>
52                     <th>Lost status</th>
53                     <th class="title-string">Lost on</th>
54                     <th>Barcode</th>
55                     <th>Call number</th>
56                     <th class="title-string">Date last seen</th>
57                     <th>Price</th>
58                     <th>Rep.price</th>
59                     <th>Library</th>
60                     <th>Item type</th>
61                     <th>Current location</th>
62                     <th>Location</th>
63                     <th>Not for loan status</th>
64                     <th>Notes</th>
65                 </tr>
66             </thead>
67             <tbody>
68                 [% FOREACH item IN items %]
69                     <tr>
70                         <td style="text-align:center;vertical-align:middle">
71                             <input type="checkbox" value="[% item.itemnumber %]" name="itemnumber" />
72                         </td>
73                         <td>
74                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]" title="[% item.itemnotes %]">[% item.biblio.title |html %]</a>
75                         </td>
76                         <td>[% item.biblio.author %]</td>
77                         <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.itemlost', authorised_value => item.itemlost ) %]
78                         <td><span title="[% item.itemlost_on %]"</span>[% item.itemlost_on | $KohaDates %]</span></td>
79                         <td>
80                             <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% item.biblionumber %]" title="[% item.itemnotes %]">[% item.barcode %]</a>
81                         </td>
82                         <td>[% item.itemcallnumber %]</td>
83                         <td><span title="[% item.datelastseen %]">[% item.datelastseen | $KohaDates %]</span></td>
84                         <td>[% item.price %]</td>
85                         <td>[% item.replacementprice %]</td>
86                         <td>[% Branches.GetName(item.homebranch) %]</td>
87                         <td>[% item.effective_itemtype %]</td>
88                         <td>[% Branches.GetName(item.holdingbranch) %]</td>
89                         <td>[% item.location %]</td>
90                         <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %]
91                         <td>[% item.itemnotes %]</td>
92                     </tr>
93                 [% END %]
94             </tbody>
95         </table>
96     [% END %]
97         [% ELSE %]
98         
99         <form name="f" action="/cgi-bin/koha/reports/itemslost.pl" method="post">
100     <fieldset class="rows">
101         <ol>
102
103         <li><label for="barcodefilter">Barcode: </label><input type="text" name="barcodefilter" id="barcodefilter" size="6" /></li>
104         <li><label for="branchfilter">Library: </label><select name="branchfilter" id="branchfilter">
105                 <option value="">All</option>
106                 [% PROCESS options_for_libraries libraries => Branches.all() %]
107             </select></li>
108     <li><label for="itemtypesfilter">Item type: </label><select name="itemtypesfilter" id="itemtypesfilter">
109                 <option value="">All</option>
110                 [% FOREACH itemtype IN itemtypes %]
111                     <option value="[% itemtype.itemtype  %]">[% itemtype.translated_description %]</option>
112                 [% END %]
113             </select></li>
114
115     <li>
116         <label for="loststatusfilter">Lost status: </label>
117         <select name="loststatusfilter" id="loststatusfilter">
118             <option value="">All</option>
119             [% FOREACH l IN AuthorisedValues.GetDescriptionsByKohaField( kohafield => 'items.itemlost') %]
120                 [% IF l.authorised_value == lostfilter %]
121                     <option value="[% l.authorised_value %]" selected="selected">[% l.lib %]</option>
122                 [% ELSE %]
123                     <option value="[% l.authorised_value %]">[% l.lib %]</option>
124                 [% END %]
125             [% END %]
126         </select>
127     </li>
128
129     <li>
130         <label for="notforloanfilter">Not for loan: </label>
131         <select name="notforloanfilter" id="notforloanfilter">
132             <option value="">All</option>
133             [% FOREACH n IN AuthorisedValues.GetDescriptionsByKohaField( kohafield => 'items.notforloan') %]
134                 [% IF n.authorised_value == notforloanfilter %]
135                     <option value="[% n.authorised_value %]" selected="selected">[% n.lib %]</option>
136                 [% ELSE %]
137                     <option value="[% n.authorised_value %]">[% n.lib %]</option>
138                 [% END %]
139             [% END %]
140         </select>
141     </li>
142
143 </ol></fieldset>
144 <fieldset class="action">    <input type="submit" value="Submit" />
145     <input type="hidden" name="get_items" value="1" /></fieldset>
146 </form>
147         
148         [% END %]
149
150 </div>
151 </div>
152 <div class="yui-b">
153 [% INCLUDE 'reports-menu.inc' %]
154 </div>
155 </div>
156
157 [% MACRO jsinclude BLOCK %]
158     [% INCLUDE 'datatables.inc' %]
159     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
160     [% INCLUDE 'columns_settings.inc' %]
161     <script type="text/javascript" src="[% interface %]/[% theme %]/js/table_filters.js"></script>
162     <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
163     <script type='text/javascript'>
164         $(document).ready(function() {
165             var columns_settings = [% ColumnsSettings.GetColumns( 'reports', 'lostitems', 'lostitems-table', 'json' ) %];
166             var lostitems_table = KohaTable("lostitems-table", {
167                 "dom": 'B<"clearfix">t',
168                 "aaSorting": [],
169                 "aoColumnDefs": [
170                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
171                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
172                 ],
173                 'bAutoWidth': false,
174                 "bPaginate": false,
175             }, columns_settings, 'with_filters');
176
177             function itemSelectionBuildExportLink() {
178                 var itemnumbers = new Array();
179                 $("input[name='itemnumber'][type='checkbox']:checked").each(function() {
180                     itemnumbers.push($(this).val());
181                 });
182                 if (itemnumbers.length > 0) {
183                     var url = '/cgi-bin/koha/tools/batchMod.pl?op=show';
184                     url += '&itemnumber=' + itemnumbers.join('&itemnumber=');
185                     $('a.itemselection_action_export').attr('href', url);
186                 } else {
187                     return false;
188                 }
189                 return true;
190             }
191
192             function itemSelectionBuildActionLinks() {
193                 var export_link_ok = itemSelectionBuildExportLink();
194                 if (export_link_ok) {
195                     $('.itemselection_actions').show();
196                 } else {
197                     $('.itemselection_actions').hide();
198                 }
199             }
200
201             itemSelectionBuildActionLinks();
202
203             $("input[name='itemnumber'][type='checkbox']").change(function() {
204                 itemSelectionBuildActionLinks();
205             });
206
207             $(".SelectAll").on("click",function(e){
208                 e.preventDefault();
209                 $("#lostitems-table").checkCheckboxes();
210                 itemSelectionBuildActionLinks();
211             });
212
213             $(".ClearAll").on("click",function(e){
214                 e.preventDefault();
215                 $("#lostitems-table").unCheckCheckboxes();
216                 itemSelectionBuildActionLinks();
217             });
218         });
219     </script>
220 [% END %]
221
222 [% INCLUDE 'intranet-bottom.inc' %]