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