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