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