Merge branch 'bug_7688' into 3.12-master
[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="/intranet-tmpl/prog/en/css/datatables.css" />
6 <script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7 [% INCLUDE 'datatables-strings.inc' %]
8 <script type="text/javascript" src="/intranet-tmpl/prog/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 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             sTable.fnFilter( this.value, 3 ); // 3 is position of title column
57         } );
58
59         $("#branchfilter").keyup(function() {
60             sTable.fnFilter( this.value, 2 ); // 2 is the position of the author column
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($("#from").val()).getTime();
96         var endDate   = Date_from_syspref($("#to").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 id="ser_claims" class="ser">
150     [% INCLUDE 'header.inc' %]
151 [% UNLESS ( preview ) %]
152     [% INCLUDE 'serials-search.inc' %]
153 [% END %]
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 [% UNLESS ( 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 [% 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 %]
168         
169              [% IF ( SHOWCONFIRMATION ) %]
170      <div class="dialog alert">Your notification has been sent.</div>
171      [% END %]
172 [% UNLESS ( letter ) %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
173     <form id="claims" name="claims" action="claims.pl" method="post">
174     <fieldset>
175             <label for="supplierid">Vendor: </label>
176             <select id="supplierid" name="supplierid">
177                 [% FOREACH suploo IN suploop %]
178                     [% IF ( suploo.selected ) %]
179                     <option value="[% suploo.id %]" selected="selected" >
180                     [% ELSE %]
181                     <option value="[% suploo.id %]">
182                     [% END %]
183                         [% suploo.name %]
184                         ([% suploo.count %])
185                     </option>
186                 [% END %]
187             </select>
188         <input type="submit" value="OK" />
189         [% IF ( phone ) %]Phone: [% phone %][% END %]
190         [% IF ( booksellerfax ) %]Fax: [% booksellerfax %][% END %]
191         [% IF ( bookselleremail ) %]</p><p><a href="mailto:[% bookselleremail %]">[% bookselleremail %]</a>[% END %]
192     </fieldset>
193 </form>
194
195    [% IF ( 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         <option>Stopped</option>
212             </select>
213         </li>
214         
215         <li>
216             <label for="titlefilter">Title : </label>
217         <input id="titlefilter" type="text" />
218     </li>
219     <li>
220             <label for="branchfilter">Library: </label>
221             <select id="branchfilter" onchange="filterByBranch();">
222             [% FOREACH branchloo IN branchloop %]
223                 [% IF ( branchloo.selected ) %]
224                 <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
225                 [% ELSE %]
226                 <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
227                 [% END %]
228             [% END %]
229         </select>
230         </li>
231         
232         <li>
233         <label for="from">From:</label>
234         <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
235         <label for="to" style="float:none;">To:</label>
236         <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
237         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
238             <input type="button" value="OK" onclick="filterByDate();" />
239         </li>
240         
241         <li>
242         <input type="reset" value="Clear filters" onclick="clearFilters();" />
243         </li>
244         </ol>
245         </fieldset>
246     </form>
247
248     <fieldset>
249         <form action="claims.pl" method="post" class="checkboxed" onsubmit="return checkForm()">
250         <input type="hidden" name="order" value="[% order %]" />
251          <table id="claimst">
252                 <thead><tr>
253                     [% IF ( letter ) %]
254                     <th><input type="checkbox" id="CheckAll"></th>
255                     [% END %]
256                     <th>Vendor</th>
257                     <th>Library</th>
258                     <th>Title</th>
259                     <th>Issue number</th>
260                     <th>Status</th>
261                     <th>Since</th>
262                     <th>Claim date</th>
263                 <th>Begin claim</th>
264                 </tr></thead>
265                 <tbody>[% FOREACH missingissue IN missingissues %]
266                     <tr>
267                         [% IF ( letter ) %]
268                             <td>
269                     <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
270                             </td>
271                         [% END %]
272                         <td>
273                         [% missingissue.name %]
274                         </td>
275                         <td>
276                         [% missingissue.branchcode %]
277                         </td>
278                         <td>
279                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
280                         </td>
281                         <td>
282                         [% missingissue.serialseq %]
283                         </td>
284                         <td>
285                             [% IF ( missingissue.status1 ) %]Expected[% END %]
286                             [% IF ( missingissue.status2 ) %]Arrived[% END %]
287                             [% IF ( missingissue.status3 ) %]Late[% END %]
288                             [% IF ( missingissue.status4 ) %]Missing[% END %]
289                             [% IF ( missingissue.status7 ) %]Claimed[% END %]
290                             [% IF ( missingissue.status8 ) %]Stopped[% END %]
291                         </td>
292                         <td class="planneddate">
293                         [% missingissue.planneddate %]
294                         </td>
295                         <td>
296                         [% missingissue.claimdate %]
297                         </td>
298                         <td>
299                             <a href="/cgi-bin/koha/serials/lateissues-excel.pl?supplierid=[% missingissue.supplieri %]&amp;serialid=[% missingissue.serialid %]&amp;op=claims">Export item data</a>
300                         </td>
301                     </tr>
302                 [% END %]</tbody>
303             </table>
304              <p><span class="exportSelected"></span></p>
305
306 [% IF ( letter ) %]
307         <fieldset class="action"> <label for="letter_code">Select notice:</label>
308             <select name="letter_code" id="letter_code">
309                 [% FOREACH letter IN letters %]
310                     <option value="[% letter.code %]">[% letter.name %]</option>
311                 [% END %]
312                         </select>
313             <input type="hidden" name="op" value="send_alert" /><input type="submit" name="submit" class="button" value="Send notification" /></fieldset>
314             [% END %]
315         </form>
316     </fieldset>
317 [% END %]
318
319 [% ELSE %]
320
321 <div id="doc" class="yui-t7">
322    <div id="bd">
323         
324 [% IF ( supplierloop ) %]
325         [% FOREACH supplierloo IN supplierloop %]
326         [% IF ( supplierloo.name ) %]
327         <p><b>[% supplierloo.name %]</b><br />
328         [% END %]
329         [% IF ( supplierloo.postal ) %]
330         [% supplierloo.postal %]<br />
331         [% END %]
332         [% IF ( supplierloo.contphone ) %]
333         Ph: [% supplierloo.contphone %]<br />
334         [% END %]
335         [% IF ( supplierloo.contfax ) %]
336         Fax: [% supplierloo.contfax %]<br />
337         [% END %]
338         [% IF ( supplierloo.contemail ) %]
339         Email: [% supplierloo.contemail %]<br />
340         [% END %]
341         [% IF ( supplierloo.accountnumber ) %]
342         A/C: [% supplierloo.accountnumber %]</p>
343         [% END %]
344         [% IF ( supplierloo.contact ) %]
345         <p>Dear [% supplierloo.contact %]</p>
346         [% ELSE %]
347         <p>To whom it may concern</p>
348         [% END %]
349         <p>The following items have not been received from you and are now considered missing:</p>
350         [% END %]
351 [% END %]
352         [% IF ( missingissues ) %]
353         <h3>Missing issues</h3>
354         <table>
355             <tr>
356                 <td><b>Vendor<b></td>
357                 <td><b>Title</b></td>
358                 <td><b>Issue number</b></td>
359                 <td><b>Missing since</b></td>
360             </tr>
361             [% FOREACH missingissue IN missingissues %]
362                 <tr>
363                     <td>
364                     [% missingissue.name %]
365                     </td>
366                     <td>
367                     [% missingissue.Title |html %]
368                     </td>
369                     <td>
370                     [% missingissue.serialseq %]
371                     </td>
372                     <td>
373                     [% missingissue.planneddate %]
374                     </td>
375                 </tr>
376             [% END %]
377         </table>
378         [% END %]
379
380 <p class="noprint"><a href="#" onclick="window.print(); return false;">Print</a> &nbsp; <a href="#" class="close">Close</a></p>
381 [% END %]
382
383 </div>
384 </div>
385
386 [% UNLESS ( preview ) %]
387 <div class="yui-b">
388 [% INCLUDE 'serials-menu.inc' %]
389 </div>
390 [% END %]
391 </div>
392 [% INCLUDE 'intranet-bottom.inc' %]