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