Fixed a bug about hidden checkboxes in claims
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
3     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
4     <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
5 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6 <script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.uitablefilter.js"></script>
7 <script type="text/JavaScript" language="JavaScript">
8 //<![CDATA[
9          $(document).ready(function() {
10                 <!-- TMPL_UNLESS NAME="preview" -->$("#claimst").tablesorter({<!-- TMPL_IF EXPR="dateformat eq 'metric'" -->
11                         dateFormat: 'uk',<!-- /TMPL_IF -->
12                         headers: { 0: { sorter: false },1:{sorter:false}}
13                 });<!-- /TMPL_UNLESS -->
14             $('#supplierid').change(function() {
15             $('#claims').submit();
16             });
17
18             // Case-insensitive version of jquery's contains function
19             jQuery.extend(
20                 jQuery.expr[':'], { 
21                     icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0" 
22                 }
23             );
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 use input:checked because it's faster, but if there must new checkboxes  
37                 // used for other purpose on this page, please use [name=serialid]:checked instead
38                 var selected = $("input:checked");
39
40                 if (selected.length == 0) {
41                         alert(_('Please select at least one item to export.'));
42                         return false;
43                 }
44                 
45                 // Building the url from currently checked boxes
46                 var url = '/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=&amp;op=claims';
47                 for (var i = 0; i < selected.length; i++) {
48                     url += '&amp;serialid=' + selected[i].value;
49                 }
50                 // And redirecting to the CSV page
51                 location.href = url;
52                 return false;
53             }); 
54
55         $("#titlefilter").keyup(function() {
56             $.uiTableFilter($("#claimst"), $("#titlefilter").val())
57             });
58          });
59
60         // Checks if the form can be sent (at least one checkbox must be checked)
61         function checkForm() {
62             if ($("input:checked").length == 0) {
63                 alert(_('Please select at least one item.'));
64                 return false;
65             }
66         }
67
68         // Filter by status
69         function filterByStatus() {
70             selectedStatus = $("#statusfilter").val();
71             if (selectedStatus == "all") {
72                 clearFilters();
73             } else {
74                 $("table#claimst tbody tr").hide();
75                 $("table#claimst tbody tr:contains(" + selectedStatus + ")").show();                
76             }
77         }
78
79         // Filter by date
80         function filterByDate() {
81             var beginDate = Date_from_syspref($("#begindate").val()).getTime();
82             var endDate   = Date_from_syspref($("#enddate").val()).getTime();
83             
84             // Checks if the beginning date is valid
85             if (!parseInt(beginDate)) {
86                 alert(_('The beginning date is missing or invalid.'));
87                 return false;
88             }
89
90             // Checks if the ending date is valid
91             if (!parseInt(endDate)) {
92                 alert(_('The ending date is missing or invalid.'));
93                 return false;
94             }
95
96             // Checks if beginning date is before ending date
97             if (beginDate > endDate) {
98                 // If not, we swap them
99                 var tmpDate = endDate;
100                 endDate = beginDate;
101                 beginDate = tmpDate;
102             }
103            
104             // We hide everything
105             $("table#claimst tbody tr").hide();
106
107             // For each date in the table
108             $(".planneddate").each(function() {
109
110                 // We make a JS Date Object, according to the locale
111                 var pdate = Date_from_syspref($(this).text()).getTime();
112
113                 // And checks if the date is between the beginning and ending dates
114                 if (pdate > beginDate && 
115                     pdate < endDate) {
116                         // If so, we can show the row
117                         $(this).parent().show();
118                     }
119
120             });
121         }
122
123         // Clears filters : shows everything
124         function clearFilters() {
125             $("table#claimst tbody tr").show();
126         }
127
128         function popup(supplierid,serialid){
129                 window.open('claims.pl?supplierid='+ supplierid +'&amp;serialid='+ serialid +'&amp;op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes');
130         }
131
132 //]]>
133 </script>
134 </head>
135 <body>
136     <!-- TMPL_INCLUDE NAME="header.inc" -->
137 <!-- TMPL_UNLESS NAME="preview" -->
138     <!--TMPL_INCLUDE NAME="serials-search.inc" -->
139 <!-- /TMPL_UNLESS -->
140
141 <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>
142
143 <!-- TMPL_UNLESS NAME="preview" -->
144
145 <div id="doc3" class="yui-t2">
146    
147    <div id="bd">
148         <div id="yui-main">
149         <div class="yui-b">
150
151     <h1>Claims</h1>
152
153 <!-- TMPL_IF NAME="letter" --><!-- TMPL_UNLESS NAME="missingissues" --><!-- TMPL_IF NAME="supplierid" --> <div class="dialog alert">No missing issues found.</div><!-- TMPL_ELSE --><div class="dialog message">Please choose a vendor.</div><!-- /TMPL_IF --><!-- /TMPL_UNLESS --><!-- /TMPL_IF -->
154         
155              <!-- TMPL_IF NAME="SHOWCONFIRMATION" -->
156      <div class="dialog alert">Your notification has been sent.</div>
157      <!-- /TMPL_IF -->
158 <!-- TMPL_UNLESS NAME="letter" --><div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div><!-- /TMPL_UNLESS -->
159     <form id="claims" name="claims" action="claims.pl" method="post">
160     <fieldset>
161             <label for="supplierid">Supplier: </label>
162             <select id="supplierid" name="supplierid">
163                 <!-- TMPL_LOOP name="suploop"-->
164                     <!-- TMPL_IF name="selected" -->
165                     <option value="<!-- TMPL_VAR name="id" -->" selected="selected" >
166                     <!-- TMPL_ELSE -->
167                     <option value="<!-- TMPL_VAR name="id" -->">
168                     <!-- /TMPL_IF -->
169                         <!-- TMPL_VAR name="name" -->
170                         (<!-- TMPL_VAR name="count" -->)
171                     </option>
172                 <!-- /TMPL_LOOP -->
173             </select>
174         <input type="submit" value="OK" />
175         <!-- TMPL_IF name="phone" -->Phone: <!-- TMPL_VAR name="phone" --><!-- /TMPL_IF -->
176         <!-- TMPL_IF name="booksellerfax" -->Fax: <!-- TMPL_VAR name="booksellerfax" --><!-- /TMPL_IF -->
177         <!-- TMPL_IF name="bookselleremail" --></p><p><a href="mailto:<!-- TMPL_VAR name="bookselleremail" -->"><!-- TMPL_VAR name="bookselleremail" --></a><!-- /TMPL_IF -->
178     </fieldset>
179 </form>
180
181    <!-- TMPL_IF NAME="missingissues" -->        
182     <h3>Missing Issues</h3>
183     <form action="claims.pl" onsubmit="return false;">
184         <fieldset class="rows">
185         <legend>Filters :</legend>
186         
187         <ol>
188         <li>
189             <label for="statusfilter">Status : </label>
190             <select id="statusfilter" onchange="filterByStatus();">
191                 <option value="all" selected="selected">(All)</option>
192                 <option>Expected</option>
193                 <option>Arrived</option>
194                 <option>Late</option>
195                 <option>Missing</option>
196                 <option>Claimed</option>
197             </select>
198         </li>
199         
200         <li>
201             <label for="titlefilter">Title : </label>
202             <input id="titlefilter" type="text" />
203         </li>
204         
205         <li>
206             <label for="begindate">From</label>
207             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="begindatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
208             <input type="text" name="begindate" id="begindate" value="<!-- TMPL_VAR name="begindate" -->" size="10" maxlength="10" />
209             <script type="text/javascript">
210                  //<![CDATA[ 
211                 Calendar.setup({
212                     inputField  : "begindate", 
213                     button              : "begindatebutton",
214                     ifFormat    : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->"
215                 });
216                 //]]>
217             </script>
218
219             <label for="enddate" style="float:none;">To</label>
220             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="enddatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
221             <input type="text" name="enddate" id="enddate" value="<!-- TMPL_VAR name="enddate" -->" size="10" maxlength="10" />
222             <script type="text/javascript">
223                  //<![CDATA[ 
224                  Calendar.setup({
225                     inputField      : "enddate", 
226                     button          : "enddatebutton",
227                     ifFormat        : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->"
228                 });
229                 //]]>
230             </script> <span class="hint"><!-- TMPL_INCLUDE NAME="date-format.inc" --></span>
231             <input type="button" value="OK" onclick="filterByDate();" />
232         </li>
233         
234         <li>
235             <input type="reset" value="Clear Filters" onclick="clearFilters();" />
236         </li>
237         </ol>
238         </fieldset>
239     </form>
240
241         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
242         <input type="hidden" name="order" value="<!--TMPL_VAR Name="order"-->" />
243          <table id="claimst">
244                 <thead><tr>
245                     <!--TMPL_IF NAME="letter"-->
246                     <th><input type="checkbox" id="CheckAll"></th>
247                     <!--/TMPL_IF-->
248                     <th>Vendor</th>
249                     <th>Title</th>
250                     <th>Issue number</th>
251                     <th>Status</th>
252                     <th>Since</th>
253                     <th>Claim Date</th>
254                 <th>Begin Claim</th>
255                 </tr></thead>
256                 <tbody><!-- TMPL_LOOP name="missingissues" -->
257                     <tr>
258                         <!--TMPL_IF NAME="letter" -->
259                             <td>
260                     <input type="checkbox" name="serialid" value="<!-- TMPL_VAR NAME="serialid"-->" />
261                             </td>
262                         <!--/TMPL_IF-->
263                         <td>
264                         <!-- TMPL_VAR name="name" -->
265                         </td>
266                         <td>
267                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->"><!-- TMPL_VAR name="title" escape="html" --></a>
268                         </td>
269                         <td>
270                         <!-- TMPL_VAR name="serialseq" -->
271                         </td>
272                         <td>
273                             <!-- TMPL_IF Name="status1" -->Expected<!-- /TMPL_IF -->
274                             <!-- TMPL_IF Name="status2" -->Arrived<!-- /TMPL_IF -->
275                             <!-- TMPL_IF Name="status3" -->Late<!-- /TMPL_IF -->
276                             <!-- TMPL_IF Name="status4" -->Missing<!-- /TMPL_IF -->
277                             <!-- TMPL_IF Name="status7" -->Claimed<!-- /TMPL_IF -->
278                         </td>
279                         <td class="planneddate">
280                         <!-- TMPL_VAR name="planneddate" -->
281                         </td>
282                         <td>
283                         <!-- TMPL_VAR name="claimdate" -->
284                         </td>
285                         <td>
286                             <a href="/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=<!-- TMPL_VAR name="supplieri" -->&amp;serialid=<!-- TMPL_VAR name="serialid" -->&amp;op=claims">Export item data</a>
287                         </td>
288                     </tr>
289                 <!-- /TMPL_LOOP --></tbody>
290             </table>
291              <p><span class="exportSelected"></span></p>
292
293 <!--TMPL_IF Name="letter" -->
294         <fieldset class="action"> <label for="letter_code">Select notice:</label>
295             <select name="letter_code" id="letter_code">
296                 <!-- TMPL_LOOP name="letters" -->
297                     <option value="<!--TMPL_VAR Name="code"-->"><!--TMPL_VAR Name="name"--></option>
298                 <!--/TMPL_LOOP-->
299                         </select>
300             <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
301             <!--/TMPL_IF-->
302         </form>
303 <!-- /TMPL_IF -->
304
305 <!-- TMPL_ELSE -->
306
307 <div id="doc" class="yui-t7">
308    <div id="bd">
309         
310 <!-- TMPL_IF Name="supplierloop"-->
311         <!-- TMPL_LOOP Name="supplierloop"-->
312         <!-- TMPL_IF NAME="name" -->
313         <p><b><!-- TMPL_VAR NAME="name" --></b><br />
314         <!-- /TMPL_IF -->
315         <!-- TMPL_IF NAME="postal" -->
316         <!-- TMPL_VAR NAME="postal" --><br />
317         <!-- /TMPL_IF -->
318         <!-- TMPL_IF NAME="contphone" -->
319         Ph: <!-- TMPL_VAR NAME="contphone" --><br />
320         <!-- /TMPL_IF -->
321         <!-- TMPL_IF NAME="contfax" -->
322         Fax: <!-- TMPL_VAR NAME="contfax" --><br />
323         <!-- /TMPL_IF -->
324         <!-- TMPL_IF NAME="contemail" -->
325         Email: <!-- TMPL_VAR NAME="contemail" --><br />
326         <!-- /TMPL_IF -->
327         <!-- TMPL_IF NAME="accountnumber" -->
328         A/C: <!-- TMPL_VAR NAME="accountnumber" --></p>
329         <!-- /TMPL_IF -->
330         <!-- TMPL_IF NAME="contact" -->
331         <p>Dear <!-- TMPL_VAR NAME="contact" --></p>
332         <!-- TMPL_ELSE -->
333         <p>To whom it may concern</p>
334         <!-- /TMPL_IF -->
335         <p>The following items have not been received from you and are now considered missing:</p>
336         <!-- /TMPL_LOOP -->
337 <!-- /TMPL_IF -->
338         <!-- TMPL_IF NAME="missingissues" -->
339         <h3>Missing Issues</h3>
340         <table>
341             <tr>
342                 <td><b>Vendor<b></td>
343                 <td><b>Title</b></td>
344                 <td><b>Issue number</b></td>
345                 <td><b>Missing since</b></td>
346             </tr>
347             <!-- TMPL_LOOP name="missingissues" -->
348                 <tr>
349                     <td>
350                     <!-- TMPL_VAR name="name" -->
351                     </td>
352                     <td>
353                     <!-- TMPL_VAR name="Title" escape="html" -->
354                     </td>
355                     <td>
356                     <!-- TMPL_VAR name="serialseq" -->
357                     </td>
358                     <td>
359                     <!-- TMPL_VAR name="planneddate" -->
360                     </td>
361                 </tr>
362             <!-- /TMPL_LOOP -->
363         </table>
364         <!-- /TMPL_IF -->
365
366 <p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> &nbsp; <a href="#" class="close">Close</a></p>
367 <!-- /TMPL_UNLESS -->
368
369 </div>
370 </div>
371
372 <!-- TMPL_UNLESS NAME="preview" -->
373 <div class="yui-b">
374 <!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
375 </div>
376 <!-- /TMPL_UNLESS -->
377 </div>
378 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->