Bug 27876: took away redundant heading in OPAC full serial issues
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-full-serial-issues.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% USE Branches %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Full subscription history for [% bibliotitle | html %] &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% BLOCK cssinclude %]
8     [% FILTER collapse %]
9     <style>
10         div.tabsub {
11             clear: both;
12         }
13         #filterform label {
14             font-weight: bold;
15         }
16         #filterform select {
17             width: 100%;
18         }
19         #subtabs a {
20             display: block;
21             float: left;
22             border: 1px solid #CCC;
23             padding: .2em .4em;
24             margin: .3em;
25             text-decoration: none;
26             font-size: 115%;
27         }
28
29         #subtabs strong {
30             display: block;
31             float: left;
32             font-size: 115%;
33             padding: .2em .4em;
34             margin: 0.3em 0;
35         }
36
37         #subtabs {
38             margin-top: 1em;
39         }
40         .action .btn {
41             font-size: 90%;
42             width: 100%;
43         }
44         .menu-collapse {
45             padding: .5em;
46         }
47         a.currentsubtab {
48             background-color: #FFC;
49         }
50     </style>
51     [% END %]
52 [% END %]
53 </head>
54 [% INCLUDE 'bodytag.inc' bodyid='opac-full-serial-issues' bodyclass='scrollto' %]
55 [% INCLUDE 'masthead.inc' %]
56
57     <div class="main">
58         <nav aria-label="breadcrumb">
59             <ul class="breadcrumb">
60                 <li class="breadcrumb-item">
61                     <a href="/cgi-bin/koha/opac-main.pl">Home</a>
62                 </li>
63                 <li class="breadcrumb-item">
64                     <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | uri %]">Details for [% bibliotitle | html %]</a>
65                 </li>
66                 <li class="breadcrumb-item active" aria-current="page">
67                     <a href="#">Full subscription history</a>
68                 </li>
69             </ul>
70         </nav>
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 action="/cgi-bin/koha/opac-serial-issues.pl" id="filterform">
78                             <h2><a href="#" class="menu-collapse-toggle">Refine your search</a></h2>
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="#" onclick="showlayer([% year.year | html %]); return false;">[% 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                                     <thead>
125                                         <tr>
126                                             <th>Date</th>
127                                             <th>Library</th>
128                                             <th>Notes</th>
129                                             <th>Date received</th>
130                                             <th>Number</th>
131                                             <th>Status</th>
132                                             <th>Subscription</th>
133                                         </tr>
134                                     </thead>
135                                     <tbody>
136                                         [% FOREACH serial IN year.serials %]
137                                             <tr>
138                                                 <td data-order="[% serial.publisheddate | html %]">
139                                                     [% IF ( serial.publisheddate ) %]
140                                                         [% IF serial.publisheddatetext %]
141                                                             [% serial.publisheddatetext | html %]
142                                                         [% ELSE %]
143                                                             [% serial.publisheddate | $KohaDates %]
144                                                         [% END %]
145                                                     [% ELSE %]
146                                                         &nbsp;
147                                                     [% END %]
148                                                 </td>
149                                                 <td class="libraryfilterclass">[% Branches.GetName( serial.branchcode ) | html %]</td>
150                                                 <td>[% serial.notes | html %]</td>
151                                                 [% IF ( serial.status2 && serial.planneddate ) %]
152                                                     <td data-order="[% serial.planneddate | html %]">
153                                                         [% serial.planneddate | $KohaDates %]
154                                                 [% ELSE %]
155                                                     <td data-order="9999-12-31">
156                                                         &nbsp;
157                                                 [% END %]
158                                                 </td>
159                                                 <td>[% serial.serialseq | html %]</td>
160                                                 <td>
161                                                     [% IF ( serial.status1 ) %]Expected[% END %]
162                                                     [% IF ( serial.status2 ) %]Arrived[% END %]
163                                                     [% IF ( serial.status3 ) %]Late[% END %]
164                                                     [% IF ( serial.status4 ) %]Missing[% END %]
165                                                         [% IF ( serial.status41 ) %]Missing (never received)[% END %]
166                                                         [% IF ( serial.status42 ) %]Missing (sold out)[% END %]
167                                                         [% IF ( serial.status43 ) %]Missing (damaged)[% END %]
168                                                         [% IF ( serial.status44 ) %]Missing (lost)[% END %]
169                                                     [% IF ( serial.status5 ) %]Not available[% END %]
170                                                     [% IF ( serial.status6 ) %]Delete[% END %]
171                                                     [% IF ( serial.status7 ) %]Claimed[% END %]
172                                                     [% IF ( serial.status8 ) %]Stopped[% END %]
173                                                 </td>
174                                                 <td class="subscriptionidfilterclass">[% serial.subscriptionid | html %]</td>
175                                             </tr>
176                                         [% END %]
177                                     </tbody>
178                                 </table>
179                             </div> <!-- / .yeardata tabsub -->
180                         [% END # / FOREACH year %]
181                     </div> <!-- / #fullserialissues -->
182                 </div> <!-- / .col-10 -->
183             </div> <!-- / .row -->
184         </div> <!-- / .container-fluid -->
185     </div> <!-- / .main -->
186
187 [% INCLUDE 'opac-bottom.inc' %]
188 [% BLOCK jsinclude %]
189     [% INCLUDE 'datatables.inc' %]
190     <script>
191         $(document).ready(function(){
192             showlayer([% yearmin | html %]);
193             $("a.tabsubs:first").addClass("currentsubtab");
194             $("#filterform").submit(function(){
195                 filterByLibrary();
196                 return false;
197             });
198             $("#libraryfilter").change(function(){
199                 filterByLibrary();
200             });
201             $("#subscriptionidfilter").change(function(){
202                 filterBySubscriptionId();
203             });
204             $("#reset").click(function(){
205                 clearFilters();
206             });
207             $("a.tabsubs").click(function(){
208                 $("a.tabsubs").removeClass("currentsubtab");
209                 $(this).addClass("currentsubtab");
210             });
211             $(".subscriptionstclass").dataTable($.extend(true, {}, dataTablesDefaults, {
212                 "order": [[ 0, "desc" ]]
213             }));
214         });
215
216         // Filters initialization
217         function initFilters() {
218             // Deleting everything from the library filter
219             $("#libraryfilter option").remove();
220
221             // Getting each branchcode from the currently displayed tab
222             var subarray = [];
223             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.libraryfilterclass").each(function() {
224                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
225             });
226
227             // Setting the option values with branchcodes
228             $("#libraryfilter").append('<option value="all">'+_("(All)")+'</option>');
229             for (var i = 0; i < subarray.length; i++) {
230                 $("#libraryfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
231             }
232         }
233
234         // Filter by Library
235         function filterByLibrary() {
236
237             selectedStatus = $("#libraryfilter").val();
238
239             // Reset the filters but keeps the selected library
240             clearFilters(true);
241
242             if (selectedStatus != 'all') {
243
244                 // We hide everything
245             $("table.subscriptionstclass tbody tr").hide();
246
247             // Then show the lines that match the currently selected library
248             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedStatus + ")").parent().show();
249
250
251             // We then prepare the subscription filter :
252
253             // Getting subscription id's for the selected library
254             var subarray = [];
255             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.subscriptionidfilterclass").each(function() {
256                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
257             });
258             // Setting the option values with subscription id's
259             $("#subscriptionidfilter").append('<option value="all">'+_("(All)")+'</option>');
260             for (var i = 0; i < subarray.length; i++) {
261                 $("#subscriptionidfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
262             }
263
264             // Subscription filtering is now ready
265             $("#subscriptionidfilter").removeAttr("disabled");
266             }
267         }
268
269         // Filter by subscription id
270         function filterBySubscriptionId() {
271
272             selectedSubscription = $("#subscriptionidfilter").val();
273             selectedLibrary      = $("#libraryfilter").val();
274
275             if (selectedSubscription == "all") {
276             clearFilters(true);
277             filterByLibrary();
278             } else {
279
280             // We hide everything
281             $("table.subscriptionstclass tbody tr").hide();
282
283             // Then show the lines that match the currently selected library
284             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedLibrary + ")").parent().show();
285
286             // Then hide the lines where the subscription id does not match the selected one
287             $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass").not(
288                 $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass:contains(" + selectedSubscription + ")")
289             ).parent().hide();
290             }
291         }
292
293         // Clears filters : reset everything
294         // (Though preserves the selected library if the keeplibrary parameter is set to true)
295         function clearFilters(keeplibrary) {
296             // Show all content
297             $("table.subscriptionstclass tbody tr").show();
298
299             // Remove old subscription options
300             $("#subscriptionidfilter option").remove();
301             $("#subscriptionidfilter option").append('<option value="all">'+_("(All)")+'</option>');
302             $("#subscriptionidfilter").attr("disabled", "disabled");
303
304             if (keeplibrary != true) {
305             // Reinit library options
306             initFilters();
307             $("#libraryfilter option[value=all]").attr("selected", "selected");
308             }
309         }
310
311         function showlayer(numlayer){
312             $(".yeardata").each(function(){
313                 ong = $(this).attr("id");
314                 if(ong == "show"+numlayer){
315                     $(this).show();
316                     currentYear = ong;
317                 } else  {
318                     $(this).hide();
319                 }
320             });
321             clearFilters();
322         }
323     </script>
324 [% END %]