Koha/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
Owen Leonard 247dca3064
Bug 23013: Upgrade DataTables in the staff client
This patch upgrades DataTables and makes some style changes to the
default DataTables toolbar style. DataTables assets are now combined and
minified using their download customizer, bundling together these
elements:

 - JSZip 2.5.0
 - pdfmake 0.1.36
 - DataTables 1.10.18
 - Buttons 1.5.6
 - Column visibility 1.5.6
 - HTML5 export 1.5.6
 - Print view 1.5.6
 - FixedHeader 3.1.4

DataTables assets have been moved from lib/jquery/plugins to
lib/datatables. The global header and footer include files are updated
correspondingly.

This patch removes the custom "four_button" pagination configuration and
updates pages which used it to use the built-in "full" type instead.
This is done for the sake of consistency and upgradability. This change
touches a lot of files.

Table-specific CSS has been moved from staff-global.scss to a new
include, _tables.scss. A second common include, _mixins.scss has some
variable definitions used in both files.

Many images have been made obsolete by this change and have been
removed.

To test, apply the patch and regenerate the staff client CSS. View
various pages in the staff client with tables:

 - Not formatted by DataTables:
   - Reports -> Most circulated items
   - Catalog -> Search results
 - Formatted by DataTables without column configuration
   - Acquisitions -> Vendor search
   - Lists
 - Formatted by DataTables with column configuration
   - Administration -> Libraries
   - Administration -> Item types
   - Reports -> Saved SQL reports
 - Non-standard DataTables configurations:
   - Circulation -> Checkouts
   - Administration -> System preferences
   - Reports -> Lost items

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2019-08-22 15:23:19 +01:00

259 lines
11 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE KohaDates %]
[% USE Branches %]
[% USE ColumnsSettings %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Acquisitions &rsaquo; Late orders</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="acq_lateorders" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="lateorders.pl">Late orders</a></div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
<h1>[% IF ( Supplier ) %][% Supplier | html %] : [% END %]Late orders</h1>
<div id="acqui_lateorders">
[% IF error_claim %]
[% IF ( error_claim == "no_email" ) %]
<div class="dialog alert">This vendor has no email</div>
[% ELSIF ( error_claim == "no_order_selected" ) %]
<div class="dialog alert">No order selected</div>
[% ELSE %]
<div class="dialog alert">[% error_claim | html %]</div>
[% END %]
[% END %]
[% IF info_claim %]
<div class="dialog message">Email has been sent.</div>
[% END %]
[% IF ( lateorders ) %]
<form action="lateorders.pl" name="claim" method="post">
<input type="hidden" name="op" value="send_alert" />
<input type="hidden" name="delay" value="[% delay | html %]" />
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
[% IF ( letters ) %]
<p><label for="letter_code">Claim using notice: </label><select name="letter_code" id="letter_code">
[% FOREACH letter IN letters %]
<option value="[% letter.code | html %]">[% letter.name | html %]</option>
[% END %]
</select>
</p>
[% END %]
<table id="late_orders">
<thead>
<tr>
[% IF Supplier %]
<th><a id="CheckAll" href="#">Check all</a><br /><a id="CheckNone" href="#">Uncheck all</a></th>
[% ELSE %]
<th></th>
[% END %]
<th class="title-string">Order date</th>
<th class="title-string">Estimated delivery date</th>
<th>Vendor</th>
<th class="anti-the">Information</th>
<th>Total cost</th>
<th>Basket</th>
<th>Basket group</th>
<th>Library</th>
<th>Fund</th>
<th>Claims count</th>
<th class="title-string">Claimed date</th>
</tr>
</thead>
<tbody>
[% FOREACH lateorder IN lateorders %]
<tr>
<td>
<input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.supplierid | html %]" name="ordernumber">
</td>
<td>
<span title="[% lateorder.orderdate | html %]">[% lateorder.orderdate | $KohaDates %] ([% lateorder.latesince | html %] days)</span>
</td>
<td>
[% IF ( lateorder.estimateddeliverydate ) %]
<span title="[% lateorder.estimateddeliverydate | html %]">[% lateorder.estimateddeliverydate | $KohaDates %]</span>
[% ELSE %]
<span title="0000-00-00"></span>
[% END %]
</td>
<td>
[% lateorder.supplier | html %]
([% lateorder.supplierid | html %])
</td>
<td>
<b>[% lateorder.title | html %]</b>
[% IF ( lateorder.author ) %]<br/><i>Author:</i> [% lateorder.author | html %][% END %]
[% IF ( lateorder.publisher ) %]
<br/><i>Published by:</i> [% lateorder.publisher | html %]
[% IF ( lateorder.publicationyear ) %]
<i> in </i>[% lateorder.publicationyear | html %]
[% END %]
[% END %]
</td>
<td>
[% lateorder.unitpricesupplier | html %]x[% lateorder.quantity | html %] =
[% lateorder.subtotal | html %]
</td>
<td>
[% IF ( CAN_user_acquisition_order_manage ) %]
<a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basketname | html %] ([% lateorder.basketno | html %])</a>
[% ELSE %]
[% lateorder.basketname | html %] ([% lateorder.basketno | html %])
[% END %]
</td>
<td>
[% IF ( lateorder.basketgroupid ) %]
[% IF ( CAN_user_acquisition_group_manage ) %]
<a href="basketgroup.pl?op=add&booksellerid=[% lateorder.supplierid | uri %]&basketgroupid=[% lateorder.basketgroupid | uri %]" title="basketgroup">[% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
[% ELSE %]
[% lateorder.basketgroupname | html %] ([% lateorder.basketgroupid | html %])</a>
[% END %]
[% END %]
</td>
<td>[% Branches.GetName( lateorder.branch ) | html %]
</td>
<td>[% lateorder.budget | html %]
</td>
<td>[% lateorder.claims_count | html %]</td>
<td>
[% IF ( lateorder.claimed_date ) %]
<span title="[% lateorder.claimed_date | html %]">[% lateorder.claimed_date | $KohaDates %]</span>
[% ELSE %]
<span title="0000-00-00"></span>
[% END %]
</td>
</tr>
[% END %]
</tbody>
<tfoot>
<tr>
<th colspan="5">Total</th>
<th>[% total | html %]</th>
<th colspan="6">&nbsp;</th>
</tr>
</tfoot>
</table>
<div class="spacer"></div>
<p style="display:block;">
<input type="button" value="Export as CSV" id="ExportSelected" />
[% UNLESS lateorder.budget_lock %]
<input type="submit" value="Claim order" />
[% END %]
</p>
</form>
[% ELSE %]<p>There are no late orders.</p>
[% END %]
</div> <!-- /#acqui_lateorders -->
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
<form action="lateorders.pl" method="get">
<fieldset class="brief">
<h4>Filter results:</h4>
[% FOREACH ERROR_LOO IN ERROR_LOOP %]
[% 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 %]
[% 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" />
<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" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="booksellerid">Vendor:</label>
<select id="booksellerid" size="1" tabindex="" name="booksellerid">
<option value=""></option>
[% FOREACH SUPPLIER_LOO IN SUPPLIER_LOOP %]
[% IF ( SUPPLIER_LOO.selected ) %]<option value="[% SUPPLIER_LOO.id | html %]" selected="selected">[% SUPPLIER_LOO.name | html %]</option>
[% ELSE %]<option value="[% SUPPLIER_LOO.id | html %]">[% SUPPLIER_LOO.name | html %]</option>[% END %]
[% END %]
</select>
</ol>
<fieldset class="action"><input type="submit" value="Filter" /></fieldset>
</fieldset>
</form>
[% INCLUDE 'acquisitions-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</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;
function check_uncheck() {
var all_nodes = $(late_orderst.fnGetNodes());
if ( $(all_nodes).find("input:checkbox[name=ordernumber]:checked").length > 0) {
var booksellerid = $(all_nodes).find("input:checkbox[name=ordernumber]:checked:first").attr("data-booksellerid");
$(all_nodes).find("input:checkbox[name=ordernumber][data-booksellerid!="+booksellerid+"]").prop('disabled', true);
} else {
$("input:checkbox[name=ordernumber]").prop('disabled', false);
}
}
$(document).ready(function() {
var columns_settings = [% ColumnsSettings.GetColumns( '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" ] }
],
"sPaginationType": "full",
"bAutoWidth": false,
"fnDrawCallback": function() {
if ( typeof late_orderst != 'undefined' ) {
check_uncheck();
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck);
};
}
}, columns_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();});
// Generates a dynamic link for exporting the selection's data as CSV
$("#ExportSelected").click(function() {
var all_nodes = $(late_orderst.fnGetNodes());
var selected = $(all_nodes).find("input[name='ordernumber']:checked");
if (selected.length == 0) {
alert(_("Please select at least one item to export."));
return false;
}
// Building the url from currently checked boxes
var url = '/cgi-bin/koha/acqui/lateorders-export.pl?op=export';
for (var i = 0; i < selected.length; i++) {
url += '&amp;ordernumber=' + selected[i].value;
}
// And redirecting to the CSV page
location.href = url;
return false;
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]