Bug 12020: Allow translating label-edit-batch hardcoded strings
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / labels / label-edit-batch.tt
1 [% USE ItemTypes %]
2     [% INCLUDE 'doc-head-open.inc' %]
3     <title>Koha &rsaquo; Tools &rsaquo; Label creator &rsaquo; Batches &rsaquo; [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]New[% END %]</title>
4     [% INCLUDE 'doc-head-close.inc' %]
5     [% INCLUDE 'greybox.inc' %]
6     <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7     [% INCLUDE 'datatables.inc' %]
8     <script type="text/javascript">
9     //<![CDATA[
10         function DeleteConfirm() {
11             var msg = _("Are you sure you want to delete batch %s?").format("[% batch_id %]");
12             var answer = confirm(msg);
13             if (answer) {
14                 window.location = "/cgi-bin/koha/labels/label-manage.pl?op=delete&amp;label_element=batch&amp;element_id=[% batch_id %]";
15             }
16             else {
17                 return; // abort delete
18             }
19         };
20         function dofocus() {    // named function req'd for body onload event by some FF and IE7 security models
21             $(".focus:last").select();
22         }
23         function verifyBarcodes(barcodes) {
24             if (barcodes.value == '') {
25                 alert(_("Please add barcodes using either the direct entry text area or the item search."));
26                 return false;   // not ok
27             }
28             else {
29                 return true;    // ok
30             };
31         }
32             function Remove() {
33                 items = new Array;
34                 item_num = new Array;
35                 if(document.items.action.length > 0) {
36                     for (var i=0; i < document.items.action.length; i++) {
37                         if (document.items.action[i].checked) {
38                             items.push("label_id=" +  document.items.action[i].value);
39                             item_num.push(i+1);
40                         }
41                     }
42                     getstr = items.join("&");
43                     item_msg = item_num.join(", ");
44                     var msg = _("Are you sure you want to remove label number(s): %s from this batch?").format(item_msg);
45                 } else if (document.items.action.checked) {
46                     alert(_("Deletion of label from a batch with only one label will delete the batch.") + "\n\n" + _("If this is what you want, select the 'Delete batch' option from the toolbar"));
47                     return; // no deletion for single item batch
48                 }
49                 else {
50                     alert(_("Please select at least one label to delete."));
51                     return;     // no item selected
52                 }
53                 var answer = confirm(msg);
54                 if (answer) {
55                     window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&amp;batch_id=[% batch_id %]&amp;" + getstr;
56                 }
57                 else {
58                     return; // abort delete
59                 }
60             };
61             function Add() {
62                 var number_list = document.getElementById("number_list");
63                 if (number_list.value == '') {
64                     window.open("/cgi-bin/koha/labels/label-item-search.pl?batch_id=[% batch_id %]&amp;type=labels",'FindABibIndex','width=875,height=400,toolbar=no,scrollbars=yes');
65                 }
66                 else {
67                     document.forms["add_by_number"].submit();
68                 }
69             };
70
71             function add_item(item_number) {
72                 $("#itemnum_enter").prop("checked",true);
73                 $("#number_list").val($("#number_list").val()+item_number+"\r\n");
74             };
75
76             function DeDuplicate() {
77                 window.location = "/cgi-bin/koha/labels/label-edit-batch.pl?op=de_duplicate&amp;batch_id=[% batch_id %]";
78             };
79             function Xport(mode) {
80                 if (mode == 'label') {
81                     labels= new Array;
82                     if(document.items.action.length > 0) {
83                         for (var i=0; i < document.items.action.length; i++) {
84                             if (document.items.action[i].checked) {
85                                 labels.push("label_id=" +  document.items.action[i].value);
86                             }
87                         }
88                         if (labels.length < 1) {
89                             alert(_("Please select at least one label to export."));
90                             return;     // no batch selected
91                         }
92                         getstr = labels.join("&");
93                     }
94                     else if (document.items.action.checked) {
95                         getstr = document.items.action.value;
96                     }
97                     else {
98                         alert(_("Please select at least one label to export."));
99                         return;     // no batch selected
100                     }
101                     return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]&" + getstr, 400, 800);
102                 }
103                 else if (mode == 'batch') {
104                     return GB_showCenter(_("Export labels"), "/cgi-bin/koha/labels/label-print.pl?batch_id=[% batch_id %]", 400, 800);
105                 }
106                 else {
107                     // some pass-thru error trapping just in case...
108                 }
109             };
110            function selected_layout() {
111                 if (document.items.action.length) {
112                 for (i=0;i<document.items.action.length;i++){
113                     if (document.items.action[i].checked==true){
114                         return(document.items.action[i].value);
115                     }
116                 };
117                 }
118                 else {
119                     if (document.items.action.checked){
120                         return(document.items.action.value);
121                     }
122                 };
123                 alert(_("Please select at least one item."));
124                 return (-1);
125             };
126
127          $(document).ready(function() {
128             $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
129                 "autoWidth": false,
130                 "aoColumnDefs": [
131                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
132                     { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
133                 ],
134                 "aaSorting": [[ 0, "asc" ]],
135                 "sPaginationType": "four_button"
136             }));
137             $("#additems").click(function(){
138                 Add();
139                 return false;
140             });
141             $("#removeitems").click(function(){
142                 Remove();
143                 return false;
144             });
145             $("#deletebatch").click(function(){
146                 DeleteConfirm();
147                 return false;
148             });
149             $("#deduplicate").click(function(){
150                 DeDuplicate();
151                 return false;
152             });
153             $("#exportitems").click(function(){
154                 Xport('label');
155                 return false;
156             });
157             $("#exportbatch").click(function(){
158                 Xport('batch');
159                 return false;
160             });
161             $(".delete").on("click", function(){
162                 return confirmDelete( _("Are you sure you want to delete this?") );
163             });
164             $(".export").on("click", function(e){
165                 e.preventDefault();
166                 var label_id = $(this).data("label-id");
167                 var batch_id = $(this).data("batch-id");
168                 GB_showCenter(_("Export labels"),"/cgi-bin/koha/labels/label-print.pl?batch_id=" + batch_id + "&label_id=" + label_id, 400, 800);
169             });
170          });
171     //]]>
172     </script>
173 </head>
174 <body id="labels_label-edit-batch" class="tools labels" onload="dofocus();">
175     [% INCLUDE 'header.inc' %]
176     [% INCLUDE 'cat-search.inc' %]
177     <div id="breadcrumbs">
178         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
179         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
180         <a href="/cgi-bin/koha/labels/label-home.pl">Label creator</a> &rsaquo;
181         <a href="/cgi-bin/koha/labels/label-manage.pl?label_element=batch">Batches</a> &rsaquo;
182         [% IF batch_id %]
183             Edit ([% batch_id %])
184         [% ELSE %]
185             New
186         [% END %]
187     </div>
188     <div id="doc3" class="yui-t2">
189         <div id="bd">
190             <div id="yui-main">
191                 <div class="yui-b">
192                         [% INCLUDE 'labels-toolbar.inc' %]
193                         [% IF ( err ) %]
194                             [% BLOCK xlate_errtype %]
195                             [%    SWITCH errtype %]
196                             [%       CASE 'ITEM_NOT_REMOVED' %]
197                             <span>Item(s) not removed from batch [% batch_id %].</span>
198                             [%       CASE 'BATCH_NOT_DELETED' %]
199                             <span>Batch [% batch_id %] was not deleted.</span>
200                             [%       CASE 'ITEM_NOT_ADDED' %]
201                             <span>Item(s) not added to batch [% batch_id %].</span>
202                             [%       CASE 'BRANCH_NOT_SET' %]
203                             <span>Library is not set, please set your library before adding items to a batch.</span>
204                             [%       CASE 'BATCH_NOT_DEDUP' %]
205                             <span>Batch [% batch_id %] not fully de-duplicated.</span>
206                             [%       CASE %]
207                             <span>Unknown error type [% errtype %].</span>
208                             [%    END %]
209                             [% END %]
210                             <div class="dialog alert">
211                                 <strong>WARNING:</strong> An error was encountered: [% PROCESS xlate_errtype %] Please have your system administrator check the error log for details.
212                             </div>
213                         [% ELSIF ( duplicate_message ) %]
214                             <div class="dialog message">
215                                 <strong>Duplicate item(s) removed from batch number [% batch_id %]: [% duplicate_count %]</strong>
216                             </div>
217                         [% END %]
218
219                         <div id="manage-label-batches">
220                             <div class="hint">Current library: [% LoginBranchname %]</div>
221                             <form name="add_by_number" action="/cgi-bin/koha/labels/label-edit-batch.pl" method="post">
222                                 <div>
223                                     <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
224                                     <ol><li>
225                                         <input type="hidden" name="op" value="add" />
226                                         <input type="hidden" name="batch_id" value="[% batch_id %]" />
227                                     </li>
228                                     <li>
229                                         <input type="radio" name="number_type" id="barcode_enter" value="barcode" checked />
230                                         <label for="barcode_enter">Enter by barcode:</label><br/>
231                                         <input type="radio" name="number_type" id="itemnum_enter" value="itemnumber" />
232                                         <label for="itemnum_enter">Enter by itemnumber:</label>
233                                     </li>
234                                     <li>
235                                         <label for="number_list">Add by barcode(s) or itemnumbers(s):
236                                             <br /> <span class="hint">One number per line.</span>
237                                             <br /> <span class="hint">Leave empty to add via item search (itemnumber).</span>
238                                         </label>
239                                         <textarea rows="5" id="number_list" name="number_list" tabindex="1" class="focus"></textarea>
240                                     </li></ol>
241                                     </fieldset>
242                                 </div>
243                             </form>
244                             <div id="batch-manage" class="btn-toolbar">
245                                 <a class="btn btn-default btn-sm" id="additems" href="#"><i class="fa fa-plus"></i> Add item(s)</a>[% IF ( table_loop ) %]
246                                 <a class="btn btn-default btn-sm" id="removeitems" href="#"><i class="fa fa-trash"></i> Remove selected items</a>
247                                 <a class="btn btn-default btn-sm" id="deletebatch" href="#"><i class="fa fa-minus-square"></i> Delete batch</a>
248                                 <a class="btn btn-default btn-sm" id="deduplicate" href="#"><i class="fa fa-minus"></i> Remove duplicates</a>
249                                 <a class="btn btn-default btn-sm" id="exportitems" href="#"><i class="fa fa-share-square-o"></i> Export selected items</a>
250                                 <a class="btn btn-default btn-sm" id="exportbatch" href="#"><i class="fa fa-share-square-o"></i> Export full batch</a>[% END %]
251                             </div>
252                             [% IF ( table_loop ) %]
253                                 <form name="items" class="checkboxed">
254                                     <h2>Items in batch number [% batch_id %]</h2>
255                                     <table id="batcht">
256                                         [% FOREACH table_loo IN table_loop %]
257                                             [% IF ( table_loo.header_fields ) %]
258                                                 <thead>
259                                                     <tr>
260                                                         [% FOREACH header_field IN table_loo.header_fields %]
261                                                             [% SWITCH header_field.field_label -%]
262                                                                 [% CASE "Label number" -%]
263                                                                     <th>Label number</th>
264                                                                 [% CASE "Summary" -%]
265                                                                     <th class="anti-the">Summary</th>
266                                                                 [% CASE "Item type" %]
267                                                                     <th>Item type</th>
268                                                                 [% CASE "Call number" %]
269                                                                     <th>Call number</th>
270                                                                 [% CASE "Barcode" %]
271                                                                     <th>Barcode</th>
272                                                                 [% CASE "Select" -%]
273                                                                     <th>Select</th>
274                                                                 [% CASE %]
275                                                                     <th>[% header_field.field_label %]</th>
276                                                             [% END -%]
277                                                         [% END %]
278                                                     </tr>
279                                                 </thead>
280                                                 <tbody>
281                                             [% ELSE %]
282                                                     <tr>
283                                                         [% FOREACH text_field IN table_loo.text_fields %]
284                                                             [% IF ( text_field.select_field ) %]
285                                                                 <td>
286                                                                     <a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/labels/label-edit-batch.pl?op=remove&amp;batch_id=[% batch_id |url %]&amp;label_id=[% text_field.field_value |url %]"><i class="fa fa-trash"></i> Delete</a>
287                                                                     <a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id %]" data-label-id="[% text_field.field_value |html %]"><i class="fa fa-share-square-o"></i> Export</a>
288                                                                 </td>
289                                                                 <td><input type="checkbox" name="action" value="[% text_field.field_value %]"></td>
290                                                             [% ELSE %]
291                                                                 <td>
292                                                                     [% IF ( text_field.field_name == '_item_type_tbl' ) %]
293                                                                         [% ItemTypes.GetDescription( text_field.field_value ) %]
294                                                                     [% ELSE %]
295                                                                         [% text_field.field_value %]
296                                                                     [% END %]
297                                                                 </td>
298                                                             [% END %]
299                                                         [% END %]
300                                                     </tr>
301                                             [% END %]
302                                         [% END %]
303                                         </tbody>
304                                     </table>
305                                 </form>
306                                 [% ELSE %]
307                                     <div class="dialog message">
308                                         <h4>There are no items in this batch yet</h4>
309                                         <p>Add items by using the text area above or leave empty to add via item search.</p>
310                                     </div>
311                                 [% END %]
312                             </div>
313                         </div>
314                 </div>
315             <div class="yui-b">
316               [% INCLUDE 'tools-menu.inc' %]
317             </div>
318             </div>
319     [% INCLUDE 'intranet-bottom.inc' %]