Koha/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt
Owen Leonard 4664ba3b25
Bug 34116: Add page-sectioning to item search in label creator
This patch adds a "page-section" class to search results page seen when
adding items to a label batch. The patch also makes some minor changes
to markup around the search header to make it more consistent with other
search pages.

To test, apply the patch and go to Cataloging -> Label creator.

- Click New -> Label batch
- Without entering anything in the textarea, click the "Add item(s)"
  button"
- In the pop-up window, perform a search which will return multiple
  results.
- Confirm that everything looks correct and all controls work as they
  should.

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit a7db3895a7)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-07-18 10:31:20 +01:00

159 lines
8 KiB
Text

[% USE raw %]
[% BLOCK pagination %]
<nav>
[% IF ( displayprev || displaynext ) %]
<ul class="pagination">
[% IF ( displayprev ) %]
<li><a class="nav" href="label-item-search.pl?startfrom=[% startfromprev | html %]&amp;ccl_query=[% ccl_query | html %]&amp;resultsperpage=[% resultsperpage | html %]&amp;op=do_search&amp;batch_id=[% batch_id | html %]"><i class="fa fa-arrow-left"></i> Previous</a></li>
[% END %]
[% FOREACH number IN numbers %]
[% IF ( startfrom == number.startfrom ) %]
<li class="active"><span>[% number.number | html %]</span></a></li>
[% ELSE %]
<li><a class="nav" href="label-item-search.pl?startfrom=[% number.startfrom | html %]&amp;ccl_query=[% ccl_query | html %]&amp;resultsperpage=[% resultsperpage | html %]&amp;op=do_search&amp;batch_id=[% batch_id | html %]">[% number.number | html %]</a></li>
[% END %]
[% END %]
[% IF ( displaynext ) %]
<li><a class="nav" href="label-item-search.pl?startfrom=[% startfromnext | html %]&amp;ccl_query=[% ccl_query | html %]&amp;resultsperpage=[% resultsperpage | html %]&amp;op=do_search&amp;batch_id=[% batch_id | html %]">Next <i class="fa fa-arrow-right"></i></a></li>
[% END %]
</ul>
[% END %]
</nav>
[% END %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Search results &rsaquo; Barcodes and labels &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
</head>
<body id="labels_result" class="tools labels">
<div class="main container-fluid">
<h1>Search results</h1>
[% IF ( results ) %]
<h3>Results [% from | html %] through [% to | html %] [% IF ( total ) %] of [% total | html %][% END %]</h3>
[% ELSE %]
<h3>No results found</h3>
[% END %]
<div class="results">
[% PROCESS pagination %]
<form name="resultform" action="" style="display:block">
<div id="toolbar" class="btn-toolbar">
<div class="btn-group"><button type="button" class="btn btn-default" id="add_items"><i class="fa fa-plus"></i> Add checked</button></div>
<div class="btn-group"><a href="#" class="btn btn-default close"><i class="fa fa-times-circle"></i> Done</a></div>
</div>
<div id="selection_ops">
<a id="CheckAll" class="btn btn-link" href="#"><i class="fa fa-check"></i> Select all</a>
<a id="CheckNone" class="btn btn-link" href="#"><i class="fa fa-remove"></i> Clear all</a>
</div>
<div id="label-search-results" class="page-section">
<input type="hidden" name="ccl_query" value="[% ccl_query | html %]" />
[% FOREACH result_se IN result_set %]
<div style="border-bottom:1px solid #CCC;padding:1em 0;">
<h4>[% result_se.title | html %]</h4>
<p>[% IF ( result_se.author ) %]by [% result_se.author | html %][% END %]
[[% result_se.itemtype | html %]], [% IF ( result_se.publishercode ) %][% result_se.publishercode | html %] [% END %][% IF ( result_se.place ) %][% result_se.place | html %] [% END %][% IF ( result_se.copyrightdate ) %][% result_se.copyrightdate | html %], [% END %][% IF ( result_se.pages ) %][% result_se.pages | html %][% END %][% IF ( result_se.isbn ) %], <strong>ISBN: </strong>[% result_se.isbn | html %][% END %][% IF ( result_se.notes ) %],<br />[% result_se.notes | html %][% END %]</p>
<table>
[% FOREACH item_tabl IN result_se.item_table %]
[% IF ( item_tabl.header_fields ) %]
<thead>
<tr>
[% FOREACH header_field IN item_tabl.header_fields %]
[% SWITCH header_field.field_label -%]
[% CASE "Add Item" -%]
<th>Add item</th>
[% CASE "Call Number" -%]
<th>Call number</th>
[% CASE "Accession Date" %]
<th>Accession date</th>
[% CASE "Barcode" %]
<th>Barcode</th>
[% CASE "Select" -%]
<th>Select</th>
[% CASE %]
<th>[% header_field.field_label | html %]</th>
[% END -%]
[% END %]
</tr>
</thead>
[% ELSE %]
<tr>
[% FOREACH text_field IN item_tabl.text_fields %]
[% IF ( text_field.select_field ) %]
<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]"></td>
[% ELSIF ( text_field.link_field ) %]
<td>
<a class="btn btn-default btn-xs select_item" data-item-number="[% text_field.field_value | html %]" data-batch-id="[% batch_id | html %]" data-field-type="[% text_field.type | html %]"><i class="fa fa-plus"></i> Add</a>
</td>
[% ELSE %]
<td>[% text_field.field_value | html %]</td>
[% END %]
[% END %]
</tr>
[% END %]
[% END %]
</table>
</div>
[% END %]
</div>
</form>
</div>
[% PROCESS pagination %]
<div id="closewindow"><a href="#" class="btn btn-default btn-default close">Close</a></div>
</div>
[% MACRO jsinclude BLOCK %]
[% Asset.js("lib/hc-sticky.js") | $raw %]
<script>
var Sticky;
$(document).ready(function(){
Sticky = $("#toolbar");
Sticky.hcSticky({
stickTo: "form",
stickyClass: "floating"
});
$("#CheckAll").click(function(e){
e.preventDefault();
$("input[type='checkbox']").prop("checked",true);
});
$("#CheckNone").click(function(e){
e.preventDefault();
$("input[type='checkbox']").prop("checked",false);
});
$("#add_items").on("click",function(){
add_item('checked',[% batch_id | html %],'[% type | html %]');
});
$(".select_item").on("click",function(e){
e.preventDefault();
var batch_id = $(this).data("batch-id");
var itemnumber = $(this).data("item-number");
var type = $(this).data("field-type");
add_item(itemnumber, batch_id, type);
});
});
function add_item(item_number,batch_id,type_id){
var p = window.opener;
if (item_number == 'checked') {
items= new Array;
if(document.resultform.action.length > 0) {
for (var i=0; i < document.resultform.action.length; i++) {
if (document.resultform.action[i].checked) {
p.add_item(document.resultform.action[i].value);
}
}
} else {
p.add_item(document.resultform.action.value);
}
}
else {
p.add_item(item_number);
}
}
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]