5 [% USE ColumnsSettings %]
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 ( Supplier ) %][% Supplier | 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.count %]
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="[% booksellerid | 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">
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>
72 <th class="title-string">Claimed date</th>
73 <th>Internal note</th>
79 [% FOREACH lateorder IN lateorders %]
82 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
85 [% lateorder.ordernumber | $raw %]
88 <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span>
91 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
92 [% IF estimated_delivery_date %]
93 <span title="[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
97 [% lateorder.basket.bookseller.name | html %]
98 ([% lateorder.basket.bookseller.id | html %])
101 <b>[% lateorder.biblio.title | html %]</b>
102 [% IF ( lateorder.biblio.author ) %]<br/><i>Author:</i> [% lateorder.biblio.author | html %][% END %]
103 [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
104 <br/><i>Published by:</i> [% lateorder.biblio.biblioitem.publishercode | html %]
105 [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
106 <i> in </i>[% lateorder.biblio.biblioitem.publicationyear | html %]
111 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
112 [% SET total = total + subtotal %]
113 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
116 [% IF ( CAN_user_acquisition_order_manage ) %]
117 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
119 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
123 [% IF ( lateorder.basket.basketgroupid ) %]
124 [% IF ( CAN_user_acquisition_group_manage ) %]
125 <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>
127 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
131 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
133 <td>[% lateorder.fund.budget_name | html %]
135 <td>[% lateorder.claims.count | html %]</td>
137 [% FOR claim IN lateorder.claims %]
138 <span title="[% lateorder.claims.last.claimed_on | html %]">[% claim.claimed_on | $KohaDates %]</span>
139 [% UNLESS loop.last %]<br/>[% END %]
143 [% IF lateorder.order_internalnote %]
144 <p class="ordernote">
145 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
146 <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">
147 <i class="fa fa-pencil"></i> Edit internal note
151 <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">
152 <i class="fa fa-plus"></i> Add internal note
157 [% IF lateorder.order_vendornote %]
158 <p class="ordernote">
159 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
160 <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">
161 <i class="fa fa-pencil"></i> Edit vendor note
165 <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">
166 <i class="fa fa-plus"></i> Add vendor note
170 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
176 <th colspan="6">Total</th>
177 <th>[% total | $Price %]</th>
178 <th colspan="9"> </th>
182 <div class="spacer"></div>
184 <p style="display:block;">
185 <div class="btn-group">
186 <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>
187 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
188 <ul class="dropdown-menu" id="export-csv-menu">
189 <li><a href="#">Default</a></li>
190 [% IF csv_profiles %]
191 [% FOR csv IN csv_profiles %]
192 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
198 <input type="submit" class="btn btn-default" value="Claim order" />
201 [% ELSE %]<p>There are no late orders.</p>
203 </div> <!-- /#acqui_lateorders -->
205 </div> <!-- /.col-sm-10.col-sm-push-2 -->
207 <div class="col-sm-2 col-sm-pull-10">
209 <form action="lateorders.pl" method="get">
210 <fieldset class="brief">
211 <h4>Filter results:</h4>
212 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
213 [% 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 %]
216 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
217 <li><label for="from">Estimated delivery date from: </label>
218 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
219 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
221 <li><label for="to">To: </label>
222 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
223 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
226 <li><label for="booksellerid">Vendor:</label>
227 <select id="booksellerid" size="1" tabindex="" name="booksellerid">
228 <option value=""></option>
229 [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
230 [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
231 [% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
235 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
238 [% INCLUDE 'acquisitions-menu.inc' %]
240 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
243 <!-- Modal for editing vendor and internal notes -->
244 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
245 <div class="modal-dialog" role="document">
246 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
247 <div class="modal-content">
248 <div class="modal-header">
249 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
250 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
252 <div class="modal-body">
253 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
254 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
255 <input type="hidden" name="op" value="save" />
256 <input type="hidden" id="type" name="type" value="" />
258 <div class="modal-footer">
259 <button type="submit" class="btn btn-default">Save</button>
260 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
267 [% MACRO jsinclude BLOCK %]
268 [% Asset.js("js/acquisitions-menu.js") | $raw %]
269 [% INCLUDE 'datatables.inc' %]
270 [% INCLUDE 'columns_settings.inc' %]
271 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
272 [% INCLUDE 'calendar.inc' %]
275 function check_uncheck() {
276 var all_nodes = $(late_orderst.fnGetNodes());
277 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
278 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
279 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
281 $("input:checkbox[name=ordernumber]").prop('disabled', false);
285 $(document).ready(function() {
287 var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
288 late_orderst = KohaTable("late_orders", {
290 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
291 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
292 { "sType": "title-string", "aTargets" : [ "title-string" ] }
294 "sPaginationType": "full",
296 "fnDrawCallback": function() {
297 if ( typeof late_orderst != 'undefined' ) {
299 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
302 }, columns_settings );
303 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
304 $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
305 $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
307 // Generates a dynamic link for exporting the selection's data as CSV
308 $("#exportbutton, #export-csv-menu a").click(function() {
309 var all_nodes = $(late_orderst.fnGetNodes());
310 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
312 if (selected.length == 0) {
313 alert(_("Please select at least one item to export."));
317 var url = $('#exportbutton').attr('href') + '?';
318 // Building the url from currently checked boxes
319 for (var i = 0; i < selected.length; i++) {
320 url += '&ordernumber=' + selected[i].value;
322 if($(this).attr("data-value")) {
323 url += '&csv_profile=' + $(this).attr("data-value");
325 // And redirecting to the CSV page
330 $(".edit_note").on("click", function(e) {
332 var ordernumber = $(this).data("ordernumber");
333 var note_type = $(this).data("note_type");
334 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
335 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
336 $("#noteEditor .modal-title").text(modalTitle);
337 $("#ordernumber").val( ordernumber );
338 $("#ordernotes").html( note_text );
339 $("#type").val( note_type );
340 $("#noteEditor").modal("show");
341 $("#ordernotes").focus();
344 $("#noteEditor").on('hidden.bs.modal', function (e) {
345 $("#noteEditorLabel").html("");
346 $("#noteEditor .modal-title").text("");
347 $("#ordernotes").html( "" );
348 $("#ordernumber").val("");
355 [% INCLUDE 'intranet-bottom.inc' %]