5 [% USE TablesSettings %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Acquisitions › Late orders</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="acq_lateorders" class="acq">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
17 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="lateorders.pl">Late orders</a></div>
19 <div class="main container-fluid">
21 <div class="col-sm-10 col-sm-push-2">
24 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
25 <div id="acqui_lateorders">
28 [% IF ( error_claim == "no_email" ) %]
29 <div class="dialog alert">This vendor has no email</div>
30 [% ELSIF ( error_claim == "no_order_selected" ) %]
31 <div class="dialog alert">No order selected</div>
33 <div class="dialog alert">[% error_claim | html %]</div>
37 <div class="dialog message">Email has been sent.</div>
39 [% IF lateorders.size %]
40 <form action="lateorders.pl" name="claim" method="post">
41 <input type="hidden" name="op" value="send_alert" />
42 <input type="hidden" name="delay" value="[% delay | html %]" />
43 <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
45 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
46 [% FOREACH letter IN letters %]
47 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
53 <table id="late_orders">
56 [% IF bookseller_filter %]
57 <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
62 <th class="title-string">Order date</th>
63 <th class="title-string">Estimated delivery date</th>
65 <th class="anti-the">Information</th>
73 <th class="title-string">Claimed date</th>
74 <th>Internal note</th>
80 [% FOREACH lateorder IN lateorders %]
83 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
86 [% lateorder.ordernumber | $raw %]
89 <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span>
92 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
93 [% IF estimated_delivery_date %]
94 <span title="[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
98 [% lateorder.basket.bookseller.name | html %]
99 ([% lateorder.basket.bookseller.id | html %])
102 <b>[% lateorder.biblio.title | html %]</b>
103 [% IF ( lateorder.biblio.author ) %]<br/><i>Author:</i> [% lateorder.biblio.author | html %][% END %]
104 [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
105 <br/><i>Published by:</i> [% lateorder.biblio.biblioitem.publishercode | html %]
106 [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
107 <i> in </i>[% lateorder.biblio.biblioitem.publicationyear | html %]
111 <td>[% lateorder.quantity | html %]</td>
113 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
114 [% SET total = total + subtotal %]
115 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
118 [% IF ( CAN_user_acquisition_order_manage ) %]
119 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
121 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
125 [% IF ( lateorder.basket.basketgroupid ) %]
126 [% IF ( CAN_user_acquisition_group_manage ) %]
127 <a href="basketgroup.pl?op=add&booksellerid=[% lateorder.basket.booksellerid | uri %]&basketgroupid=[% lateorder.basket.basketgroupid | uri %]" title="basketgroup">[% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
129 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
133 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
135 <td>[% lateorder.fund.budget_name | html %]
137 <td>[% lateorder.claims.count | html %]</td>
139 [% FOR claim IN lateorder.claims %]
140 <span title="[% lateorder.claims.last.claimed_on | html %]">[% claim.claimed_on | $KohaDates %]</span>
141 [% UNLESS loop.last %]<br/>[% END %]
145 [% IF lateorder.order_internalnote %]
146 <p class="ordernote">
147 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
148 <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" title="Edit internal note">
149 <i class="fa fa-pencil"></i> Edit internal note
153 <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" title="Add internal note">
154 <i class="fa fa-plus"></i> Add internal note
159 [% IF lateorder.order_vendornote %]
160 <p class="ordernote">
161 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
162 <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" title="Edit vendor note">
163 <i class="fa fa-pencil"></i> Edit vendor note
167 <a class="edit_note noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-note_type="vendor" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" title="Add vendor note">
168 <i class="fa fa-plus"></i> Add vendor note
172 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
178 <th colspan="6">Total</th>
179 <th>[% total | $Price %]</th>
180 <th colspan="10"> </th>
184 <div class="spacer"></div>
186 <p style="display:block;">
187 <div class="btn-group">
188 <a id="exportbutton" class="btn btn-default" href="/cgi-bin/koha/acqui/lateorders-export.pl"><i class="fa fa-download"></i> Export as CSV</a>
189 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
190 <ul class="dropdown-menu" id="export-csv-menu">
191 <li><a href="#">Default</a></li>
192 [% IF csv_profiles %]
193 [% FOR csv IN csv_profiles %]
194 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
200 <input type="submit" class="btn btn-default" value="Claim order" />
203 [% ELSE %]<p>There are no late orders.</p>
205 </div> <!-- /#acqui_lateorders -->
207 </div> <!-- /.col-sm-10.col-sm-push-2 -->
209 <div class="col-sm-2 col-sm-pull-10">
211 <form action="lateorders.pl" method="get">
212 <fieldset class="brief">
213 <h4>Filter results:</h4>
214 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
215 [% IF ( ERROR_LOO.delay_digits ) %]<p class="error">The number of days ([% ERROR_LOO.bad_delay | html %]) must be a number between 0 and 999.</p>[% END %]
218 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
219 <li><label for="from">Estimated delivery date from: </label>
220 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
221 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
223 <li><label for="to">To: </label>
224 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
225 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
228 <li><label for="booksellerid">Vendor:</label>
229 <select id="booksellerid" tabindex="" name="booksellerid">
230 <option value=""></option>
231 [% FOREACH bookseller IN booksellers %]
232 [% IF bookseller.id == bookseller_filter.id %]
233 <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
235 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
240 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
243 [% INCLUDE 'acquisitions-menu.inc' %]
245 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
248 <!-- Modal for editing vendor and internal notes -->
249 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
250 <div class="modal-dialog" role="document">
251 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
252 <div class="modal-content">
253 <div class="modal-header">
254 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
255 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
257 <div class="modal-body">
258 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
259 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
260 <input type="hidden" name="op" value="save" />
261 <input type="hidden" id="type" name="type" value="" />
263 <div class="modal-footer">
264 <button type="submit" class="btn btn-default">Save</button>
265 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
272 [% MACRO jsinclude BLOCK %]
273 [% Asset.js("js/acquisitions-menu.js") | $raw %]
274 [% INCLUDE 'datatables.inc' %]
275 [% INCLUDE 'columns_settings.inc' %]
276 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
277 [% INCLUDE 'calendar.inc' %]
280 function check_uncheck() {
281 var all_nodes = $(late_orderst.fnGetNodes());
282 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
283 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
284 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
286 $("input:checkbox[name=ordernumber]").prop('disabled', false);
290 $(document).ready(function() {
292 var columns_settings = [% TablesSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
293 late_orderst = KohaTable("late_orders", {
295 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
296 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
297 { "sType": "title-string", "aTargets" : [ "title-string" ] }
299 "sPaginationType": "full",
301 "fnDrawCallback": function() {
302 if ( typeof late_orderst != 'undefined' ) {
304 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
307 }, columns_settings );
308 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
309 $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
310 $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
312 // Generates a dynamic link for exporting the selection's data as CSV
313 $("#exportbutton, #export-csv-menu a").click(function() {
314 var all_nodes = $(late_orderst.fnGetNodes());
315 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
317 if (selected.length == 0) {
318 alert(_("Please select at least one item to export."));
322 var url = $('#exportbutton').attr('href') + '?';
323 // Building the url from currently checked boxes
324 for (var i = 0; i < selected.length; i++) {
325 url += '&ordernumber=' + selected[i].value;
327 if($(this).attr("data-value")) {
328 url += '&csv_profile=' + $(this).attr("data-value");
330 // And redirecting to the CSV page
335 $(".edit_note").on("click", function(e) {
337 var ordernumber = $(this).data("ordernumber");
338 var note_type = $(this).data("note_type");
339 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
340 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
341 $("#noteEditor .modal-title").text(modalTitle);
342 $("#ordernumber").val( ordernumber );
343 $("#ordernotes").html( note_text );
344 $("#type").val( note_type );
345 $("#noteEditor").modal("show");
346 $("#ordernotes").focus();
349 $("#noteEditor").on('hidden.bs.modal', function (e) {
350 $("#noteEditorLabel").html("");
351 $("#noteEditor .modal-title").text("");
352 $("#ordernotes").html( "" );
353 $("#ordernumber").val("");
360 [% INCLUDE 'intranet-bottom.inc' %]