5 [% USE ColumnsSettings %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Acquisitions › Late orders</title>
9 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="acq_lateorders" class="acq">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'acquisitions-search.inc' %]
16 <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>
18 <div class="main container-fluid">
20 <div class="col-sm-10 col-sm-push-2">
23 <h1>[% IF ( Supplier ) %][% Supplier | html %] : [% END %]Late orders</h1>
24 <div id="acqui_lateorders">
27 [% IF ( error_claim == "no_email" ) %]
28 <div class="dialog alert">This vendor has no email</div>
29 [% ELSIF ( error_claim == "no_order_selected" ) %]
30 <div class="dialog alert">No order selected</div>
32 <div class="dialog alert">[% error_claim | html %]</div>
36 <div class="dialog message">Email has been sent.</div>
38 [% IF ( lateorders ) %]
39 <form action="lateorders.pl" name="claim" method="post">
40 <input type="hidden" name="op" value="send_alert" />
41 <input type="hidden" name="delay" value="[% delay | html %]" />
42 <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
44 <p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
45 [% FOREACH letter IN letters %]
46 <option value="[% letter.code | html %]">[% letter.name | html %]</option>
51 <table id="late_orders">
55 <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
60 <th class="title-string">Order date</th>
61 <th class="title-string">Estimated delivery date</th>
63 <th class="anti-the">Information</th>
70 <th class="title-string">Claimed date</th>
71 <th>Internal note</th>
77 [% FOREACH lateorder IN lateorders %]
80 <input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
83 [% lateorder.ordernumber | $raw %]
86 <span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
89 [% IF ( lateorder.estimateddeliverydate ) %]
90 <span title="[% lateorder.estimateddeliverydate | html %]">[% lateorder.estimateddeliverydate | $KohaDates %]</span>
92 <span title="0000-00-00"></span>
96 [% lateorder.supplier | html %]
97 ([% lateorder.supplierid | html %])
100 <b>[% lateorder.title | html %]</b>
101 [% IF ( lateorder.author ) %]<br/><i>Author:</i> [% lateorder.author | html %][% END %]
102 [% IF ( lateorder.publisher ) %]
103 <br/><i>Published by:</i> [% lateorder.publisher | html %]
104 [% IF ( lateorder.publicationyear ) %]
105 <i> in </i>[% lateorder.publicationyear | html %]
110 [% lateorder.unitpricesupplier | html %]x[% lateorder.quantity | html %] =
111 [% lateorder.subtotal | html %]
114 [% IF ( CAN_user_acquisition_order_manage ) %]
115 <a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basketname | html %] ([% lateorder.basketno | html %])</a>
117 [% lateorder.basketname | html %] ([% lateorder.basketno | html %])
121 [% IF ( lateorder.basketgroupid ) %]
122 [% IF ( CAN_user_acquisition_group_manage ) %]
123 <a href="basketgroup.pl?op=add&booksellerid=[% lateorder.supplierid | uri %]&basketgroupid=[% lateorder.basketgroupid | uri %]" title="basketgroup">[% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
125 [% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
129 <td>[% Branches.GetName( lateorder.branch ) | html %]
131 <td>[% lateorder.budget | html %]
133 <td>[% lateorder.claims_count | html %]</td>
135 [% IF ( lateorder.claimed_date ) %]
136 <span title="[% lateorder.claimed_date | html %]">[% lateorder.claimed_date | $KohaDates %]</span>
138 <span title="0000-00-00"></span>
142 [% IF ( lateorder.internalnote ) %]
143 <p class="ordernote">
144 <span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.internalnote | html %]</span>
145 <a class="edit_note" 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">
146 <i class="fa fa-pencil"></i> Edit internal note
150 <a class="edit_note" 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">
151 <i class="fa fa-plus"></i> Add internal note
156 [% IF ( lateorder.vendornote ) %]
157 <p class="ordernote">
158 <span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.vendornote | html %]</span>
159 <a class="edit_note" 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">
160 <i class="fa fa-pencil"></i> Edit vendor note
164 <a class="edit_note" 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">
165 <i class="fa fa-plus"></i> Add vendor note
169 <td>[% lateorder.isbn | $raw %]</td>
175 <th colspan="6">Total</th>
176 <th>[% total | html %]</th>
177 <th colspan="9"> </th>
181 <div class="spacer"></div>
183 <p style="display:block;">
184 <input type="button" value="Export as CSV" id="ExportSelected" />
185 [% UNLESS lateorder.budget_lock %]
186 <input type="submit" value="Claim order" />
188 <input type="button" value="Save notes" id="savenotes"/>
191 [% ELSE %]<p>There are no late orders.</p>
193 </div> <!-- /#acqui_lateorders -->
195 </div> <!-- /.col-sm-10.col-sm-push-2 -->
197 <div class="col-sm-2 col-sm-pull-10">
199 <form action="lateorders.pl" method="get">
200 <fieldset class="brief">
201 <h4>Filter results:</h4>
202 [% FOREACH ERROR_LOO IN ERROR_LOOP %]
203 [% 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 %]
206 <li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
207 <li><label for="from">Estimated delivery date from: </label>
208 <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
209 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
211 <li><label for="to">To: </label>
212 <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
213 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
216 <li><label for="booksellerid">Vendor:</label>
217 <select id="booksellerid" size="1" tabindex="" name="booksellerid">
218 <option value=""></option>
219 [% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
220 [% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
221 [% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
225 <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
228 [% INCLUDE 'acquisitions-menu.inc' %]
230 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
233 <!-- Modal for editing vendor and internal notes -->
234 <div class="modal" id="noteEditor" tabindex="-1" role="dialog" aria-labelledby="noteEditorLabel">
235 <div class="modal-dialog" role="document">
236 <form id="modify_order_notes" action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
237 <div class="modal-content">
238 <div class="modal-header">
239 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
240 <h4 class="modal-title" id="noteEditorLabel">Order note</h4>
242 <div class="modal-body">
243 <textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
244 <input type="hidden" id="ordernumber" name="ordernumber" value="" />
245 <input type="hidden" name="op" value="save" />
246 <input type="hidden" id="type" name="type" value="" />
248 <div class="modal-footer">
249 <button type="submit" class="btn btn-default">Save</button>
250 <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
257 [% MACRO jsinclude BLOCK %]
258 [% Asset.js("js/acquisitions-menu.js") | $raw %]
259 [% INCLUDE 'datatables.inc' %]
260 [% INCLUDE 'columns_settings.inc' %]
261 [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
262 [% INCLUDE 'calendar.inc' %]
265 function check_uncheck() {
266 var all_nodes = $(late_orderst.fnGetNodes());
267 if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
268 var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
269 $(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
271 $("input:checkbox[name=ordernumber]").prop('disabled', false);
275 $(document).ready(function() {
277 var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
278 late_orderst = KohaTable("late_orders", {
280 { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
281 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
282 { "sType": "title-string", "aTargets" : [ "title-string" ] }
284 "sPaginationType": "full",
286 "fnDrawCallback": function() {
287 if ( typeof late_orderst != 'undefined' ) {
289 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
292 }, columns_settings );
293 $('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
294 $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
295 $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
297 // Generates a dynamic link for exporting the selection's data as CSV
298 $("#ExportSelected").click(function() {
299 var all_nodes = $(late_orderst.fnGetNodes());
300 var selected = $(all_nodes).find("input[name='ordernumber']:checked");
302 if (selected.length == 0) {
303 alert(_("Please select at least one item to export."));
307 // Building the url from currently checked boxes
308 var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
309 for (var i = 0; i < selected.length; i++) {
310 url += '&ordernumber=' + selected[i].value;
312 // And redirecting to the CSV page
317 $(".edit_note").on("click", function(e) {
319 var ordernumber = $(this).data("ordernumber");
320 var note_type = $(this).data("note_type");
321 var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
322 var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
323 $("#noteEditor .modal-title").text(modalTitle);
324 $("#ordernumber").val( ordernumber );
325 $("#ordernotes").html( note_text );
326 $("#type").val( note_type );
327 $("#noteEditor").modal("show");
328 $("#ordernotes").focus();
331 $("#noteEditor").on('hidden.bs.modal', function (e) {
332 $("#noteEditorLabel").html("");
333 $("#noteEditor .modal-title").text("");
334 $("#ordernotes").html( "" );
335 $("#ordernumber").val("");
342 [% INCLUDE 'intranet-bottom.inc' %]