Bug 5917 / Bug 6085 : Fixing not being able to change language
[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         $("#branchfilter").keyup(function() {
60             $.uiTableFilter($("#claimst"), $("#branchfilter").val())
61             });
62          });
63
64         // Checks if the form can be sent (at least one checkbox must be checked)
65         function checkForm() {
66             if ($("input:checked").length == 0) {
67                 alert(_('Please select at least one item.'));
68                 return false;
69             }
70         }
71
72         // Filter by status
73         function filterByStatus() {
74             selectedStatus = $("#statusfilter").val();
75             if (selectedStatus == "all") {
76                 clearFilters();
77             } else {
78                 $("table#claimst tbody tr").hide();
79                 $("table#claimst tbody tr:contains(" + selectedStatus + ")").show();
80             }
81         }
82
83         // Filter by branch
84         function filterByBranch() {
85             selectedBranch = $("#branchfilter").val();
86             if (selectedBranch == "all") {
87                 clearFilters();
88             } else {
89                 $("table#claimst tbody tr").hide();
90                 $("table#claimst tbody tr:contains(" + selectedBranch + ")").show();
91             }
92         }
93         // Filter by date
94         function filterByDate() {
95             var beginDate = Date_from_syspref($("#begindate").val()).getTime();
96             var endDate   = Date_from_syspref($("#enddate").val()).getTime();
97             
98             // Checks if the beginning date is valid
99             if (!parseInt(beginDate)) {
100                 alert(_('The beginning date is missing or invalid.'));
101                 return false;
102             }
103
104             // Checks if the ending date is valid
105             if (!parseInt(endDate)) {
106                 alert(_('The ending date is missing or invalid.'));
107                 return false;
108             }
109
110             // Checks if beginning date is before ending date
111             if (beginDate > endDate) {
112                 // If not, we swap them
113                 var tmpDate = endDate;
114                 endDate = beginDate;
115                 beginDate = tmpDate;
116             }
117            
118             // We hide everything
119             $("table#claimst tbody tr").hide();
120
121             // For each date in the table
122             $(".planneddate").each(function() {
123
124                 // We make a JS Date Object, according to the locale
125                 var pdate = Date_from_syspref($(this).text()).getTime();
126
127                 // And checks if the date is between the beginning and ending dates
128                 if (pdate > beginDate && 
129                     pdate < endDate) {
130                         // If so, we can show the row
131                         $(this).parent().show();
132                     }
133
134             });
135         }
136
137         // Clears filters : shows everything
138         function clearFilters() {
139             $("table#claimst tbody tr").show();
140         }
141
142         function popup(supplierid,serialid){
143                 window.open('claims.pl?supplierid='+ supplierid +'&amp;serialid='+ serialid +'&amp;op=preview' ,'popup', 'width=600,height=400,toolbar=no,scrollbars=yes');
144         }
145
146 //]]>
147 </script>
148 </head>
149 <body>
150     <!-- TMPL_INCLUDE NAME="header.inc" -->
151 <!-- TMPL_UNLESS NAME="preview" -->
152     <!--TMPL_INCLUDE NAME="serials-search.inc" -->
153 <!-- /TMPL_UNLESS -->
154
155 <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>
156
157 <!-- TMPL_UNLESS NAME="preview" -->
158
159 <div id="doc3" class="yui-t2">
160    
161    <div id="bd">
162         <div id="yui-main">
163         <div class="yui-b">
164
165     <h1>Claims</h1>
166
167 <!-- 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 -->
168         
169              <!-- TMPL_IF NAME="SHOWCONFIRMATION" -->
170      <div class="dialog alert">Your notification has been sent.</div>
171      <!-- /TMPL_IF -->
172 <!-- 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 -->
173     <form id="claims" name="claims" action="claims.pl" method="post">
174     <fieldset>
175             <label for="supplierid">Supplier: </label>
176             <select id="supplierid" name="supplierid">
177                 <!-- TMPL_LOOP name="suploop"-->
178                     <!-- TMPL_IF name="selected" -->
179                     <option value="<!-- TMPL_VAR name="id" -->" selected="selected" >
180                     <!-- TMPL_ELSE -->
181                     <option value="<!-- TMPL_VAR name="id" -->">
182                     <!-- /TMPL_IF -->
183                         <!-- TMPL_VAR name="name" -->
184                         (<!-- TMPL_VAR name="count" -->)
185                     </option>
186                 <!-- /TMPL_LOOP -->
187             </select>
188         <input type="submit" value="OK" />
189         <!-- TMPL_IF name="phone" -->Phone: <!-- TMPL_VAR name="phone" --><!-- /TMPL_IF -->
190         <!-- TMPL_IF name="booksellerfax" -->Fax: <!-- TMPL_VAR name="booksellerfax" --><!-- /TMPL_IF -->
191         <!-- TMPL_IF name="bookselleremail" --></p><p><a href="mailto:<!-- TMPL_VAR name="bookselleremail" -->"><!-- TMPL_VAR name="bookselleremail" --></a><!-- /TMPL_IF -->
192     </fieldset>
193 </form>
194
195    <!-- TMPL_IF NAME="missingissues" -->        
196     <h3>Missing Issues</h3>
197     <form action="claims.pl" onsubmit="return false;">
198         <fieldset class="rows">
199         <legend>Filters :</legend>
200         
201         <ol>
202         <li>
203             <label for="statusfilter">Status : </label>
204             <select id="statusfilter" onchange="filterByStatus();">
205                 <option value="all" selected="selected">(All)</option>
206                 <option>Expected</option>
207                 <option>Arrived</option>
208                 <option>Late</option>
209                 <option>Missing</option>
210                 <option>Claimed</option>
211             </select>
212         </li>
213         
214         <li>
215             <label for="titlefilter">Title : </label>
216             <input id="titlefilter" type="text" />
217             <label for="branchfilter">Branch: </label>
218             <select id="branchfilter" onchange="filterByBranch();">
219             <!-- TMPL_LOOP Name="branchloop" -->
220                 <!-- TMPL_IF NAME="selected" -->
221                 <option value="<!-- TMPL_VAR NAME="value" -->" selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
222                 <!-- TMPL_ELSE -->
223                 <option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branchname" --></option>
224                 <!-- /TMPL_IF -->
225             <!-- /TMPL_LOOP -->
226         </select>
227         </li>
228         
229         <li>
230             <label for="begindate">From</label>
231             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="begindatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
232             <input type="text" name="begindate" id="begindate" value="<!-- TMPL_VAR name="begindate" -->" size="10" maxlength="10" />
233             <script type="text/javascript">
234                  //<![CDATA[ 
235                 Calendar.setup({
236                     inputField  : "begindate", 
237                     button              : "begindatebutton",
238                     ifFormat    : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->"
239                 });
240                 //]]>
241             </script>
242
243             <label for="enddate" style="float:none;">To</label>
244             <img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="enddatebutton" style="cursor: pointer;" alt="Show Calendar" title="Show Calendar" />
245             <input type="text" name="enddate" id="enddate" value="<!-- TMPL_VAR name="enddate" -->" size="10" maxlength="10" />
246             <script type="text/javascript">
247                  //<![CDATA[ 
248                  Calendar.setup({
249                     inputField      : "enddate", 
250                     button          : "enddatebutton",
251                     ifFormat        : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->"
252                 });
253                 //]]>
254             </script> <span class="hint"><!-- TMPL_INCLUDE NAME="date-format.inc" --></span>
255             <input type="button" value="OK" onclick="filterByDate();" />
256         </li>
257         
258         <li>
259             <input type="reset" value="Clear Filters" onclick="clearFilters();" />
260         </li>
261         </ol>
262         </fieldset>
263     </form>
264
265     <fieldset>
266         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
267         <input type="hidden" name="order" value="<!--TMPL_VAR Name="order"-->" />
268          <table id="claimst">
269                 <thead><tr>
270                     <!--TMPL_IF NAME="letter"-->
271                     <th><input type="checkbox" id="CheckAll"></th>
272                     <!--/TMPL_IF-->
273                     <th>Vendor</th>
274                     <th>Branch</th>
275                     <th>Title</th>
276                     <th>Issue number</th>
277                     <th>Status</th>
278                     <th>Since</th>
279                     <th>Claim Date</th>
280                 <th>Begin Claim</th>
281                 </tr></thead>
282                 <tbody><!-- TMPL_LOOP name="missingissues" -->
283                     <tr>
284                         <!--TMPL_IF NAME="letter" -->
285                             <td>
286                     <input type="checkbox" name="serialid" value="<!-- TMPL_VAR NAME="serialid"-->" />
287                             </td>
288                         <!--/TMPL_IF-->
289                         <td>
290                         <!-- TMPL_VAR name="name" -->
291                         </td>
292                         <td>
293                         <!-- TMPL_VAR name="branchcode" -->
294                         </td>
295                         <td>
296                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->"><!-- TMPL_VAR name="title" escape="html" --></a>
297                         </td>
298                         <td>
299                         <!-- TMPL_VAR name="serialseq" -->
300                         </td>
301                         <td>
302                             <!-- TMPL_IF Name="status1" -->Expected<!-- /TMPL_IF -->
303                             <!-- TMPL_IF Name="status2" -->Arrived<!-- /TMPL_IF -->
304                             <!-- TMPL_IF Name="status3" -->Late<!-- /TMPL_IF -->
305                             <!-- TMPL_IF Name="status4" -->Missing<!-- /TMPL_IF -->
306                             <!-- TMPL_IF Name="status7" -->Claimed<!-- /TMPL_IF -->
307                         </td>
308                         <td class="planneddate">
309                         <!-- TMPL_VAR name="planneddate" -->
310                         </td>
311                         <td>
312                         <!-- TMPL_VAR name="claimdate" -->
313                         </td>
314                         <td>
315                             <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>
316                         </td>
317                     </tr>
318                 <!-- /TMPL_LOOP --></tbody>
319             </table>
320              <p><span class="exportSelected"></span></p>
321
322 <!--TMPL_IF Name="letter" -->
323         <fieldset class="action"> <label for="letter_code">Select notice:</label>
324             <select name="letter_code" id="letter_code">
325                 <!-- TMPL_LOOP name="letters" -->
326                     <option value="<!--TMPL_VAR Name="code"-->"><!--TMPL_VAR Name="name"--></option>
327                 <!--/TMPL_LOOP-->
328                         </select>
329             <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
330             <!--/TMPL_IF-->
331         </form>
332     </fieldset>
333 <!-- /TMPL_IF -->
334
335 <!-- TMPL_ELSE -->
336
337 <div id="doc" class="yui-t7">
338    <div id="bd">
339         
340 <!-- TMPL_IF Name="supplierloop"-->
341         <!-- TMPL_LOOP Name="supplierloop"-->
342         <!-- TMPL_IF NAME="name" -->
343         <p><b><!-- TMPL_VAR NAME="name" --></b><br />
344         <!-- /TMPL_IF -->
345         <!-- TMPL_IF NAME="postal" -->
346         <!-- TMPL_VAR NAME="postal" --><br />
347         <!-- /TMPL_IF -->
348         <!-- TMPL_IF NAME="contphone" -->
349         Ph: <!-- TMPL_VAR NAME="contphone" --><br />
350         <!-- /TMPL_IF -->
351         <!-- TMPL_IF NAME="contfax" -->
352         Fax: <!-- TMPL_VAR NAME="contfax" --><br />
353         <!-- /TMPL_IF -->
354         <!-- TMPL_IF NAME="contemail" -->
355         Email: <!-- TMPL_VAR NAME="contemail" --><br />
356         <!-- /TMPL_IF -->
357         <!-- TMPL_IF NAME="accountnumber" -->
358         A/C: <!-- TMPL_VAR NAME="accountnumber" --></p>
359         <!-- /TMPL_IF -->
360         <!-- TMPL_IF NAME="contact" -->
361         <p>Dear <!-- TMPL_VAR NAME="contact" --></p>
362         <!-- TMPL_ELSE -->
363         <p>To whom it may concern</p>
364         <!-- /TMPL_IF -->
365         <p>The following items have not been received from you and are now considered missing:</p>
366         <!-- /TMPL_LOOP -->
367 <!-- /TMPL_IF -->
368         <!-- TMPL_IF NAME="missingissues" -->
369         <h3>Missing Issues</h3>
370         <table>
371             <tr>
372                 <td><b>Vendor<b></td>
373                 <td><b>Title</b></td>
374                 <td><b>Issue number</b></td>
375                 <td><b>Missing since</b></td>
376             </tr>
377             <!-- TMPL_LOOP name="missingissues" -->
378                 <tr>
379                     <td>
380                     <!-- TMPL_VAR name="name" -->
381                     </td>
382                     <td>
383                     <!-- TMPL_VAR name="Title" escape="html" -->
384                     </td>
385                     <td>
386                     <!-- TMPL_VAR name="serialseq" -->
387                     </td>
388                     <td>
389                     <!-- TMPL_VAR name="planneddate" -->
390                     </td>
391                 </tr>
392             <!-- /TMPL_LOOP -->
393         </table>
394         <!-- /TMPL_IF -->
395
396 <p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> &nbsp; <a href="#" class="close">Close</a></p>
397 <!-- /TMPL_UNLESS -->
398
399 </div>
400 </div>
401
402 <!-- TMPL_UNLESS NAME="preview" -->
403 <div class="yui-b">
404 <!-- TMPL_INCLUDE NAME="serials-menu.inc" -->
405 </div>
406 <!-- /TMPL_UNLESS -->
407 </div>
408 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->