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' %]
18 <nav aria-label="Breadcrumb" class="breadcrumb">
21 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
27 <a href="#" aria-current="page">Late orders</a>
32 <div class="main container-fluid">
34 <div class="col-sm-10 col-sm-push-2">
37 <h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
38 <div id="acqui_lateorders">
41 [% IF ( error_claim == "no_email" ) %]
42 <div class="dialog alert">This vendor has no email</div>
43 [% ELSIF ( error_claim == "no_order_selected" ) %]
44 <div class="dialog alert">No order selected</div>
46 <div class="dialog alert">[% error_claim | html %]</div>
50 <div class="dialog message">Email has been sent.</div>
52 [% IF lateorders.size %]
53 <form action="lateorders.pl" name="claim" method="post">
54 <input type="hidden" name="op" value="send_alert" />
55 <input type="hidden" name="delay" value="[% delay | html %]" />
56 <input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" />
58 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
59 [% FOREACH letter IN letters %]
60 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
66 [% SET total_quantity = 0 %]
67 [% IF bookseller_filter %]
68 <p><a id="CheckAll" href="#"><i class="fa fa-check"></i> Check all</a> <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Uncheck all</a></p>
70 <table id="late_orders">
73 <th class="NoSort"></th>
75 <th class="title-string">Order date</th>
76 <th class="title-string">Estimated delivery date</th>
78 <th class="anti-the">Information</th>
87 <th class="title-string">Claimed date</th>
88 <th>Internal note</th>
94 [% FOREACH lateorder IN lateorders %]
97 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber">
100 [% lateorder.ordernumber | $raw %]
103 <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span>
106 [% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
107 [% IF estimated_delivery_date %]
108 <span title="[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
112 [% lateorder.basket.bookseller.name | html %]
113 ([% lateorder.basket.bookseller.id | html %])
116 <span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span>
117 [% IF ( lateorder.biblio.author ) %]<br/><em>Author:</em> [% lateorder.biblio.author | html %][% END %]
118 [% IF ( lateorder.biblio.biblioitem.publishercode ) %]
119 <br/><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %]
120 [% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
121 <em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %]
126 [% lateorder.quantity | html %]
127 [% SET total_quantity = total_quantity + lateorder.quantity %]
130 [% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
131 [% SET total = total + subtotal %]
132 [% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] = [% subtotal | $Price %]
135 [% IF ( CAN_user_acquisition_order_manage ) %]
136 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a>
138 [% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])
142 [% IF ( lateorder.basket.basketgroupid ) %]
143 [% IF ( CAN_user_acquisition_group_manage ) %]
144 <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>
146 [% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a>
150 <td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
152 <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
153 <td>[% lateorder.fund.budget_name | html %]</td>
154 <td>[% lateorder.claims.count | html %]</td>
156 [% FOR claim IN lateorder.claims %]
157 <span title="[% lateorder.claims.last.claimed_on | html %]">[% claim.claimed_on | $KohaDates %]</span>
158 [% UNLESS loop.last %]<br/>[% END %]
162 [% IF lateorder.order_internalnote %]
163 <p class="ordernote">
164 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span>
165 <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">
166 <i class="fa fa-pencil"></i> Edit internal note
170 <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">
171 <i class="fa fa-plus"></i> Add internal note
176 [% IF lateorder.order_vendornote %]
177 <p class="ordernote">
178 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span>
179 <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">
180 <i class="fa fa-pencil"></i> Edit vendor note
184 <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">
185 <i class="fa fa-plus"></i> Add vendor note
189 <td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td>
195 <th colspan="6">Total</th>
196 <th>[% total_quantity | html %]</th>
197 <th>[% total | $Price %]</th>
198 <th colspan="10"> </th>
203 <fieldset class="action">
204 <div class="btn-group">
205 <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>
206 <a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
207 <ul class="dropdown-menu" id="export-csv-menu">
208 <li><a href="#">Default</a></li>
209 [% IF csv_profiles %]
210 [% FOR csv IN csv_profiles %]
211 <li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
217 <input type="submit" class="btn btn-default" value="Claim order" />
220 [% ELSE %]<p>There are no late orders.</p>
222 </div> <!-- /#acqui_lateorders -->
224 </div> <!-- /.col-sm-10.col-sm-push-2 -->
226 <div class="col-sm-2 col-sm-pull-10">
228 <form action="lateorders.pl" method="get">
229 <fieldset class="brief">
230 <h4>Filter results:</h4>
231 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
232 [% 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 %]
235 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
236 <li><label for="from">Estimated delivery date from: </label>
237 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
238 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
240 <li><label for="to">To: </label>
241 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
242 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
245 <li><label for="booksellerid">Vendor:</label>
246 <select id="booksellerid" tabindex="" name="booksellerid">
247 <option value=""></option>
248 [% FOREACH bookseller IN booksellers %]
249 [% IF bookseller.id == bookseller_filter.id %]
250 <option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option>
252 <option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option>
257 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
260 [% INCLUDE 'acquisitions-menu.inc' %]
262 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
265 <!-- Modal for editing vendor and internal notes -->
266 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
267 <div class="modal-dialog" role="document">
268 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
269 <div class="modal-content">
270 <div class="modal-header">
271 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
272 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
274 <div class="modal-body">
275 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
276 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
277 <input type="hidden" name="op" value="save" />
278 <input type="hidden" id="type" name="type" value="" />
280 <div class="modal-footer">
281 <button type="submit" class="btn btn-default">Save</button>
282 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
289 [% MACRO jsinclude BLOCK %]
290 [% Asset.js("js/acquisitions-menu.js") | $raw %]
291 [% INCLUDE 'datatables.inc' %]
292 [% INCLUDE 'columns_settings.inc' %]
293 [% INCLUDE 'calendar.inc' %]
296 function check_uncheck() {
297 var all_nodes = $(late_orderst.fnGetNodes());
298 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
299 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
300 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
302 $("input:checkbox[name=ordernumber]").prop('disabled', false);
306 $(document).ready(function() {
308 var columns_settings = [% TablesSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
309 late_orderst = KohaTable("late_orders", {
310 "sorting": [[ 1, "asc" ]],
311 "sPaginationType": "full",
313 "fnDrawCallback": function() {
314 if ( typeof late_orderst != 'undefined' ) {
316 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
319 }, columns_settings );
320 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
321 $('#CheckAll').click(function(e){
323 $("#late_orders input:checkbox").prop("checked", true);
325 $('#CheckNone').click(function(e){
327 $("#late_orders input:checkbox").prop("checked", false);
330 // Generates a dynamic link for exporting the selection's data as CSV
331 $("#exportbutton, #export-csv-menu a").click(function() {
332 var all_nodes = $(late_orderst.fnGetNodes());
333 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
335 if (selected.length == 0) {
336 alert(_("Please select at least one item to export."));
340 var url = $('#exportbutton').attr('href') + '?';
341 // Building the url from currently checked boxes
342 for (var i = 0; i < selected.length; i++) {
343 url += '&ordernumber=' + selected[i].value;
345 if($(this).attr("data-value")) {
346 url += '&csv_profile=' + $(this).attr("data-value");
348 // And redirecting to the CSV page
353 $(".edit_note").on("click", function(e) {
355 var ordernumber = $(this).data("ordernumber");
356 var note_type = $(this).data("note_type");
357 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
358 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
359 $("#noteEditor .modal-title").text(modalTitle);
360 $("#ordernumber").val( ordernumber );
361 $("#ordernotes").html( note_text );
362 $("#type").val( note_type );
363 $("#noteEditor").modal("show");
364 $("#ordernotes").focus();
367 $("#noteEditor").on('hidden.bs.modal', function (e) {
368 $("#noteEditorLabel").html("");
369 $("#noteEditor .modal-title").text("");
370 $("#ordernotes").html( "" );
371 $("#ordernumber").val("");
378 [% INCLUDE 'intranet-bottom.inc' %]