Bug 34116: Add page-sectioning to item search in label creator
[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>Search results &rsaquo; Barcodes and labels &rsaquo; Koha</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         [% IF ( results ) %]
34             <h3>Results [% from | html %] through [% to | html %] [% IF ( total ) %] of [% total | html %][% END %]</h3>
35         [% ELSE %]
36             <h3>No results found</h3>
37         [% END %]
38         <div class="results">
39             [% PROCESS pagination %]
40
41             <form name="resultform" action="" style="display:block">
42             <div id="toolbar" class="btn-toolbar">
43                 <div class="btn-group"><button type="button" class="btn btn-default" id="add_items"><i class="fa fa-plus"></i> Add checked</button></div>
44                 <div class="btn-group"><a href="#" class="btn btn-default close"><i class="fa fa-times-circle"></i> Done</a></div>
45             </div>
46
47             <div id="selection_ops">
48                 <a id="CheckAll" class="btn btn-link" href="#"><i class="fa fa-check"></i> Select all</a>
49                 <a id="CheckNone" class="btn btn-link"  href="#"><i class="fa fa-remove"></i> Clear all</a>
50             </div>
51
52                 <div id="label-search-results" class="page-section">
53                 <input type="hidden" name="ccl_query" value="[% ccl_query | html %]" />
54             [% FOREACH result_se IN result_set %]
55             <div style="border-bottom:1px solid #CCC;padding:1em 0;">
56                     <h4>[% result_se.title | html %]</h4>
57                             <p>[% IF ( result_se.author ) %]by [% result_se.author | html %][% END %]
58                             [[% 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>
59
60                     <table>
61                     [% FOREACH item_tabl IN result_se.item_table %]
62                     [% IF ( item_tabl.header_fields ) %]
63                         <thead>
64                             <tr>
65                                 [% FOREACH header_field IN item_tabl.header_fields %]
66                                     [% SWITCH header_field.field_label -%]
67                                         [% CASE "Add Item" -%]
68                                             <th>Add item</th>
69                                         [% CASE "Call Number" -%]
70                                             <th>Call number</th>
71                                         [% CASE "Accession Date" %]
72                                             <th>Accession date</th>
73                                         [% CASE "Barcode" %]
74                                             <th>Barcode</th>
75                                         [% CASE "Select" -%]
76                                             <th>Select</th>
77                                         [% CASE %]
78                                             <th>[% header_field.field_label | html %]</th>
79                                     [% END -%]
80                                 [% END %]
81                             </tr>
82                         </thead>
83                     [% ELSE %]
84                     <tr>
85                     [% FOREACH text_field IN item_tabl.text_fields %]
86                     [% IF ( text_field.select_field ) %]
87                         <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
88                     [% ELSIF ( text_field.link_field ) %]
89                         <td>
90                             <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>
91                         </td>
92                     [% ELSE %]
93                         <td>[% text_field.field_value | html %]</td>
94                     [% END %]
95                     [% END %]
96                     </tr>
97                     [% END %]
98                     [% END %]
99                     </table>
100                     </div>
101             [% END %]
102                 </div>
103             </form>
104         </div>
105         [% PROCESS pagination %]
106         <div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
107     </div>
108
109 [% MACRO jsinclude BLOCK %]
110     [% Asset.js("lib/hc-sticky.js") | $raw %]
111     <script>
112         var Sticky;
113         $(document).ready(function(){
114             Sticky = $("#toolbar");
115             Sticky.hcSticky({
116                 stickTo: "form",
117                 stickyClass: "floating"
118             });
119             $("#CheckAll").click(function(e){
120                 e.preventDefault();
121                 $("input[type='checkbox']").prop("checked",true);
122             });
123             $("#CheckNone").click(function(e){
124                 e.preventDefault();
125                 $("input[type='checkbox']").prop("checked",false);
126             });
127             $("#add_items").on("click",function(){
128                 add_item('checked',[% batch_id | html %],'[% type | html %]');
129             });
130             $(".select_item").on("click",function(e){
131                 e.preventDefault();
132                 var batch_id = $(this).data("batch-id");
133                 var itemnumber = $(this).data("item-number");
134                 var type = $(this).data("field-type");
135                 add_item(itemnumber, batch_id, type);
136             });
137         });
138         function add_item(item_number,batch_id,type_id){
139             var p = window.opener;
140             if (item_number == 'checked') {
141                 items= new Array;
142                 if(document.resultform.action.length > 0) {
143                     for (var i=0; i < document.resultform.action.length; i++) {
144                         if (document.resultform.action[i].checked) {
145                             p.add_item(document.resultform.action[i].value);
146                         }
147                     }
148                 } else {
149                     p.add_item(document.resultform.action.value);
150                 }
151             }
152             else {
153                 p.add_item(item_number);
154             }
155         }
156     </script>
157 [% END %]
158
159 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]