Bug 34478: Add method="get" to forms without method
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-full-serial-issues.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE AdditionalContents %]
6 [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7 [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
8 [% USE AuthorisedValues %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Full subscription history for [% bibliotitle | html %] &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% BLOCK cssinclude %]
13     [% FILTER collapse %]
14     <style>
15         div.tabsub {
16             clear: both;
17         }
18         #filterform label {
19             font-weight: bold;
20         }
21         #filterform select {
22             width: 100%;
23         }
24         #subtabs a {
25             display: block;
26             float: left;
27             border: 1px solid #CCC;
28             padding: .2em .4em;
29             margin: .3em;
30             text-decoration: none;
31             font-size: 115%;
32         }
33
34         #subtabs strong {
35             display: block;
36             float: left;
37             font-size: 115%;
38             padding: .2em .4em;
39             margin: 0.3em 0;
40         }
41
42         #subtabs {
43             margin-top: 1em;
44         }
45         .action .btn {
46             font-size: 90%;
47             width: 100%;
48         }
49         .menu-collapse {
50             padding: .5em;
51         }
52         a.currentsubtab {
53             background-color: #FFC;
54         }
55     </style>
56     [% END %]
57 [% END %]
58 </head>
59 [% INCLUDE 'bodytag.inc' bodyid='opac-full-serial-issues' bodyclass='scrollto' %]
60 [% INCLUDE 'masthead.inc' %]
61
62     <div class="main">
63         [% WRAPPER breadcrumbs %]
64             [% WRAPPER breadcrumb_item %]
65                 <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | uri %]">Details for [% bibliotitle | html %]</a>
66             [% END %]
67             [% WRAPPER breadcrumb_item bc_active= 1 %]
68                 <span>Full subscription history</span>
69             [% END %]
70         [% END #/ WRAPPER breadcrumbs %]
71
72         <div class="container-fluid">
73             <div class="row">
74                 <div class="col-lg-2">
75                     <div id="searchfacetscontainer">
76                         <div id="search-facets">
77                             <form method="get" action="/cgi-bin/koha/opac-serial-issues.pl" id="filterform">
78                                 <legend><h2><a href="#" class="menu-collapse-toggle">Refine your search</a></h2></legend>
79                             <ul class="menu-collapse">
80                                 <li>
81                                     <label for="libraryfilter">Library: </label>
82                                     <select id="libraryfilter" name="libraryfilter"></select>
83                                     <label for="subscriptionidfilter">Subscription: </label>
84                                     <select id="subscriptionidfilter" name="subscriptionfilter" disabled="disabled"></select>
85                                 </li>
86                                 <li class="action">
87                                     <input type="reset" id="reset" class="btn btn-primary" value="Clear" />
88                                 </li>
89                             </ul>
90                             </form>
91                         </div> <!-- / #search-facets -->
92                     </div> <!-- / #searchfacetscontainer -->
93                     <div id="navigation">
94                         [% INCLUDE 'navigation.inc' %]
95                     </div>
96                 </div> <!-- / .col-lg-2 -->
97                 <div class="col-10 order-first order-md-first order-lg-2">
98                     <div id="fullserialissues" class="maincontent">
99                         [% UNLESS ( popup ) %]
100                             <h1>Full subscription history for [% bibliotitle | html %]</h1>
101                             <div id="views">
102                                 <span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]">Normal view</a></span>
103                                 <span class="view"><a id="Briefhistory" href="/cgi-bin/koha/opac-serial-issues.pl?biblionumber=[% biblionumber | html %]&amp;selectview=small">Brief history</a></span>
104                                 <span class="view"><span id="Fullhistory">Full history</span></span>
105                             </div>
106                         [% END %]
107
108                         <div id="subtabs">
109                             <strong>Show year: </strong>
110                             [% FOREACH year IN years %]
111                                 [% IF ( year.year ) %]
112                                     <a class="tabsubs" href="#" data-year="[% year.year | html %]">[% year.year | html %]</a>
113                                 [% END %]
114                             [% END %]
115                         </div>
116
117                         [% FOREACH year IN years %]
118                             [% IF loop.first %]
119                                 <div class="yeardata tabsub" id="show[% year.year | html %]" style="display:block">
120                             [% ELSE %]
121                                 <div class="yeardata tabsub" id="show[% year.year | html %]" style="display:none">
122                             [% END %]
123                                 <table class="subscriptionstclass table table-bordered table-striped">
124                                     <caption class="sr-only">Subscriptions</caption>
125                                     <thead>
126                                         <tr>
127                                             <th>Date</th>
128                                             <th>Library</th>
129                                             <th>Location</th>
130                                             <th>Notes</th>
131                                             <th>Date received</th>
132                                             <th>Number</th>
133                                             <th>Status</th>
134                                             <th>Subscription</th>
135                                         </tr>
136                                     </thead>
137                                     <tbody>
138                                         [% FOREACH serial IN year.serials %]
139                                             <tr>
140                                                 <td data-order="[% serial.publisheddate | html %]">
141                                                     [% IF ( serial.publisheddate ) %]
142                                                         [% IF serial.publisheddatetext %]
143                                                             [% serial.publisheddatetext | html %]
144                                                         [% ELSE %]
145                                                             [% serial.publisheddate | $KohaDates %]
146                                                         [% END %]
147                                                     [% ELSE %]
148                                                         &nbsp;
149                                                     [% END %]
150                                                 </td>
151                                                 <td class="libraryfilterclass">[% Branches.GetName( serial.branchcode ) | html %]</td>
152                                                 <td>[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => serial.location, opac => 1 ) | html %]</td>
153                                                 <td>[% serial.notes | html %]</td>
154                                                 [% IF ( serial.status2 && serial.planneddate ) %]
155                                                     <td data-order="[% serial.planneddate | html %]">
156                                                         [% serial.planneddate | $KohaDates %]
157                                                 [% ELSE %]
158                                                     <td data-order="9999-12-31">
159                                                         &nbsp;
160                                                 [% END %]
161                                                 </td>
162                                                 <td>[% serial.serialseq | html %]</td>
163                                                 <td>
164                                                     [% INCLUDE 'serial-status.inc' serial = serial %]
165                                                 </td>
166                                                 <td class="subscriptionidfilterclass">[% serial.subscriptionid | html %]</td>
167                                             </tr>
168                                         [% END %]
169                                     </tbody>
170                                 </table>
171                             </div> <!-- / .yeardata tabsub -->
172                         [% END # / FOREACH year %]
173                     </div> <!-- / #fullserialissues -->
174                 </div> <!-- / .col-10 -->
175             </div> <!-- / .row -->
176         </div> <!-- / .container-fluid -->
177     </div> <!-- / .main -->
178
179 [% INCLUDE 'opac-bottom.inc' %]
180 [% BLOCK jsinclude %]
181     [% INCLUDE 'datatables.inc' %]
182     <script>
183         $(document).ready(function(){
184             showlayer([% yearmin | html %]);
185             $("a.tabsubs:first").addClass("currentsubtab");
186             $("#filterform").submit(function(){
187                 filterByLibrary();
188                 return false;
189             });
190             $("#libraryfilter").change(function(){
191                 filterByLibrary();
192             });
193             $("#subscriptionidfilter").change(function(){
194                 filterBySubscriptionId();
195             });
196             $("#reset").click(function(){
197                 clearFilters();
198             });
199             $("a.tabsubs").on("click", function(e){
200                 e.preventDefault();
201                 let year = $(this).data("year");
202                 $("a.tabsubs").removeClass("currentsubtab");
203                 $(this).addClass("currentsubtab");
204                 showlayer( year );
205             });
206             $(".subscriptionstclass").dataTable($.extend(true, {}, dataTablesDefaults, {
207                 "order": [[ 0, "desc" ]]
208             }));
209         });
210
211         // Filters initialization
212         function initFilters() {
213             // Deleting everything from the library filter
214             $("#libraryfilter option").remove();
215
216             // Getting each branchcode from the currently displayed tab
217             var subarray = [];
218             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.libraryfilterclass").each(function() {
219                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
220             });
221
222             // Setting the option values with branchcodes
223             $("#libraryfilter").append('<option value="all">'+_("(All)")+'</option>');
224             for (var i = 0; i < subarray.length; i++) {
225                 $("#libraryfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
226             }
227         }
228
229         // Filter by Library
230         function filterByLibrary() {
231
232             selectedStatus = $("#libraryfilter").val();
233
234             // Reset the filters but keeps the selected library
235             clearFilters(true);
236
237             if (selectedStatus != 'all') {
238
239                 // We hide everything
240             $("table.subscriptionstclass tbody tr").hide();
241
242             // Then show the lines that match the currently selected library
243             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedStatus + ")").parent().show();
244
245
246             // We then prepare the subscription filter :
247
248             // Getting subscription id's for the selected library
249             var subarray = [];
250             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.subscriptionidfilterclass").each(function() {
251                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
252             });
253             // Setting the option values with subscription id's
254             $("#subscriptionidfilter").append('<option value="all">'+_("(All)")+'</option>');
255             for (var i = 0; i < subarray.length; i++) {
256                 $("#subscriptionidfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
257             }
258
259             // Subscription filtering is now ready
260             $("#subscriptionidfilter").removeAttr("disabled");
261             }
262         }
263
264         // Filter by subscription id
265         function filterBySubscriptionId() {
266
267             selectedSubscription = $("#subscriptionidfilter").val();
268             selectedLibrary      = $("#libraryfilter").val();
269
270             if (selectedSubscription == "all") {
271             clearFilters(true);
272             filterByLibrary();
273             } else {
274
275             // We hide everything
276             $("table.subscriptionstclass tbody tr").hide();
277
278             // Then show the lines that match the currently selected library
279             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedLibrary + ")").parent().show();
280
281             // Then hide the lines where the subscription id does not match the selected one
282             $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass").not(
283                 $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass:contains(" + selectedSubscription + ")")
284             ).parent().hide();
285             }
286         }
287
288         // Clears filters : reset everything
289         // (Though preserves the selected library if the keeplibrary parameter is set to true)
290         function clearFilters(keeplibrary) {
291             // Show all content
292             $("table.subscriptionstclass tbody tr").show();
293
294             // Remove old subscription options
295             $("#subscriptionidfilter option").remove();
296             $("#subscriptionidfilter option").append('<option value="all">'+_("(All)")+'</option>');
297             $("#subscriptionidfilter").attr("disabled", "disabled");
298
299             if (keeplibrary != true) {
300             // Reinit library options
301             initFilters();
302             $("#libraryfilter option[value=all]").attr("selected", "selected");
303             }
304         }
305
306         function showlayer(numlayer){
307             $(".yeardata").each(function(){
308                 ong = $(this).attr("id");
309                 if(ong == "show"+numlayer){
310                     $(this).show();
311                     currentYear = ong;
312                 } else  {
313                     $(this).hide();
314                 }
315             });
316             clearFilters();
317         }
318     </script>
319 [% END %]