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