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