fe26aa8d12b622a6039920f1f60257c6ccf07309
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / addorderiso2709.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Acquisitions &rsaquo; Order staged MARC records
8 [% IF ( batch_details ) %]
9  &rsaquo; Batch [% import_batch_id | html %]
10 [% ELSE %]
11  &rsaquo; Batch list
12 [% END %]
13 </title>
14 [% Asset.css("css/datatables.css") | $raw %]
15 <style type="text/css">#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
16 [% INCLUDE 'doc-head-close.inc' %]
17 </head>
18
19 <body id="acq_addorderiso2709" class="acq">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'acquisitions-search.inc' %]
22 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% booksellername | html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Basket [% basketno | html %]</a> &rsaquo; Add orders from MARC file</div>
23     <div class="container-fluid">
24         <div class="row">
25             <div class="col-sm-6 col-sm-offset-3 col-md-8 col-md-offset-2">
26              [% IF ( allmatch ) %]<div class="dialog alert">
27               <h4>No records imported</h4>
28              No record have been imported because they all match an existing record in your catalog.<br />You'll have to treat them individually.
29              </div>
30              [% END %]
31
32              [% IF ( batch_details ) %]
33                 <h1>Add orders from [% comments | html %]
34                     ([% file_name | html %] staged on [% upload_timestamp | $KohaDates with_hours => 1 | html %])
35                 </h1>
36                 <form action="/cgi-bin/koha/acqui/addorderiso2709.pl" method="post" id="Aform">
37                 <div id="tabs" class="toptabs">
38                   <ul>
39                     <li><a href="#records_to_import">Select to import</a></li>
40                     <li><a href="#items_info" class="items_info">Item information</a></li>
41                     <li><a href="#accounting_details">Default accounting details</a></li>
42                   </ul>
43
44                   <div id="records_to_import">
45                     <div id="searchheader">
46                         <div>
47                             <span class="checkall"><a id="checkAll" href="#">Select all</a></span>
48                             |
49                             <span class="uncheckall"><a id="unCheckAll" href="#">Clear all</a></span>
50                             |
51                             <span>
52                                 <label for="matcher_id">Matching:</label>
53                                     <select name="matcher_id" id="matcher_id">
54                                         <option value="_TITLE_AUTHOR_">Title and author</option>
55                                         <option value="">Do not look for matching records</option>
56                                         [% FOREACH available_matcher IN available_matchers %]
57                                             [% IF ( available_matcher.code == current_matcher_code ) %]
58                                                 <option value="[% available_matcher.matcher_id | html %]" selected="selected">
59                                                     [% available_matcher.code | html %] ([% available_matcher.description | html %])
60                                                 </option>
61                                             [% ELSE %]
62                                                 <option value="[% available_matcher.matcher_id | html %]">
63                                                     [% available_matcher.code | html %] ([% available_matcher.description | html %])
64                                                 </option>
65                                             [% END %]
66                                         [% END %]
67                                     </select>
68                             </span>
69                             |
70                             <span>
71                                 <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive funds:</label>
72                                 <input type="checkbox" id="showallbudgets" />
73                             </span>
74                         </div>
75                     </div>
76
77                         <input type="hidden" name="op" value="import_records"/>
78                         <input type="hidden" name="basketno" value="[% basketno | html %]" />
79                         <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
80                         <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
81                         <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
82
83                         [% FOREACH biblio IN biblio_list %]
84                         <fieldset class="biblio unselected rows" style="float:none;">
85                           <legend>
86                             <label for="record_[% biblio.import_record_id | html %]" style="width:auto;">
87                               <input type="checkbox" name="import_record_id" id="record_[% biblio.import_record_id | html %]" value="[% biblio.import_record_id | html %]" />
88                               <span class="citation">[% biblio.citation | html %]</span>
89                             </label>
90                             <span class="links" style="font-weight: normal;">
91                               ( <a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% biblio.import_record_id | uri %]" class="previewData">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% biblio.import_record_id | html %]" class="previewData">Card</a> | <a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=[% booksellerid | html %]&amp;basketno=[% basketno | html %]&amp;breedingid=[% biblio.import_record_id | html %]&amp;import_batch_id=[% biblio.import_batch_id | html %]&amp;biblionumber=[% biblio.match_biblionumber | html %]">Add order</a> )
92                             </span>
93                           </legend>
94                           <div style="float:left">
95                           <ol>
96                             <li class="status">
97                               <span class="match">
98                                 [% IF ( biblio_lis.overlay_status == 'no_match' ) %]
99                                     No match
100                                 [% ELSIF ( biblio_lis.overlay_status == 'match_applied' ) %]
101                                     Match applied
102                                 [% ELSIF ( biblio_lis.overlay_status == 'auto_match' ) %]
103                                     Match found
104                                 [% ELSE %]
105                                     [% biblio_lis.overlay_status | html %]
106                                 [% END %]
107                                 [% IF ( biblio.match_biblionumber ) %]
108                                   Matches biblio [% biblio.match_biblionumber | uri %] (score = [% biblio.match_score | html %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblio.match_biblionumber | uri %]">[% biblio.match_citation | html %]</a>
109                                 [% END %]
110                               </span>
111                             </li>
112                             <li class="quantity">
113                                 <label for="quantity_record_[% biblio.import_record_id | html %]" class="required">Quantity: </label>
114                                 <input id="quantity_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.quantity.length ? biblio.quantity : 1 | html %]" name="quantity" />
115                             </li>
116                             <li class="price">
117                                 <label for="price_record_[% biblio.import_record_id | html %]">Price: </label>
118                                 <input id="price_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.price | html %]" name="price" />
119                             </li>
120                             <li class="discount">
121                                 <label for="discount_record_[% biblio.import_record_id | html %]">Discount: </label>
122                                 <input id="discount_record_[% biblio.import_record_id | html %]" type="text" value="[% biblio.discount | html %]" name="discount" size="6" /> %
123                                 (If empty, discount rate from vendor will be used)
124                             </li>
125                             <li class="budget">
126                                 <label for="fund_record_[% biblio.import_record_id | html %]">Fund: </label>
127                                 [% IF ( close ) %]
128                                   <input type="hidden" size="20" name="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
129                                 [% ELSE %]
130                                   <select id="fund_record_[% biblio.import_record_id | html %]" size="1" name="budget_id">
131                                     <option value="">Select a fund</option>
132                                     [% FOREACH budget IN budget_loop %]
133                                         [% IF ( budget.b_id == biblio.budget_id ) %]
134                                           [% IF budget.b_active %]
135                                             <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %]</option>
136                                           [% ELSE %]
137                                             <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]" selected="selected">[% budget.b_txt | html %] (inactive)</option>
138                                           [% END %]
139                                         [% ELSE %]
140                                             [% IF budget.b_active %]<option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option>
141                                             [% ELSE %]<option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %] (inactive)</option>
142                                             [% END %]
143                                         [% END %]
144                                     [% END %]
145                                   </select>
146                                 [% END %]
147                             </li>
148                             <li class="sort1">
149                                 <label for="sort1_record_[% biblio.import_record_id | html %]">Statistic 1: </label>
150                                 <input id="sort1_record_[% biblio.import_record_id | html %]" type="text" id="sort1" size="20" name="sort1" value="[% biblio.sort1 | html %]" />
151                             </li>
152                             <li class="sort2">
153                                 <label for="sort2_record_[% biblio.import_record_id | html %]">Statistic 2: </label>
154                                 <input id="sort2_record_[% biblio.import_record_id | html %]" type="text" id="sort2" size="20" name="sort2" value="[% biblio.sort2 | html %]" />
155                             </li>
156                           </ol>
157                         </div>
158                         <div style="float:right">
159                         [% IF biblio.item_error %]Item records could not be processed because the number of item fields was uneven.[% END %]
160                         [% FOREACH item IN biblio.iteminfos %]
161                         <fieldset>
162                         <legend>Item Record [% item.item_id | html %]</legend>
163                         <ol>
164                         <li>
165                         <label for="homebranch_item_[% item.item_id | html %]">homebranch</label><select id="homebranch_item_[% item.item_id | html %]" name="homebranch_[% item.biblio_count | html %]">
166                         [% FOREACH l IN libraries %]
167                           [% IF l.branchcode == item.homebranch %]
168                             <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
169                           [% ELSE %]
170                             <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
171                           [% END %]
172                         [% END %]
173                         </select>
174                         </li>
175
176                         <li><label for="holdingbranch_item_[% item.item_id | html %]">holdingbranch</label><select id="holdingbranch_item_[% item.item_id | html %]" name="holdingbranch_[% item.biblio_count | html %]">
177                         [% FOREACH l IN libraries %]
178                           [% IF l.branchcode == item.holdingbranch %]
179                             <option value="[% l.branchcode | html %]" selected="selected">[% l.branchname | html %]</option>
180                           [% ELSE %]
181                             <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
182                           [% END %]
183                         [% END %]
184                         </select>
185                         </li>
186                         <li><label for="itype_item_[% item.item_id | html %]">itype</label><select id="itype_item_[% item.item_id | html %]" name="itype_[% item.biblio_count | html %]">
187                         [% FOREACH itypeloo IN itypeloop %]
188                           [% IF ( itypeloo.itemtype ) == ( item.itype ) %]
189                             <option value="[% itypeloo.itemtype | html %]" selected="selected">[% itypeloo.description | html %]</option>
190                           [% ELSE %]
191                             <option value="[% itypeloo.itemtype | html %]">[% itypeloo.description | html %]</option>
192                           [% END %]
193                         [% END %]
194                         </select>
195                         </li>
196
197                         <li><label for="nonpublic_note_item_[% item.item_id | html %]">nonpublic_note</label><input type="text" id="nonpublic_note_item_[% item.item_id | html %]" name="nonpublic_note_[% item.biblio_count | html %]" value="[% item.nonpublic_note | html %]"></li>
198                         <li><label for="public_note_item_[% item.item_id | html %]">public_note</label><input type="text" id="public_note_item_[% item.item_id | html %]" name="public_note_[% item.biblio_count | html %]" value="[% item.public_note | html %]"></li>
199                         <li><label for="loc_item_[% item.item_id | html %]">loc</label><select id="loc_item_[% item.item_id | html %]" name="loc_[% item.biblio_count | html %]">
200                         <option value=""> </option>
201                         [% FOREACH locationloo IN locationloop %]
202                             [% IF ( locationloo.code ) == (item.loc) %]<option value="[% locationloo.code | html %]" selected="selected">[% locationloo.description | html %]</option>[% ELSE %]<option value="[% locationloo.code | html %]">[% locationloo.description | html %]</option>[% END %]
203                         [% END %]
204                        </select>
205                         </li>
206
207                         <li><label for="ccode_item_[% item.item_id | html %]">ccode</label><select id="ccode_item_[% item.item_id | html %]" name="ccode_[% item.biblio_count | html %]">
208                         [% FOREACH ccodeloo IN ccodeloop %]
209                             [% IF ( ccodeloo.code ) == (item.ccode) %]<option value="[% ccodeloo.code | html %]" selected="selected">[% ccodeloo.description | html %]</option>[% ELSE %]<option value="[% ccodeloo.code | html %]">[% ccodeloo.description | html %]</option>[% END %]
210                         [% END %]
211                         </select>
212                         </li>
213
214                         <li><label for="notforloan_item_[% item.item_id | html %]">notforloan</label><select id="notforloan_item_[% item.item_id | html %]" name="notforloan_[% item.biblio_count | html %]">
215                         [% FOREACH n IN notforloanloop %]
216                             [% IF n.code == item.notforloan %]
217                                 <option value="[% n.code | html %]" selected="selected">[% n.description | html %]</option>
218                             [% ELSE %]
219                                 <option value="[% n.code | html %]">[% n.description | html %]</option>
220                             [% END %]
221                         [% END %]
222                         </select>
223                         </li>
224                         <li><label for="uri_item_[% item.item_id | html %]">uri</label><input type="text" id="uri_item_[% item.item_id | html %]" name="uri_[% item.biblio_count | html %]" value="[% item.uri | html %]"></li>
225                         <li><label for="copyno_item_[% item.item_id | html %]">copyno</label><input type="text" id="copyno_item_[% item.item_id | html %]" name="copyno_[% item.biblio_count | html %]" value="[% item.copyno | html %]"></li>
226                         <li><label for="budget_code_item_[% item.item_id | html %]">budget_code</label><select id="budget_code_item_[% item.item_id | html %]" name="budget_code_[% item.biblio_count | html %]">
227                         <option value="">Select a fund</option>
228                         [% FOREACH budget_loo IN budget_loop %]
229                             [% IF ( budget_loo.b_id ) == ( item.budget_id ) %]<option value="[% budget_loo.b_id | html %]" selected="selected">[% budget_loo.b_txt | html %]</option>
230                             [% ELSE %]<option value="[% budget_loo.b_id | html %]">[% budget_loo.b_txt | html %]</option>
231                             [% END %]
232                         [% END %]
233                         </select>
234                         </li>
235                         <li><label for="price_item_[% item.item_id | html %]">price</label><input type="text" id="price_item_[% item.item_id | html %]" name="itemprice_[% item.biblio_count | html %]" value="[% item.itemprice | html %]"></li>
236                         <li><label for="replacementprice_item_[% item.item_id | html %]">replacement price</label><input type="text" id="replacementprice_item_[% item.item_id | html %]" name="replacementprice_[% item.biblio_count | html %]" value="[% item.replacementprice | html %]"></li>
237                         <li><label for="callnumber_item_[% item.item_id | html %]">callnumber</label><input type="text" id="callnumber_item_[% item.item_id | html %]" name="itemcallnumber_[% item.biblio_count | html %]" value="[% item.itemcallnumber | html %]"></li>
238                         </ol>
239                         </fieldset>
240                         [% END %]
241                         </div>
242                         </fieldset>
243                             <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
244                                 <div class="modal-dialog">
245                                 <div class="modal-content">
246                                 <div class="modal-header">
247                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
248                                     <h3 id="dataPreviewLabel">MARC preview</h3>
249                                 </div>
250                                 <div class="modal-body">
251                                     <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
252                                 </div>
253                                 <div class="modal-footer">
254                                     <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
255                                 </div>
256                                 </div>
257                                 </div>
258                             </div>
259                         [% END %]
260                       </div>
261                       <div id="items_info">
262                         <h2>Item information</h2>
263                         <p>Import all the checked items in the basket with the following parameters:</p>
264
265                         [% IF ( items ) %]
266                         <fieldset class="rows" style="float:none;">
267                             <legend>Item</legend>
268                             [% IF ( NoACQframework ) %]
269                                 <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
270                             [% END %]
271                             [% FOREACH item IN items %]
272                             <div id="outeritemblock">
273                             <div id="itemblock">
274                                 <ol>
275                                 [% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden | html %];">
276                                     <div class="subfield_line" id="subfield[% iteminformatio.serialid | html %][% iteminformatio.countitems | html %][% iteminformatio.subfield | html %][% iteminformatio.random | html %]">
277                                         [% IF (iteminformatio.mandatory) %]
278                                             <label class="required">[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
279                                         [% ELSE %]
280                                             <label>[% iteminformatio.subfield | html %] - [% iteminformatio.marc_lib | $raw %]</label>
281                                         [% END %]
282
283                                         [% IF ( iteminformatio.marc_value.type == 'select' ) %]
284                                             <select name="field_value" size="1">
285                                             [% FOREACH value IN iteminformatio.marc_value.values %]
286                                                 [% IF ( value == iteminformatio.marc_value.default ) %]
287                                                     <option value="[% value | html %]" selected="selected">[% iteminformatio.marc_value.labels.$value | html %]</option>
288                                                 [% ELSE %]
289                                                     <option value="[% value | html %]">[% iteminformatio.marc_value.labels.$value | html %]</option>
290                                                 [% END %]
291                                             [% END %]
292                                             </select>
293                                         [% ELSE %]
294                                         [% iteminformatio.marc_value | $raw %]
295                                         [% END %]
296                                         <input type="hidden" name="itemid" value="1" />
297                                         <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield | html %]" />
298                                         <input type="hidden" name="tag" value="[% iteminformatio.tag | html %]" />
299                                         <input type="hidden" name="subfield" value="[% iteminformatio.subfield | html %]" />
300                                         <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory | html %]" />
301                                         [% IF ( iteminformatio.mandatory ) %] <span class="required">Required</span>[% END %]
302                                     </div></li>
303                                 [% END %]
304                                 </ol>
305                             </div><!-- /iteminformation -->
306                             </div>
307                             [% END %] <!-- /items -->
308                         </fieldset>
309                         [% END %] <!-- items -->
310                       </div>
311                       <div id="accounting_details">
312                         <p>Import all the checked items in the basket with the following accounting details (used only if no information is filled for the item):</p>
313                         <fieldset class="rows" style="float:none;">
314                             <legend>Accounting details</legend>
315                             <ol>
316                                 <li>
317                                     <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
318                                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
319                                 </li>
320                                 <li>
321                                     [% IF ( close ) %]
322                                         <span class="label">Fund: </span>
323                                         <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id | html %]" />[% Budget_name | html %]
324                                     [% ELSE %]
325                                         <li>
326                                             <label for="all_currency">Currency:</label>
327                                             <select name="all_currency" id="all_currency">
328                                             [% FOREACH currency IN currencies %]
329                                                 [% IF currency.currency == bookseller.listprice %]
330                                                     <option value="[% currency.currency | html %]" selected="selected">[% currency.currency | html %]</option>
331                                                 [% ELSIF not currency.archived %]
332                                                     <option value="[% currency.currency | html %]">[% currency.currency | html %]</option>
333                                                 [% END %]
334                                             [% END %]
335                                             </select>
336                                         </li>
337                                         <li>
338                                             <label for="all_budget_id">Fund: </label>
339                                             <select id="all_budget_id" size="1" name="all_budget_id">
340                                               <option value="">Select a fund</option>
341                                             [% FOREACH budget_loo IN budget_loop %]
342                                                 [% 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>
343                                                 [% 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>
344                                                 [% END %]
345                                             [% END %]
346                                             </select>
347                                             <label for="all_showallbudgets" style="float:none;width:auto;">&nbsp;Show inactive:</label>
348                                             <input type="checkbox" id="all_showallbudgets" />
349                                         </li>
350                                     [% END %]
351                                 </li>
352                                 <li>
353                                     <label for="all_order_internalnote">Internal note: </label>
354                                     <textarea id="all_order_internalnote" cols="30" rows="3" name="all_order_internalnote"></textarea>
355                                 </li>
356                                 <li>
357                                     <label for="all_order_vendornote">Vendor note: </label>
358                                     <textarea id="all_order_vendornote" cols="30" rows="3" name="all_order_vendornote"></textarea>
359                                 </li>
360                                 <li>
361                                     <div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
362                                     <label for="all_sort1">Statistic 1: </label>
363                                     <input type="text" id="all_sort1" size="20" name="all_sort1" value="" />
364                                 </li>
365                                 <li>
366                                     <label for="all_sort2">Statistic 2: </label>
367                                     <input type="text" id="all_sort2" size="20" name="all_sort2" value="" />
368                                 </li>
369                             </ol>
370                         </fieldset>
371                       </div>
372                       </div>
373
374                       <fieldset class="action">
375                           <input type="submit" value="Save" /><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a>
376                       </fieldset>
377                     </form>
378                 [% ELSE %]
379                 <div>
380                   <h1>Choose the file to add to the basket</h1>
381                   <table id="files">
382                     <thead>
383                       <tr>
384                         <th>File name</th>
385                         <th>Comments</th>
386                         <th>Status</th>
387                         <th class="title-string">Staged</th>
388                         <th># Bibliographic records</th>
389                         <th class="NoSort">&nbsp;</th>
390                       </tr>
391                     </thead>
392                     <tbody>
393                       [% FOREACH batch_lis IN batch_list %]
394                       <tr>
395                         <td>[% batch_lis.file_name | html %]</td>
396                         <td>[% batch_lis.comments | html %]</td>
397                         <td>
398                           [% IF ( batch_lis.import_status == 'cleaned' ) %]
399                             Cleaned
400                           [% ELSIF ( batch_lis.import_status == 'imported' ) %]
401                             Imported
402                           [% ELSIF ( batch_lis.import_status == 'importing' ) %]
403                             Importing
404                           [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
405                             Reverted
406                           [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
407                             Reverting
408                           [% ELSIF ( batch_lis.import_status == 'staged' ) %]
409                             Staged
410                           [% ELSE %]
411                             [% batch_lis.import_status | html %]
412                           [% END %]
413                         </td>
414                         <td><span title="[% batch_lis.staged_date | html %]">[% batch_lis.staged_date | $KohaDates with_hours => 1 | html %]</span></td>
415                         <td>[% batch_lis.num_records | html %]</td>
416                         <td><a href="[% batch_lis.scriptname | uri %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;basketno=[% basketno | uri %]&amp;booksellerid=[% booksellerid | uri %]">Add orders</a></td>
417                       </tr>
418                       [% END %]
419                     </tbody>
420                   </table>
421                 </div>
422                 [% END %]
423             </div> [% # /div.col-sm-6 %]
424        </div> [% # /div.row %]
425
426 [% MACRO jsinclude BLOCK %]
427     [% Asset.js("js/acquisitions-menu.js") | $raw %]
428 [% INCLUDE 'datatables.inc' %]
429     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
430     [% Asset.js("js/acq.js") | $raw %]
431     <script type="text/JavaScript">
432         $(document).ready(function() {
433             $("#files").dataTable($.extend(true, {}, dataTablesDefaults, {
434                 "aoColumnDefs": [
435                     { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
436                     { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
437                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
438                 ],
439                 "sPaginationType": "four_button",
440                 "aaSorting": []
441             } ) );
442
443             // keep copy of the inactive budgets
444             disabledBudgetsCopy = $("select[name='all_budget_id']").html();
445             $("select[name='all_budget_id'] .b_inactive").remove();
446             $("select[name='budget_id'] .b_inactive").remove();
447
448             $("#showallbudgets").click(function() {
449                 if ($(this).is(":checked")) {
450                     $("select[name='budget_id']").html(disabledBudgetsCopy)
451                 }
452                 else {
453                     $("select[name='budget_id'] .b_inactive").remove();
454                 }
455             });
456
457             $("#all_showallbudgets").click(function() {
458                 if ($(this).is(":checked")) {
459                     $("select[name='all_budget_id']").html(disabledBudgetsCopy);
460                 }
461                 else {
462                     $("select[name='all_budget_id'] .b_inactive").remove();
463                 }
464             });
465
466             $("select[name='budget_id']").change(function(){
467                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
468                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
469                 var destination_sort1 = $(this).parents('fieldset').find('li.sort1').find('input[name="sort1"]');
470                 var sort1 = $(destination_sort1).val() || "";
471                 if ( destination_sort1.length < 1 ) {
472                     destination_sort1 = $(this).parents('fieldset').find('li.sort1 > select[name="sort1"]');
473                 }
474                 var destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('input[name="sort2"]');
475                 var sort2 = $(destination_sort2).val() || "";
476                 if ( destination_sort2.length < 1 ) {
477                     destination_sort2 = $(this).parents('fieldset').find('li.sort2').find('select[name="sort2"]');
478                 }
479                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
480
481                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
482             } );
483
484             $("select[name='budget_id']").change();
485
486             $("select[name='all_budget_id']").change(function(){
487                 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
488                 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
489                 var destination_sort1 = $(this).parent().siblings('li').find('input[name="all_sort1"]');
490                 if ( destination_sort1.length < 1 ) {
491                     destination_sort1 = $(this).parent().siblings('li').find('select[name="all_sort1"]');
492                 }
493                 var destination_sort2 = $(this).parent().siblings('li').find('input[name="all_sort2"]');
494                 if ( destination_sort2.length < 1 ) {
495                     destination_sort2 = $(this).parent().siblings('li').find('select[name="all_sort2"]');
496                 }
497                 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1 );
498                 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2 );
499                 $(this).parent().siblings('li').find('select[name="sort1"]').attr('name', 'all_sort1');
500                 $(this).parent().siblings('li').find('input[name="sort1"]').attr('name', 'all_sort1');
501                 $(this).parent().siblings('li').find('select[name="sort2"]').attr('name', 'all_sort2');
502                 $(this).parent().siblings('li').find('input[name="sort2"]').attr('name', 'all_sort2');
503             } );
504
505             $("select[name='all_budget_id']").change();
506
507             $("#records_to_import fieldset.rows div").hide();
508             $('input:checkbox[name="import_record_id"]').change(function(){
509                 var container = $(this).parents("fieldset");
510                 if ( $(this).is(':checked') ) {
511                     $(container).addClass("selected");
512                     $(container).removeClass("unselected");
513                     $(container).find("div").toggle(true);
514                 } else {
515                     $(container).addClass("unselected");
516                     $(container).removeClass("selected");
517                     $(container).find("div").toggle(false);
518                 }
519             } );
520
521             $("input:checkbox").prop("checked", false);
522             $("div.biblio.unselected select").prop('disabled', false);
523             $("div.biblio.unselected input").prop('disabled', false);
524
525             $("#checkAll").click(function(){
526                 $("#Aform").checkCheckboxes();
527                 $("input:checkbox[name='import_record_id']").change();
528                 return false;
529             });
530             $("#unCheckAll").click(function(){
531                 $("#Aform").unCheckCheckboxes();
532                 $("input:checkbox[name='import_record_id']").change();
533                 return false;
534             });
535
536             $("#Aform").on("submit", function(){
537                 if ( $("input:checkbox[name='import_record_id']:checked").length < 1 ) {
538                     alert(_("There is no record selected"));
539                     return false;
540                 }
541
542                 var error = 0;
543                 $("input:checkbox[name='import_record_id']:checked").parents('fieldset').find('input[name="quantity"]').each(function(){
544                     if ( $(this).val().length < 1 || isNaN( $(this).val() ) ) {
545                         error++;
546                     }
547                 });
548                 if ( error > 0 ) {
549                     alert(error + " " + _("quantity values are not filled in or are not numbers"));
550                     return false;
551
552                 }
553
554                 return disableUnchecked($(this));
555             });
556             $('#tabs').tabs();
557             $(".previewData").on("click", function(e){
558                 e.preventDefault();
559                 var ltitle = $(this).text();
560                 var page = $(this).attr("href");
561                 $("#dataPreviewLabel").text(ltitle);
562                 $("#dataPreview .modal-body").load(page + " div");
563                 $('#dataPreview').modal({show:true});
564             });
565             $("#dataPreview").on("hidden.bs.modal", function(){
566                 $("#dataPreviewLabel").html("");
567                 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
568             });
569         });
570
571         function disableUnchecked(form){
572             $("fieldset.biblio.unselected").each(function(){
573                 $(this).remove();
574             });
575             return 1;
576         }
577     </script>
578 [% END %]
579
580 [% INCLUDE 'intranet-bottom.inc' %]