[% USE Asset %]
[% USE KohaDates %]
[% USE Branches %]
-[% USE ColumnsSettings %]
+[% USE TablesSettings %]
[% USE Price %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Acquisitions › Late orders</title>
+<title>Late orders › Acquisitions › Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_lateorders" class="acq">
-[% INCLUDE 'header.inc' %]
-[% INCLUDE 'acquisitions-search.inc' %]
+[% WRAPPER 'header.inc' %]
+ [% INCLUDE 'acquisitions-search.inc' %]
+[% END %]
+
-<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>
+[% WRAPPER 'sub-header.inc' %]
+<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
+ <ol>
+ <li>
+ <a href="/cgi-bin/koha/mainpage.pl">Home</a>
+ </li>
+ <li>
+ <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
+ </li>
+ <li>
+ <a href="#" aria-current="page">Late orders</a>
+ </li>
+ </ol>
+</nav>
+[% END %]
<div class="main container-fluid">
<div class="row">
<main>
<h1>[% IF bookseller_filter %][% bookseller_filter.name | html %] : [% END %]Late orders</h1>
-<div id="acqui_lateorders">
+<div id="acqui_lateorders" class="page-section">
[% IF error_claim %]
[% IF ( error_claim == "no_email" ) %]
</p>
[% END %]
[% SET total = 0 %]
+ [% SET total_quantity = 0 %]
+ [% IF bookseller_filter %]
+ <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>
+ [% END %]
<table id="late_orders">
<thead>
<tr>
- [% IF bookseller_filter %]
- <th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
- [% ELSE %]
- <th></th>
- [% END %]
+ <th class="NoSort"></th>
<th>Order line</th>
- <th class="title-string">Order date</th>
- <th class="title-string">Estimated delivery date</th>
+ <th>Order date</th>
+ <th>Estimated delivery date</th>
<th>Vendor</th>
<th class="anti-the">Information</th>
<th>Quantity</th>
<th>Basket</th>
<th>Basket group</th>
<th>Library</th>
+ <th>Budget</th>
<th>Fund</th>
<th>Claims count</th>
- <th class="title-string">Claimed date</th>
+ <th>Claimed date</th>
<th>Internal note</th>
<th>Vendor note</th>
<th>ISBN</th>
<td>
[% lateorder.ordernumber | $raw %]
</td>
- <td>
- <span title="[% lateorder.basket.closedate | html %]">[% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)</span>
+ <td data-order="[% lateorder.basket.closedate | html %]">
+ [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days)
</td>
- <td>
+ [% IF lateorder.get_column('estimated_delivery_date') %]
[% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %]
- [% IF estimated_delivery_date %]
- <span title="[% estimated_delivery_date | html %]">[% estimated_delivery_date | $KohaDates %]</span>
- [% END %]
+ [% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %]
+ [% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %]
+ [% END %]
+ <td data-order="[% estimated_delivery_date | html %]">
+ <p class="delivery_date">
+ <span>[% estimated_delivery_date | $KohaDates %]</span>
+ [% IF CAN_user_acquisition_order_manage %]
+ <a class="edit_delivery_date noExport" data-ordernumber="[% lateorder.ordernumber | html %]" data-delivery_date="[% estimated_delivery_date | html %]" id="delivery_date_[% lateorder.ordernumber | html %]" href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% lateorder.ordernumber | html %]" title="Edit delivery date">
+ <i class="fa fa-pencil"></i> Edit
+ </a>
+ [% END %]
+ </p>
</td>
<td>
[% lateorder.basket.bookseller.name | html %]
([% lateorder.basket.bookseller.id | html %])
</td>
<td>
- <b>[% lateorder.biblio.title | html %]</b>
- [% IF ( lateorder.biblio.author ) %]<br/><i>Author:</i> [% lateorder.biblio.author | html %][% END %]
+ <span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span>
+ [% IF ( lateorder.biblio.author ) %]<br/><em>Author:</em> [% lateorder.biblio.author | html %][% END %]
[% IF ( lateorder.biblio.biblioitem.publishercode ) %]
- <br/><i>Published by:</i> [% lateorder.biblio.biblioitem.publishercode | html %]
+ <br/><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %]
[% IF ( lateorder.biblio.biblioitem.publicationyear ) %]
- <i> in </i>[% lateorder.biblio.biblioitem.publicationyear | html %]
+ <em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %]
[% END %]
[% END %]
</td>
- <td>[% lateorder.quantity | html %]</td>
+ <td>
+ [% lateorder.quantity | html %]
+ [% SET total_quantity = total_quantity + lateorder.quantity %]
+ </td>
<td>
[% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %]
[% SET total = total + subtotal %]
</td>
<td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
</td>
- <td>[% lateorder.fund.budget_name | html %]
- </td>
+ <td>[% lateorder.fund.budget.budget_period_description | html %]</td>
+ <td>[% lateorder.fund.budget_name | html %]</td>
<td>[% lateorder.claims.count | html %]</td>
- <td>
+ <td data-order="[% lateorder.claims.last.claimed_on | html %]">
[% FOR claim IN lateorder.claims %]
- <span title="[% lateorder.claims.last.claimed_on | html %]">[% claim.claimed_on | $KohaDates %]</span>
+ [% claim.claimed_on | $KohaDates %]
[% UNLESS loop.last %]<br/>[% END %]
[% END %]
</td>
<tfoot>
<tr>
<th colspan="6">Total</th>
+ <th>[% total_quantity | html %]</th>
<th>[% total | $Price %]</th>
<th colspan="10"> </th>
</tr>
</tfoot>
</table>
- <div class="spacer"></div>
- <p style="display:block;">
+ <fieldset class="action">
<div class="btn-group">
<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>
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a>
<ul class="dropdown-menu" id="export-csv-menu">
<li><a href="#">Default</a></li>
- [% IF csv_profiles %]
+ [% IF csv_profiles.count %]
[% FOR csv IN csv_profiles %]
<li><a href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li>
[% END %]
</div>
<input type="submit" class="btn btn-default" value="Claim order" />
- </p>
+ </fieldset>
</form>
[% ELSE %]<p>There are no late orders.</p>
[% END %]
<ol>
<li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li>
<li><label for="from">Estimated delivery date from: </label>
- <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="datepickerfrom" />
+ <input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="flatpickr" data-date_to="to"/>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="to">To: </label>
- <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="datepickerto" />
+ <input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="flatpickr" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
[% END %]
</select>
</ol>
- <fieldset class="action"><input type="submit" value="Filter" /></fieldset>
</fieldset>
+ <fieldset class="action"><input type="submit" class="btn btn-primary" value="Filter" /></fieldset>
</form>
[% INCLUDE 'acquisitions-menu.inc' %]
</aside>
</div>
<div class="modal-body">
<textarea id="ordernotes" name="ordernotes" rows="3" cols="30" class="focus">[% ordernotes | html %]</textarea>
- <input type="hidden" id="ordernumber" name="ordernumber" value="" />
+ <input type="hidden" id="notes_ordernumber" name="ordernumber" value="" />
<input type="hidden" name="op" value="save" />
<input type="hidden" id="type" name="type" value="" />
</div>
</div>
</div>
+<!-- Modal for editing estimated delivery date -->
+<div class="modal" id="dateEditor" tabindex="-1" role="dialog" aria-labelledby="dateEditorLabel">
+ <div class="modal-dialog" role="document">
+ <form id="modify_estimated_delivery_date" action="/cgi-bin/koha/acqui/moddeliverydate.pl" method="post">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
+ <h4 class="modal-title" id="dateEditorLabel">Estimated delivery date</h4>
+ </div>
+ <div class="modal-body">
+ <input type="text" id="estimated_delivery_date" size="10" name="estimated_delivery_date" class="flatpickr" value="[% estimated_delivery_date | html %]"/>
+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
+ <input type="hidden" id="date_ordernumber" name="ordernumber" value="" />
+ <input type="hidden" name="op" value="save" />
+ </div>
+ <div class="modal-footer">
+ <button type="submit" class="btn btn-default">Save</button>
+ <button type="button" class="btn btn-link cancel" data-dismiss="modal">Cancel</button>
+ </div>
+ </div>
+ </form>
+ </div>
+</div>
+
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/acquisitions-menu.js") | $raw %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'columns_settings.inc' %]
- [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
<script>
var late_orderst;
$(document).ready(function() {
- var columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
+ var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %];
late_orderst = KohaTable("late_orders", {
- "aoColumnDefs": [
- { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false },
- { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
- { "sType": "title-string", "aTargets" : [ "title-string" ] }
- ],
+ "sorting": [[ 1, "asc" ]],
"sPaginationType": "full",
"bAutoWidth": false,
"fnDrawCallback": function() {
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
};
}
- }, columns_settings );
+ }, table_settings );
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
- $('#CheckAll').click(function(){ $(late_orderst.fnGetNodes()).find("td").checkCheckboxes();});
- $('#CheckNone').click(function(){ $(late_orderst.fnGetNodes()).find("td").unCheckCheckboxes();});
+ $('#CheckAll').click(function(e){
+ e.preventDefault();
+ $("#late_orders input:checkbox").prop("checked", true);
+ });
+ $('#CheckNone').click(function(e){
+ e.preventDefault();
+ $("#late_orders input:checkbox").prop("checked", false);
+ });
// Generates a dynamic link for exporting the selection's data as CSV
$("#exportbutton, #export-csv-menu a").click(function() {
e.preventDefault();
var ordernumber = $(this).data("ordernumber");
var note_type = $(this).data("note_type");
- var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
+ var modalTitle = _("%s (order number %s)").format($(this).attr("title"), ordernumber);
var note_text = $( "#" + note_type + "-note-" + ordernumber ).html();
$("#noteEditor .modal-title").text(modalTitle);
- $("#ordernumber").val( ordernumber );
+ $("#notes_ordernumber").val( ordernumber );
$("#ordernotes").html( note_text );
$("#type").val( note_type );
$("#noteEditor").modal("show");
$("#noteEditorLabel").html("");
$("#noteEditor .modal-title").text("");
$("#ordernotes").html( "" );
- $("#ordernumber").val("");
+ $("#notes_ordernumber").val("");
$("#type").val("");
});
+
+ $(".edit_delivery_date").on("click", function(e) {
+ e.preventDefault();
+ var ordernumber = $(this).data("ordernumber");
+ var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")";
+ var delivery_date = $( "#delivery_date_" + ordernumber ).data("delivery_date");
+ const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr;
+ estimated_delivery_date.setDate( delivery_date );
+ $("#dateEditor .modal-title").text(modalTitle);
+ $("#date_ordernumber").val(ordernumber);
+ $("#dateEditor").modal("show");
+ });
+
+ $("#dateEditor").on('hidden.bs.modal', function (e) {
+ $("#dateEditorLabel").html("");
+ $("#dateEditor .modal-title").text("");
+ $("#estimated_delivery_date").html( "" );
+ $("#date_ordernumber").val("");
+ });
});
</script>
[% END %]