Owen Leonard
454619be40
This patch modifies the patron card creator templates to use the Bootstrap grid instead of YUI. To test, apply the patch and view the following pages, confirming that they look correct at various browser widths: - Tools -> patron card creator - Manage -> Card batches - Edit card batch - Manage -> Layouts - Edit layout - Manage -> Images - Manage -> Card templates - Edit template - Manage -> Printer profiles - Edit profile Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
337 lines
17 KiB
Text
337 lines
17 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Patron card creator › Batches › [% IF batch_id %]Edit ([% batch_id | html %])[% ELSE %]New[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("css/datatables.css") | $raw %]
|
|
</head>
|
|
|
|
<body id="pcard_edit-batch" class="tools pcard">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
<div id="breadcrumbs">
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
|
|
<a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> ›
|
|
<a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a> ›
|
|
[% IF description %]
|
|
Edit <a href="/cgi-bin/koha/patroncards/edit-batch.pl?op=edit&element_id=[% batch_id | uri %]">[% description | html %]</a>
|
|
[% ELSIF batch_id %]
|
|
Edit <a href="/cgi-bin/koha/patroncards/edit-batch.pl?op=edit&element_id=[% batch_id | uri %]">([% batch_id | html %])</a>
|
|
[% ELSE %]
|
|
New
|
|
[% END %]
|
|
</div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% INCLUDE 'patroncards-toolbar.inc' %]
|
|
|
|
[% IF ( duplicate_message ) %]
|
|
<div class="dialog message">
|
|
<strong>Duplicate patrons removed from batch number [% batch_id | html %]: [% duplicate_count | html %]</strong>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'patroncards-errors.inc' %]
|
|
<div id="manage-patroncard-batches">
|
|
<div class="hint">Current library: [% LoginBranchname | html %]</div>
|
|
<form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
|
|
<div>
|
|
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
|
|
<ol><li id="description">
|
|
<input type="hidden" name="op" value="add" />
|
|
<input type="hidden" name="batch_id" value="[% batch_id | html %]" />
|
|
<label for="description">Batch description: </label>
|
|
<input type="text" name="description" value="[% description | html %]"> <span id="change-status"></span>
|
|
</li><li>
|
|
<label for="bor_num_list">Add by borrowernumber(s):
|
|
<br /> <span class="hint">One borrowernumber per line.</span>
|
|
</label>
|
|
<textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
|
|
</li></ol>
|
|
</fieldset>
|
|
</div>
|
|
</form>
|
|
<div id="batch-manage" class="action">
|
|
<a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add patron(s)</a>[% IF ( table_loop ) %]
|
|
<a class="btn btn-default btn-sm" id="savedesc" href="#" data-batch_id="[% batch_id | html %]"><i class="fa fa-save"></i> Save description</a>
|
|
<a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected patrons</a>
|
|
<a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
|
|
<a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
|
|
<a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected card(s)</a>
|
|
<a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export card batch</a>[% END %]
|
|
</div>
|
|
[% IF ( table_loop ) %]
|
|
<form name="items" class="checkboxed">
|
|
<h2>Patrons in batch number [% batch_id | html %]</h2>
|
|
<table id="batcht">
|
|
[% FOREACH table_loo IN table_loop %]
|
|
[% IF ( table_loo.header_fields ) %]
|
|
<thead>
|
|
<tr>
|
|
[% FOREACH header_field IN table_loo.header_fields %]
|
|
[% SWITCH header_field.field_label -%]
|
|
[% CASE "Summary" -%]
|
|
<th>Borrower name</th>
|
|
[% CASE "Borrower Number" %]
|
|
<th>Borrower number</th>
|
|
[% CASE "Actions " %]
|
|
<th>Actions</th>
|
|
[% CASE "Select" -%]
|
|
<th>Select</th>
|
|
[% CASE %]
|
|
<th>[% header_field.field_label | html %]</th>
|
|
[% END -%]
|
|
[% END %]
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% ELSE %]
|
|
<tr>
|
|
[% FOREACH text_field IN table_loo.text_fields %]
|
|
[% IF ( text_field.select_field ) %]
|
|
<td>
|
|
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&label_id=[% text_field.field_value | html %]"><i class="fa fa-trash"></i> Delete</a>
|
|
<a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id | html %]" data-label-id="[% text_field.field_value | html %]"><i class="fa fa-share-square-o"></i> Export</a>
|
|
</td>
|
|
<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
|
|
[% ELSE %]
|
|
<td>[% text_field.field_value | html %]</td>
|
|
[% END %]
|
|
[% END %]
|
|
</tr>
|
|
[% END %]
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
[% ELSE %]
|
|
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
|
|
<ol><li>
|
|
<div class="dialog message">
|
|
<h4>There are no patrons in this batch yet</h4>
|
|
<p>Add patrons by borrowernumber using the text area above or leave empty to add via patron search.</p>
|
|
</div>
|
|
</li></ol>
|
|
</fieldset>
|
|
[% END %]
|
|
</div>
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'greybox.inc' %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
<script>
|
|
function DeleteConfirm() {
|
|
var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id | html %]");
|
|
var answer = confirm(msg);
|
|
if (answer) {
|
|
window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=batch&element_id=[% batch_id | html %]";
|
|
} else {
|
|
return; // abort delete
|
|
}
|
|
};
|
|
function Remove() {
|
|
items = new Array;
|
|
|
|
if(document.items.action.length > 0) {
|
|
for (var i=0; i < document.items.action.length; i++) {
|
|
if (document.items.action[i].checked) {
|
|
items.push("label_id=" + document.items.action[i].value);
|
|
}
|
|
}
|
|
getstr = items.join("&");
|
|
var msg = _("Are you sure you want to remove the selected patron(s) from this batch?");
|
|
} else if (document.items.action.checked) {
|
|
alert(_("Deletion of patron from a batch with only one patron will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar"));
|
|
return; // no deletion for single item batch
|
|
} else {
|
|
alert(_("Please select at least one patron to delete."));
|
|
return; // no item selected
|
|
}
|
|
var answer = confirm(msg);
|
|
if (answer) {
|
|
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&" + getstr;
|
|
} else {
|
|
return; // abort delete
|
|
}
|
|
};
|
|
function Add() {
|
|
var bor_nums = document.getElementById("bor_num_list");
|
|
if (bor_nums.value == '') {
|
|
window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
|
|
'PatronPopup',
|
|
'width=840,height=500,location=yes,toolbar=no,'
|
|
+ 'scrollbars=yes,resize=yes');
|
|
} else {
|
|
document.forms["add_by_bor_num"].submit();
|
|
}
|
|
};
|
|
|
|
function add_user(borrowernumber) {
|
|
$("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
|
|
}
|
|
|
|
function DeDuplicate() {
|
|
window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&batch_id=[% batch_id | html %]";
|
|
};
|
|
function Xport(mode) {
|
|
if (mode == 'label') {
|
|
patroncards= new Array;
|
|
if(document.items.action.length > 0) {
|
|
for (var i=0; i < document.items.action.length; i++) {
|
|
if (document.items.action[i].checked) {
|
|
patroncards.push("label_id=" + document.items.action[i].value);
|
|
}
|
|
}
|
|
if (patroncards.length < 1) {
|
|
alert(_("Please select at least one card to export."));
|
|
return; // no batch selected
|
|
}
|
|
getstr = patroncards.join("&");
|
|
} else if (document.items.action.checked) {
|
|
getstr = document.items.action.value;
|
|
} else {
|
|
alert(_("Please select at least one card to export."));
|
|
return; // no batch selected
|
|
}
|
|
return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]&" + getstr, 400, 800);
|
|
} else if (mode == 'batch') {
|
|
return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id | html %]", 400, 800);
|
|
} else {
|
|
// some pass-thru error trapping just in case...
|
|
}
|
|
};
|
|
function selected_layout() {
|
|
if (document.items.action.length) {
|
|
for (i=0;i<document.items.action.length;i++){
|
|
if (document.items.action[i].checked==true){
|
|
return(document.items.action[i].value);
|
|
}
|
|
};
|
|
} else {
|
|
if (document.items.action.checked){
|
|
return(document.items.action.value);
|
|
}
|
|
};
|
|
alert(_("Please select at least one item."));
|
|
return (-1);
|
|
};
|
|
|
|
$(document).ready(function() {
|
|
[% IF table_loop %]
|
|
$("#description").show();
|
|
[% ELSE %]
|
|
$("#description").hide();
|
|
[% END %]
|
|
$("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
|
|
],
|
|
"aaSorting": [[ 0, "asc" ]],
|
|
"sPaginationType": "four_button",
|
|
"autoWidth": false
|
|
}));
|
|
$("#additems").click(function(){
|
|
Add();
|
|
return false;
|
|
});
|
|
$("#removeitems").click(function(){
|
|
Remove();
|
|
return false;
|
|
});
|
|
$("#deletebatch").click(function(){
|
|
DeleteConfirm();
|
|
return false;
|
|
});
|
|
$("#deduplicate").click(function(){
|
|
DeDuplicate();
|
|
return false;
|
|
});
|
|
$("#exportitems").click(function(){
|
|
Xport('label');
|
|
return false;
|
|
});
|
|
$("#exportbatch").click(function(){
|
|
Xport('batch');
|
|
return false;
|
|
});
|
|
$(".delete").on("click", function(){
|
|
return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
|
|
});
|
|
$(".export").on("click", function(e){
|
|
e.preventDefault();
|
|
var label_id = $(this).data("label-id");
|
|
var batch_id = $(this).data("batch-id");
|
|
GB_showCenter( _("Export single card"),'/cgi-bin/koha/patroncards/print.pl?batch_id=' + batch_id + '&label_id=' + label_id, 400, 800);
|
|
});
|
|
$("#savedesc").click(function(event){
|
|
var newdescription = $(this).siblings('input[name="description"]').val();
|
|
var batch_id = $(this).data('batch_id');
|
|
var ajaxData = {
|
|
'newdescription': newdescription,
|
|
'batch_id': batch_id,
|
|
'card_element': "batch",
|
|
'creator': "patroncard",
|
|
};
|
|
|
|
$.ajax({
|
|
url: '/cgi-bin/koha/svc/creator_batches',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
data: ajaxData,
|
|
})
|
|
|
|
.done(function(data){
|
|
if (data.status == 'success') {
|
|
$("input[name='description']").text(data.newdesc);
|
|
$("#change-status").text(_("Saved"));
|
|
} else {
|
|
$("#change-status").text(_("Unable to save description"));
|
|
}
|
|
});
|
|
});
|
|
$("#savedesc").click(function(event){
|
|
var newdescription = $('input[name="description"]').val();
|
|
var batch_id = $(this).data('batch_id');
|
|
var ajaxData = {
|
|
'newdescription': newdescription,
|
|
'batch_id': batch_id,
|
|
'card_element': "batch",
|
|
'creator': "patroncard",
|
|
};
|
|
|
|
$.ajax({
|
|
url: '/cgi-bin/koha/svc/creator_batches',
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
data: ajaxData,
|
|
})
|
|
|
|
.done(function(data){
|
|
if (data.status == 'success') {
|
|
$("input[name='description']").text(data.newdesc);
|
|
$("#change-status").text(_("Saved"));
|
|
} else {
|
|
$("#change-status").text(_("Unable to save description"));
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|