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