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