Bug 2093: (follow-up) Add OPAC dashboard for logged-in users
[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 | html %]">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 | html %]">Normal view</a></span>
52                                 <span class="view"><a id="Briefhistory" href="/cgi-bin/koha/opac-serial-issues.pl?biblionumber=[% biblionumber | html %]&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 %]">
90                                                             [% IF serial.publisheddatetext %]
91                                                                 [% serial.publisheddatetext %]
92                                                             [% ELSE %]
93                                                                 [% serial.publisheddate | $KohaDates %]
94                                                             [% END %]
95                                                         </span>
96                                                     [% ELSE %]
97                                                         &nbsp;
98                                                     [% END %]
99                                                 </td>
100                                                 <td class="libraryfilterclass">[% Branches.GetName( serial.branchcode ) %]</td>
101                                                 <td>[% serial.notes %]</td>
102                                                 <td>
103                                                     [% IF ( serial.status2 && serial.planneddate ) %]
104                                                         <span title="[% serial.planneddate %]">[% serial.planneddate | $KohaDates %]</span>
105                                                     [% ELSE %]
106                                                         <span title="9999-12-31">&nbsp;</span>
107                                                     [% END %]
108                                                 </td>
109                                                 <td>[% serial.serialseq %]</td>
110                                                 <td>
111                                                     [% IF ( serial.status1 ) %]Expected[% END %]
112                                                     [% IF ( serial.status2 ) %]Arrived[% END %]
113                                                     [% IF ( serial.status3 ) %]Late[% END %]
114                                                     [% IF ( serial.status4 ) %]Missing[% END %]
115                                                         [% IF ( serial.status41 ) %]Missing (never received)[% END %]
116                                                         [% IF ( serial.status42 ) %]Missing (sold out)[% END %]
117                                                         [% IF ( serial.status43 ) %]Missing (damaged)[% END %]
118                                                         [% IF ( serial.status44 ) %]Missing (lost)[% END %]
119                                                     [% IF ( serial.status5 ) %]Not available[% END %]
120                                                     [% IF ( serial.status6 ) %]Delete[% END %]
121                                                     [% IF ( serial.status7 ) %]Claimed[% END %]
122                                                     [% IF ( serial.status8 ) %]Stopped[% END %]
123                                                 </td>
124                                                 <td class="subscriptionidfilterclass">[% serial.subscriptionid %]</td>
125                                             </tr>
126                                         [% END %]
127                                     </tbody>
128                                 </table>
129                             </div> <!-- / .yeardata tabsub -->
130                         [% END # / FOREACH year %]
131                     </div> <!-- / #fullserialissues -->
132                 </div> <!-- / .span10 -->
133             </div> <!-- / .row-fluid -->
134         </div> <!-- / .container-fluid -->
135     </div> <!-- / .main -->
136
137 [% INCLUDE 'opac-bottom.inc' %]
138 [% BLOCK jsinclude %]
139 [% INCLUDE 'datatables.inc' %]
140 <script type="text/javascript">
141     //<![CDATA[
142         $(document).ready(function(){
143             showlayer([% yearmin %]);
144             $("a.tabsubs:first").addClass("currentsubtab");
145             $("#filterform").submit(function(){
146                 filterByLibrary();
147                 return false;
148             });
149             $("#libraryfilter").change(function(){
150                 filterByLibrary();
151             });
152             $("#subscriptionidfilter").change(function(){
153                 filterBySubscriptionId();
154             });
155             $("#reset").click(function(){
156                 clearFilters();
157             });
158             $("a.tabsubs").click(function(){
159                 $("a.tabsubs").removeClass("currentsubtab");
160                 $(this).addClass("currentsubtab");
161             });
162             $(".subscriptionstclass").dataTable($.extend(true, {}, dataTablesDefaults, {
163                 "aaSorting": [[ 0, "desc" ]],
164                 "aoColumns": [
165                     { "sType": "title-string" },
166                     null,
167                     null,
168                     { "sType": "title-string" },
169                     null,
170                     null,
171                     null
172                 ]
173             }));
174         });
175
176         // Filters initialization
177         function initFilters() {
178             // Deleting everything from the library filter
179             $("#libraryfilter option").remove();
180
181             // Getting each branchcode from the currently displayed tab
182             var subarray = [];
183             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.libraryfilterclass").each(function() {
184                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
185             });
186
187             // Setting the option values with branchcodes
188             $("#libraryfilter").append('<option value="all">'+_("(All)")+'</option>');
189             for (var i = 0; i < subarray.length; i++) {
190                 $("#libraryfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
191             }
192         }
193
194         // Filter by Library
195
196         function filterByLibrary() {
197
198             selectedStatus = $("#libraryfilter").val();
199
200             // Reset the filters but keeps the selected library
201             clearFilters(true);
202
203             if (selectedStatus != 'all') {
204
205                 // We hide everything
206             $("table.subscriptionstclass tbody tr").hide();
207
208             // Then show the lines that match the currently selected library
209             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedStatus + ")").parent().show();
210
211
212             // We then prepare the subscription filter :
213
214             // Getting subscription id's for the selected library
215             var subarray = [];
216             $("div#" + currentYear + " table.subscriptionstclass tbody tr:visible td.subscriptionidfilterclass").each(function() {
217                 if (subarray.indexOf($(this).text()) == -1) { subarray.push($(this).text()); }
218             });
219             // Setting the option values with subscription id's
220             $("#subscriptionidfilter").append('<option value="all">'+_("(All)")+'</option>');
221             for (var i = 0; i < subarray.length; i++) {
222                 $("#subscriptionidfilter").append('<option value="' + subarray[i] + '">' + subarray[i] + '</option>');
223             }
224
225             // Subscription filtering is now ready
226             $("#subscriptionidfilter").removeAttr("disabled");
227             }
228         }
229
230         // Filter by subscription id
231         function filterBySubscriptionId() {
232
233             selectedSubscription = $("#subscriptionidfilter").val();
234             selectedLibrary      = $("#libraryfilter").val();
235
236             if (selectedSubscription == "all") {
237             clearFilters(true);
238             filterByLibrary();
239             } else {
240
241             // We hide everything
242             $("table.subscriptionstclass tbody tr").hide();
243
244             // Then show the lines that match the currently selected library
245             $("table.subscriptionstclass tbody tr td.libraryfilterclass:contains(" + selectedLibrary + ")").parent().show();
246
247             // Then hide the lines where the subscription id does not match the selected one
248             $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass").not(
249                 $("table.subscriptionstclass tbody tr td.subscriptionidfilterclass:contains(" + selectedSubscription + ")")
250             ).parent().hide();
251             }
252         }
253
254         // Clears filters : reset everything
255         // (Though preserves the selected library if the keeplibrary parameter is set to true)
256         function clearFilters(keeplibrary) {
257
258             // Show all content
259             $("table.subscriptionstclass tbody tr").show();
260
261             // Remove old subscription options
262             $("#subscriptionidfilter option").remove();
263             $("#subscriptionidfilter option").append('<option value="all">'+_("(All)")+'</option>');
264             $("#subscriptionidfilter").attr("disabled", "disabled");
265
266             if (keeplibrary != true) {
267             // Reinit library options
268             initFilters();
269             $("#libraryfilter option[value=all]").attr("selected", "selected");
270             }
271         }
272         function showlayer(numlayer){
273             $(".yeardata").each(function(){
274                 ong = $(this).attr("id");
275                 if(ong == "show"+numlayer){
276                     $(this).show();
277                     currentYear = ong;
278                 } else  {
279                     $(this).hide();
280                 }
281             });
282             clearFilters();
283         }
284     //]]>
285 </script>
286 [% END %]