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 [% WRAPPER 'header.inc' %]
33 [% INCLUDE 'cat-search.inc' %]
36 [% WRAPPER 'sub-header.inc' %]
37 [% WRAPPER breadcrumbs %]
38 [% WRAPPER breadcrumb_item %]
39 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
41 [% WRAPPER breadcrumb_item %]
42 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
44 [% WRAPPER breadcrumb_item bc_active= 1 %]
45 [% PROCESS translate_card_element element=card_element_title %]
47 [% END #/ WRAPPER breadcrumbs %]
48 [% END #/ WRAPPER sub-header.inc %]
50 <div class="main container-fluid">
52 <div class="col-sm-10 col-sm-push-2">
55 [% INCLUDE 'patroncards-toolbar.inc' %]
57 <h1>Patron card templates</h1>
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 <div class="page-section">
64 <h2>Currently available [% PROCESS translate_card_element element=card_element_title FILTER lower %]</h2>
66 [% FOREACH table_loo IN table_loop %]
67 [% IF ( table_loo.header_fields ) %]
69 [% FOREACH header_field IN table_loo.header_fields %]
70 [% SWITCH header_field.field_label -%]
71 [%- CASE 'Layout ID' -%]<th>Layout ID</th>
72 [%- CASE 'Layout' -%]<th>Layout</th>
73 [%- CASE 'Action' -%]<th>Action</th>
74 [%- CASE 'Actions' -%]<th class="noExport">Actions</th>
75 [%- CASE 'Select' -%][% IF ( print ) %]<th>Select</th>[% END %]
76 [%- CASE 'Template ID' -%]<th>Template ID</th>
77 [%- CASE 'Template Name' -%]<th>Template name</th>
78 [%- CASE 'Description' -%]<th>Description</th>
79 [%- CASE 'Profile ID' -%]<th>Profile ID</th>
80 [%- CASE 'Printer Name' -%]<th>Printer name</th>
81 [%- CASE 'Paper Bin' -%]<th>Paper bin</th>
82 [%- CASE 'Batch ID' -%]<th>Batch ID</th>
83 [%- CASE 'Patron Count' -%]<th>Patron count</th>
84 [%- CASE -%]<th>[% header_field.field_label | html %]</th>
90 [% FOREACH text_field IN table_loo.text_fields %]
91 [% IF ( text_field.select_field ) %]
93 <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>
94 [% 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 %]
95 <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>
97 [% IF ( print ) %]<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
98 [% ELSIF ( text_field.field_value ) %]
99 <td>[% text_field.field_value | html %]</td>
108 <fieldset class="action">
109 [% IF ( print ) %]<input type="button" id="print" value="Export selected batches" />[% END %]
111 </div> <!-- /.page-section -->
112 [% IF patron_lists %]
113 <fieldset class="rows">
114 <legend>Or use a patron list</legend>
117 <label for="patron_list_id">Patron list: </label>
118 <select id="patron_list_id" name="patron_list_id">
119 <option value=""></option>
120 [% FOREACH pl IN patron_lists %]
121 <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
127 <fieldset class="action">
128 <input type="button" id="printlist" value="Export from patron list" />
134 <div class="dialog message">
135 <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
136 <p>Use the toolbar above to create a new [% PROCESS translate_card_element element=card_element %].</p></div>
141 </div> <!-- /.col-sm-10.col-sm-push-2 -->
143 <div class="col-sm-2 col-sm-pull-10">
145 [% INCLUDE 'tools-menu.inc' %]
147 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
148 </div> <!-- /.row -->
150 [% MACRO jsinclude BLOCK %]
151 [% INCLUDE 'greybox.inc' %]
153 function DeleteConfirm() {
154 var element_ids = selected_layouts("delete");
157 if (element_ids.length > 1) {
158 msg = _("Are you sure you want to delete %s %s?").format(element_ids.length, "[% PROCESS translate_card_elements element=card_element %]");
159 } else if (element_ids.length == 1) {
160 msg = _("Are you sure you want to delete %s %s?").format("[% PROCESS translate_card_element element=card_element %]", element_ids[0]);
163 if (msg && confirm(msg)) {
165 for (var i = 0; i < element_ids.length; i++) {
166 if (element_ids[i] > -1) {
167 elements += element_ids[i] + ","
170 return; // no layout selected
174 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element | html %]&element_id=" + elements;
177 return; // abort delete
183 var element_id = selected_layouts("edit");
185 window.location = "/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=" + element_id;
188 return; // no layout selected
193 if(document.layouts.action.length > 0) {
194 for (var i=0; i < document.layouts.action.length; i++) {
195 if (document.layouts.action[i].checked) {
196 batches.push("batch_id=" + document.layouts.action[i].value);
199 if (batches.length < 1) {
200 alert(_("Please select at least one batch to export."));
201 return; // no batch selected
203 getstr = batches.join("&");
205 else if (document.layouts.action.checked) {
206 getstr = "batch_id="+document.layouts.action.value;
209 alert(_("Please select at least one batch to export."));
210 return; // no batch selected
212 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
215 function XportPatronlist() {
216 if ( patron_list_id.value.length < 1 ) {
217 alert(_("Please select a patron list."));
218 return; // no patron list selected
220 getstr = 'patronlist_id='+patron_list_id.value;
221 return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
224 function selected_layout(op) {
225 if (document.layouts.action.length) {
226 var selected = new Array();
227 for (i=0;i<document.layouts.action.length;i++){
228 if (document.layouts.action[i].checked){
232 if (selected.length == 1 || (op == "delete" && selected.length >= 1)) {
233 if (op == "delete") {
234 var selectedDelete = new Array;
235 for (i = 0; i < selected.length; i++) {
236 selectedDelete.push(document.layouts.action[selected[i]].value);
238 return(selectedDelete);
240 // op == 'edit' returns only the object and not list
241 return(document.layouts.action[selected[0]].value);
244 else if (selected.length < 1) {
246 alert(_("Please select one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
248 alert(_("Please select at least one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
253 alert(_("Please select only one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
258 if (document.layouts.action.checked){
259 return([document.layouts.action.value]);
262 alert(_("Please select a %s.").format("[% PROCESS translate_card_element element=card_element %]"));
266 $(document).ready(function() {
267 $("#edit").click(function(){
271 $("#delete").click(function(){
275 $("#print").click(function(){
279 $("#printlist").click(function(){
283 $(".delete").on("click", function(){
284 return confirmDelete( _("Are you sure you want to delete this?") );
286 $(".export").on("click", function(e){
288 var batch_id = $(this).data("batch-id");
289 GB_showCenter( _("Export single batch"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id, 400, 800);
295 [% INCLUDE 'intranet-bottom.inc' %]