Koha/koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-edit-range.tt
Owen Leonard d30c6dcb7f
Bug 32085: Consistent classes for primary buttons: Labels
This patch makes changes the button markup in label-creation templates
-- including the barcode image generator -- so that all submit buttons
and any buttons that should should be styled as primary buttons have the
Bootstrap class "btn btn-primary."

To test, apply the patch and view label-related pages to confirm
that everything looks correct. In most cases there are no visible
changes.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-04 19:16:18 -03:00

147 lines
5.5 KiB
Text

[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Print barcode range &rsaquo; Label creator &rsaquo; Cataloging &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'greybox.inc' %]
</head>
<body id="labels_label-home" class="tools labels">
[% WRAPPER 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
[% END %]
[% WRAPPER 'sub-header.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
</li>
<li>
<a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
</li>
<li>
<a href="#" aria-current="page">
Print barcode range
</a>
</li>
</ol>
</nav>
[% END %]
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% INCLUDE 'labels-toolbar.inc' %]
<h1>Print barcode range</h1>
<form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
<input type="hidden" name="op" value="add" />
<fieldset class="rows">
<ol>
<li>
<label for="from-input">From:</label>
<input type="text" inputmode="numeric" pattern="[0-9]*" name="from" id="from-input" value="0" style="text-align: right;"/>
</li>
<li>
<label for="to-input">To:</label>
<input type="text" inputmode="numeric" pattern="[0-9]*" name="to" id="to-input" value="0" style="text-align: right;"/>
</li>
</ol>
</fieldset>
<fieldset class="action">
<button type="button" class="btn btn-primary" id="print">Print range</button>
</fieldset>
</form>
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'cat-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
</div> <!-- /.main.container-fluid -->
[% MACRO jsinclude BLOCK %]
<script>
function Xport() {
var str = "";
str += "from=" + document.getElementById("from-input").value + "&";
str += "to=" + document.getElementById("to-input").value;
return GB_showCenter('Export labels', "/cgi-bin/koha/labels/label-print.pl?" + str, 400, 800);
}
function checkTwoValue(_from, _to, _id){
var result = _from.length == _to.length;
if (_from[0] == "0" || _to[0] == "0") {
switch (_id){
case 'from-input':
var to_inp = $("#to-input")
if (to_inp.hasClass('error')){
to_inp.removeClass('error').addClass('valid');
$("to-input-error").remove();
}
if ($('#to-input-error').length){
$("#to-input-error").remove();
}
return result;
case 'to-input':
var from_inp = $("#from-input")
if (from_inp.hasClass('error')){
from_inp.removeClass('error').addClass('valid');
}
if ($('#from-input-error').length){
$("#from-input-error").remove();
}
return result;
}
}
return true;
}
$(document).ready(function () {
$('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
$.validator.addMethod("gt", function(value, element, params) {
return parseInt(value) >= parseInt($(params).val());
}, _("Must be greater or equal to the from value."));
$.validator.addMethod("eq", function(value, element, params) {
return checkTwoValue($("#from-input").val(), $("#to-input").val(), $(element).attr('id'));
}, _("From and to values must have the same length."));
$("form[name=add_by_number]").validate({
rules: {
from: {
required: true,
eq: "#from-input",
eq: "#to-input",
},
to: {
required: true,
gt: "#from-input",
eq: "#from-input",
eq: "#to-input",
}
}
});
$("#print").on("click", function () {
if ( $("form[name=add_by_number]").valid() ) {
return Xport();
}
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]