Bug 11559: (QA followup) replace font choices, fix macro editor
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / patroncards / edit-batch.tt
1     [% INCLUDE 'doc-head-open.inc' %]
2     <title>Koha &rsaquo; Tools &rsaquo; Patron card creator &rsaquo; Batches &rsaquo; [% IF batch_id %]Edit ([% batch_id %])[% ELSE %]Create[% END %]</title>
3     [% INCLUDE 'doc-head-close.inc' %]
4     [% INCLUDE 'greybox.inc' %]
5     <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6     [% INCLUDE 'datatables.inc' %]
7     <script type="text/javascript">
8         //<![CDATA[
9            var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this patron from the card batch?");
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/patroncards/manage.pl?op=delete&amp;card_element=batch&amp;element_id=[% batch_id %]";
15                 }
16                 else {
17                     return; // abort delete
18                 }
19             };
20             function Remove() {
21                 items = new Array;
22                 item_num = new Array;
23                 if(document.items.action.length > 0) {
24                     for (var i=0; i < document.items.action.length; i++) {
25                         if (document.items.action[i].checked) {
26                             items.push("label_id=" +  document.items.action[i].value);
27                             item_num.push(i+1);
28                         }
29                     }
30                     if (items.length < 1) {
31                         alert(_("Please select at least one item to delete."));
32                         return;     // no item selected
33                     }
34                     getstr = items.join("&");
35                     item_msg = item_num.join(", ");
36                     var msg = _("Are you sure you want to remove card number(s): %s from this batch?").format(item_msg);
37                 }
38                 else {
39                     alert(_("Please select at least label to delete."));
40                     return;     // no item selected
41                 }
42                 var answer = confirm(msg);
43                 if (answer) {
44                     window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&amp;batch_id=[% batch_id %]&amp;" + getstr;
45                 }
46                 else {
47                     return; // abort delete
48                 }
49             };
50             function Add() {
51                 var bor_nums = document.getElementById("bor_num_list");
52                 if (bor_nums.value == '') {
53                     window.open("/cgi-bin/koha/patroncards/add_user_search.pl",
54                    'PatronPopup',
55                    'width=740,height=450,location=yes,toolbar=no,'
56                    + 'scrollbars=yes,resize=yes');
57                 }
58                 else {
59                     document.forms["add_by_bor_num"].submit();
60                 }
61             };
62
63             function add_user(borrowernumber) {
64                 $("#bor_num_list").val($("#bor_num_list").val()+borrowernumber+"\r\n");
65             }
66
67             function DeDuplicate() {
68                 window.location = "/cgi-bin/koha/patroncards/edit-batch.pl?op=de_duplicate&amp;batch_id=[% batch_id %]";
69             };
70             function Xport(mode) {
71                 if (mode == 'label') {
72                     patroncards= new Array;
73                     if(document.items.action.length > 0) {
74                         for (var i=0; i < document.items.action.length; i++) {
75                             if (document.items.action[i].checked) {
76                                 patroncards.push("label_id=" +  document.items.action[i].value);
77                             }
78                         }
79                         if (patroncards.length < 1) {
80                             alert(_("Please select at least one card to export."));
81                             return;     // no batch selected
82                         }
83                         getstr = patroncards.join("&");
84                     }
85                     else if (document.items.action.checked) {
86                         getstr = document.items.action.value;
87                     }
88                     else {
89                         alert(_("Please select at least one card to export."));
90                         return;     // no batch selected
91                     }
92                     return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&" + getstr, 700, 800);
93                 }
94                 else if (mode == 'batch') {
95                     return GB_showCenter(_("Export patron cards"), "/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]", 700, 800);
96                 }
97                 else {
98                     // some pass-thru error trapping just in case...
99                 }
100             };
101            function selected_layout() {
102                 if (document.items.action.length) {
103                 for (i=0;i<document.items.action.length;i++){
104                     if (document.items.action[i].checked==true){
105                         return(document.items.action[i].value);
106                     }
107                 };
108                 }
109                 else {
110                     if (document.items.action.checked){
111                         return(document.items.action.value);
112                     }
113                 };
114                 alert(_("Please select at least one item."));
115                 return (-1);
116             };
117
118          $(document).ready(function() {
119             $("#batcht").dataTable($.extend(true, {}, dataTablesDefaults, {
120                 "aoColumnDefs": [
121                     { "aTargets": [ -2, -1 ], "bSortable": false, "bSearchable": false }
122                 ],
123                 "aaSorting": [[ 0, "asc" ]],
124                 "sPaginationType": "four_button"
125             }));
126             $("#additems").click(function(){
127                 Add();
128                 return false;
129             });
130             $("#removeitems").click(function(){
131                 Remove();
132                 return false;
133             });
134             $("#deletebatch").click(function(){
135                 DeleteConfirm();
136                 return false;
137             });
138             $("#deduplicate").click(function(){
139                 DeDuplicate();
140                 return false;
141             });
142             $("#exportitems").click(function(){
143                 Xport('label');
144                 return false;
145             });
146             $("#exportbatch").click(function(){
147                 Xport('batch');
148                 return false;
149             });
150          });
151         //]]>
152     </script>
153 </head>
154 <body id="pcard_edit-batch" class="tools pcard">
155     [% INCLUDE 'header.inc' %]
156     [% INCLUDE 'cat-search.inc' %]
157     <div id="breadcrumbs">
158         <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
159         <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo;
160         <a href="/cgi-bin/koha/patroncards/home.pl">Patron card creator</a> &rsaquo;
161         <a href="/cgi-bin/koha/patroncards/manage.pl?card_element=batch">Batches</a> &rsaquo;
162         [% IF batch_id %]
163             Edit ([% batch_id %])
164         [% ELSE %]
165             Create
166         [% END %]
167     </div>
168     <div id="doc3" class="yui-t2">
169         <div id="bd">
170             <div id="yui-main">
171                 <div class="yui-b">
172                     <div class="yui-g">
173                     [% INCLUDE 'patroncards-toolbar.inc' %]
174                         <div class="yui-u first">
175
176                         </div>
177                     </div>
178
179                 [% IF ( duplicate_message ) %]
180                     <div class="dialog message">
181                         <strong>[% duplicate_count %] duplicate item(s) found</strong> and removed from batch [% batch_id %].
182                     </div>
183                 [% END %]
184
185                     [% INCLUDE 'patroncards-errors.inc' %]
186                     <div id="manage-patroncard-batches">
187                         <div class="hint">Current library: [% LoginBranchname %]</div>
188                             <form name="add_by_bor_num" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
189                                 <div>
190                                     <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
191                                     <ol><li>
192                                     <input type="hidden" name="op" value="add" />
193                                     <input type="hidden" name="batch_id" value="[% batch_id %]" />
194                                     <label for="bor_num_list">Add by borrowernumber(s):
195                                         <br /> <span class="hint">One borrowernumber per line.</span>
196                                     </label>
197                                     <textarea rows="5" id="bor_num_list" name="bor_num_list" tabindex="1" class="focus"></textarea>
198                                     </li></ol>
199                                     </fieldset>
200                                 </div>
201                             </form>
202                             <div id="batch-manage" class="action">
203                                 <a class="btn btn-small" id="additems" href="#"><icon class="fa fa-plus"></icon> Add patron(s)</a>[% IF ( table_loop ) %]
204                                 <a class="btn btn-small" id="removeitems" href="#"><icon class="fa fa-trash"></icon> Remove selected patrons</a>
205                                 <a class="btn btn-small" id="deduplicate" href="#"><icon class="fa fa-minus"></icon> Remove duplicates</a>
206                                 <a class="btn btn-small" id="exportitems" href="#"><icon class="fa fa-share-square-o"></icon> Export selected card(s)</a>
207                                 <a class="btn btn-small" id="exportbatch" href="#"><icon class="fa fa-share-square-o"></icon> Export card batch</a>[% END %]
208                             </div>
209                             [% IF ( table_loop ) %]
210                             <form name="items" class="checkboxed">
211                                 <h2>Items in batch number [% batch_id %]</h2>
212                                 <table id="batcht">
213                                     [% FOREACH table_loo IN table_loop %]
214                                         [% IF ( table_loo.header_fields ) %]
215                                             <thead>
216                                                 <tr>
217                                                     [% FOREACH header_field IN table_loo.header_fields %]
218                                                         [% SWITCH header_field.field_label -%]
219                                                             [% CASE "Summary" -%]
220                                                                 <th>Borrower name</th>
221                                                             [% CASE "Borrower Number" %]
222                                                                 <th>Borrower number</th>
223                                                             [% CASE "Actions " %]
224                                                                 <th>Actions</th>
225                                                             [% CASE "Select" -%]
226                                                                 <th>Select</th>
227                                                             [% CASE %]
228                                                                 <th>[% header_field.field_label %]</th>
229                                                         [% END -%]
230                                                     [% END %]
231                                                 </tr>
232                                             </thead>
233                                             <tbody>
234                                         [% ELSE %]
235                                             <tr>
236                                                 [% FOREACH text_field IN table_loo.text_fields %]
237                                                     [% IF ( text_field.select_field ) %]
238                                                         <td>
239                                                             <a class="btn btn-mini" onclick="return confirm(MSG_CONFIRM_DELETE);" href="/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&amp;batch_id=[% batch_id %]&amp;label_id=[% text_field.field_value %]"><icon class="fa fa-trash"></icon> Delete</a>
240                                                             <a class="btn btn-mini" href="#" onclick="GB_showCenter('Export single card','/cgi-bin/koha/patroncards/print.pl?batch_id=[% batch_id %]&label_id=[% text_field.field_value %]')"><icon class="fa fa-share-square-o"></icon> Export</a>
241                                                         </td>
242                                                         <td><input type="checkbox" name="action" value="[% text_field.field_value %]" /></td>
243                                                     [% ELSE %]
244                                                         <td>[% text_field.field_value %]</td>
245                                                     [% END %]
246                                                 [% END %]
247                                             </tr>
248                                         [% END %]
249                                     [% END %]
250                                     </tbody>
251                                 </table>
252                             </form>
253                             [% ELSE %]
254                                 <fieldset class="rows" style="border-bottom: 0px; border: 0px;">
255                                 <ol><li>
256                                     <div class="dialog message">
257                                         <h4>There are no items in this batch yet</h4>
258                                         <p>Add items by borrowernumber using the text area above or leave empty to add via patron search.</p>
259                                     </div>
260                                 </li></ol>
261                                 </fieldset>
262                             [% END %]
263                         </div>
264                     </div>
265                 </div>
266             </div>
267     [% INCLUDE 'intranet-bottom.inc' %]