Bug 33908: Improve translation of title tags: Acquisitions
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / duplicate_orders.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE KohaDates %]
5 [% SET footerjs = 1 %]
6 [% PROCESS 'i18n.inc' %]
7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>[% FILTER collapse %]
9     [% UNLESS blocking_error %]
10         [% tx("Basket {basketnumber}", { basketnumber = basket.basketno }) | html %] &rsaquo;
11         [% t("Duplicate existing orders") | html %] &rsaquo;
12     [% END %]
13     [% t("Acquisitions") | html %] &rsaquo;
14     [% t("Koha") | html %]
15 [% END %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
17 <style>
18     .picked_to_duplicate > td { background-color: #bcdb89 !important; }
19     span.hint { margin-left: 1em; }
20 </style>
21 </head>
22
23 <body id="acq_duplicate_orders" class="acq">
24
25 [% WRAPPER 'header.inc' %]
26     [% INCLUDE 'acquisitions-search.inc' %]
27 [% END %]
28
29 [% WRAPPER 'sub-header.inc' %]
30     [% WRAPPER breadcrumbs %]
31         [% WRAPPER breadcrumb_item %]
32             <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
33         [% END %]
34         [% UNLESS blocking_error %]
35             [% WRAPPER breadcrumb_item %]
36                 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% vendor.id | uri %]">[% vendor.name | html %]</a>
37             [% END %]
38             [% WRAPPER breadcrumb_item %]
39                 <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | uri %]">Basket [% basket.basketno | html %]</a>
40             [% END %]
41             [% WRAPPER breadcrumb_item bc_active= 1 %]
42                 <span>Duplicate existing orders</span>
43             [% END %]
44         [% END # /UNLESS blocking_error %]
45     [% END #/ WRAPPER breadcrumbs %]
46 [% END #/ WRAPPER sub-header.inc %]
47
48 <div class="main container-fluid">
49     <div class="row">
50         <div class="col-sm-10 col-sm-push-2">
51             <main>
52
53 <h1>Duplicate existing orders</h1>
54 [% INCLUDE 'blocking_errors.inc' %]
55
56 [% IF op == 'search' || op == 'select' %]
57 <form action="/cgi-bin/koha/acqui/duplicate_orders.pl" method="post">
58     <fieldset class="rows">
59         <legend>
60             [% IF op == 'search' %]
61                 <span>Search orders</span>
62             [% ELSE %]
63                 <span>Refine search</span>
64             [% END %]
65             <span class="toggle_orders_filters" id="show_orders_filters"><a href="#">[+]</a></span>
66             <span class="toggle_orders_filters" id="hide_orders_filters"><a href="#">[-]</a></span>
67         </legend>
68         <div id="orders_filters">
69             [% INCLUDE 'filter-orders.inc' %]
70             <input type="hidden" name="op" value="select" />
71             <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
72
73             <input type="hidden" name="ordernumbers" value="[% ordernumbers.join(',') | html %]" />
74         </div>
75     </fieldset>
76     <fieldset class="action"><input type="submit" class="btn btn-primary" value="Search" /></fieldset>
77 </form>
78 [% END %]
79
80 [% BLOCK display_order_line %]
81     [% IF selected %]
82     <tr class="picked_to_duplicate" data-ordernumber="[% order.ordernumber | html %]">
83     [% ELSE %]
84     <tr data-ordernumber="[% order.ordernumber | html %]">
85     [% END %]
86         <td>
87             [% IF can_check %]
88                 [% IF selected %]
89                     <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" checked="checked" />
90                 [% ELSE %]
91                     <input type="checkbox" name="ordernumber" value="[% order.ordernumber | html %]" />
92                 [% END %]
93             [% END %]
94             [% order.ordernumber | html %]
95             [% IF order.ordernumber != order.parent_ordernumber %]([% order.parent_ordernumber | html %])[% END %]
96         </td>
97         <td>
98             [% SWITCH order.orderstatus %]
99                 [% CASE 'new' %]<span>New</span>
100                 [% CASE 'ordered' %]<span>Ordered</span>
101                 [% CASE 'partial' %]<span>Partially received</span>
102                 [% CASE 'complete' %]<span>Received</span>
103                 [% CASE 'cancelled' %]<span>Cancelled</span>
104             [% END %]
105         </td>
106         <td>[% order.basketname | html %] (<a href="basket.pl?basketno=[% order.basketno | uri %]">[% order.basketno | html %]</a>)</td>
107         <td>[% order.authorisedbyname | html %]</td>
108         <td>
109             [% IF ( order.basketgroupid ) %]
110                 [% order.groupname | html %] (<a href="basketgroup.pl?op=add&booksellerid=[% order.id | uri %]&basketgroupid=[% order.basketgroupid | uri %]">[% order.basketgroupid | html %]</a>)
111             [% ELSE %]
112                 &nbsp;
113             [% END %]
114         </td>
115         <td>[% IF ( order.invoicenumber ) %]
116                 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% order.invoiceid | uri %]">[% order.invoicenumber | html %]</a>
117             [% ELSE %]
118                 &nbsp;
119             [% END %]
120         </td>
121         <td>
122             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title |html %]</a>
123             <br />[% order.author | html %] <br /> [% order.isbn | html %]
124         </td>
125         <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.id | uri %]">[% order.name | html %]</a></td>
126         <td data-order="[% order.creationdate | html %]">[% order.creationdate | $KohaDates %]</td>
127         <td data-order="[% order.datereceived | html %]">
128             [% order.datereceived | $KohaDates %]
129         </td>
130         <td>[% order.quantityreceived | html %]</td>
131         <td>[% order.quantity | html %]</td>
132         <td>[% order.ecost | html %]</td>
133         <td>[% order.budget_name | html %]</td>
134     </tr>
135 [% END %]
136
137
138 [% IF op == 'select' && ( result_order_loop || selected_order_loop ) %]
139 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl">
140     <div id="orders_to_copy" class="page-section">
141         <table id="table_orders">
142             <caption>
143                 <span class="actions"><a href="#" id="select_all"><i class="fa fa-check"></i> Select all</a>
144                 | <a href="#" id="clear_all"><i class="fa fa-times"></i> Clear all</a></span>
145             </caption>
146
147             <thead>
148                     <tr>
149                     <th>Order line (parent)</th>
150                     <th>Status</th>
151                     <th>Basket</th>
152                     <th>Basket creator</th>
153                     <th>Basket group</th>
154                     <th>Invoice number</th>
155                     <th class="anti-the">Summary</th>
156                     <th>Vendor</th>
157                     <th>Placed on</th>
158                     <th>Received on</th>
159                     <th>Quantity received</th>
160                     <th>Quantity ordered</th>
161                     <th>Unit cost</th>
162                     <th>Fund</th>
163                 </tr>
164             </thead>
165             <tfoot>
166             [% FOREACH order IN selected_order_loop %]
167                 [% INCLUDE display_order_line selected => 1 can_check => 1%]
168             [% END %]
169             </tfoot>
170             <tbody>
171             [% FOREACH order IN result_order_loop %]
172                 [% INCLUDE display_order_line can_check => 1 %]
173             [% END %]
174             </tbody>
175         </table>
176     </div>
177     <fieldset class="action">
178         <input type="hidden" name="op" value="batch_edit" />
179         <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
180         <button type="submit" class="btn btn-primary go_to_batch_edit">Next <i class="fa fa-fw fa-arrow-right"></i></button>
181     </fieldset>
182 </form>
183
184 [% ELSIF op == "batch_edit" %]
185
186 <form method="post" action="/cgi-bin/koha/acqui/duplicate_orders.pl" id="batch_edit_form">
187     <div id="accounting_details">
188       <p>Duplicate all the orders with the following accounting details:</p>
189       <fieldset class="rows" style="float:none;">
190           <legend>Accounting details</legend>
191           <div class="hint" style="margin: 1em 1em 0">Check boxes to duplicate the original values</div>
192           <ol>
193               <li>
194                   <label for="all_currency">Currency:</label>
195                   <input type="checkbox" name="copy_existing_value" value="currency" title="Copy existing value" />
196                   <select name="all_currency" id="all_currency">
197                   [% FOREACH currency IN currencies %]
198                       [% IF currency.currency == vendor.listprice %]
199                           <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
200                       [% ELSIF not currency.archived %]
201                           <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
202                       [% END %]
203                   [% END %]
204                   </select>
205                   <span class="hint" id="hint_currency">The original currency value will be copied</span>
206               </li>
207               <li>
208                   <label for="all_budget_id">Fund: </label>
209                   <input type="checkbox" name="copy_existing_value" value="budget_id" title="Copy existing value" />
210                   <select id="all_budget_id" name="all_budget_id">
211                     <option value="">Select a fund</option>
212                   [% FOREACH budget_loo IN budget_loop %]
213                       [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id | html %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %]</option>
214                       [% ELSE %]<option value="[% budget_loo.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat | html %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat | html %]">[% budget_loo.b_txt | html %] (inactive)</option>
215                       [% END %]
216                   [% END %]
217                   </select>
218                   <label for="all_showallbudgets" style="float:none;width:auto;margin-right:0;">&nbsp;Show inactive:</label>
219                   <input type="checkbox" id="all_showallbudgets" />
220                   <span class="hint" id="hint_budget_id">The original fund will be used</span>
221               </li>
222               <li>
223                   <label for="all_order_internalnote">Internal note: </label>
224                   <input type="checkbox" name="copy_existing_value" value="order_internalnote" title="Copy existing value" />
225                   <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
226                   <span class="hint" id="hint_order_internalnote">The original internal note will be used</span>
227               </li>
228               <li>
229                   <label for="all_order_vendornote">Vendor note: </label>
230                   <input type="checkbox" name="copy_existing_value" value="order_vendornote" title="Copy existing value" />
231                   <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
232                   <span class="hint" id="hint_order_vendornote">The original vendor note will be used</span>
233               </li>
234               <li>
235                   <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
236                   <label for="all_sort1">Statistic 1: </label>
237                   <input type="checkbox" name="copy_existing_value" value="sort1" title="Copy existing value" />
238                   <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
239                   <span class="hint" id="hint_sort1">The original statistic 1 will be used</span>
240
241               </li>
242               <li>
243                   <label for="all_sort2">Statistic 2: </label>
244                   <input type="checkbox" name="copy_existing_value" value="sort2" title="Copy existing value" />
245                   <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
246                   <span class="hint" id="hint_sort2">The original statistic 2 will be used</span>
247               </li>
248           </ol>
249       </fieldset>
250     </div>
251
252     <fieldset class="action">
253         [% FOREACH ordernumber IN ordernumbers %]
254             <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
255         [% END %]
256         <input type="hidden" name="op" value="do_duplicate" />
257         <input type="hidden" name="basketno" value="[% basket.basketno | html %]" />
258         <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, useful when receiveing an order -->
259         <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
260         <button type="submit" class="btn btn-primary">Duplicate orders</button>
261         <a class="cancel" href="/cgi-bin/koha/acqui/duplicate_orders.pl?basketno=[% basket.basketno | html %]">Cancel</a>
262     </fieldset>
263 </form>
264
265 [% ELSIF op == 'duplication_done' %]
266     [% IF new_orders %]
267         <table id="table_neworders">
268             <thead>
269                 <tr>
270                     <th>Order line</th>
271                     <th>Status</th>
272                     <th>Basket</th>
273                     <th>Basket creator</th>
274                     <th>Basket group</th>
275                     <th>Invoice number</th>
276                     <th class="anti-the">Summary</th>
277                     <th>Vendor</th>
278                     <th>Placed on</th>
279                     <th>Received on</th>
280                     <th>Quantity received</th>
281                     <th>Quantity ordered</th>
282                     <th>Unit cost</th>
283                     <th>Fund</th>
284                 </tr>
285             </thead>
286             <tbody>
287             [% FOREACH order IN new_orders %]
288                 [% INCLUDE display_order_line %]
289             [% END %]
290             </tbody>
291         </table>
292         <a class="btn btn-default" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basket.basketno | html %]"><i class="fa fa-fw fa-arrow-left"></i> Return to the basket</a
293     [% ELSE %]
294         <span>No order has been duplicated. Maybe something wrong happened?</span>
295     [% END %]
296 [% END %]
297
298 </main>
299 </div> <!-- /.col-sm-10.col-sm-push-2 -->
300
301 <div class="col-sm-2 col-sm-pull-10">
302     <aside>
303         [% INCLUDE 'acquisitions-menu.inc' %]
304     </aside>
305 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
306 </div>
307
308 [% MACRO jsinclude BLOCK %]
309     [% Asset.js("js/acquisitions-menu.js") | $raw %]
310     [% INCLUDE 'calendar.inc' %]
311     [% INCLUDE 'datatables.inc' %]
312     [% INCLUDE 'columns_settings.inc' %]
313     [% Asset.js("js/acq.js") | $raw %]
314     [% Asset.js("js/funds_sorts.js") | $raw %]
315     <script>
316         function update_ordernumber_list(){
317             var ordernumbers = [];
318             $("input[name='ordernumber']").filter(":checked").each(function(){
319                 ordernumbers.push($(this).val());
320             });
321             $("input[name='ordernumbers']").val(ordernumbers.join(','));
322         }
323
324         var MSG_REMOVE_PATRON = _("Remove");
325         var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
326         var MSG_NO_FUND_SELECTED = _("No fund selected.");
327         $(document).ready(function() {
328             $('span.hint').hide();
329             KohaTable("table_orders", {
330                 "bPaginate": false
331             });
332
333             [% IF op == 'search' OR op == 'select' %]
334                 function AddPatron( patron_name, value, container, input_name ) {
335                     div = "<div id='borrower_" + value + "'>" + patron_name + " ( <a href='#' class='removePatron'><i class='fa fa-trash-can' aria-hidden='true'></i> " + MSG_REMOVE_PATRON + " </a> ) <input type='hidden' name='" + input_name + "' value='" + value + "' /></div>";
336                     $(container).append( div );
337
338                     $(container).parent().show( 800 );
339                 }
340                 function RemovePatron( cardnumber, container ) {
341                     $( '#borrower_' + cardnumber ).remove();
342
343                     if ( ! $(container).html() ) {
344                         $(container).parent("fieldset").hide( 800 );
345                     }
346                 }
347                 patron_autocomplete($("#find_patron"), {
348                     'on-select-callback': function( event, ui ) {
349                         var field = ui.item.borrowernumber;
350                         AddPatron( ui.item.firstname + " " + ( ui.item.middle_name || "" ) + " " + ui.item.surname, field, $("#basket_creators"), 'created_by' );
351                         $("#find_patron").val('').focus();
352                         return false;
353                     }
354                 });
355                 $("body").on("click",".removePatron",function(e){
356                     e.preventDefault();
357                     var divid = $(this).parent().attr("id");
358                     var cardnumber = divid.replace("borrower_","");
359                     RemovePatron(cardnumber, $("#basket_creators"));
360                 });
361
362             [% END %]
363
364             $("#show_orders_filters, #hide_orders_filters").on('click', function(e) {
365                 e.preventDefault();
366                 $('#orders_filters').toggle();
367                 $('.toggle_orders_filters').toggle();
368             });
369             [% IF op == 'search' OR op == 'select' AND NOT result_order_loop %]
370                 $("#show_orders_filters").hide();
371                 $("#orders_filters").show();
372             [% ELSE %]
373                 $("#hide_orders_filters").hide();
374                 $("#orders_filters").hide();
375             [% END %]
376
377             $("input[name='ordernumber']").on("change", function(){
378                 if ( $(this).is(':checked') ) {
379                     $(this).parents("tr").addClass("picked_to_duplicate");
380                 } else {
381                     $(this).parents("tr").removeClass("picked_to_duplicate");
382                 }
383             }).on("click", function(e){
384                 update_ordernumber_list();
385             });
386
387             $("#select_all").on("click",function(e){
388                 e.preventDefault();
389                 selectAll();
390                 update_ordernumber_list();
391             });
392
393             $("#clear_all").on("click",function(e){
394                 e.preventDefault();
395                 clearAll();
396                 update_ordernumber_list();
397             });
398             function selectAll () {
399                 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
400                     $(this).prop("checked", true).change();
401                 });
402                 return false;
403             }
404             function clearAll () {
405                 $("#table_orders").find("input[type='checkbox'][name='ordernumber']").each(function(){
406                     $(this).prop("checked", false).change();
407                 });
408                 return false;
409             }
410
411             $(".go_to_batch_edit").on("click",function(e){
412                 if ($("input[name='ordernumber']").filter(":checked").length == 0){
413                     alert(MSG_NO_ITEM_SELECTED);
414                     e.preventDefault();
415                 }
416             });
417
418             $("#batch_edit_form").on("submit", function(e){
419                 var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
420                 if ( ! budget_value_will_be_reused ) {
421                     if ($("#all_budget_id").find("option:selected").val() == "" ) {
422                         alert(MSG_NO_FUND_SELECTED);
423                         e.preventDefault();
424                     }
425                 }
426             });
427             $("input[name='copy_existing_value']").click(function(){
428                 render_disabled(this);
429             });
430
431             $("input[name='copy_existing_value']").each(function(){
432                 render_disabled(this);
433             });
434         });
435         function render_disabled (elt) {
436             var field = $(elt).val();
437             var hint_node = $("#hint_" + field);
438             var input_element = $(elt).parent().find("[name='all_"+field+"']");
439             if ($(elt).is(":checked")) {
440                 $(input_element).prop('disabled', true);
441                 $(hint_node).show();
442             } else {
443                 $(input_element).prop('disabled', false);
444                 $(hint_node).hide();
445             }
446         }
447     </script>
448 [% END %]
449
450 [% INCLUDE 'intranet-bottom.inc' %]