|
Lines 5-10
Link Here
|
| 5 |
[% USE Branches %] |
5 |
[% USE Branches %] |
| 6 |
[% USE TablesSettings %] |
6 |
[% USE TablesSettings %] |
| 7 |
[% USE Price %] |
7 |
[% USE Price %] |
|
|
8 |
[% USE To %] |
| 8 |
[% SET footerjs = 1 %] |
9 |
[% SET footerjs = 1 %] |
| 9 |
[% PROCESS 'i18n.inc' %] |
10 |
[% PROCESS 'i18n.inc' %] |
| 10 |
[% INCLUDE 'doc-head-open.inc' %] |
11 |
[% INCLUDE 'doc-head-open.inc' %] |
|
Lines 53-273
Link Here
|
| 53 |
[% IF info_claim %] |
54 |
[% IF info_claim %] |
| 54 |
<div class="alert alert-info">Email has been sent.</div> |
55 |
<div class="alert alert-info">Email has been sent.</div> |
| 55 |
[% END %] |
56 |
[% END %] |
| 56 |
[% IF lateorders.size %] |
57 |
<form action="lateorders.pl" name="claim" method="post"> |
| 57 |
<form action="lateorders.pl" name="claim" method="post"> |
58 |
[% INCLUDE 'csrf-token.inc' %] |
| 58 |
[% INCLUDE 'csrf-token.inc' %] |
59 |
<input type="hidden" name="op" value="cud-send_alert" /> |
| 59 |
<input type="hidden" name="op" value="cud-send_alert" /> |
60 |
[% IF ( letters ) %] |
| 60 |
<input type="hidden" name="delay" value="[% delay | html %]" /> |
61 |
<p |
| 61 |
<input type="hidden" name="booksellerid" value="[% bookseller_filter.id | html %]" /> |
62 |
><label for="letter_code">Claim using notice: </label |
| 62 |
[% IF ( letters ) %] |
63 |
><select name="letter_code" id="letter_code"> |
| 63 |
<p |
64 |
[% FOREACH letter IN letters %] |
| 64 |
><label for="letter_code">Claim using notice: </label |
65 |
<option value="[% letter.code | html %]">[% letter.name | html %]</option> |
| 65 |
><select name="letter_code" id="letter_code"> |
|
|
| 66 |
[% FOREACH letter IN letters %] |
| 67 |
<option value="[% letter.code | html %]">[% letter.name | html %]</option> |
| 68 |
[% END %] |
| 69 |
</select> |
| 70 |
</p> |
| 71 |
[% END %] |
| 72 |
[% SET total = 0 %] |
| 73 |
[% SET total_quantity = 0 %] |
| 74 |
[% IF bookseller_filter %] |
| 75 |
<p |
| 76 |
><a id="CheckAll" href="#"><i class="fa fa-check"></i> Check all</a> <a id="CheckNone" href="#"><i class="fa fa-times"></i> Uncheck all</a></p |
| 77 |
> |
| 78 |
[% END %] |
| 79 |
<table id="late_orders"> |
| 80 |
<thead> |
| 81 |
<tr> |
| 82 |
<th class="no-sort"></th> |
| 83 |
<th>Order line</th> |
| 84 |
<th>Order date</th> |
| 85 |
<th>Estimated delivery date</th> |
| 86 |
<th>Vendor</th> |
| 87 |
<th class="anti-the">Information</th> |
| 88 |
<th>Quantity</th> |
| 89 |
<th>Total cost</th> |
| 90 |
<th>Basket</th> |
| 91 |
<th>Basket date</th> |
| 92 |
<th>Basket group</th> |
| 93 |
<th>Library</th> |
| 94 |
<th>Budget</th> |
| 95 |
<th>Fund</th> |
| 96 |
<th>Claims count</th> |
| 97 |
<th>Claimed date</th> |
| 98 |
<th>Internal note</th> |
| 99 |
<th>Vendor note</th> |
| 100 |
<th>ISBN</th> |
| 101 |
</tr> |
| 102 |
</thead> |
| 103 |
<tbody> |
| 104 |
[% FOREACH lateorder IN lateorders %] |
| 105 |
<tr> |
| 106 |
<td> |
| 107 |
<input type="checkbox" value="[% lateorder.ordernumber | html %]" data-booksellerid="[% lateorder.basket.booksellerid | html %]" name="ordernumber" /> |
| 108 |
</td> |
| 109 |
<td> [% lateorder.ordernumber | $raw %] </td> |
| 110 |
<td data-order="[% lateorder.basket.closedate | html %]"> [% lateorder.basket.closedate | $KohaDates %] ([% lateorder.basket.late_since_days | html %] days) </td> |
| 111 |
[% IF lateorder.get_column('estimated_delivery_date') %] |
| 112 |
[% SET estimated_delivery_date = lateorder.get_column('estimated_delivery_date') %] |
| 113 |
[% ELSIF lateorder.get_column('calculated_estimated_delivery_date') %] |
| 114 |
[% SET estimated_delivery_date = lateorder.get_column('calculated_estimated_delivery_date') %] |
| 115 |
[% END %] |
| 116 |
<td data-order="[% estimated_delivery_date | html %]"> |
| 117 |
<p class="delivery_date"> |
| 118 |
<span>[% estimated_delivery_date | $KohaDates %]</span> |
| 119 |
[% IF CAN_user_acquisition_order_manage %] |
| 120 |
<a |
| 121 |
class="edit_delivery_date no-export" |
| 122 |
data-ordernumber="[% lateorder.ordernumber | html %]" |
| 123 |
data-delivery_date="[% estimated_delivery_date | html %]" |
| 124 |
id="delivery_date_[% lateorder.ordernumber | html %]" |
| 125 |
href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=[% lateorder.ordernumber | html %]" |
| 126 |
title="Edit delivery date" |
| 127 |
> |
| 128 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit |
| 129 |
</a> |
| 130 |
[% END %] |
| 131 |
</p> |
| 132 |
</td> |
| 133 |
<td> [% lateorder.basket.bookseller.name | html %] ([% lateorder.basket.bookseller.id | html %]) </td> |
| 134 |
<td> |
| 135 |
<span class="title">[% INCLUDE 'biblio-title.inc' biblio=lateorder.biblio link=1 %]</span> |
| 136 |
[% IF ( lateorder.biblio.author ) %]<br /><em>Author:</em> [% lateorder.biblio.author | html %][% END %] |
| 137 |
[% IF ( lateorder.biblio.biblioitem.publishercode ) %] |
| 138 |
<br /><em>Published by:</em> [% lateorder.biblio.biblioitem.publishercode | html %] |
| 139 |
[% IF ( lateorder.biblio.biblioitem.publicationyear ) %] |
| 140 |
<em> in </em>[% lateorder.biblio.biblioitem.publicationyear | html %] |
| 141 |
[% END %] |
| 142 |
[% END %] |
| 143 |
</td> |
| 144 |
<td> |
| 145 |
[% lateorder.quantity | html %] |
| 146 |
[% SET total_quantity = total_quantity + lateorder.quantity %] |
| 147 |
</td> |
| 148 |
<td> |
| 149 |
[% SET subtotal = (lateorder.quantity - lateorder.quantityreceived) * lateorder.rrp %] |
| 150 |
[% SET total = total + subtotal %] |
| 151 |
[% lateorder.rrp | html %]x[% lateorder.quantity - lateorder.quantityreceived | html %] |
| 152 |
= [% subtotal | $Price %] |
| 153 |
</td> |
| 154 |
<td> |
| 155 |
[% IF ( CAN_user_acquisition_order_manage ) %] |
| 156 |
<a href="basket.pl?basketno=[% lateorder.basketno | uri %]" title="basket">[% lateorder.basket.basketname | html %] ([% lateorder.basketno | html %])</a> |
| 157 |
[% ELSE %] |
| 158 |
[% lateorder.basket.basketname | html %] |
| 159 |
([% lateorder.basketno | html %]) |
| 160 |
[% END %] |
| 161 |
</td> |
| 162 |
<td data-order="[% lateorder.basket.creationdate | html %]">[% lateorder.basket.creationdate | $KohaDates %]</td> |
| 163 |
<td> |
| 164 |
[% IF ( lateorder.basket.basketgroupid ) %] |
| 165 |
[% IF ( CAN_user_acquisition_group_manage ) %] |
| 166 |
<a href="basketgroup.pl?op=add&booksellerid=[% lateorder.basket.booksellerid | uri %]&basketgroupid=[% lateorder.basket.basketgroupid | uri %]" title="basketgroup" |
| 167 |
>[% lateorder.basket.basket_group.name | html %] ([% lateorder.basket.basketgroupid | html %])</a |
| 168 |
> |
| 169 |
[% ELSE %] |
| 170 |
[% lateorder.basket.basket_group.name | html %] |
| 171 |
([% lateorder.basket.basketgroupid | html %]) |
| 172 |
[% END %] |
| 173 |
[% END %] |
| 174 |
</td> |
| 175 |
<td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %] </td> |
| 176 |
<td>[% lateorder.fund.budget.budget_period_description | html %]</td> |
| 177 |
<td>[% lateorder.fund.budget_name | html %]</td> |
| 178 |
<td>[% lateorder.claims.count | html %]</td> |
| 179 |
<td data-order="[% lateorder.claims.last.claimed_on | html %]"> |
| 180 |
[% FOR claim IN lateorder.claims %] |
| 181 |
[% claim.claimed_on | $KohaDates %] |
| 182 |
[% UNLESS loop.last %]<br />[% END %] |
| 183 |
[% END %] |
| 184 |
</td> |
| 185 |
<td> |
| 186 |
[% IF lateorder.order_internalnote %] |
| 187 |
<p class="ordernote"> |
| 188 |
<span id="internal-note-[% lateorder.ordernumber | html %]">[% lateorder.order_internalnote | html %]</span> |
| 189 |
<a |
| 190 |
class="edit_note no-export" |
| 191 |
data-ordernumber="[% lateorder.ordernumber | html %]" |
| 192 |
data-note_type="internal" |
| 193 |
href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" |
| 194 |
title="Edit internal note" |
| 195 |
> |
| 196 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit internal note |
| 197 |
</a> |
| 198 |
</p> |
| 199 |
[% ELSE %] |
| 200 |
<a |
| 201 |
class="edit_note no-export" |
| 202 |
data-ordernumber="[% lateorder.ordernumber | html %]" |
| 203 |
data-note_type="internal" |
| 204 |
href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=internal" |
| 205 |
title="Add internal note" |
| 206 |
> |
| 207 |
<i class="fa fa-plus"></i> Add internal note |
| 208 |
</a> |
| 209 |
[% END %] |
| 210 |
</td> |
| 211 |
<td> |
| 212 |
[% IF lateorder.order_vendornote %] |
| 213 |
<p class="ordernote"> |
| 214 |
<span id="vendor-note-[% lateorder.ordernumber | html %]">[% lateorder.order_vendornote | html %]</span> |
| 215 |
<a |
| 216 |
class="edit_note no-export" |
| 217 |
data-ordernumber="[% lateorder.ordernumber | html %]" |
| 218 |
data-note_type="vendor" |
| 219 |
href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" |
| 220 |
title="Edit vendor note" |
| 221 |
> |
| 222 |
<i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit vendor note |
| 223 |
</a> |
| 224 |
</p> |
| 225 |
[% ELSE %] |
| 226 |
<a |
| 227 |
class="edit_note no-export" |
| 228 |
data-ordernumber="[% lateorder.ordernumber | html %]" |
| 229 |
data-note_type="vendor" |
| 230 |
href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% lateorder.ordernumber | html %]&type=vendor" |
| 231 |
title="Add vendor note" |
| 232 |
> |
| 233 |
<i class="fa fa-plus"></i> Add vendor note |
| 234 |
</a> |
| 235 |
[% END %] |
| 236 |
</td> |
| 237 |
<td>[% lateorder.biblio.biblioitem.isbn | $raw %]</td> |
| 238 |
</tr> |
| 239 |
[% END %] |
66 |
[% END %] |
| 240 |
</tbody> |
67 |
</select> |
| 241 |
<tfoot> |
68 |
</p> |
| 242 |
<tr> |
69 |
[% END %] |
| 243 |
<th colspan="6">Total</th> |
70 |
<p> |
| 244 |
<th>[% total_quantity | html %]</th> |
71 |
<a id="CheckAll" href="#"><i class="fa fa-check"></i> Check all</a> |
| 245 |
<th>[% total | $Price %]</th> |
72 |
<a id="CheckNone" href="#"><i class="fa fa-times"></i> Uncheck all</a> |
| 246 |
<th colspan="10"> </th> |
73 |
</p> |
| 247 |
</tr> |
74 |
<table id="late_orders"> |
| 248 |
</tfoot> |
75 |
<thead> |
| 249 |
</table> |
76 |
<tr> |
| 250 |
|
77 |
<th class="no-sort"></th> |
| 251 |
<fieldset class="action"> |
78 |
<th>Order line</th> |
| 252 |
<div class="btn-group"> |
79 |
<th>Order date</th> |
| 253 |
<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> |
80 |
<th>Estimated delivery date</th> |
| 254 |
<a class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"></a> |
81 |
<th>Vendor</th> |
| 255 |
<ul class="dropdown-menu" id="export-csv-menu"> |
82 |
<th class="anti-the">Information</th> |
| 256 |
<li><a class="dropdown-item dropdown-menu-end" href="#">Default</a></li> |
83 |
<th>Quantity</th> |
| 257 |
[% IF csv_profiles.count %] |
84 |
<th>Total cost</th> |
| 258 |
[% FOR csv IN csv_profiles %] |
85 |
<th>Basket</th> |
| 259 |
<li><a class="dropdown-item" href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li> |
86 |
<th>Basket date</th> |
| 260 |
[% END %] |
87 |
<th>Basket group</th> |
|
|
88 |
<th>Library</th> |
| 89 |
<th>Budget</th> |
| 90 |
<th>Fund</th> |
| 91 |
<th>Claims count</th> |
| 92 |
<th>Claimed date</th> |
| 93 |
<th>Internal note</th> |
| 94 |
<th>Vendor note</th> |
| 95 |
<th>ISBN</th> |
| 96 |
</tr> |
| 97 |
</thead> |
| 98 |
</table> |
| 99 |
|
| 100 |
<fieldset class="action"> |
| 101 |
<div class="btn-group"> |
| 102 |
<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> |
| 103 |
<a class="btn btn-default dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"></a> |
| 104 |
<ul class="dropdown-menu" id="export-csv-menu"> |
| 105 |
<li><a class="dropdown-item dropdown-menu-end" href="#">Default</a></li> |
| 106 |
[% IF csv_profiles.count %] |
| 107 |
[% FOR csv IN csv_profiles %] |
| 108 |
<li><a class="dropdown-item" href="#" data-value="[% csv.export_format_id | html %]">[% csv.profile | html %]</a></li> |
| 261 |
[% END %] |
109 |
[% END %] |
| 262 |
</ul> |
110 |
[% END %] |
| 263 |
</div> |
111 |
</ul> |
| 264 |
|
112 |
</div> |
| 265 |
<input type="submit" class="btn btn-default" value="Claim order" /> |
113 |
|
| 266 |
</fieldset> |
114 |
<input type="submit" class="btn btn-default" value="Claim order" /> |
| 267 |
</form> |
115 |
</fieldset> |
| 268 |
[% ELSE %] |
116 |
</form> |
| 269 |
<p>There are no late orders.</p> |
|
|
| 270 |
[% END %] |
| 271 |
</div> |
117 |
</div> |
| 272 |
<!-- /#acqui_lateorders --> |
118 |
<!-- /#acqui_lateorders --> |
| 273 |
</main> |
119 |
</main> |
|
Lines 276-317
Link Here
|
| 276 |
|
122 |
|
| 277 |
<div class="col-md-2 order-sm-2 order-md-1"> |
123 |
<div class="col-md-2 order-sm-2 order-md-1"> |
| 278 |
<aside> |
124 |
<aside> |
| 279 |
<form action="lateorders.pl" method="get"> |
125 |
<form method="get" id="late_orders_filter_form"> |
| 280 |
<fieldset class="brief"> |
126 |
<fieldset class="brief"> |
| 281 |
<h4>Filter results:</h4> |
127 |
<h3>Filters:</h3> |
| 282 |
[% FOREACH ERROR_LOO IN ERROR_LOOP %] |
|
|
| 283 |
[% 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 %] |
| 284 |
[% END %] |
| 285 |
<ol> |
128 |
<ol> |
| 286 |
<li><label for="delay">Order date:</label><input size="3" maxlength="3" id="delay" type="text" name="delay" value="[% delay | html %]" /> days ago</li> |
129 |
<li> |
| 287 |
<li |
130 |
<label for="late_delay">Order date:</label> |
| 288 |
><label for="from">Estimated delivery date from: </label> |
131 |
<input size="3" maxlength="3" id="late_delay" type="text" name="late_delay" value="0" /> days ago |
| 289 |
<input type="text" size="10" id="from" name="estimateddeliverydatefrom" value="[% estimateddeliverydatefrom | html %]" class="flatpickr" data-date_to="to" /> |
|
|
| 290 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
| 291 |
</li> |
132 |
</li> |
| 292 |
<li |
133 |
<li> |
| 293 |
><label for="to">To: </label> |
134 |
<label for="estimated_deliverydate_from">Estimated delivery date from:</label> |
| 294 |
<input type="text" size="10" id="to" name="estimateddeliverydateto" value="[% estimateddeliverydateto | html %]" class="flatpickr" /> |
135 |
<input type="text" name="estimated_deliverydate_from" id="estimated_deliverydate_from" class="flatpickr" data-date_to="estimated_deliverydate_from" /> |
| 295 |
<div class="hint">[% INCLUDE 'date-format.inc' %]</div> |
136 |
</li> |
|
|
137 |
<li> |
| 138 |
<label for="estimated_deliverydate_to">To:</label> |
| 139 |
<input type="text" name="estimated_deliverydate_to" id="estimated_deliverydate_to" class="flatpickr" data-date_to="estimated_deliverydate_to" /> |
| 296 |
</li> |
140 |
</li> |
| 297 |
|
|
|
| 298 |
<li |
141 |
<li |
| 299 |
><label for="booksellerid">Vendor:</label> |
142 |
><label for="vendor_filter">Vendor:</label> |
| 300 |
<select id="booksellerid" tabindex="" name="booksellerid"> |
143 |
<select id="vendor_filter" tabindex="" name="vendor_filter"> |
| 301 |
<option value=""></option> |
144 |
<option value="">All vendors</option> |
| 302 |
[% FOREACH bookseller IN booksellers %] |
|
|
| 303 |
[% IF bookseller.id == bookseller_filter.id %] |
| 304 |
<option value="[% bookseller.id | html %]" selected="selected">[% bookseller.name | html %]</option> |
| 305 |
[% ELSE %] |
| 306 |
<option value="[% bookseller.id | html %]">[% bookseller.name | html %]</option> |
| 307 |
[% END %] |
| 308 |
[% END %] |
| 309 |
</select> |
145 |
</select> |
| 310 |
</li></ol |
146 |
</li> |
| 311 |
> |
147 |
</ol> |
|
|
148 |
</fieldset> |
| 149 |
<fieldset class="action"> |
| 150 |
<input type="submit" class="btn btn-primary" value="Filter" /> |
| 151 |
<input type="button" value="Clear" class="clear_search" /> |
| 312 |
</fieldset> |
152 |
</fieldset> |
| 313 |
<fieldset class="action"><input type="submit" class="btn btn-primary" value="Filter" /></fieldset> |
|
|
| 314 |
</form> |
153 |
</form> |
|
|
154 |
<!-- /#late_orders_filter_form, --> |
| 315 |
[% INCLUDE 'acquisitions-menu.inc' %] |
155 |
[% INCLUDE 'acquisitions-menu.inc' %] |
| 316 |
</aside> |
156 |
</aside> |
| 317 |
</div> |
157 |
</div> |
|
Lines 388-405
Link Here
|
| 388 |
|
228 |
|
| 389 |
$(document).ready(function() { |
229 |
$(document).ready(function() { |
| 390 |
|
230 |
|
| 391 |
var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %]; |
|
|
| 392 |
late_orderst = $("#late_orders").kohaTable({ |
| 393 |
"sorting": [[ 1, "asc" ]], |
| 394 |
"pagingType": "full", |
| 395 |
"autoWidth": false, |
| 396 |
"drawCallback": function() { |
| 397 |
if ( typeof late_orderst != 'undefined' ) { |
| 398 |
check_uncheck(); |
| 399 |
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck); |
| 400 |
}; |
| 401 |
} |
| 402 |
}, table_settings ); |
| 403 |
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck); |
231 |
$('input:checkbox[name=ordernumber]').bind('click', check_uncheck); |
| 404 |
$('#CheckAll').click(function(e){ |
232 |
$('#CheckAll').click(function(e){ |
| 405 |
e.preventDefault(); |
233 |
e.preventDefault(); |
|
Lines 410-416
Link Here
|
| 410 |
$("#late_orders input:checkbox").prop("checked", false); |
238 |
$("#late_orders input:checkbox").prop("checked", false); |
| 411 |
}); |
239 |
}); |
| 412 |
|
240 |
|
| 413 |
// Generates a dynamic link for exporting the selection's data as CSV |
241 |
const buildQuery = () => { |
|
|
242 |
const late_delay = parseInt($("#late_delay").val()); |
| 243 |
const estimated_deliverydate_from = $("#estimated_deliverydate_from").val(); |
| 244 |
const estimated_deliverydate_to = $("#estimated_deliverydate_to").val(); |
| 245 |
|
| 246 |
const queryParams = [ |
| 247 |
["only_late", "1"], |
| 248 |
...(Number.isNaN(late_delay) ? [] : [["late_delay", late_delay]]), |
| 249 |
...(estimated_deliverydate_from ? [["estimated_deliverydate_from", estimated_deliverydate_from]] : []), |
| 250 |
...(estimated_deliverydate_to ? [["estimated_deliverydate_to", estimated_deliverydate_to]] : []), |
| 251 |
]; |
| 252 |
|
| 253 |
return '/api/v1/acquisitions/orders?' + queryParams |
| 254 |
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`) |
| 255 |
.join("&"); |
| 256 |
} |
| 257 |
|
| 258 |
let additional_filters = { |
| 259 |
"basket.vendor_id": () => { |
| 260 |
let vendor_id = $("#vendor_filter").val(); |
| 261 |
if (!vendor_id) return ""; |
| 262 |
return { "=": vendor_id }; |
| 263 |
} |
| 264 |
}; |
| 265 |
|
| 266 |
var table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'lateorders', 'late_orders', 'json' ) | $raw %]; |
| 267 |
var late_orderst = $("#late_orders").kohaTable({ |
| 268 |
order: [[ 1, "asc" ]], |
| 269 |
paging: true, |
| 270 |
embed: [ |
| 271 |
"basket.authorizer+strings", |
| 272 |
"basket.basket_group", |
| 273 |
"basket.late_since_days", |
| 274 |
"basket.vendor", |
| 275 |
"biblio", |
| 276 |
"claims+count", |
| 277 |
"fund.budget" |
| 278 |
], |
| 279 |
ajax: { |
| 280 |
url: buildQuery(), |
| 281 |
}, |
| 282 |
columns: [ |
| 283 |
{ |
| 284 |
data: "order_id", // checkbox |
| 285 |
orderable: false, |
| 286 |
searchable: false, |
| 287 |
render: function(data, type, row, meta) { |
| 288 |
return '<input type="checkbox" value="%s" data-booksellerid="%s" name="ordernumber" />'.format(escape_str(data),escape_str(row.basket.vendor_id)); |
| 289 |
} |
| 290 |
}, |
| 291 |
{ |
| 292 |
data: "order_id", |
| 293 |
orderable: true, |
| 294 |
searchable: true |
| 295 |
}, |
| 296 |
{ |
| 297 |
data: "basket.close_date", |
| 298 |
type: "date", |
| 299 |
orderable: true, |
| 300 |
render: function(data, type, row, meta) { |
| 301 |
return '%s (%s)'.format($date(data),_("%s days").format(escape_str(row.basket.late_since_days))); |
| 302 |
} |
| 303 |
}, |
| 304 |
{ |
| 305 |
data: "estimated_delivery_date", |
| 306 |
type: "date", |
| 307 |
orderable: true, |
| 308 |
render: function(data, type, row, meta) { |
| 309 |
return '<p class="delivery_date"><span>%s</span>'.format($date(data)) |
| 310 |
[% IF CAN_user_acquisition_order_manage %] |
| 311 |
+ '<a class="edit_delivery_date no-export" data-ordernumber="%s" '.format(escape_str(row.order_id)) |
| 312 |
+ 'data-delivery_date="%s" id="delivery_date_%s" '.format(escape_str(data),escape_str(row.order_id)) |
| 313 |
+ 'href="/cgi-bin/koha/acqui/moddeliverydate.pl?ordernumber=%s" title="%s">'.format(encodeURIComponent(row.order_id),_("Edit delivery date")) |
| 314 |
+ '<i class="fa-solid fa-pencil" aria-hidden="true"></i> %s</a>'.format(_("Edit")) |
| 315 |
[% END %] |
| 316 |
+ '</p>'; |
| 317 |
} |
| 318 |
}, |
| 319 |
{ |
| 320 |
data: 'basket.vendor.name', |
| 321 |
orderable: false, |
| 322 |
searchable: true, |
| 323 |
render: function(data, type, row, meta) { |
| 324 |
return '%s (%s)'.format(escape_str(data), escape_str(row.basket.vendor_id)); |
| 325 |
} |
| 326 |
}, |
| 327 |
{ |
| 328 |
[% SET summary_fields = "biblio.title:biblio.author:biblio.isbn:biblio.publisher:me.internal_note:me.vendor_note" %] |
| 329 |
[% IF Koha.Preference('marcflavour')=='UNIMARC' %][% SET summary_fields = summary_fields _ ":biblio.ean" %][% END %] |
| 330 |
"data": "[% summary_fields | html %]", |
| 331 |
"render": function(data, type, row, meta) { |
| 332 |
var result = ''; |
| 333 |
if ( row && row.biblio_id != null ) { |
| 334 |
result = '<p><span class="title"><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a></span>'.format(encodeURIComponent(row.biblio_id),escape_str(row.biblio.title)); |
| 335 |
if ( row.biblio.author != null ) |
| 336 |
result += '<br /><em>%s:</em> %s'.format(_("Author"),escape_str(row.biblio.author)); |
| 337 |
if ( row.biblio.publisher != null ) { |
| 338 |
result += '<br /><em>%s:</em> %s'.format(_("Published by"),escape_str(row.biblio.publisher)); |
| 339 |
if ( row.biblio.publication_year != null ) { |
| 340 |
result += '<em> %s </em> %s'.format(__px("Published in <date>","in"),escape_str(row.biblio.publication_year)); |
| 341 |
} |
| 342 |
} |
| 343 |
result += '</p>'; |
| 344 |
} |
| 345 |
|
| 346 |
return result; |
| 347 |
}, |
| 348 |
"orderable": true, |
| 349 |
}, |
| 350 |
{ |
| 351 |
data: 'quantity', |
| 352 |
orderable: true, |
| 353 |
searchable: true |
| 354 |
}, |
| 355 |
{ |
| 356 |
data: "", // total cost, calculated |
| 357 |
orderable: false, |
| 358 |
searchable: false, |
| 359 |
render: function(data, type, row, meta) { |
| 360 |
let reminder_qty = (row.quantity - row.quantity_received); |
| 361 |
let subtotal = reminder_qty * row.replacement_price; |
| 362 |
return '%s x %s = %s'.format( escape_price(row.replacement_price), reminder_qty, escape_price(subtotal) ); |
| 363 |
} |
| 364 |
}, |
| 365 |
{ |
| 366 |
data: 'basket.name', |
| 367 |
orderable: true, |
| 368 |
searchable: true, |
| 369 |
render: function(data, type, row, meta) { |
| 370 |
var basket_name = '%s (%s)'.format(escape_str(data),escape_str(row.basket_id)); |
| 371 |
[% IF ( CAN_user_acquisition_order_manage ) %] |
| 372 |
return '<a href="basket.pl?basketno=%s" title="%s">%s</a>'.format(encodeURIComponent(row.basket_id),escape_str(data),basket_name); |
| 373 |
[% ELSE %] |
| 374 |
return basket_name; |
| 375 |
[% END %] |
| 376 |
} |
| 377 |
}, |
| 378 |
{ |
| 379 |
data: 'basket.creation_date', |
| 380 |
orderable: true, |
| 381 |
render: function(data, type, row, meta) { |
| 382 |
return $date(data); |
| 383 |
} |
| 384 |
}, |
| 385 |
{ |
| 386 |
data: 'basket.basket_group_id', |
| 387 |
orderable: true, |
| 388 |
searchable: true, |
| 389 |
render: function(data, type, row, meta) { |
| 390 |
if ( data != null ) { |
| 391 |
[%- IF CAN_user_acquisition_group_manage -%] |
| 392 |
return '<a href="basketgroup.pl?op=add&booksellerid=%s&basketgroupid=%s" title="basketgroup">%s (%s)</a>' |
| 393 |
.format(encodeURIComponent(row.vendor_id),encodeURIComponent(data),row.basket.basket_group.name, data); |
| 394 |
[%- ELSE -%] |
| 395 |
return '%s (%s)'.format(row.basket.basket_group.name, data); |
| 396 |
[%- END -%] |
| 397 |
} else { return ''; } |
| 398 |
} |
| 399 |
}, |
| 400 |
{ |
| 401 |
data: 'basket.authorizer.library_id', |
| 402 |
orderable: false, |
| 403 |
searchable: false, |
| 404 |
render: function(data, type, row, meta) { |
| 405 |
return escape_str(row.basket.authorizer._strings.library_id.str); |
| 406 |
} |
| 407 |
}, |
| 408 |
{ |
| 409 |
data: 'fund.budget.budget_period_description', |
| 410 |
orderable: true, |
| 411 |
searchable: true |
| 412 |
}, |
| 413 |
{ |
| 414 |
data: 'fund.name', |
| 415 |
orderable: true, |
| 416 |
searchable: true |
| 417 |
}, |
| 418 |
{ |
| 419 |
data: 'claims_count', |
| 420 |
orderable: true, |
| 421 |
searchable: false |
| 422 |
}, |
| 423 |
{ |
| 424 |
data: 'claims', |
| 425 |
orderable: false, |
| 426 |
searchable: false, |
| 427 |
render: function(data, type, row, meta) { |
| 428 |
return data != undefined ? data.map(item => $date(item.date_claimed)).join('<br/>') : ''; |
| 429 |
} |
| 430 |
}, |
| 431 |
{ |
| 432 |
data: "", // internal_note |
| 433 |
orderable: false, |
| 434 |
searchable: false, |
| 435 |
render: function(data, type, row, meta) { |
| 436 |
if ( row.internal_note != null && row.internal_note != '' ) { |
| 437 |
return '<p class="ordernote">' |
| 438 |
+ '<span id="internal-note-%s">%s</span>'.format(row.order_id,escape_str(row.internal_note)) |
| 439 |
+ '<a class="edit_note no-export" data-ordernumber="%s" '.format(row.order_id) |
| 440 |
+ 'data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=%s&type=internal" '.format(encodeURIComponent(row.order_id)) |
| 441 |
+ 'title="Edit internal note"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit internal note</a></p>'.format(_("Edit internal note"),_("Edit internal note")); |
| 442 |
} |
| 443 |
else { |
| 444 |
return '<a class="edit_note no-export" data-ordernumber="%s" '.format(row.order_id) |
| 445 |
+ 'data-note_type="internal" href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=%s&type=internal" '.format(encodeURIComponent(row.order_id)) |
| 446 |
+ 'title="%s"><i class="fa fa-plus"></i> %s</a>'.format(_("Add internal note"),_("Add internal note")); |
| 447 |
} |
| 448 |
|
| 449 |
} |
| 450 |
}, |
| 451 |
{ |
| 452 |
data: "", // vendor_note |
| 453 |
orderable: false, |
| 454 |
searchable: false, |
| 455 |
render: function(data, type, row, meta) { |
| 456 |
if ( row.vendor_note != null && row.vendor_note != '' ) { |
| 457 |
return '<p class="ordernote"><span id="vendor-note-%s">%s</span>'.format(row.order_id,escape_str(row.vendor_note)) |
| 458 |
+ '<a class="edit_note no-export" data-ordernumber="%s" data-note_type="vendor" '.format(row.order_id) |
| 459 |
+ 'href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=%s&type=vendor" '.format(encodeURIComponent(row.order_id)) |
| 460 |
+ 'title="%s"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit vendor note</a></p>'.format(_("Edit vendor note"),_("Edit vendor note")); |
| 461 |
} |
| 462 |
else { |
| 463 |
return '<a class="edit_note no-export" data-ordernumber="%s" data-note_type="vendor" '.format(row.order_id) |
| 464 |
+ 'href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=%s&type=vendor" '.format(row.order_id) |
| 465 |
+ 'title="%s"><i class="fa fa-plus"></i> %s</a>'.format(_("Add vendor note"),_("Add vendor note")); |
| 466 |
} |
| 467 |
} |
| 468 |
}, |
| 469 |
{ |
| 470 |
data: 'biblio.isbn', |
| 471 |
orderable: true, |
| 472 |
searchable: true |
| 473 |
} |
| 474 |
] |
| 475 |
}, |
| 476 |
table_settings, |
| 477 |
false, // add_column_filters |
| 478 |
additional_filters, // default_filters |
| 479 |
undefined, // filters_options |
| 480 |
undefined, //external_filter_nodes |
| 481 |
); |
| 482 |
|
| 483 |
const redrawTable = () => { |
| 484 |
late_orderst.api().ajax.url(buildQuery()).load(); |
| 485 |
}; |
| 486 |
|
| 487 |
const clearFilters = () => { |
| 488 |
$("#late_delay").val("0"); |
| 489 |
$("#estimated_deliverydate_from")[0]._flatpickr?.clear(); |
| 490 |
$("#estimated_deliverydate_to")[0]._flatpickr?.clear(); |
| 491 |
$("#vendor_filter").val("").trigger('change'); |
| 492 |
|
| 493 |
redrawTable(); |
| 494 |
}; |
| 495 |
|
| 496 |
$("#late_orders_filter_form").on("submit", (e) => { |
| 497 |
e.preventDefault(); |
| 498 |
redrawTable(); |
| 499 |
}); |
| 500 |
|
| 501 |
// Clear all filters |
| 502 |
$(".clear_search").click(clearFilters); |
| 503 |
|
| 504 |
// Generates a dynamic link for exporting the selection's data as CSV |
| 414 |
$("#exportbutton, #export-csv-menu a").click(function() { |
505 |
$("#exportbutton, #export-csv-menu a").click(function() { |
| 415 |
var all_nodes = late_orderst.DataTable().rows().nodes(); |
506 |
var all_nodes = late_orderst.DataTable().rows().nodes(); |
| 416 |
var selected = $(all_nodes).find("input[name='ordernumber']:checked"); |
507 |
var selected = $(all_nodes).find("input[name='ordernumber']:checked"); |
|
Lines 474-479
Link Here
|
| 474 |
$("#estimated_delivery_date").html( "" ); |
565 |
$("#estimated_delivery_date").html( "" ); |
| 475 |
$("#date_ordernumber").val(""); |
566 |
$("#date_ordernumber").val(""); |
| 476 |
}); |
567 |
}); |
|
|
568 |
|
| 569 |
function populateVendorsFilter() { |
| 570 |
$.ajax({ |
| 571 |
type: "GET", |
| 572 |
url: "/api/v1/acquisitions/vendors", |
| 573 |
success: function (vendors) { |
| 574 |
vendors |
| 575 |
.sort((a, b) => |
| 576 |
a.name.localeCompare(b.name) |
| 577 |
) |
| 578 |
.forEach(function (vendor) { |
| 579 |
if ( |
| 580 |
$( |
| 581 |
"#vendor_filter option[value=" + |
| 582 |
vendor.id + |
| 583 |
"]" |
| 584 |
).length == 0 |
| 585 |
) { |
| 586 |
$("#vendor_filter").append( |
| 587 |
'<option value="' + |
| 588 |
vendor.id + |
| 589 |
'">' + |
| 590 |
vendor.name + |
| 591 |
"</option>" |
| 592 |
); |
| 593 |
} |
| 594 |
}); |
| 595 |
}, |
| 596 |
}); |
| 597 |
} |
| 598 |
|
| 599 |
populateVendorsFilter(); |
| 477 |
}); |
600 |
}); |
| 478 |
</script> |
601 |
</script> |
| 479 |
[% END %] |
602 |
[% END %] |
| 480 |
- |
|
|