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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
40 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
43 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
46 <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a>
49 <a href="#" aria-current="page">
50 [% PROCESS translate_card_element element=card_element_title %]
57 <div class="main container-fluid">
59 <div class="col-sm-10 col-sm-push-2">
62 [% INCLUDE 'patroncards-toolbar.inc' %]
64 <h1>Patron card templates</h1>
66 [% INCLUDE 'patroncards-errors.inc' %]
67 <div id="manage-patroncards-layouts">
68 [% IF ( table_loop ) %]
69 <form name="layouts" action="/cgi-bin/koha/manage.pl?card_element=[% card_element | html %]">
70 <h2>Currently available [% PROCESS translate_card_element element=card_element_title FILTER lower %]</h2>
72 [% FOREACH table_loo IN table_loop %]
73 [% IF ( table_loo.header_fields ) %]
75 [% FOREACH header_field IN table_loo.header_fields %]
76 [% SWITCH header_field.field_label -%]
77 [%- CASE 'Layout ID' -%]<th>Layout ID</th>
78 [%- CASE 'Layout' -%]<th>Layout</th>
79 [%- CASE 'Action' -%]<th>Action</th>
80 [%- CASE 'Actions' -%]<th class="noExport">Actions</th>
81 [%- CASE 'Select' -%][% IF ( print ) %]<th>Select</th>[% END %]
82 [%- CASE 'Template ID' -%]<th>Template ID</th>
83 [%- CASE 'Template Name' -%]<th>Template name</th>
84 [%- CASE 'Description' -%]<th>Description</th>
85 [%- CASE 'Profile ID' -%]<th>Profile ID</th>
86 [%- CASE 'Printer Name' -%]<th>Printer name</th>
87 [%- CASE 'Paper Bin' -%]<th>Paper bin</th>
88 [%- CASE 'Batch ID' -%]<th>Batch ID</th>
89 [%- CASE 'Patron Count' -%]<th>Patron count</th>
90 [%- CASE -%]<th>[% header_field.field_label | html %]</th>
96 [% FOREACH text_field IN table_loo.text_fields %]
97 [% IF ( text_field.select_field ) %]
99 <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>
100 [% 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 %]
101 <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>
103 [% IF ( print ) %]<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
104 [% ELSIF ( text_field.field_value ) %]
105 <td>[% text_field.field_value | html %]</td>
114 <fieldset class="action">
115 [% IF ( print ) %]<input type="button" id="print" value="Export selected batches" />[% END %]
117 [% IF patron_lists %]
118 <fieldset class="rows">
119 <legend>Or use a patron list</legend>
122 <label for="patron_list_id">Patron list: </label>
123 <select id="patron_list_id" name="patron_list_id">
124 <option value=""></option>
125 [% FOREACH pl IN patron_lists %]
126 <option value="[% pl.patron_list_id | html %]">[% pl.name | html %]</option>
132 <fieldset class="action">
133 <input type="button" id="printlist" value="Export from patron list" />
139 <div class="dialog message">
140 <h4>There are no [% PROCESS translate_card_element element=card_element_title %] currently available.</h4>
141 <p>Use the toolbar above to create a new [% PROCESS translate_card_element element=card_element %].</p></div>
146 </div> <!-- /.col-sm-10.col-sm-push-2 -->
148 <div class="col-sm-2 col-sm-pull-10">
150 [% INCLUDE 'tools-menu.inc' %]
152 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
153 </div> <!-- /.row -->
155 [% MACRO jsinclude BLOCK %]
156 [% INCLUDE 'greybox.inc' %]
158 function DeleteConfirm() {
159 var element_ids = selected_layouts("delete");
162 if (element_ids.length > 1) {
163 msg = _("Are you sure you want to delete %s %s?").format(element_ids.length, "[% PROCESS translate_card_elements element=card_element %]");
164 } else if (element_ids.length == 1) {
165 msg = _("Are you sure you want to delete %s %s?").format("[% PROCESS translate_card_element element=card_element %]", element_ids[0]);
168 if (msg && confirm(msg)) {
170 for (var i = 0; i < element_ids.length; i++) {
171 if (element_ids[i] > -1) {
172 elements += element_ids[i] + ","
175 return; // no layout selected
179 window.location = "/cgi-bin/koha/patroncards/manage.pl?op=delete&card_element=[% card_element | html %]&element_id=" + elements;
182 return; // abort delete
188 var element_id = selected_layouts("edit");
190 window.location = "/cgi-bin/koha/patroncards/edit-[% card_element | html %].pl?op=edit&element_id=" + element_id;
193 return; // no layout selected
198 if(document.layouts.action.length > 0) {
199 for (var i=0; i < document.layouts.action.length; i++) {
200 if (document.layouts.action[i].checked) {
201 batches.push("batch_id=" + document.layouts.action[i].value);
204 if (batches.length < 1) {
205 alert(_("Please select at least one batch to export."));
206 return; // no batch selected
208 getstr = batches.join("&");
210 else if (document.layouts.action.checked) {
211 getstr = "batch_id="+document.layouts.action.value;
214 alert(_("Please select at least one batch to export."));
215 return; // no batch selected
217 return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 400, 800);
220 function XportPatronlist() {
221 if ( patron_list_id.value.length < 1 ) {
222 alert(_("Please select a patron list."));
223 return; // no patron list selected
225 getstr = 'patronlist_id='+patron_list_id.value;
226 return GB_showCenter(_("Export patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?" + getstr, 700, 800);
229 function selected_layout(op) {
230 if (document.layouts.action.length) {
231 var selected = new Array();
232 for (i=0;i<document.layouts.action.length;i++){
233 if (document.layouts.action[i].checked){
237 if (selected.length == 1 || (op == "delete" && selected.length >= 1)) {
238 if (op == "delete") {
239 var selectedDelete = new Array;
240 for (i = 0; i < selected.length; i++) {
241 selectedDelete.push(document.layouts.action[selected[i]].value);
243 return(selectedDelete);
245 // op == 'edit' returns only the object and not list
246 return(document.layouts.action[selected[0]].value);
249 else if (selected.length < 1) {
251 alert(_("Please select one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
253 alert(_("Please select at least one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
258 alert(_("Please select only one %s to %s.").format("[% PROCESS translate_card_element element=card_element %]", op));
263 if (document.layouts.action.checked){
264 return([document.layouts.action.value]);
267 alert(_("Please select a %s.").format("[% PROCESS translate_card_element element=card_element %]"));
271 $(document).ready(function() {
272 $("#edit").click(function(){
276 $("#delete").click(function(){
280 $("#print").click(function(){
284 $("#printlist").click(function(){
288 $(".delete").on("click", function(){
289 return confirmDelete( _("Are you sure you want to delete this?") );
291 $(".export").on("click", function(e){
293 var batch_id = $(this).data("batch-id");
294 GB_showCenter( _("Export single batch"),'/cgi-bin/koha/patroncards/print.pl?batch_id='+batch_id, 400, 800);
300 [% INCLUDE 'intranet-bottom.inc' %]