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