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