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