3 [% BLOCK translate_card_element %]
5 [%- CASE 'layout' -%]layout
6 [%- CASE 'Layouts' -%]Layouts
7 [%- CASE 'template' -%]template
8 [%- CASE 'Templates' -%]Templates
9 [%- CASE 'profile' -%]profile
10 [%- CASE 'Profiles' -%]Profiles
11 [%- CASE 'batch' -%]batch
12 [%- CASE 'Batches' -%]Batches
13 [%- CASE 'Actions' -%]Actions
16 [% BLOCK translate_card_elements %]
17 [%- SWITCH element -%]
18 [%- CASE 'layout' -%]layouts
19 [%- CASE 'template' -%]templates
20 [%- CASE 'profile' -%]profiles
21 [%- CASE 'batch' -%]batches
25 [% INCLUDE 'doc-head-open.inc' %]
26 <title>Koha › Tools › Patron card creator › [% PROCESS translate_card_element element=card_element_title %]</title>
27 [% INCLUDE 'doc-head-close.inc' %]
30 <body id="pcard_manage" class="tools pcard">
31 [% INCLUDE 'header.inc' %]
32 [% INCLUDE 'cat-search.inc' %]
34 <nav aria-label="Breadcrumb" class="breadcrumb">
37 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
40 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
43 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
46 <a href="#" aria-current="page">
47 [% PROCESS translate_card_element element=card_element_title %]
53 <div class="main container-fluid">
55 <div class="col-sm-10 col-sm-push-2">
58 [% INCLUDE 'patroncards-toolbar.inc' %]
59 [% INCLUDE 'patroncards-errors.inc' %]
60 <div id="manage-patroncards-layouts">
61 [% IF ( table_loop ) %]
62 <form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element | html %]">
63 <h2>Currently available [% PROCESS translate_card_element element=card_element_title FILTER lower %]</h2>
65 [% FOREACH table_loo IN table_loop %]
66 [% IF ( table_loo.header_fields ) %]
68 [% FOREACH header_field IN table_loo.header_fields %]
69 [% SWITCH header_field.field_label -%]
70 [%- CASE 'Layout ID' -%]<th>Layout ID</th>
71 [%- CASE 'Layout' -%]<th>Layout</th>
72 [%- CASE 'Action' -%]<th>Action</th>
73 [%- CASE 'Actions' -%]<th class="noExport">Actions</th>
74 [%- CASE 'Select' -%][% IF ( print ) %]<th>Select</th>[% END %]
75 [%- CASE 'Template ID' -%]<th>Template ID</th>
76 [%- CASE 'Template Name' -%]<th>Template name</th>
77 [%- CASE 'Description' -%]<th>Description</th>
78 [%- CASE 'Profile ID' -%]<th>Profile ID</th>
79 [%- CASE 'Printer Name' -%]<th>Printer name</th>
80 [%- CASE 'Paper Bin' -%]<th>Paper bin</th>
81 [%- CASE 'Batch ID' -%]<th>Batch ID</th>
82 [%- CASE 'Patron Count' -%]<th>Patron count</th>
83 [%- CASE -%]<th>[% header_field.field_label | html %]</th>
89 [% FOREACH text_field IN table_loo.text_fields %]
90 [% IF ( text_field.select_field ) %]
92 <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>
93 [% 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 %]
94 <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>
96 [% IF ( print ) %]<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
97 [% ELSIF ( text_field.field_value ) %]
98 <td>[% text_field.field_value | html %]</td>
107 <fieldset class="action">
108 [% IF ( print ) %]<input type="button" id="print" value="Export selected batches" />[% END %]
110 [% IF patron_lists %]
111 <fieldset class="rows">
112 <legend>Or use a patron list</legend>
115 <label for="patron_list_id">Patron list: </label>
116 <select id="patron_list_id" name="patron_list_id">
117 <option value=""></option>
118 [% FOREACH pl IN patron_lists %]
119 <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
125 <fieldset class="action">
126 <input type="button" id="printlist" value="Export from patron list" />
132 <div class="dialog message">
133 <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
134 <p>Use the toolbar above to create a new [% PROCESS translate_card_element element=card_element %].</p></div>
139 </div> <!-- /.col-sm-10.col-sm-push-2 -->
141 <div class="col-sm-2 col-sm-pull-10">
143 [% INCLUDE 'tools-menu.inc' %]
145 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
146 </div> <!-- /.row -->
148 [% MACRO jsinclude BLOCK %]
149 [% INCLUDE 'greybox.inc' %]
151 function DeleteConfirm() {
152 var element_ids = selected_layouts("delete");
155 if (element_ids.length > 1) {
156 msg = _("Are you sure you want to delete %s %s?").format(element_ids.length, "[% PROCESS translate_card_elements element=card_element %]");
157 } else if (element_ids.length == 1) {
158 msg = _("Are you sure you want to delete %s %s?").format("[% PROCESS translate_card_element element=card_element %]", element_ids[0]);
161 if (msg && confirm(msg)) {
163 for (var i = 0; i < element_ids.length; i++) {
164 if (element_ids[i] > -1) {
165 elements += element_ids[i] + ","
168 return; // no layout selected
172 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element | html %]&element_id=" + elements;
175 return; // abort delete
181 var element_id = selected_layouts("edit");
183 window.location = "/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=" + element_id;
186 return; // no layout selected
191 if(document.layouts.action.length > 0) {
192 for (var i=0; i < document.layouts.action.length; i++) {
193 if (document.layouts.action[i].checked) {
194 batches.push("batch_id=" + document.layouts.action[i].value);
197 if (batches.length < 1) {
198 alert(_("Please select at least one batch to export."));
199 return; // no batch selected
201 getstr = batches.join("&");
203 else if (document.layouts.action.checked) {
204 getstr = "batch_id="+document.layouts.action.value;
207 alert(_("Please select at least one batch to export."));
208 return; // no batch selected
210 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
213 function XportPatronlist() {
214 if ( patron_list_id.value.length < 1 ) {
215 alert(_("Please select a patron list."));
216 return; // no patron list selected
218 getstr = 'patronlist_id='+patron_list_id.value;
219 return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
222 function selected_layout(op) {
223 if (document.layouts.action.length) {
224 var selected = new Array();
225 for (i=0;i<document.layouts.action.length;i++){
226 if (document.layouts.action[i].checked){
230 if (selected.length == 1 || (op == "delete" && selected.length >= 1)) {
231 if (op == "delete") {
232 var selectedDelete = new Array;
233 for (i = 0; i < selected.length; i++) {
234 selectedDelete.push(document.layouts.action[selected[i]].value);
236 return(selectedDelete);
238 // op == 'edit' returns only the object and not list
239 return(document.layouts.action[selected[0]].value);
242 else if (selected.length < 1) {
244 alert(_("Please select one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
246 alert(_("Please select at least one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
251 alert(_("Please select only one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
256 if (document.layouts.action.checked){
257 return([document.layouts.action.value]);
260 alert(_("Please select a %s.").format("[% PROCESS translate_card_element element=card_element %]"));
264 $(document).ready(function() {
265 $("#edit").click(function(){
269 $("#delete").click(function(){
273 $("#print").click(function(){
277 $("#printlist").click(function(){
281 $(".delete").on("click", function(){
282 return confirmDelete( _("Are you sure you want to delete this?") );
284 $(".export").on("click", function(e){
286 var batch_id = $(this).data("batch-id");
287 GB_showCenter( _("Export single batch"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id, 400, 800);
293 [% INCLUDE 'intranet-bottom.inc' %]