Bug 19623: (follow-up) Correct footer include in pop-up windows
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / serials / claims.tt
1 [% USE AuthorisedValues %]
2 [% USE Branches %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5     <title>Koha &rsaquo; Serials &rsaquo; Claims</title>
6     [% INCLUDE 'doc-head-close.inc' %]
7 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
8 </head>
9
10 <body id="ser_claims" class="ser">
11     [% INCLUDE 'header.inc' %]
12     [% INCLUDE 'serials-search.inc' %]
13
14 <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>
15
16 <div id="doc3" class="yui-t2">
17    
18    <div id="bd">
19         <div id="yui-main">
20         <div class="yui-b">
21
22     <h1>Claims</h1>
23
24     [% IF error_claim %]
25         [% IF error_claim == 'no_vendor_email' %]
26             <div class="dialog alert">This vendor has no email defined for late issues.</div>
27         [% ELSIF error_claim == 'bad_or_missing_sender' %]
28             <div class="dialog alert">Bad or missing sender address; check your branch email address or preference KohaAdminEmailAddress.</div>
29         [% ELSE %]
30             <div class="dialog alert">[% error_claim %]</div>
31         [% END %]
32     [% END %]
33     [% IF info_claim %]
34         <div class="dialog message">Email has been sent.</div>
35     [% END %]
36
37 [% IF letters %][% 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 %]
38         
39              [% IF ( SHOWCONFIRMATION ) %]
40      <div class="dialog alert">Your notification has been sent.</div>
41      [% END %]
42 [% UNLESS letters %]<div class="dialog alert">No claims notice defined. <a href="/cgi-bin/koha/tools/letter.pl">Please define one</a>.</div>[% END %]
43     <form id="claims" name="claims" action="claims.pl" method="post">
44     <fieldset>
45             <label for="supplierid">Vendor: </label>
46             <select id="supplierid" name="supplierid">
47                 [% FOREACH suploo IN suploop %]
48                     [% IF ( suploo.selected ) %]
49                     <option value="[% suploo.id %]" selected="selected" >
50                     [% ELSE %]
51                     <option value="[% suploo.id %]">
52                     [% END %]
53                         [% suploo.name %]
54                         ([% suploo.count %])
55                     </option>
56                 [% END %]
57             </select>
58         <input type="submit" value="OK" />
59     </fieldset>
60 </form>
61
62    [% IF ( missingissues ) %]   
63     <h3>Missing issues</h3>
64     <form action="claims.pl" id="filter_claims_form">
65         <fieldset class="rows">
66         <legend>Filters :</legend>
67         
68         <ol>
69         <li>
70         <label for="from">From:</label>
71         <input type="text" name="begindate" id="from" value="[% begindate %]" size="10" maxlength="10" class="datepickerfrom" />
72         <label for="to" style="float:none;">To:</label>
73         <input type="text" name="enddate" id="to" value="[% enddate %]" size="10" maxlength="10" class="datepickerto" />
74         <span class="hint">[% INCLUDE 'date-format.inc' %]</span>
75         <input id="filterByDate" type="button" value="OK" />
76         <a href="#" id="clearfilter"><i class="fa fa-remove"></i> Clear filter</a>
77     </li>
78         </ol>
79         </fieldset>
80     </form>
81
82     <fieldset>
83         <form action="claims.pl" method="post" id="claims_form">
84             <table id="claimst">
85                 <thead>
86                     <tr>
87                         <th><input type="checkbox" id="CheckAll"></th>
88                         <th>Vendor</th>
89                         <th>Library</th>
90                         <th class="anti-the">Title</th>
91                         <th>ISSN</th>
92                         <th>Issue number</th>
93                         <th>Status</th>
94                         <th class="title-string">Since</th>
95                         <th>Claims count</th>
96                         <th class="title-string">Claim date</th>
97                         [% FOR field IN additional_fields_for_subscription %]
98                           <th>[% field.name %]</th>
99                         [% END %]
100                     </tr>
101                 </thead>
102                 <tfoot>
103                   <tr>
104                     <td></td>
105                     <td><input type="text" class="filter" data-column_num="1" placeholder="Search vendor" /></td>
106                     <td><input type="text" class="filter" data-column_num="2" placeholder="Search library" /></td>
107                     <td><input type="text" class="filter" data-column_num="3" placeholder="Search title" /></td>
108                     <td><input type="text" class="filter" data-column_num="4" placeholder="Search ISSN" /></td>
109                     <td><input type="text" class="filter" data-column_num="5" placeholder="Search issue number" /></td>
110                     <td><input type="text" class="filter" data-column_num="6" placeholder="Search status" /></td>
111                     <td><input type="text" class="filter" data-column_num="7" placeholder="Search since" /></td>
112                     <td><input type="text" class="filter" data-column_num="8" placeholder="Search claim count" /></td>
113                     <td><input type="text" class="filter" data-column_num="9" placeholder="Search claim date" /></td>
114                     [% FOR field IN additional_fields_for_subscription %]
115                       <td><input type="text" class="filter" data-column_num="[% loop.count + 9 %]" placeholder="Search [% field.name %]" /></td>
116                     [% END %]
117                   </tr>
118                 </tfoot>
119                 <tbody>[% FOREACH missingissue IN missingissues %]
120                     <tr>
121                         <td>
122                           [% UNLESS missingissue.cannot_claim %]
123                             <input type="checkbox" name="serialid" value="[% missingissue.serialid %]" />
124                           [% END %]
125                         </td>
126                         <td>[% missingissue.name %]</td>
127                         <td>
128                             <span class="branch-[% missingissue.branchcode %]">[% Branches.GetName( missingissue.branchcode ) %]</span>
129                         </td>
130                         <td>
131                         <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% missingissue.subscriptionid %]">[% missingissue.title |html %]</a>
132                         </td>
133                         <td>[% missingissue.issn %]</td>
134                         <td>[% missingissue.serialseq %]</td>
135                         <td>
136                             [% IF ( missingissue.status1 ) %]<span class="status-expected">Expected</span>[% END %]
137                             [% IF ( missingissue.status3 ) %]<span class="status-late">Late</span>[% END %]
138                             [% IF ( missingissue.status4 ) %]<span class="status-missing">Missing</span>[% END %]
139                             [% IF ( missingissue.status41 ) %]<span class="status-missing_never_received">Missing (never received)</span>[% END %]
140                             [% IF ( missingissue.status42 ) %]<span class="status-missing_sold_out">Missing (sold out)</span>[% END %]
141                             [% IF ( missingissue.status43 ) %]<span class="status-missing_damaged">Missing (damaged)</span>[% END %]
142                             [% IF ( missingissue.status44 ) %]<span class="status-missing_lost">Missing (lost)</span>[% END %]
143                             [% IF ( missingissue.status7 ) %]<span class="status-claimed">Claimed</span>[% END %]
144                         </td>
145                         <td class="planneddate">
146                             [% IF ( missingissue.planneddate ) %]
147                                 <span title="[% missingissue.planneddateISO %]">[% missingissue.planneddate %]</span>
148                             [% ELSE %]
149                                 <span title="0000-00-00"></span>
150                             [% END %]
151                         </td>
152                         <td>[% missingissue.claims_count %]</td>
153                         <td>
154                             [% IF ( missingissue.claimdate ) %]
155                                 <span title="[% missingissue.claimdateISO %]">[% missingissue.claimdate %]</span>
156                             [% ELSE %]
157                                 <span title="0000-00-00"></span>
158                             [% END %]
159                         </td>
160                         [% FOR field IN additional_fields_for_subscription %]
161                           [% IF field.authorised_value_category %]
162                             <td>[% AuthorisedValues.GetByCode( field.authorised_value_category, missingissue.additional_fields.${field.name} ) %]</td>
163                           [% ELSE %]
164                             <td>[% missingissue.additional_fields.${field.name} %]</td>
165                           [% END %]
166                         [% END %]
167                     </tr>
168                 [% END %]</tbody>
169             </table>
170
171             [% IF csv_profiles %]
172               <fieldset class="action">
173                 <label for="csv_code">Select CSV profile:</label>
174                 <select id="csv_profile_for_export">
175                   [% FOR csv IN csv_profiles %]
176                     <option value="[% csv.export_format_id %]">[% csv.profile %]</option>
177                    [% END %]
178                 </select>
179                 <span class="exportSelected"><a id="ExportSelected" href="/cgi-bin/koha/serials/claims.pl">Download selected claims</a></span>
180             [% END %]
181
182             [% IF letters %]
183                 <fieldset class="action">
184                     <label for="letter_code">Select notice:</label>
185                     <select name="letter_code" id="letter_code">
186                         [% FOREACH letter IN letters %]
187                             <option value="[% letter.code %]">[% letter.name %]</option>
188                         [% END %]
189                     </select>
190                     <input type="hidden" name="op" value="send_alert" />
191                     <input type="hidden" name="supplierid" value="[% supplierid %]" />
192                     <input type="submit" name="submit" class="button" value="Send notification" />
193                 </fieldset>
194             [% END %]
195         </form>
196     </fieldset>
197 [% END %]
198
199 </div>
200 </div>
201
202 <div class="yui-b">
203 [% INCLUDE 'serials-menu.inc' %]
204 </div>
205 </div>
206
207 [% MACRO jsinclude BLOCK %]
208     [% INCLUDE 'calendar.inc' %]
209     [% INCLUDE 'datatables.inc' %]
210     <script type="text/javascript">
211         var sTable;
212         $(document).ready(function() {
213             sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, {
214                 "sDom": 't',
215                     "aoColumnDefs": [
216                         { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
217                         { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] },
218                         { 'sType': "title-string", 'aTargets' : [ 'title-string'] }
219                     ],
220                 "bPaginate": false
221             }));
222             sTable.fnAddFilters("filter", "200");
223             $('#supplierid').change(function() {
224                 $('#claims').submit();
225             });
226
227             // Checkboxes : Select All / None
228             $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>");
229
230             $("#CheckAll").click(function() {
231                 $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked'));
232             });
233
234             // Generates a dynamic link for exporting the selections data as CSV
235             $("#ExportSelected").click(function() {
236                 // 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.
237                 var selected = $("input[name=serialid]:checked");
238
239             if (selected.length == 0) {
240                 alert(_("Please select at least one item to export."));
241                 return false;
242             }
243
244             // Building the url from currently checked boxes
245             var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&amp;op=claims';
246             for (var i = 0; i < selected.length; i++) {
247                 url += '&amp;serialid=' + selected[i].value;
248             }
249             url += '&amp;csv_profile=' + $("#csv_profile_for_export option:selected").val();
250             // And redirecting to the CSV page
251             location.href = url;
252             return false;
253             });
254             $("#filterByDate").on("click",function(e){
255                 e.preventDefault();
256                 filterByDate();
257             });
258             $("#clearfilter").on("click",function(e){
259                 e.preventDefault();
260                 $("#from,#to").val("");
261                 $("table#claimst tbody tr").show();
262             });
263             $("#claims_form").on("submit",function(){
264                 return checkForm();
265             });
266             $("#filter_claims_form").on("submit",function(){
267                 return false;
268             });
269          });
270
271         // Checks if the form can be sent (at least one checkbox must be checked)
272         function checkForm() {
273             if ($("input:checked").length == 0) {
274             alert(_("Please select at least one issue."));
275             return false;
276             }
277         }
278
279         // Filter by date
280         function filterByDate() {
281             var beginDate = Date_from_syspref($("#from").val()).getTime();
282             var endDate   = Date_from_syspref($("#to").val()).getTime();
283
284             // Checks if the beginning date is valid
285             if (!parseInt(beginDate)) {
286                 alert(_("The beginning date is missing or invalid."));
287                 return false;
288             }
289
290             // Checks if the ending date is valid
291             if (!parseInt(endDate)) {
292                 alert(_("The ending date is missing or invalid."));
293                 return false;
294             }
295
296             // Checks if beginning date is before ending date
297             if (beginDate > endDate) {
298                 // If not, we swap them
299                 var tmpDate = endDate;
300                 endDate = beginDate;
301                 beginDate = tmpDate;
302             }
303
304             // We hide everything
305             $("table#claimst tbody tr").hide();
306
307             // For each date in the table
308             $(".planneddate").each(function() {
309
310             // We make a JS Date Object, according to the locale
311             var pdate = Date_from_syspref($(this).text()).getTime();
312
313             // And checks if the date is between the beginning and ending dates
314             if (pdate > beginDate &&
315                 pdate < endDate) {
316                 // If so, we can show the row
317                 $(this).parent().show();
318                 }
319             });
320         }
321     </script>
322 [% END %]
323
324 [% INCLUDE 'intranet-bottom.inc' %]