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