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