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