Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / result.tt
1 [% USE raw %]
2 [% BLOCK pagination %]
3     <nav>
4         [% IF ( displayprev || displaynext ) %]
5             <ul class="pagination">
6                 [% IF ( displayprev ) %]
7                     <li><a class="nav" href="label-item-search.pl?startfrom=[% startfromprev | html %]&amp;ccl_query=[% ccl_query | html %]&amp;resultsperpage=[% resultsperpage | html %]&amp;op=do_search&amp;batch_id=[% batch_id | html %]"><i class="fa fa-arrow-left"></i> Previous</a></li>
8                 [% END %]
9                 [% FOREACH number IN numbers %]
10                     [% IF ( startfrom == number.startfrom ) %]
11                         <li class="active"><span>[% number.number | html %]</span></a></li>
12                     [% ELSE %]
13                         <li><a class="nav" href="label-item-search.pl?startfrom=[% number.startfrom | html %]&amp;ccl_query=[% ccl_query | html %]&amp;resultsperpage=[% resultsperpage | html %]&amp;op=do_search&amp;batch_id=[% batch_id | html %]">[% number.number | html %]</a></li>
14                     [% END %]
15                 [% END %]
16                 [% IF ( displaynext ) %]
17                     <li><a class="nav" href="label-item-search.pl?startfrom=[% startfromnext | html %]&amp;ccl_query=[% ccl_query | html %]&amp;resultsperpage=[% resultsperpage | html %]&amp;op=do_search&amp;batch_id=[% batch_id | html %]">Next <i class="fa fa-arrow-right"></i></a></li>
18                 [% END %]
19             </ul>
20         [% END %]
21     </nav>
22 [% END %]
23 [% USE Asset %]
24 [% SET footerjs = 1 %]
25     [% INCLUDE 'doc-head-open.inc' %]
26     <title>Koha &rsaquo; Barcodes and labels &rsaquo; Search results</title>
27     [% INCLUDE 'doc-head-close.inc' %]
28 </head>
29
30 <body id="labels_result" class="tools labels">
31     <div class="main container-fluid">
32             <h1>Search results</h1>
33         <div class="results">
34             [% PROCESS pagination %]
35                 [% IF ( results ) %]
36                 <strong>Results [% from | html %] through [% to | html %] [% IF ( total ) %] of [% total | html %][% END %]</strong>
37                 [% ELSE %]
38                 No results found
39                 [% END %]
40
41             <form name="resultform" action="">
42             <div id="toolbar" class="btn-toolbar">
43                 <div class="btn-group"><button type="button" class="btn btn-default btn-sm" id="add_items"><i class="fa fa-plus"></i> Add checked</button></div>
44                 <div class="btn-group"><a href="#" class="btn btn-default btn-sm close"><i class="fa fa-times-circle"></i> Done</a></div>
45             </div>
46                 <div><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a> <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a></div>
47
48                 <div id="label-search-results">
49                 <input type="hidden" name="ccl_query" value="[% ccl_query | html %]" />
50             [% FOREACH result_se IN result_set %]
51             <div style="border-bottom:1px solid #CCC;padding:1em 0;">
52                     <h4>[% result_se.title | html %]</h4>
53                             <p>[% IF ( result_se.author ) %]by [% result_se.author | html %][% END %]
54                             [[% result_se.itemtype | html %]], [% IF ( result_se.publishercode ) %][% result_se.publishercode | html %] [% END %][% IF ( result_se.place ) %][% result_se.place | html %] [% END %][% IF ( result_se.copyrightdate ) %][% result_se.copyrightdate | html %], [% END %][% IF ( result_se.pages ) %][% result_se.pages | html %][% END %][% IF ( result_se.isbn ) %], <b>ISBN: </b>[% result_se.isbn | html %][% END %][% IF ( result_se.notes ) %],<br />[% result_se.notes | html %][% END %]</p>
55
56                     <table>
57                     [% FOREACH item_tabl IN result_se.item_table %]
58                     [% IF ( item_tabl.header_fields ) %]
59                         <thead>
60                             <tr>
61                                 [% FOREACH header_field IN item_tabl.header_fields %]
62                                     [% SWITCH header_field.field_label -%]
63                                         [% CASE "Add Item" -%]
64                                             <th>Add item</th>
65                                         [% CASE "Call Number" -%]
66                                             <th>Call number</th>
67                                         [% CASE "Accession Date" %]
68                                             <th>Accession date</th>
69                                         [% CASE "Barcode" %]
70                                             <th>Barcode</th>
71                                         [% CASE "Select" -%]
72                                             <th>Select</th>
73                                         [% CASE %]
74                                             <th>[% header_field.field_label | html %]</th>
75                                     [% END -%]
76                                 [% END %]
77                             </tr>
78                         </thead>
79                     [% ELSE %]
80                     <tr>
81                     [% FOREACH text_field IN item_tabl.text_fields %]
82                     [% IF ( text_field.select_field ) %]
83                         <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
84                     [% ELSIF ( text_field.link_field ) %]
85                         <td>
86                             <a class="btn btn-default btn-xs select_item" data-item-number="[% text_field.field_value | html %]" data-batch-id="[% batch_id | html %]" data-field-type="[% text_field.type | html %]"><i class="fa fa-plus"></i> Add</a>
87                         </td>
88                     [% ELSE %]
89                         <td>[% text_field.field_value | html %]</td>
90                     [% END %]
91                     [% END %]
92                     </tr>
93                     [% END %]
94                     [% END %]
95                     </table>
96                     </div>
97             [% END %]
98                 </div>
99             </form>
100         </div>
101         [% PROCESS pagination %]
102         <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
103     </div>
104
105 [% MACRO jsinclude BLOCK %]
106     [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %]
107     <script>
108         $(document).ready(function(){
109             $("#toolbar").fixFloat();
110             $("#CheckAll").click(function(e){
111                 e.preventDefault();
112                 $("input[type='checkbox']").prop("checked",true);
113             });
114             $("#CheckNone").click(function(e){
115                 e.preventDefault();
116                 $("input[type='checkbox']").prop("checked",false);
117             });
118             $("#add_items").on("click",function(){
119                 add_item('checked',[% batch_id | html %],'[% type | html %]');
120             });
121             $(".select_item").on("click",function(e){
122                 e.preventDefault();
123                 var batch_id = $(this).data("batch-id");
124                 var itemnumber = $(this).data("item-number");
125                 var type = $(this).data("field-type");
126                 add_item(itemnumber, batch_id, type);
127             });
128         });
129         function add_item(item_number,batch_id,type_id){
130             var p = window.opener;
131             if (item_number == 'checked') {
132                 items= new Array;
133                 if(document.resultform.action.length > 0) {
134                     for (var i=0; i < document.resultform.action.length; i++) {
135                         if (document.resultform.action[i].checked) {
136                             p.add_item(document.resultform.action[i].value);
137                         }
138                     }
139                 } else {
140                     p.add_item(document.resultform.action.value);
141                 }
142             }
143             else {
144                 p.add_item(item_number);
145             }
146         }
147     </script>
148 [% END %]
149
150 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]