Bug 10430 - status filter not working in serial claims when translated
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
3     [% INCLUDE 'doc-head-close.inc' %]
4 [% INCLUDE 'calendar.inc' %]
5 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" />
6 <script type="text/javascript" src="[% interface %]/[% theme %]/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7 [% INCLUDE 'datatables-strings.inc' %]
8 <script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
9 <script type="text/javascript">
10 //<![CDATA[
11     [% IF (dateformat == 'metric') %]dt_add_type_uk_date();[% END %]
12          $(document).ready(function() {
13         [% UNLESS ( preview ) %]
14          var sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
15             "sDom": 't',
16             "aoColumnDefs": [
17                 { "aTargets": [ 0,1,-1 ], "bSortable": false, "bSearchable": false }
18             ],
19             "bPaginate": false
20         }));
21         [% END %]
22             $('#supplierid').change(function() {
23             $('#claims').submit();
24             });
25
26             // Checkboxes : Select All / None
27             $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
28             $("span.exportSelected").html("<a id=\"ExportSelected\" href=\"/cgi-bin/koha/serials/claims.pl\"> "+_("Export selected items data") +"<\/a>");
29
30         $("#CheckAll").click(function() {
31             $("#claimst tr:visible :checkbox").attr('checked', $("#CheckAll").is(':checked'));
32         });
33
34             // Generates a dynamic link for exporting the selection's data as CSV
35             $("#ExportSelected").click(function() {
36                // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error.
37              var selected = $("input[name=serialid]:checked");
38
39                 if (selected.length == 0) {
40                         alert(_("Please select at least one item to export."));
41                         return false;
42                 }
43                 
44                 // Building the url from currently checked boxes
45                 var url = '/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=&amp;op=claims';
46                 for (var i = 0; i < selected.length; i++) {
47                     url += '&amp;serialid=' + selected[i].value;
48                 }
49                 // And redirecting to the CSV page
50                 location.href = url;
51                 return false;
52             }); 
53
54         $("#titlefilter").keyup( function () {
55             sTable.fnFilter( this.value, 3 ); // 3 is position of title column
56         } );
57
58         $("#branchfilter").keyup(function() {
59             sTable.fnFilter( this.value, 2 ); // 2 is the position of the author column
60             });
61          });
62
63         // Checks if the form can be sent (at least one checkbox must be checked)
64         function checkForm() {
65             if ($("input:checked").length == 0) {
66                 alert(_("Please select at least one item."));
67                 return false;
68             }
69         }
70
71     // Filter by status
72     function filterByStatus() {
73         selectedStatus = $("#statusfilter").val();
74         if (selectedStatus == "all") {
75             clearFilters();
76         } else {
77             $("table#claimst tbody tr").hide();
78             $("table#claimst tbody tr").each( function() {
79                 if ( $(this).find("span.status-" + selectedStatus).size() > 0 ) {
80                     $(this).show();
81                 }
82             });
83         }
84     }
85
86         // Filter by branch
87         function filterByBranch() {
88             selectedBranch = $("#branchfilter").val();
89             if (selectedBranch == "all") {
90                 clearFilters();
91             } else {
92                 $("table#claimst tbody tr").hide();
93                 $("table#claimst tbody tr:contains(" + selectedBranch + ")").show();
94             }
95         }
96         // Filter by date
97         function filterByDate() {
98         var beginDate = Date_from_syspref($("#from").val()).getTime();
99         var endDate   = Date_from_syspref($("#to").val()).getTime();
100             
101             // Checks if the beginning date is valid
102             if (!parseInt(beginDate)) {
103                 alert(_("The beginning date is missing or invalid."));
104                 return false;
105             }
106
107             // Checks if the ending date is valid
108             if (!parseInt(endDate)) {
109                 alert(_("The ending date is missing or invalid."));
110                 return false;
111             }
112
113             // Checks if beginning date is before ending date
114             if (beginDate > endDate) {
115                 // If not, we swap them
116                 var tmpDate = endDate;
117                 endDate = beginDate;
118                 beginDate = tmpDate;
119             }
120            
121             // We hide everything
122             $("table#claimst tbody tr").hide();
123
124             // For each date in the table
125             $(".planneddate").each(function() {
126
127                 // We make a JS Date Object, according to the locale
128                 var pdate = Date_from_syspref($(this).text()).getTime();
129
130                 // And checks if the date is between the beginning and ending dates
131                 if (pdate > beginDate && 
132                     pdate < endDate) {
133                         // If so, we can show the row
134                         $(this).parent().show();
135                     }
136
137             });
138         }
139
140         // Clears filters : shows everything
141         function clearFilters() {
142             $("table#claimst tbody tr").show();
143         }
144
145         function popup(supplierid,serialid){
146                 window.open('claims.pl?supplierid='+ supplierid +'&amp;serialid='+ serialid +'&amp;op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes');
147         }
148
149 //]]>
150 </script>
151 </head>
152 <body id="ser_claims" class="ser">
153     [% INCLUDE 'header.inc' %]
154 [% UNLESS ( preview ) %]
155     [% INCLUDE 'serials-search.inc' %]
156 [% END %]
157
158 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Claims</div>
159
160 [% UNLESS ( preview ) %]
161
162 <div id="doc3" class="yui-t2">
163    
164    <div id="bd">
165         <div id="yui-main">
166         <div class="yui-b">
167
168     <h1>Claims</h1>
169
170 [% IF ( letter ) %][% UNLESS ( missingissues ) %][% IF ( supplierid ) %] <div class="dialog alert">No missing issues found.</div>[% ELSE %]<div class="dialog message">Please choose a vendor.</div>[% END %][% END %][% END %]
171         
172              [% IF ( SHOWCONFIRMATION ) %]
173      <div class="dialog alert">Your notification has been sent.</div>
174      [% END %]
175 [% UNLESS ( letter ) %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
176     <form id="claims" name="claims" action="claims.pl" method="post">
177     <fieldset>
178             <label for="supplierid">Vendor: </label>
179             <select id="supplierid" name="supplierid">
180                 [% FOREACH suploo IN suploop %]
181                     [% IF ( suploo.selected ) %]
182                     <option value="[% suploo.id %]" selected="selected" >
183                     [% ELSE %]
184                     <option value="[% suploo.id %]">
185                     [% END %]
186                         [% suploo.name %]
187                         ([% suploo.count %])
188                     </option>
189                 [% END %]
190             </select>
191         <input type="submit" value="OK" />
192         [% IF ( phone ) %]Phone: [% phone %][% END %]
193         [% IF ( booksellerfax ) %]Fax: [% booksellerfax %][% END %]
194         [% IF ( bookselleremail ) %]</p><p><a href="mailto:[% bookselleremail %]">[% bookselleremail %]</a>[% END %]
195     </fieldset>
196 </form>
197
198    [% IF ( missingissues ) %]   
199     <h3>Missing issues</h3>
200     <form action="claims.pl" onsubmit="return false;">
201         <fieldset class="rows">
202         <legend>Filters :</legend>
203         
204         <ol>
205         <li>
206             <label for="statusfilter">Status : </label>
207             <select id="statusfilter" onchange="filterByStatus();">
208             <option value="all" selected="selected">(All)</option>
209             <option value="expected">Expected</option>
210             <option value="arrived">Arrived</option>
211             <option value="late">Late</option>
212             <option value="missing">Missing</option>
213             <option value="claimed">Claimed</option>
214             <option value="stopped">Stopped</option>
215             </select>
216         </li>
217         
218         <li>
219             <label for="titlefilter">Title : </label>
220         <input id="titlefilter" type="text" />
221     </li>
222     <li>
223             <label for="branchfilter">Library: </label>
224             <select id="branchfilter" onchange="filterByBranch();">
225             [% FOREACH branchloo IN branchloop %]
226                 [% IF ( branchloo.selected ) %]
227                 <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
228                 [% ELSE %]
229                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
230                 [% END %]
231             [% END %]
232         </select>
233         </li>
234         
235         <li>
236         <label for="from">From:</label>
237         <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
238         <label for="to" style="float:none;">To:</label>
239         <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
240         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
241             <input type="button" value="OK" onclick="filterByDate();" />
242         </li>
243         
244         <li>
245         <input type="reset" value="Clear filters" onclick="clearFilters();" />
246         </li>
247         </ol>
248         </fieldset>
249     </form>
250
251     <fieldset>
252         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
253         <input type="hidden" name="order" value="[% order %]" />
254          <table id="claimst">
255                 <thead><tr>
256                     [% IF ( letter ) %]
257                     <th><input type="checkbox" id="CheckAll"></th>
258                     [% END %]
259                     <th>Vendor</th>
260                     <th>Library</th>
261                     <th>Title</th>
262                     <th>Issue number</th>
263                     <th>Status</th>
264                     <th>Since</th>
265                     <th>Claim date</th>
266                 <th>Begin claim</th>
267                 </tr></thead>
268                 <tbody>[% FOREACH missingissue IN missingissues %]
269                     <tr>
270                         [% IF ( letter ) %]
271                             <td>
272                     <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
273                             </td>
274                         [% END %]
275                         <td>
276                         [% missingissue.name %]
277                         </td>
278                         <td>
279                         [% missingissue.branchcode %]
280                         </td>
281                         <td>
282                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
283                         </td>
284                         <td>
285                         [% missingissue.serialseq %]
286                         </td>
287                         <td>
288                             [% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
289                             [% IF ( missingissue.status2 ) %]<span class="status-arrived">Arrived</span>[% END %]
290                             [% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
291                             [% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
292                             [% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
293                             [% IF ( missingissue.status8 ) %]<span class="status-stopped">Stopped</span>[% END %]
294                         </td>
295                         <td class="planneddate">
296                         [% missingissue.planneddate %]
297                         </td>
298                         <td>
299                         [% missingissue.claimdate %]
300                         </td>
301                         <td>
302                             <a href="/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=[% missingissue.supplieri %]&amp;serialid=[% missingissue.serialid %]&amp;op=claims">Export item data</a>
303                         </td>
304                     </tr>
305                 [% END %]</tbody>
306             </table>
307              <p><span class="exportSelected"></span></p>
308
309 [% IF ( letter ) %]
310         <fieldset class="action"> <label for="letter_code">Select notice:</label>
311             <select name="letter_code" id="letter_code">
312                 [% FOREACH letter IN letters %]
313                     <option value="[% letter.code %]">[% letter.name %]</option>
314                 [% END %]
315                         </select>
316             <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
317             [% END %]
318         </form>
319     </fieldset>
320 [% END %]
321
322 [% ELSE %]
323
324 <div id="doc" class="yui-t7">
325    <div id="bd">
326         
327 [% IF ( supplierloop ) %]
328         [% FOREACH supplierloo IN supplierloop %]
329         [% IF ( supplierloo.name ) %]
330         <p><b>[% supplierloo.name %]</b><br />
331         [% END %]
332         [% IF ( supplierloo.postal ) %]
333         [% supplierloo.postal %]<br />
334         [% END %]
335         [% IF ( supplierloo.contphone ) %]
336         Ph: [% supplierloo.contphone %]<br />
337         [% END %]
338         [% IF ( supplierloo.contfax ) %]
339         Fax: [% supplierloo.contfax %]<br />
340         [% END %]
341         [% IF ( supplierloo.contemail ) %]
342         Email: [% supplierloo.contemail %]<br />
343         [% END %]
344         [% IF ( supplierloo.accountnumber ) %]
345         A/C: [% supplierloo.accountnumber %]</p>
346         [% END %]
347         [% IF ( supplierloo.contact ) %]
348         <p>Dear [% supplierloo.contact %]</p>
349         [% ELSE %]
350         <p>To whom it may concern</p>
351         [% END %]
352         <p>The following items have not been received from you and are now considered missing:</p>
353         [% END %]
354 [% END %]
355         [% IF ( missingissues ) %]
356         <h3>Missing issues</h3>
357         <table>
358             <tr>
359                 <td><b>Vendor<b></td>
360                 <td><b>Title</b></td>
361                 <td><b>Issue number</b></td>
362                 <td><b>Missing since</b></td>
363             </tr>
364             [% FOREACH missingissue IN missingissues %]
365                 <tr>
366                     <td>
367                     [% missingissue.name %]
368                     </td>
369                     <td>
370                     [% missingissue.Title |html %]
371                     </td>
372                     <td>
373                     [% missingissue.serialseq %]
374                     </td>
375                     <td>
376                     [% missingissue.planneddate %]
377                     </td>
378                 </tr>
379             [% END %]
380         </table>
381         [% END %]
382
383 <p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> &nbsp; <a href="#" class="close">Close</a></p>
384 [% END %]
385
386 </div>
387 </div>
388
389 [% UNLESS ( preview ) %]
390 <div class="yui-b">
391 [% INCLUDE 'serials-menu.inc' %]
392 </div>
393 [% END %]
394 </div>
395 [% INCLUDE 'intranet-bottom.inc' %]