Bug 27610: Changed pages of OPAC to have a <h1>
[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</h1>
101                             <h2>Full subscription history for [% bibliotitle | html %]</h2>
102                             <div id="views">
103                                 <span class="view"><a id="Normalview" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]">Normal view</a></span>
104                                 <span class="view"><a id="Briefhistory" href="/cgi-bin/koha/opac-serial-issues.pl?biblionumber=[% biblionumber | html %]&amp;selectview=small">Brief history</a></span>
105                                 <span class="view"><span id="Fullhistory">Full history</span></span>
106                             </div>
107                         [% END %]
108
109                         <div id="subtabs">
110                             <strong>Show year: </strong>
111                             [% FOREACH year IN years %]
112                                 [% IF ( year.year ) %]
113                                     <a class="tabsubs" href="#" onclick="showlayer([% year.year | html %]); return false;">[% year.year | html %]</a>
114                                 [% END %]
115                             [% END %]
116                         </div>
117
118                         [% FOREACH year IN years %]
119                             [% IF loop.first %]
120                                 <div class="yeardata tabsub" id="show[% year.year | html %]" style="display:block">
121                             [% ELSE %]
122                                 <div class="yeardata tabsub" id="show[% year.year | html %]" style="display:none">
123                             [% END %]
124                                 <table class="subscriptionstclass table table-bordered table-striped">
125                                     <thead>
126                                         <tr>
127                                             <th>Date</th>
128                                             <th>Library</th>
129                                             <th>Notes</th>
130                                             <th>Date received</th>
131                                             <th>Number</th>
132                                             <th>Status</th>
133                                             <th>Subscription</th>
134                                         </tr>
135                                     </thead>
136                                     <tbody>
137                                         [% FOREACH serial IN year.serials %]
138                                             <tr>
139                                                 <td>
140                                                     [% IF ( serial.publisheddate ) %]
141                                                         <span title="[% serial.publisheddate | html %]">
142                                                             [% IF serial.publisheddatetext %]
143                                                                 [% serial.publisheddatetext | html %]
144                                                             [% ELSE %]
145                                                                 [% serial.publisheddate | $KohaDates %]
146                                                             [% END %]
147                                                         </span>
148                                                     [% ELSE %]
149                                                         &nbsp;
150                                                     [% END %]
151                                                 </td>
152                                                 <td class="libraryfilterclass">[% Branches.GetName( serial.branchcode ) | html %]</td>
153                                                 <td>[% serial.notes | html %]</td>
154                                                 <td>
155                                                     [% IF ( serial.status2 && serial.planneddate ) %]
156                                                         <span title="[% serial.planneddate | html %]">[% serial.planneddate | $KohaDates %]</span>
157                                                     [% ELSE %]
158                                                         <span title="9999-12-31">&nbsp;</span>
159                                                     [% END %]
160                                                 </td>
161                                                 <td>[% serial.serialseq | html %]</td>
162                                                 <td>
163                                                     [% IF ( serial.status1 ) %]Expected[% END %]
164                                                     [% IF ( serial.status2 ) %]Arrived[% END %]
165                                                     [% IF ( serial.status3 ) %]Late[% END %]
166                                                     [% IF ( serial.status4 ) %]Missing[% END %]
167                                                         [% IF ( serial.status41 ) %]Missing (never received)[% END %]
168                                                         [% IF ( serial.status42 ) %]Missing (sold out)[% END %]
169                                                         [% IF ( serial.status43 ) %]Missing (damaged)[% END %]
170                                                         [% IF ( serial.status44 ) %]Missing (lost)[% END %]
171                                                     [% IF ( serial.status5 ) %]Not available[% END %]
172                                                     [% IF ( serial.status6 ) %]Delete[% END %]
173                                                     [% IF ( serial.status7 ) %]Claimed[% END %]
174                                                     [% IF ( serial.status8 ) %]Stopped[% END %]
175                                                 </td>
176                                                 <td class="subscriptionidfilterclass">[% serial.subscriptionid | html %]</td>
177                                             </tr>
178                                         [% END %]
179                                     </tbody>
180                                 </table>
181                             </div> <!-- / .yeardata tabsub -->
182                         [% END # / FOREACH year %]
183                     </div> <!-- / #fullserialissues -->
184                 </div> <!-- / .col-10 -->
185             </div> <!-- / .row -->
186         </div> <!-- / .container-fluid -->
187     </div> <!-- / .main -->
188
189 [% INCLUDE 'opac-bottom.inc' %]
190 [% BLOCK jsinclude %]
191     [% INCLUDE 'datatables.inc' %]
192     <script>
193         $(document).ready(function(){
194             showlayer([% yearmin | html %]);
195             $("a.tabsubs:first").addClass("currentsubtab");
196             $("#filterform").submit(function(){
197                 filterByLibrary();
198                 return false;
199             });
200             $("#libraryfilter").change(function(){
201                 filterByLibrary();
202             });
203             $("#subscriptionidfilter").change(function(){
204                 filterBySubscriptionId();
205             });
206             $("#reset").click(function(){
207                 clearFilters();
208             });
209             $("a.tabsubs").click(function(){
210                 $("a.tabsubs").removeClass("currentsubtab");
211                 $(this).addClass("currentsubtab");
212             });
213             $(".subscriptionstclass").dataTable($.extend(true, {}, dataTablesDefaults, {
214                 "order": [[ 0, "desc" ]],
215                 "columns": [
216                     { "type": "title-string" },
217                     null,
218                     null,
219                     { "type": "title-string" },
220                     null,
221                     null,
222                     null
223                 ]
224             }));
225         });
226
227         // Filters initialization
228         function initFilters() {
229             // Deleting everything from the library filter
230             $("#libraryfilter option").remove();
231
232             // Getting each branchcode from the currently displayed tab
233             var subarray = [];
234             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.libraryfilterclass").each(function() {
235                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
236             });
237
238             // Setting the option values with branchcodes
239             $("#libraryfilter").append('<option value="all">'+_("(All)")+'</option>');
240             for (var i = 0; i < subarray.length; i++) {
241                 $("#libraryfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
242             }
243         }
244
245         // Filter by Library
246         function filterByLibrary() {
247
248             selectedStatus = $("#libraryfilter").val();
249
250             // Reset the filters but keeps the selected library
251             clearFilters(true);
252
253             if (selectedStatus != 'all') {
254
255                 // We hide everything
256             $("table.subscriptionstclass tbody tr").hide();
257
258             // Then show the lines that match the currently selected library
259             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedStatus + ")").parent().show();
260
261
262             // We then prepare the subscription filter :
263
264             // Getting subscription id's for the selected library
265             var subarray = [];
266             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.subscriptionidfilterclass").each(function() {
267                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
268             });
269             // Setting the option values with subscription id's
270             $("#subscriptionidfilter").append('<option value="all">'+_("(All)")+'</option>');
271             for (var i = 0; i < subarray.length; i++) {
272                 $("#subscriptionidfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
273             }
274
275             // Subscription filtering is now ready
276             $("#subscriptionidfilter").removeAttr("disabled");
277             }
278         }
279
280         // Filter by subscription id
281         function filterBySubscriptionId() {
282
283             selectedSubscription = $("#subscriptionidfilter").val();
284             selectedLibrary      = $("#libraryfilter").val();
285
286             if (selectedSubscription == "all") {
287             clearFilters(true);
288             filterByLibrary();
289             } else {
290
291             // We hide everything
292             $("table.subscriptionstclass tbody tr").hide();
293
294             // Then show the lines that match the currently selected library
295             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedLibrary + ")").parent().show();
296
297             // Then hide the lines where the subscription id does not match the selected one
298             $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass").not(
299                 $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass:contains(" + selectedSubscription + ")")
300             ).parent().hide();
301             }
302         }
303
304         // Clears filters : reset everything
305         // (Though preserves the selected library if the keeplibrary parameter is set to true)
306         function clearFilters(keeplibrary) {
307             // Show all content
308             $("table.subscriptionstclass tbody tr").show();
309
310             // Remove old subscription options
311             $("#subscriptionidfilter option").remove();
312             $("#subscriptionidfilter option").append('<option value="all">'+_("(All)")+'</option>');
313             $("#subscriptionidfilter").attr("disabled", "disabled");
314
315             if (keeplibrary != true) {
316             // Reinit library options
317             initFilters();
318             $("#libraryfilter option[value=all]").attr("selected", "selected");
319             }
320         }
321
322         function showlayer(numlayer){
323             $(".yeardata").each(function(){
324                 ong = $(this).attr("id");
325                 if(ong == "show"+numlayer){
326                     $(this).show();
327                     currentYear = ong;
328                 } else  {
329                     $(this).hide();
330                 }
331             });
332             clearFilters();
333         }
334     </script>
335 [% END %]