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' %]
33 <div id="breadcrumbs">
34 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
35 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> ›
36 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> ›
37 [% PROCESS translate_card_element element=card_element_title %]
40 <div class="main container-fluid">
42 <div class="col-sm-10 col-sm-push-2">
45 [% INCLUDE 'patroncards-toolbar.inc' %]
46 [% INCLUDE 'patroncards-errors.inc' %]
47 <div id="manage-patroncards-layouts">
48 [% IF ( table_loop ) %]
49 <form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element | html %]">
50 <h2>Currently available [% PROCESS translate_card_element element=card_element_title FILTER lower %]</h2>
52 [% FOREACH table_loo IN table_loop %]
53 [% IF ( table_loo.header_fields ) %]
55 [% FOREACH header_field IN table_loo.header_fields %]
56 [% SWITCH header_field.field_label -%]
57 [%- CASE 'Layout ID' -%]<th>Layout ID</th>
58 [%- CASE 'Layout' -%]<th>Layout</th>
59 [%- CASE 'Action' -%]<th>Action</th>
60 [%- CASE 'Actions' -%]<th>Actions</th>
61 [%- CASE 'Select' -%][% IF ( print ) %]<th>Select</th>[% END %]
62 [%- CASE 'Template ID' -%]<th>Template ID</th>
63 [%- CASE 'Template Name' -%]<th>Template name</th>
64 [%- CASE 'Description' -%]<th>Description</th>
65 [%- CASE 'Profile ID' -%]<th>Profile ID</th>
66 [%- CASE 'Printer Name' -%]<th>Printer name</th>
67 [%- CASE 'Paper Bin' -%]<th>Paper bin</th>
68 [%- CASE 'Batch ID' -%]<th>Batch ID</th>
69 [%- CASE 'Patron Count' -%]<th>Patron count</th>
70 [%- CASE -%]<th>[% header_field.field_label | html %]</th>
76 [% FOREACH text_field IN table_loo.text_fields %]
77 [% IF ( text_field.select_field ) %]
79 <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>
80 [% 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 %]
81 <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>
83 [% IF ( print ) %]<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
84 [% ELSIF ( text_field.field_value ) %]
85 <td>[% text_field.field_value | html %]</td>
94 <fieldset class="action">
95 [% IF ( print ) %]<input type="button" id="print" value="Export selected batches" />[% END %]
98 <fieldset class="rows">
99 <legend>Or use a patron list</legend>
102 <label for="patron_list_id">Patron list: </label>
103 <select id="patron_list_id" name="patron_list_id">
104 <option value=""></option>
105 [% FOREACH pl IN patron_lists %]
106 <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
112 <fieldset class="action">
113 <input type="button" id="printlist" value="Export from patron list" />
119 <div class="dialog message">
120 <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
121 <p>Use the toolbar above to create a new [% PROCESS translate_card_element element=card_element %].</p></div>
126 </div> <!-- /.col-sm-10.col-sm-push-2 -->
128 <div class="col-sm-2 col-sm-pull-10">
130 [% INCLUDE 'tools-menu.inc' %]
132 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
133 </div> <!-- /.row -->
135 [% MACRO jsinclude BLOCK %]
136 [% INCLUDE 'greybox.inc' %]
138 function DeleteConfirm() {
139 var element_ids = selected_layouts("delete");
142 if (element_ids.length > 1) {
143 msg = _("Are you sure you want to delete %s %s?").format(element_ids.length, "[% PROCESS translate_card_elements element=card_element %]");
144 } else if (element_ids.length == 1) {
145 msg = _("Are you sure you want to delete %s %s?").format("[% PROCESS translate_card_element element=card_element %]", element_ids[0]);
148 if (msg && confirm(msg)) {
150 for (var i = 0; i < element_ids.length; i++) {
151 if (element_ids[i] > -1) {
152 elements += element_ids[i] + ","
155 return; // no layout selected
159 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element | html %]&element_id=" + elements;
162 return; // abort delete
168 var element_id = selected_layouts("edit");
170 window.location = "/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=" + element_id;
173 return; // no layout selected
178 if(document.layouts.action.length > 0) {
179 for (var i=0; i < document.layouts.action.length; i++) {
180 if (document.layouts.action[i].checked) {
181 batches.push("batch_id=" + document.layouts.action[i].value);
184 if (batches.length < 1) {
185 alert(_("Please select at least one batch to export."));
186 return; // no batch selected
188 getstr = batches.join("&");
190 else if (document.layouts.action.checked) {
191 getstr = "batch_id="+document.layouts.action.value;
194 alert(_("Please select at least one batch to export."));
195 return; // no batch selected
197 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
200 function XportPatronlist() {
201 if ( patron_list_id.value.length < 1 ) {
202 alert(_("Please select a patron list."));
203 return; // no patron list selected
205 getstr = 'patronlist_id='+patron_list_id.value;
206 return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
209 function selected_layout(op) {
210 if (document.layouts.action.length) {
211 var selected = new Array();
212 for (i=0;i<document.layouts.action.length;i++){
213 if (document.layouts.action[i].checked){
217 if (selected.length == 1 || (op == "delete" && selected.length >= 1)) {
218 if (op == "delete") {
219 var selectedDelete = new Array;
220 for (i = 0; i < selected.length; i++) {
221 selectedDelete.push(document.layouts.action[selected[i]].value);
223 return(selectedDelete);
225 // op == 'edit' returns only the object and not list
226 return(document.layouts.action[selected[0]].value);
229 else if (selected.length < 1) {
231 alert(_("Please select one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
233 alert(_("Please select at least one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
238 alert(_("Please select only one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
243 if (document.layouts.action.checked){
244 return([document.layouts.action.value]);
247 alert(_("Please select a %s.").format("[% PROCESS translate_card_element element=card_element %]"));
251 $(document).ready(function() {
252 $("#edit").click(function(){
256 $("#delete").click(function(){
260 $("#print").click(function(){
264 $("#printlist").click(function(){
268 $(".delete").on("click", function(){
269 return confirmDelete( _("Are you sure you want to delete this?") );
271 $(".export").on("click", function(e){
273 var batch_id = $(this).data("batch-id");
274 GB_showCenter( _("Export single batch"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id, 400, 800);
280 [% INCLUDE 'intranet-bottom.inc' %]