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