Lines 147-152
Link Here
|
147 |
</fieldset> |
147 |
</fieldset> |
148 |
<fieldset v-if="train.items.length" class="rows"> |
148 |
<fieldset v-if="train.items.length" class="rows"> |
149 |
<legend>{{ $__("Items") }}</legend> |
149 |
<legend>{{ $__("Items") }}</legend> |
|
|
150 |
<span class="action_links"> |
151 |
<a |
152 |
role="link" |
153 |
@click="selectAll()" |
154 |
:title="$__('Select all')" |
155 |
><i class="fa fa-check"></i>{{ $__("Select all") }}</a |
156 |
> |
157 |
<a @click="clearAll()" :title="$__('Clear all')" |
158 |
><i class="fa fa-remove"></i>{{ $__("Clear all") }}</a |
159 |
> |
160 |
{{ $__("Actions: ") }} |
161 |
<a |
162 |
v-if="selected_items.length > 0" |
163 |
@click="printSelected()" |
164 |
:title="$__('Print slips')" |
165 |
><i class="fa fa-print"></i>{{ $__("Print slips") }}</a |
166 |
> |
167 |
<a v-else class="disabled" :title="$__('Print slips')" |
168 |
><i class="fa fa-print"></i>{{ $__("Print slips") }}</a |
169 |
> |
170 |
</span> |
150 |
<table v-if="item_table.display" :id="table_id"></table> |
171 |
<table v-if="item_table.display" :id="table_id"></table> |
151 |
<ol v-else> |
172 |
<ol v-else> |
152 |
<li |
173 |
<li |
Lines 260-265
export default {
Link Here
|
260 |
train_list: [], |
281 |
train_list: [], |
261 |
train_id_selected_for_copy: null, |
282 |
train_id_selected_for_copy: null, |
262 |
train_item_id_to_copy: null, |
283 |
train_item_id_to_copy: null, |
|
|
284 |
selected_items: [], |
263 |
av_options: {}, |
285 |
av_options: {}, |
264 |
} |
286 |
} |
265 |
}, |
287 |
}, |
Lines 301-311
export default {
Link Here
|
301 |
this.item_table.data.push(item_row) |
323 |
this.item_table.data.push(item_row) |
302 |
}) |
324 |
}) |
303 |
this.item_table.columns = [] |
325 |
this.item_table.columns = [] |
304 |
this.item_table.columns.push({ |
326 |
this.item_table.columns.push( |
305 |
name: "", |
327 |
{ |
306 |
title: this.$__("ID"), |
328 |
name: "checkboxes", |
307 |
data: "item.user_train_item_id", |
329 |
className: "checkboxes", |
308 |
}) |
330 |
width: "5%", |
|
|
331 |
render: (data, type, row) => { |
332 |
return "" |
333 |
}, |
334 |
}, |
335 |
{ |
336 |
name: "", |
337 |
title: this.$__("ID"), |
338 |
data: "item.user_train_item_id", |
339 |
} |
340 |
) |
309 |
train.default_processing.attributes.forEach(a => |
341 |
train.default_processing.attributes.forEach(a => |
310 |
this.item_table.columns.push({ |
342 |
this.item_table.columns.push({ |
311 |
name: a.name, |
343 |
name: a.name, |
Lines 468-473
export default {
Link Here
|
468 |
} |
500 |
} |
469 |
) |
501 |
) |
470 |
}, |
502 |
}, |
|
|
503 |
clearAll() { |
504 |
this.selected_items = [] |
505 |
$("#" + this.table_id) |
506 |
.find("input[name='user_train_item_id'][type='checkbox']") |
507 |
.prop("checked", false) |
508 |
}, |
509 |
selectAll() { |
510 |
$("#" + this.table_id) |
511 |
.find("input[name='user_train_item_id'][type='checkbox']") |
512 |
.each((i, input) => { |
513 |
this.selected_items.push($(input).val()) |
514 |
$(input).prop("checked", true) |
515 |
}) |
516 |
}, |
517 |
printSelected() { |
518 |
window.open( |
519 |
"/cgi-bin/koha/preservation/print_slip.pl?%s_blank".format( |
520 |
this.selected_items |
521 |
.map(id => "train_item_id=" + id) |
522 |
.join("&") |
523 |
) |
524 |
) |
525 |
}, |
526 |
updateSelectedItems(checked, train_item_id) { |
527 |
if (checked) { |
528 |
this.selected_items.push(train_item_id) |
529 |
} else { |
530 |
this.selected_items = this.selected_items.filter( |
531 |
id => id != train_item_id |
532 |
) |
533 |
} |
534 |
}, |
471 |
build_datatable: function () { |
535 |
build_datatable: function () { |
472 |
let table_id = this.table_id |
536 |
let table_id = this.table_id |
473 |
let item_table = this.item_table |
537 |
let item_table = this.item_table |
Lines 476-481
export default {
Link Here
|
476 |
let printSlip = this.printSlip |
540 |
let printSlip = this.printSlip |
477 |
let selectTrainForCopy = this.selectTrainForCopy |
541 |
let selectTrainForCopy = this.selectTrainForCopy |
478 |
let train = this.train |
542 |
let train = this.train |
|
|
543 |
let updateSelectedItems = this.updateSelectedItems |
479 |
|
544 |
|
480 |
let table = KohaTable(table_id, { |
545 |
let table = KohaTable(table_id, { |
481 |
data: item_table.data, |
546 |
data: item_table.data, |
Lines 484-489
export default {
Link Here
|
484 |
columns: item_table.columns, |
549 |
columns: item_table.columns, |
485 |
drawCallback: function (settings) { |
550 |
drawCallback: function (settings) { |
486 |
var api = new $.fn.dataTable.Api(settings) |
551 |
var api = new $.fn.dataTable.Api(settings) |
|
|
552 |
$.each($(this).find("td.checkboxes"), function (index, e) { |
553 |
let tr = $(this).parent() |
554 |
let train_item = api.row(tr).data().item |
555 |
let train_item_id = train_item.train_item_id |
556 |
|
557 |
let checkbox = createVNode("input", { |
558 |
type: "checkbox", |
559 |
name: "user_train_item_id", |
560 |
value: train_item_id, |
561 |
onChange: e => { |
562 |
updateSelectedItems( |
563 |
e.target.checked, |
564 |
train_item_id |
565 |
) |
566 |
}, |
567 |
}) |
568 |
|
569 |
render(checkbox, e) |
570 |
}) |
487 |
$.each($(this).find("td.actions"), function (index, e) { |
571 |
$.each($(this).find("td.actions"), function (index, e) { |
488 |
let tr = $(this).parent() |
572 |
let tr = $(this).parent() |
489 |
let train_item = api.row(tr).data().item |
573 |
let train_item = api.row(tr).data().item |
Lines 588-593
export default {
Link Here
|
588 |
.action_links a { |
672 |
.action_links a { |
589 |
padding-left: 0.2em; |
673 |
padding-left: 0.2em; |
590 |
font-size: 11px; |
674 |
font-size: 11px; |
|
|
675 |
cursor: pointer; |
591 |
} |
676 |
} |
592 |
.attributes_values { |
677 |
.attributes_values { |
593 |
float: left; |
678 |
float: left; |