Bug 28438: Capitalization: Various corrections
[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>[% 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
51                         [% IF ( error ) %]
52                             <div class="dialog alert">
53                                 <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.
54                             </div>
55                         [% END %]
56
57                         <div id="manage-label-layouts">
58                             [% IF ( table_loop ) %]
59                             <form name="layouts" action="/cgi-bin/koha/label-manage.pl?label_element=[% label_element | html %]">
60                             [% IF    ( label_element == 'layout' ) %]
61                             <h2>Currently available layouts</h2>
62                             [% ELSIF ( label_element == 'template' ) %]
63                             <h2>Currently available templates</h2>
64                             [% ELSIF ( label_element == 'profile' ) %]
65                             <h2>Currently available profiles</h2>
66                             [% ELSIF ( label_element == 'batch' ) %]
67                             <h2>Currently available batches</h2>
68                             [% END %]
69                             <table id="labels-table">
70                                 [% FOREACH table_loo IN table_loop %]
71                                     [% IF ( table_loo.header_fields ) %]
72                                         <thead>
73                                         <tr>
74                                             [% FOREACH header_field IN table_loo.header_fields %]
75                                                 [% SWITCH header_field.field_label %]
76                                                     [% CASE 'Layout ID'       %]<th>Layout ID</th>
77                                                     [% CASE 'Layout'          %]<th>Layout</th>
78                                                     [% CASE 'Barcode Type'    %]<th>Barcode type</th>
79                                                     [% CASE 'Print Type'      %]<th>Print type</th>
80                                                     [% CASE 'Template ID'     %]<th>Template ID</th>
81                                                     [% CASE 'Template Name'   %]<th>Template name</th>
82                                                     [% CASE 'Description'     %]<th>Description</th>
83                                                     [% CASE 'Actions'         %]<th class="noExport">Actions</th>
84                                                     [% CASE 'Profile ID'      %]<th>Profile ID</th>
85                                                     [% CASE 'Printer Name'    %]<th>Printer name</th>
86                                                     [% CASE 'Paper Bin'       %]<th>Paper bin</th>
87                                                     [% CASE 'Batch ID'        %]<th>Batch ID</th>
88                                                     [% CASE 'Item Count'      %]<th>Item count</th>
89                                                     [% CASE 'Fields to Print' %]<th>Fields to print</th>
90                                                     [% CASE                   %]<th>[% header_field.field_label | html %]</th>
91                                                 [% END %]
92                                             [% END %]
93                                         </tr>
94                                         </thead>
95                                     [% ELSE %]
96                                         <tr>
97                                         [% FOREACH text_field IN table_loo.text_fields %]
98                                             [% IF ( text_field.select_field ) %]
99                                                 <td class="actions">
100                                                     <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>
101                                                     <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>
102                                                 </td>
103                                                 [% IF label_element == 'batch' %] <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>
106                                             [% ELSE %]
107                                                 <td>&nbsp;</td>
108                                             [% END %]
109                                         [% END %]
110                                         </tr>
111                                     [% END %]
112                                 [% END %]
113                             </table>
114                             [% IF ( print ) %]<button type="button" class="btn btn-default" id="print">Export selected</button>[% END %]
115                             </fieldset>
116                             </form>
117                             [% ELSE %]
118                                                         <div class="dialog message">
119                             <h4>There are no
120                             [% PROCESS translate_label_element element=label_element_title %]
121                             currently available.</h4>
122                             <p>Use the toolbar above to create a new
123                             [% PROCESS translate_label_element element=label_element %].</p></div>
124                             [% END %]
125                         </div>
126             </main>
127         </div> <!-- /.col-sm-10.col-sm-push-2 -->
128
129         <div class="col-sm-2 col-sm-pull-10">
130             <aside>
131                 [% INCLUDE 'tools-menu.inc' %]
132             </aside>
133         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
134      </div> <!-- /.row -->
135
136 [% MACRO jsinclude BLOCK %]
137     [% Asset.js("js/tools-menu.js") | $raw %]
138     [% INCLUDE 'greybox.inc' %]
139     [% INCLUDE 'datatables.inc' %]
140     <script>
141         function Xport() {
142             batches= new Array;
143             if(document.layouts.action.length > 0) {
144                 for (var i=0; i < document.layouts.action.length; i++) {
145                     if (document.layouts.action[i].checked) {
146                         batches.push("batch_id=" +  document.layouts.action[i].value);
147                     }
148                 }
149                 if (batches.length < 1) {
150                     alert(_("Please select at least one batch to export."));
151                     return;     // no batch selected
152                 }
153                 getstr = batches.join("&");
154             }
155             else if (document.layouts.action.checked) {
156                 getstr = "batch_id="+document.layouts.action.value;
157             }
158             else {
159                 alert(_("Please select at least one batch to export."));
160                 return;     // no batch selected
161             }
162             return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?" + getstr, 400, 800);
163         }
164         function selected_layout(op) {
165             var selected = new Array;
166             if (document.layouts.action.length) {
167                 for (i=0;i<document.layouts.action.length;i++){
168                     if (document.layouts.action[i].checked){
169                         selected.push(i);
170                     }
171                 };
172                 if (selected.length == 1) {
173                     return(document.layouts.action[selected[0]].value);
174                 }
175                 else {
176                     alert(_("Please select only one %s to %s.").format("[% label_element | html %]", op));
177                     return (-1);
178                 }
179             }
180             else {
181                 if (document.layouts.action.checked){
182                     return(document.layouts.action.value);
183                 }
184             };
185             alert(_("Please select a %s.").format("[% label_element | html %]"));
186             return (-1);
187         }
188         $(document).ready(function(){
189             $("#print").click(function(e){
190                 e.preventDefault();
191                 Xport();
192             });
193             $(".delete").on("click", function(){
194                 return confirmDelete( _("Are you sure you want to delete this?") );
195             });
196             $("#labels-table").dataTable($.extend(true, {}, dataTablesDefaults, {
197                 "sPaginationType": "full",
198                 "aaSorting": [[ 1, "asc" ]],
199                 "aoColumnDefs": [
200                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
201                 ]
202             }));
203         });
204     </script>
205 [% END %]
206
207 [% INCLUDE 'intranet-bottom.inc' %]