Bug 29002: (follow-up) Use $patron_to_html function
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-manage.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% BLOCK translate_label_element %]
6 [%-  SWITCH element -%]
7 [%-  CASE 'layout'    -%][% t('layout') | html %]
8 [%-  CASE 'Layouts'   -%][% t('Label layouts') | html %]
9 [%-  CASE 'template'  -%][% t('template') | html %]
10 [%-  CASE 'Templates' -%][% t('Label templates') | html %]
11 [%-  CASE 'profile'   -%][% t('profile') | html %]
12 [%-  CASE 'Profiles'  -%][% t('Printer profiles') | html %]
13 [%-  CASE 'batch'     -%][% t('batch') | html %]
14 [%-  CASE 'Batches'   -%][% t('Label batches') | html %]
15 [%-  END -%]
16 [% END %]
17     [% INCLUDE 'doc-head-open.inc' %]
18     <title>[% FILTER collapse %]
19         [% PROCESS translate_label_element element=label_element_title %] &rsaquo;
20         [% t("Label creator") | html %] &rsaquo;
21         [% t("Cataloging") | html %] &rsaquo;
22         [% t("Koha") | html %]
23     [% END %]</title>
24     [% INCLUDE 'doc-head-close.inc' %]
25 </head>
26
27 <body id="labels_label-manage" class="tools labels">
28     [% WRAPPER 'header.inc' %]
29     [% INCLUDE 'cat-search.inc' %]
30 [% END %]
31
32 [% WRAPPER 'sub-header.inc' %]
33     [% WRAPPER breadcrumbs %]
34         [% WRAPPER breadcrumb_item %]
35             <a href="/cgi-bin/koha/cataloguing/cataloging-home.pl">Cataloging</a>
36         [% END %]
37         [% WRAPPER breadcrumb_item %]
38             <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a>
39         [% END %]
40         [% WRAPPER breadcrumb_item bc_active= 1 %]
41             [% PROCESS translate_label_element element=label_element_title %]
42         [% END %]
43     [% END #/ WRAPPER breadcrumbs %]
44 [% END #/ WRAPPER sub-header.inc %]
45
46     <div class="main container-fluid">
47         <div class="row">
48             <div class="col-sm-10 col-sm-push-2">
49                 <main>
50
51                     [% INCLUDE 'labels-toolbar.inc' %]
52                     <h2>[% PROCESS translate_label_element element=label_element_title %]</h2>
53
54                         [% IF ( error ) %]
55                             <div class="dialog alert">
56                                 <strong>WARNING:</strong> An error was encountered and the [% op | html %] operation for [% label_element | html %] [% element_id | html %] was not completed. Please have your system administrator check the error log for details.
57                             </div>
58                         [% END %]
59
60                         <div id="manage-label-layouts" class="page-section">
61                             [% IF ( table_loop ) %]
62                             <form name="layouts" action="/cgi-bin/koha/label-manage.pl?label_element=[% label_element | html %]">
63
64                             <div class="page-section">
65                                 <table id="labels-table">
66                                     [% FOREACH table_loo IN table_loop %]
67                                         [% IF ( table_loo.header_fields ) %]
68                                             <thead>
69                                             <tr>
70                                                 [% FOREACH header_field IN table_loo.header_fields %]
71                                                     [% SWITCH header_field.field_label %]
72                                                         [% CASE 'Layout ID'       %]<th>Layout ID</th>
73                                                         [% CASE 'Layout'          %]<th>Layout</th>
74                                                         [% CASE 'Barcode Type'    %]<th>Barcode type</th>
75                                                         [% CASE 'Print Type'      %]<th>Print type</th>
76                                                         [% CASE 'Template ID'     %]<th>Template ID</th>
77                                                         [% CASE 'Template Name'   %]<th>Template name</th>
78                                                         [% CASE 'Description'     %]<th>Description</th>
79                                                         [% CASE 'Actions'         %]<th class="noExport">Actions</th>
80                                                         [% CASE 'Profile ID'      %]<th>Profile ID</th>
81                                                         [% CASE 'Printer Name'    %]<th>Printer name</th>
82                                                         [% CASE 'Paper Bin'       %]<th>Paper bin</th>
83                                                         [% CASE 'Batch ID'        %]<th>Batch ID</th>
84                                                         [% CASE 'Item Count'      %]<th>Item count</th>
85                                                         [% CASE 'Fields to Print' %]<th>Fields to print</th>
86                                                         [% CASE                   %]<th>[% header_field.field_label | html %]</th>
87                                                     [% END %]
88                                                 [% END %]
89                                             </tr>
90                                             </thead>
91                                         [% ELSE %]
92                                             <tr>
93                                             [% FOREACH text_field IN table_loo.text_fields %]
94                                                 [% IF ( text_field.select_field ) %]
95                                                     <td class="actions">
96                                                         <a class="btn btn-default btn-xs" href="/cgi-bin/koha/labels/label-edit-[% label_element |url %].pl?op=edit&amp;element_id=[% text_field.field_value |url %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
97                                                         <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-manage.pl?op=delete&amp;label_element=[% label_element | html %]&amp;element_id=[% text_field.field_value |url %]"><i class="fa fa-trash-can"></i> Delete</a>
98                                                     </td>
99                                                     [% IF label_element == 'batch' %] <td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>[% END %]
100                                                 [% ELSIF ( text_field.field_value ) %]
101                                                     <td>[% text_field.field_value | html %]</td>
102                                                 [% ELSE %]
103                                                     <td>&nbsp;</td>
104                                                 [% END %]
105                                             [% END %]
106                                             </tr>
107                                         [% END %]
108                                     [% END %]
109                                 </table>
110                             </div> <!-- /.page-section -->
111                             [% IF ( print ) %]<button type="button" class="btn btn-default" id="print">Export selected</button>[% END %]
112                             </fieldset>
113                             </form>
114                             [% ELSE %]
115                                                         <div class="dialog message">
116                             <h4>There are no
117                             [% PROCESS translate_label_element element=label_element_title %]
118                             currently available.</h4>
119                             <p>Use the toolbar above to create a new
120                             [% PROCESS translate_label_element element=label_element %].</p></div>
121                             [% END %]
122                         </div>
123             </main>
124         </div> <!-- /.col-sm-10.col-sm-push-2 -->
125
126         <div class="col-sm-2 col-sm-pull-10">
127             <aside>
128                 [% INCLUDE 'cat-menu.inc' %]
129             </aside>
130         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
131      </div> <!-- /.row -->
132
133 [% MACRO jsinclude BLOCK %]
134     [% INCLUDE 'greybox.inc' %]
135     [% INCLUDE 'datatables.inc' %]
136     <script>
137         function Xport() {
138             batches= new Array;
139             if(document.layouts.action.length > 0) {
140                 for (var i=0; i < document.layouts.action.length; i++) {
141                     if (document.layouts.action[i].checked) {
142                         batches.push("batch_id=" +  document.layouts.action[i].value);
143                     }
144                 }
145                 if (batches.length < 1) {
146                     alert(_("Please select at least one batch to export."));
147                     return;     // no batch selected
148                 }
149                 getstr = batches.join("&");
150             }
151             else if (document.layouts.action.checked) {
152                 getstr = "batch_id="+document.layouts.action.value;
153             }
154             else {
155                 alert(_("Please select at least one batch to export."));
156                 return;     // no batch selected
157             }
158             return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?" + getstr, 400, 800);
159         }
160         function selected_layout(op) {
161             var selected = new Array;
162             if (document.layouts.action.length) {
163                 for (i=0;i<document.layouts.action.length;i++){
164                     if (document.layouts.action[i].checked){
165                         selected.push(i);
166                     }
167                 };
168                 if (selected.length == 1) {
169                     return(document.layouts.action[selected[0]].value);
170                 }
171                 else {
172                     alert(_("Please select only one %s to %s.").format("[% label_element | html %]", op));
173                     return (-1);
174                 }
175             }
176             else {
177                 if (document.layouts.action.checked){
178                     return(document.layouts.action.value);
179                 }
180             };
181             alert(_("Please select a %s.").format("[% label_element | html %]"));
182             return (-1);
183         }
184         $(document).ready(function(){
185             $('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
186             $("#print").click(function(e){
187                 e.preventDefault();
188                 Xport();
189             });
190             $(".delete").on("click", function(){
191                 return confirmDelete( _("Are you sure you want to delete this?") );
192             });
193             $("#labels-table").dataTable($.extend(true, {}, dataTablesDefaults, {
194                 "sPaginationType": "full",
195                 "aaSorting": [[ 1, "asc" ]],
196                 "aoColumnDefs": [
197                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
198                 ]
199             }));
200         });
201     </script>
202 [% END %]
203
204 [% INCLUDE 'intranet-bottom.inc' %]