|
Lines 153-158
Link Here
|
| 153 |
</fieldset> |
153 |
</fieldset> |
| 154 |
<fieldset v-if="train.items.length" class="rows"> |
154 |
<fieldset v-if="train.items.length" class="rows"> |
| 155 |
<legend>{{ $__("Items") }}</legend> |
155 |
<legend>{{ $__("Items") }}</legend> |
|
|
156 |
<span class="action_links"> |
| 157 |
<a |
| 158 |
role="link" |
| 159 |
@click="selectAll()" |
| 160 |
:title="$__('Select all')" |
| 161 |
><i class="fa fa-check"></i>{{ $__("Select all") }}</a |
| 162 |
> |
| 163 |
<a @click="clearAll()" :title="$__('Clear all')" |
| 164 |
><i class="fa fa-remove"></i>{{ $__("Clear all") }}</a |
| 165 |
> |
| 166 |
{{ $__("Actions: ") }} |
| 167 |
<a |
| 168 |
v-if="selected_items.length > 0" |
| 169 |
@click="printSelected()" |
| 170 |
:title="$__('Print slips')" |
| 171 |
><i class="fa fa-print"></i>{{ $__("Print slips") }}</a |
| 172 |
> |
| 173 |
<a v-else class="disabled" :title="$__('Print slips')" |
| 174 |
><i class="fa fa-print"></i>{{ $__("Print slips") }}</a |
| 175 |
> |
| 176 |
</span> |
| 156 |
<table v-if="item_table.display" :id="table_id"></table> |
177 |
<table v-if="item_table.display" :id="table_id"></table> |
| 157 |
<ol v-else> |
178 |
<ol v-else> |
| 158 |
<li |
179 |
<li |
|
Lines 268-273
export default {
Link Here
|
| 268 |
train_list: [], |
289 |
train_list: [], |
| 269 |
train_id_selected_for_copy: null, |
290 |
train_id_selected_for_copy: null, |
| 270 |
train_item_id_to_copy: null, |
291 |
train_item_id_to_copy: null, |
|
|
292 |
selected_items: [], |
| 271 |
av_options: {}, |
293 |
av_options: {}, |
| 272 |
} |
294 |
} |
| 273 |
}, |
295 |
}, |
|
Lines 309-319
export default {
Link Here
|
| 309 |
this.item_table.data.push(item_row) |
331 |
this.item_table.data.push(item_row) |
| 310 |
}) |
332 |
}) |
| 311 |
this.item_table.columns = [] |
333 |
this.item_table.columns = [] |
| 312 |
this.item_table.columns.push({ |
334 |
this.item_table.columns.push( |
| 313 |
name: "", |
335 |
{ |
| 314 |
title: this.$__("ID"), |
336 |
name: "checkboxes", |
| 315 |
data: "item.user_train_item_id", |
337 |
className: "checkboxes", |
| 316 |
}) |
338 |
width: "5%", |
|
|
339 |
render: (data, type, row) => { |
| 340 |
return "" |
| 341 |
}, |
| 342 |
}, |
| 343 |
{ |
| 344 |
name: "", |
| 345 |
title: this.$__("ID"), |
| 346 |
data: "item.user_train_item_id", |
| 347 |
} |
| 348 |
) |
| 317 |
train.default_processing.attributes.forEach(a => |
349 |
train.default_processing.attributes.forEach(a => |
| 318 |
this.item_table.columns.push({ |
350 |
this.item_table.columns.push({ |
| 319 |
name: a.name, |
351 |
name: a.name, |
|
Lines 478-483
export default {
Link Here
|
| 478 |
} |
510 |
} |
| 479 |
) |
511 |
) |
| 480 |
}, |
512 |
}, |
|
|
513 |
clearAll() { |
| 514 |
this.selected_items = [] |
| 515 |
$("#" + this.table_id) |
| 516 |
.find("input[name='user_train_item_id'][type='checkbox']") |
| 517 |
.prop("checked", false) |
| 518 |
}, |
| 519 |
selectAll() { |
| 520 |
$("#" + this.table_id) |
| 521 |
.find("input[name='user_train_item_id'][type='checkbox']") |
| 522 |
.each((i, input) => { |
| 523 |
this.selected_items.push($(input).val()) |
| 524 |
$(input).prop("checked", true) |
| 525 |
}) |
| 526 |
}, |
| 527 |
printSelected() { |
| 528 |
window.open( |
| 529 |
"/cgi-bin/koha/preservation/print_slip.pl?%s_blank".format( |
| 530 |
this.selected_items |
| 531 |
.map(id => "train_item_id=" + id) |
| 532 |
.join("&") |
| 533 |
) |
| 534 |
) |
| 535 |
}, |
| 536 |
updateSelectedItems(checked, train_item_id) { |
| 537 |
if (checked) { |
| 538 |
this.selected_items.push(train_item_id) |
| 539 |
} else { |
| 540 |
this.selected_items = this.selected_items.filter( |
| 541 |
id => id != train_item_id |
| 542 |
) |
| 543 |
} |
| 544 |
}, |
| 481 |
build_datatable: function () { |
545 |
build_datatable: function () { |
| 482 |
let table_id = this.table_id |
546 |
let table_id = this.table_id |
| 483 |
let item_table = this.item_table |
547 |
let item_table = this.item_table |
|
Lines 486-491
export default {
Link Here
|
| 486 |
let printSlip = this.printSlip |
550 |
let printSlip = this.printSlip |
| 487 |
let selectTrainForCopy = this.selectTrainForCopy |
551 |
let selectTrainForCopy = this.selectTrainForCopy |
| 488 |
let train = this.train |
552 |
let train = this.train |
|
|
553 |
let updateSelectedItems = this.updateSelectedItems |
| 489 |
|
554 |
|
| 490 |
let table = KohaTable(table_id, { |
555 |
let table = KohaTable(table_id, { |
| 491 |
data: item_table.data, |
556 |
data: item_table.data, |
|
Lines 494-499
export default {
Link Here
|
| 494 |
columns: item_table.columns, |
559 |
columns: item_table.columns, |
| 495 |
drawCallback: function (settings) { |
560 |
drawCallback: function (settings) { |
| 496 |
var api = new $.fn.dataTable.Api(settings) |
561 |
var api = new $.fn.dataTable.Api(settings) |
|
|
562 |
$.each($(this).find("td.checkboxes"), function (index, e) { |
| 563 |
let tr = $(this).parent() |
| 564 |
let train_item = api.row(tr).data().item |
| 565 |
let train_item_id = train_item.train_item_id |
| 566 |
|
| 567 |
let checkbox = createVNode("input", { |
| 568 |
type: "checkbox", |
| 569 |
name: "user_train_item_id", |
| 570 |
value: train_item_id, |
| 571 |
onChange: e => { |
| 572 |
updateSelectedItems( |
| 573 |
e.target.checked, |
| 574 |
train_item_id |
| 575 |
) |
| 576 |
}, |
| 577 |
}) |
| 578 |
|
| 579 |
render(checkbox, e) |
| 580 |
}) |
| 497 |
$.each($(this).find("td.actions"), function (index, e) { |
581 |
$.each($(this).find("td.actions"), function (index, e) { |
| 498 |
let tr = $(this).parent() |
582 |
let tr = $(this).parent() |
| 499 |
let train_item = api.row(tr).data().item |
583 |
let train_item = api.row(tr).data().item |
|
Lines 599-604
export default {
Link Here
|
| 599 |
.action_links a { |
683 |
.action_links a { |
| 600 |
padding-left: 0.2em; |
684 |
padding-left: 0.2em; |
| 601 |
font-size: 11px; |
685 |
font-size: 11px; |
|
|
686 |
cursor: pointer; |
| 602 |
} |
687 |
} |
| 603 |
.attributes_values { |
688 |
.attributes_values { |
| 604 |
float: left; |
689 |
float: left; |