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