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