2 [% PROCESS 'i18n.inc' %]
4 [% BLOCK translate_card_element %]
6 [%- CASE 'layout' -%][% t('layout') | html %]
7 [%- CASE 'Layouts' -%][% t('Layouts') | html %]
8 [%- CASE 'template' -%][% t('template') | html %]
9 [%- CASE 'Templates' -%][% t('Templates') | html %]
10 [%- CASE 'profile' -%][% t('profile') | html %]
11 [%- CASE 'Profiles' -%][% t('Profiles') | html %]
12 [%- CASE 'batch' -%][% t('batch') | html %]
13 [%- CASE 'Batches' -%][% t('Batches') | html %]
14 [%- CASE 'Actions' -%][% t('Actions') | html %]
17 [% BLOCK translate_card_elements %]
18 [%- SWITCH element -%]
19 [%- CASE 'layout' -%]<span>layouts</span>
20 [%- CASE 'template' -%]<span>templates</span>
21 [%- CASE 'profile' -%]<span>profiles</span>
22 [%- CASE 'batch' -%]<span>batches</span>
26 [% INCLUDE 'doc-head-open.inc' %]
27 <title>[% PROCESS translate_card_element element=card_element_title %] › Patron card creator › Tools › Koha</title>
28 [% INCLUDE 'doc-head-close.inc' %]
31 <body id="pcard_manage" class="tools pcard">
32 [% INCLUDE 'header.inc' %]
33 [% INCLUDE 'cat-search.inc' %]
35 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
38 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
41 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
44 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
47 <a href="#" aria-current="page">
48 [% PROCESS translate_card_element element=card_element_title %]
54 <div class="main container-fluid">
56 <div class="col-sm-10 col-sm-push-2">
59 [% INCLUDE 'patroncards-toolbar.inc' %]
61 <h1>Patron card templates</h1>
63 [% INCLUDE 'patroncards-errors.inc' %]
64 <div id="manage-patroncards-layouts">
65 [% IF ( table_loop ) %]
66 <form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element | html %]">
67 <h2>Currently available [% PROCESS translate_card_element element=card_element_title FILTER lower %]</h2>
69 [% FOREACH table_loo IN table_loop %]
70 [% IF ( table_loo.header_fields ) %]
72 [% FOREACH header_field IN table_loo.header_fields %]
73 [% SWITCH header_field.field_label -%]
74 [%- CASE 'Layout ID' -%]<th>Layout ID</th>
75 [%- CASE 'Layout' -%]<th>Layout</th>
76 [%- CASE 'Action' -%]<th>Action</th>
77 [%- CASE 'Actions' -%]<th class="noExport">Actions</th>
78 [%- CASE 'Select' -%][% IF ( print ) %]<th>Select</th>[% END %]
79 [%- CASE 'Template ID' -%]<th>Template ID</th>
80 [%- CASE 'Template Name' -%]<th>Template name</th>
81 [%- CASE 'Description' -%]<th>Description</th>
82 [%- CASE 'Profile ID' -%]<th>Profile ID</th>
83 [%- CASE 'Printer Name' -%]<th>Printer name</th>
84 [%- CASE 'Paper Bin' -%]<th>Paper bin</th>
85 [%- CASE 'Batch ID' -%]<th>Batch ID</th>
86 [%- CASE 'Patron Count' -%]<th>Patron count</th>
87 [%- CASE -%]<th>[% header_field.field_label | html %]</th>
93 [% FOREACH text_field IN table_loo.text_fields %]
94 [% IF ( text_field.select_field ) %]
96 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=[% text_field.field_value | html %]"><i class="fa fa-edit"></i> Edit</a>
97 [% IF ( print ) %]<a class="btn btn-default btn-xs export" data-batch-id="[% text_field.field_value |url %]" href="/cgi-bin/koha/patroncards/print.pl?batch_id=[% text_field.field_value |url %]"><i class="fa fa-share-square-o"></i> Export</a>[% END %]
98 <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element | html %]&element_id=[% text_field.field_value | html %]"><i class="fa fa-trash"></i> Delete</a>
100 [% IF ( print ) %]<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
101 [% ELSIF ( text_field.field_value ) %]
102 <td>[% text_field.field_value | html %]</td>
111 <fieldset class="action">
112 [% IF ( print ) %]<input type="button" id="print" value="Export selected batches" />[% END %]
114 [% IF patron_lists %]
115 <fieldset class="rows">
116 <legend>Or use a patron list</legend>
119 <label for="patron_list_id">Patron list: </label>
120 <select id="patron_list_id" name="patron_list_id">
121 <option value=""></option>
122 [% FOREACH pl IN patron_lists %]
123 <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
129 <fieldset class="action">
130 <input type="button" id="printlist" value="Export from patron list" />
136 <div class="dialog message">
137 <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
138 <p>Use the toolbar above to create a new [% PROCESS translate_card_element element=card_element %].</p></div>
143 </div> <!-- /.col-sm-10.col-sm-push-2 -->
145 <div class="col-sm-2 col-sm-pull-10">
147 [% INCLUDE 'tools-menu.inc' %]
149 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
150 </div> <!-- /.row -->
152 [% MACRO jsinclude BLOCK %]
153 [% INCLUDE 'greybox.inc' %]
155 function DeleteConfirm() {
156 var element_ids = selected_layouts("delete");
159 if (element_ids.length > 1) {
160 msg = _("Are you sure you want to delete %s %s?").format(element_ids.length, "[% PROCESS translate_card_elements element=card_element %]");
161 } else if (element_ids.length == 1) {
162 msg = _("Are you sure you want to delete %s %s?").format("[% PROCESS translate_card_element element=card_element %]", element_ids[0]);
165 if (msg && confirm(msg)) {
167 for (var i = 0; i < element_ids.length; i++) {
168 if (element_ids[i] > -1) {
169 elements += element_ids[i] + ","
172 return; // no layout selected
176 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element | html %]&element_id=" + elements;
179 return; // abort delete
185 var element_id = selected_layouts("edit");
187 window.location = "/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=" + element_id;
190 return; // no layout selected
195 if(document.layouts.action.length > 0) {
196 for (var i=0; i < document.layouts.action.length; i++) {
197 if (document.layouts.action[i].checked) {
198 batches.push("batch_id=" + document.layouts.action[i].value);
201 if (batches.length < 1) {
202 alert(_("Please select at least one batch to export."));
203 return; // no batch selected
205 getstr = batches.join("&");
207 else if (document.layouts.action.checked) {
208 getstr = "batch_id="+document.layouts.action.value;
211 alert(_("Please select at least one batch to export."));
212 return; // no batch selected
214 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
217 function XportPatronlist() {
218 if ( patron_list_id.value.length < 1 ) {
219 alert(_("Please select a patron list."));
220 return; // no patron list selected
222 getstr = 'patronlist_id='+patron_list_id.value;
223 return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
226 function selected_layout(op) {
227 if (document.layouts.action.length) {
228 var selected = new Array();
229 for (i=0;i<document.layouts.action.length;i++){
230 if (document.layouts.action[i].checked){
234 if (selected.length == 1 || (op == "delete" && selected.length >= 1)) {
235 if (op == "delete") {
236 var selectedDelete = new Array;
237 for (i = 0; i < selected.length; i++) {
238 selectedDelete.push(document.layouts.action[selected[i]].value);
240 return(selectedDelete);
242 // op == 'edit' returns only the object and not list
243 return(document.layouts.action[selected[0]].value);
246 else if (selected.length < 1) {
248 alert(_("Please select one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
250 alert(_("Please select at least one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
255 alert(_("Please select only one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
260 if (document.layouts.action.checked){
261 return([document.layouts.action.value]);
264 alert(_("Please select a %s.").format("[% PROCESS translate_card_element element=card_element %]"));
268 $(document).ready(function() {
269 $("#edit").click(function(){
273 $("#delete").click(function(){
277 $("#print").click(function(){
281 $("#printlist").click(function(){
285 $(".delete").on("click", function(){
286 return confirmDelete( _("Are you sure you want to delete this?") );
288 $(".export").on("click", function(e){
290 var batch_id = $(this).data("batch-id");
291 GB_showCenter( _("Export single batch"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id, 400, 800);
297 [% INCLUDE 'intranet-bottom.inc' %]