Bug 23590: Add ability to edit the manager of a suggestion
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% PROCESS 'i18n.inc' %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% USE Price %]
8 [% USE ColumnsSettings %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>Koha &rsaquo; Acquisitions  &rsaquo;
12     [% IF ( op_save ) %]
13         [% IF ( suggestionid ) %]
14             Suggestions &rsaquo;  Edit suggestion #[% suggestionid | html %]
15         [% ELSE %]
16             Suggestions &rsaquo; Add suggestion
17         [% END %]
18     [% ELSIF ( op == 'show' ) %]
19            Suggestions &rsaquo; Show suggestion #[% suggestionid | html %]
20     [% ELSE %]
21         Suggestions management
22     [% END %]
23 </title>
24 [% INCLUDE 'doc-head-close.inc' %]
25 [% IF ( op_else ) %]
26 [% END %]
27 [% IF ( op_else ) %]
28     <style>
29         h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
30         .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; } div.note { background: transparent none; border-style: dotted; border-width: 1px 0 0 0; font-size : 90%; padding: 2px 0 0 0; } div.note i { color: #CCC; }
31     </style>
32 [% END %]
33 </head>
34
35 <body id="acq_suggestion" class="acq">
36 [% INCLUDE 'header.inc' %]
37 [% INCLUDE 'cat-search.inc' %]
38 <div id="breadcrumbs">
39     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
40     [% IF ( op_save ) %]
41         [% IF ( suggestionid ) %]
42             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid | html %]
43         [% ELSE %]
44             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
45         [% END %]
46     [% ELSIF ( op == 'show' ) %]
47            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid | html %]
48     [% ELSE %]
49         Suggestions management
50     [% END %]
51 </div>
52
53 [% IF ( op == 'show' ) %]
54     <div class="main container-fluid">
55         <div class="row">
56             <div class="col-md-8 col-md-offset-2">
57
58     <div id="toolbar" class="btn-toolbar">
59         <a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a>
60         <a class="btn btn-default deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
61     </div>
62
63     <fieldset class="rows">
64       <legend>Bibliographic information</legend>
65       <ol>
66             [% IF ( title ) %]
67                 <li>
68                     <span class="label">Title:</span>
69                     [% IF suggestion.biblionumber %]
70                         <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
71                     [% ELSE %]
72                         [% title | html %]
73                     [% END %]
74                 </li>
75             [% END %]
76             [% IF ( author ) %]
77                 <li>
78                     <span class="label">Author:</span>
79                     [% author | html %]
80                 </li>
81             [% END %]
82             [% IF ( copyrightdate ) %]
83                 <li>
84                     <span class="label">Copyright date:</span>
85                     [% copyrightdate | html %]
86                 </li>
87             [% END %]
88             [% IF ( isbn ) %]
89                 <li>
90                     <span class="label">ISBN or ISSN or other standard number:</span>
91                     [% isbn | html %]
92                 </li>
93             [% END %]
94             [% IF ( publishercode ) %]
95                 <li>
96                     <span class="label">Publisher:</span>
97                     [% publishercode | html %]
98                 </li>
99             [% END %]
100             [% IF ( place ) %]
101                 <li>
102                     <span class="label">Publication place:</span>
103                     [% place | html %]
104                 </li>
105             [% END %]
106             [% IF ( collectiontitle ) %]
107                 <li>
108                     <span class="label">Collection title:</span>
109                     [% collectiontitle | html %]
110                 </li>
111             [% END %]
112             [% IF ( itemtype ) %]
113                 <li>
114                     <span class="label">Document type:</span>
115                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
116                 </li>
117             [% END %]
118         [% IF ( patron_reason_loop ) %]
119           <li><span class="label">Reason for suggestion: </span>
120             [% FOREACH patron_reason_loo IN patron_reason_loop %]
121               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib | html %][% END %]
122             [% END %]
123           </li>
124         [% END %]
125             [% IF ( note ) %]
126                 <li>
127                     <span class="label">Notes:</span>
128                     [% note | html %]
129                 </li>
130             [% END %]
131       </ol>
132     </fieldset>
133     <fieldset class="rows"> <legend>Suggestion management</legend>
134       <ol>
135         <li>
136           <span class="label">Status:</span>
137           [% SET status_found = 0 %]
138           [% IF ( STATUS == 'ASKED' ) %]
139               Pending
140               [% SET status_found = 1 %]
141           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
142               Accepted
143               [% SET status_found = 1 %]
144           [% ELSIF ( STATUS == 'CHECKED' ) %]
145               Checked
146               [% SET status_found = 1 %]
147           [% ELSIF ( STATUS == 'REJECTED' ) %]
148               Rejected
149               [% SET status_found = 1 %]
150           [% ELSIF ( STATUS == 'ORDERED' ) %]
151               Ordered
152               [% SET status_found = 1 %]
153           [% ELSIF ( STATUS == 'AVAILABLE' ) %]
154               Available
155               [% SET status_found = 1 %]
156           [% ELSE %]
157               [% FOREACH s IN SuggestionStatuses %]
158                   [% IF STATUS == s.authorised_value %]
159                       [% s.lib | html %]
160                       [% SET status_found = 1 %]
161                   [% END %]
162               [% END %]
163           [% END %]
164
165         </li>
166         <li>
167           <table>
168             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
169             <tbody>
170             <tr>
171                 <th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
172                 <td>[% suggesteddate | $KohaDates %]</td>
173                 <td>
174                     [% IF ( suggestedby_borrowernumber ) %]
175                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
176                         [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])
177                     [% END %]
178                 </td>
179             </tr>
180             <tr>
181                 <th>Managed by:</th>
182                 <td>[% manageddate | $KohaDates %]</td>
183                 <td>
184                         [% IF ( managedby_borrowernumber ) %]
185                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | uri %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
186                             [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])
187                         [% END %]
188                 </td>
189             </tr>
190             <tr>
191                 <th>Accepted on:</th>
192                 <td>[% accepteddate | $KohaDates %]</td>
193                 <td>
194                     [% IF ( acceptedby_borrowernumber ) %]
195                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
196                         [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])
197                     [% END %]
198                 </td>
199             </tr>
200             </tbody>
201         </table></li></ol>
202     </fieldset>
203     <fieldset class="rows"> <legend>Acquisition information</legend>
204       <ol>
205         <li>
206           <span class="label">Library:</span> [% Branches.GetName( branchcode ) | html %]
207         </li>
208         <li>
209           <span class="label">Fund:</span> [% budgetname | html %]
210         </li>
211         <li>
212           <span class="label">Copies:</span>[% quantity | html %]
213         </li>
214         <li>
215           <span class="label">Currency:</span>[% currency | html %]
216         </li>
217         <li>
218           <span class="label">Price:</span>[% price | $Price %]
219         </li>
220         <li>
221           <span class="label">Total</span>[% total | $Price %]
222         </li>
223       </ol>
224     </fieldset>
225
226     <fieldset class="action">
227         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
228     </fieldset>
229
230     </div>
231     </div>
232 </div>
233 [% ELSE %]
234
235 [% IF ( op_save ) %]
236     <div class="main container-fluid">
237         <div class="row">
238             <div class="col-md-8 col-md-offset-2">
239 [% ELSE %]
240     <div class="main container-fluid">
241         <div class="row">
242             <div class="col-sm-10 col-sm-push-2">
243                 <main>
244
245 [% END %]
246
247 [% IF ( op_save ) %]
248     [% FOR m IN messages %]
249         <div class="dialog [% m.type | html %]">
250             [% SWITCH m.code %]
251             [% CASE 'biblio_exists' %]
252                 A similar document already exists: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
253             [% CASE %]
254                 [% m.code | html %]
255             [% END %]
256         </div>
257     [% END %]
258     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
259     <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
260     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
261     [% IF ( suggestionid ) %]
262         <h1>Edit purchase suggestion #[% suggestionid | html %]</h1>
263         <input type="hidden" name="suggestionid" value="[% suggestionid | html %]"/>
264     [% ELSE %]
265         <h1>Enter a new purchase suggestion</h1>
266     [% END %]
267     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
268         <li>
269             <label for="title" class="required">Title:</label>
270             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title | html %]" required="required" class="required" />
271             <span class="required">Required</span>
272         </li>
273         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
274         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
275         <li><label for="isbn">ISBN or ISSN or other standard number:</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]"/></li>
276         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
277         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
278         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
279         <li><label for="itemtype">Document type:</label>
280             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
281         </li>
282         [% IF patron_reason_loop %]
283             <li>
284                 <label for="patronreason">Reason for suggestion: </label>
285                 <select name="patronreason" id="patronreason">
286                     <option value=""> -- Choose -- </option>
287                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
288                         [% IF patron_reason_loo.authorised_value == patronreason %]
289                             <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
290                         [% ELSE %]
291                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
292                         [% END %]
293                     [% END %]
294                 </select>
295             </li>
296         [% END %]
297         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea></li>
298         </ol>
299     </fieldset>
300     <fieldset class="rows"> <legend>Suggestion management</legend>
301        <ol>
302             [% IF ( suggestionid ) %]
303                 <li>
304                     <label for="STATUS">Status:</label>
305                     <select id="STATUS" name="STATUS">
306                         <option value="">No status</option>
307
308                         [% IF (statusselected_ASKED ) %]
309                             <option value="ASKED" selected="selected">Pending</option>
310                         [% ELSE %]
311                             <option value="ASKED">Pending</option>
312                         [% END %]
313
314                         [% IF (statusselected_ACCEPTED ) %]
315                             <option value="ACCEPTED" selected="selected">Accepted</option>
316                         [% ELSE %]
317                             <option value="ACCEPTED">Accepted</option>
318                         [% END %]
319
320                         [% IF (statusselected_CHECKED ) %]
321                             <option value="CHECKED" selected="selected">Checked</option>
322                         [% ELSE %]
323                             <option value="CHECKED">Checked</option>
324                         [% END %]
325
326                         [% IF ( statusselected_REJECTED ) %]
327                             <option value="REJECTED" selected="selected">Rejected</option>
328                         [% ELSE %]
329                             <option value="REJECTED">Rejected</option>
330                         [% END %]
331
332                         [% FOREACH s IN SuggestionStatuses %]
333                             [% IF s.authorised_value == suggestion.STATUS %]
334                                 <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
335                             [% ELSE %]
336                                 <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
337                             [% END %]
338                         [% END %]
339                     </select>
340                 </li>
341                 <li>
342                     <label for="reason">Reason</label>
343                     <select class="select-reason" id="reason" name="reason">
344                         <option value=""> -- Choose a reason -- </option>
345                         [% FOREACH reasonsloo IN suggestion.reasonsloop %]
346                             [% IF (reasonsloo.lib == suggestion.reason) %]
347                                 <option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
348                             [% ELSE %]
349                                 <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
350                             [% END %]
351                         [% END %]
352                         <option value="other">Others...</option>
353                     </select>
354
355                     <span id="other_reason" name="other_reason">
356                         [% IF other_reason %]
357                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
358                         [% ELSE %]
359                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
360                         [% END %]
361                         <a href="#back">Cancel</a>
362                     </span>
363                 </li>
364             [% END %]
365         <li><table>
366             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
367             <tbody>
368             <tr>
369                 <th><label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label> </th>
370                 <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
371                 <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>  [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %]
372                 </td>
373             </tr>
374             <tr>
375                 <th><label for="accepteddate">Accepted on:</label> </th>
376                 <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
377                 <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])[% END %]</td>
378             </tr>
379             </tbody>
380         </table></li>
381
382             <li>
383                 <label for="managedon">Managed on:</label>
384                 <input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
385             </li>
386             <li>
387                 <label for="managedby_name">by:</label>
388                 <div>
389                     <span id="managedby_name">
390                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% logged_in_user.borrowernumber | uri %]">You</a>
391                     </span>
392                     [% IF managedby_borrowernumber && logged_in_user.borrowernumber != managedby_borrowernumber %]
393                         | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])
394                     [% END %]
395                     <br />
396                     <a id="edit_manager" class="new_window" href="#"><i class="fa fa-search"></i> Select manager</a>
397                     [% IF managedby_borrowernumber && logged_in_user.borrowernumber != managedby_borrowernumber %]
398                         <a id="restore_previous_manager" href="#"><i class="fa fa-trash"></i> Keep existing manager</a>
399                     [% END %]
400                     <input type="hidden" name="managedby" id="managedby" value="[% logged_in_user.borrowernumber | html %]" />
401                 </div>
402             </li>
403         </ol>
404     </fieldset>
405     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
406         <li><label for="branchcode">Library:</label>
407             <select name="branchcode" id="branchcode">
408                 <option value="">Any</option>
409                 [% IF branchfilter %]
410                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
411                 [% ELSE %]
412                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
413                 [% END %]
414             </select>
415         </li>
416         <li><label for="budgetid">Fund:</label>
417             <select name="budgetid" id="budgetid">
418                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
419                 [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>[% END %][% END %]
420             </select>
421                 </li><li><label for="quantity">Copies:</label>
422             <input type="text" size="10" id="quantity" name="quantity" value="[% quantity | html %]" />
423                 </li>
424                 <li>
425                     <label for="currency">Currency:</label>
426                     [% FOREACH c IN currencies %]
427                         <input type="hidden" value="[% c.rate | html %]" id="currency_rate_[% c.currency | html %]" name="currency_rate_[% c.currency | html %]" />
428                         <input type="hidden" id="[% c.currency | html %]" name="[% c.currency | html %]" value="[% c.rate | html %]" />
429                     [% END %]
430
431                     <select name="currency" id="currency">
432                         [% FOREACH c IN currencies %]
433                             [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
434                                 <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
435                             [% ELSIF not c.archived %]
436                                 <option value="[% c.currency | html %]">[% c.currency | html %]</option>
437                             [% END %]
438                         [% END %]
439                     </select>
440                 </li>
441                 <li><label for="price">Price:</label>
442             <input type="text" size="20" name="price" id="price" value="[% price | html %]" />
443                 </li><li><label for="total">Total: </label>
444                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]"/>
445                 </li></ol>
446     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]noone[% END %]"/>
447     <fieldset class="action">
448         <input type="hidden" name="op" value="[% op | html %]" />
449         [% IF ( suggestionid ) %]
450             [% IF ( need_confirm ) %]
451                 <input type="hidden" name="save_confirmed" value="1" />
452                 <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
453             [% ELSE %]
454                 <input type="submit" value="Save" />
455             [% END %]
456             <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby | uri %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>
457         [% ELSE %]
458             [% IF ( need_confirm ) %]
459                 <input type="hidden" name="save_confirmed" value="1" />
460                 <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
461             [% ELSE %]
462                 <input type="submit" value="Submit your suggestion" />
463             [% END %]
464             <a class="cancel" href="suggestion.pl">Cancel</a>
465         [% END %]
466     </fieldset>
467     </form>
468 [% END %]
469
470 [% IF ( op_else ) %]
471 <div id="toolbar" class="btn-toolbar">
472     <a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
473 </div>
474
475 <h1>Suggestions management</h1>
476
477
478 [% FOR m IN messages %]
479     <div class="dialog [% m.type | html %]">
480         [% SWITCH m.code %]
481         [% CASE 'already_exists' %]
482             The suggestion has not been added. A suggestion with this title already exists (<a href='/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% m.id | html %]&op=show'>suggestion #[% m.id | html %]</a>)
483         [% CASE 'biblio_exists' %]
484             A similar document already exists: <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.id | uri %]">[% m.title | html %]</a>. Click on "Confirm your suggestion" to ignore this message.
485         [% CASE %]
486             [% m.code | html %]
487         [% END %]
488     </div>
489 [% END %]
490
491 [% UNLESS ( notabs ) %]
492     <div id="suggestiontabs" class="toptabs">
493     <ul class="ui-tabs-nav">
494         [% FOREACH suggestion IN suggestions %]
495                 <li>
496             <a href="#tab_[% loop.count | uri %]">
497             [% IF ( suggestion.suggestiontypelabel ) %]
498                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
499                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
500                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
501                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
502                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
503                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
504                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Status unknown
505                 [% ELSE %][% suggestion.suggestiontypelabel | html %][% END %]
506             [% ELSE %]
507                 [% IF ( suggestion.suggestiontype ) %]
508                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) | html %]
509                 [% ELSE %]
510                     No name
511                 [% END %]
512             [% END %]
513             ([% suggestion.suggestions_loop.size | html %])</a></li>
514
515         [% END %]
516     </ul>
517 [% END %]
518
519 [% FOREACH suggestion IN suggestions %]
520 <div id="tab_[% loop.count | html %]">
521 <form class="update_suggestions" name="f" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#tab_[% loop.count | html %]">
522
523 [% IF ( suggestion.suggestions_loop ) %]
524 <p><a class="checkall" href="#">Check all</a> | <a class="uncheckall" href="#">Uncheck all</a></p>
525     <table id="table_[% loop.count | html %]" class="sorted">
526         <thead>
527             <tr>
528                 <th class="NoSort noExport">&nbsp;</th>
529                 <th class="anti-the">Suggestion</th>
530                 <th>Suggested by</th>
531                 <th>Suggested on</th>
532                 <th>Managed by</th>
533                 <th>Managed on</th>
534                 <th>Library</th>
535                 <th>Fund</th>
536                 <th>Status</th>
537                 <th class="NoSort noExport">&nbsp;</th>
538             </tr>
539     </thead>
540         <tbody>
541             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
542                 <tr>
543                 <td>
544                     <input type="checkbox" name="suggestionid" value="[% suggestions_loo.suggestionid | html %]" />
545                 </td>
546                 <td>
547                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&amp;op=show" title="suggestion" >
548                         [% suggestions_loo.title | html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author | html %][% END %]</a>
549                     <br />
550                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate | html %] [% END %]
551                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %]
552                         [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<div class="note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>[% END %]
553                 </td>
554                 <td>
555                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamesuggestedby | html %][% IF ( suggestions_loo.firstnamesuggestedby ) %], [% suggestions_loo.firstnamesuggestedby | html %][% END %] [% IF (suggestions_loo.cardnumbersuggestedby ) %]([% suggestions_loo.cardnumbersuggestedby | html %])[% END %]</a>
556                 </td>
557                 <td data-order="[% suggestions_loo.suggesteddate | html %]">
558                     [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate | $KohaDates %][% END %]
559                 </td>
560                 <td>
561                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamemanagedby | html %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby | html %][% END %]</a>
562                 </td>
563                 <td data-order="[% suggestions_loo.manageddate | html %]">
564                     [% IF ( suggestions_loo.manageddate ) %][% suggestions_loo.manageddate | $KohaDates %][% END %]
565                 </td>
566                 <td>
567                     [% Branches.GetName( suggestions_loo.branchcode ) | html %]
568                 </td>
569                 <td>
570                     [% suggestions_loo.budget_name | html %]
571                 </td>
572                 <td>
573                     [% IF ( suggestions_loo.ASKED ) %]
574                         Pending
575                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
576                         Accepted
577                     [% ELSIF ( suggestions_loo.ORDERED ) %]
578                         Ordered
579                     [% ELSIF ( suggestions_loo.REJECTED ) %]
580                         Rejected
581                     [% ELSIF ( suggestions_loo.CHECKED ) %]
582                         Checked
583                     [% ELSIF ( suggestions_loo.AVAILABLE ) %]
584                         Available
585                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
586                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) | html %]
587                     [% ELSE %]
588                         Status unknown
589                     [% END %]
590
591                     [% IF ( suggestions_loo.reason ) %]
592                         <br />([% suggestions_loo.reason | html %])
593                     [% END %]
594                 </td>
595                 <td class="actions">
596                     <a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a>
597                     <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
598                 </td>
599         </tr>
600         [% END %]</tbody>
601         </table>
602
603         <div class="row">
604             <h2 style="padding-left:1em;">Change selected suggestions</h3>
605             <div class="col-sm-4">
606                 <fieldset>
607                     <div id="select-reason">
608                        <label for="STATUS">Mark selected as: </label>
609                        <select name="STATUS" id="STATUS">
610                            <option value=""> -- Choose a status --</option>
611
612                            [% IF (statusselected_ASKED ) %]
613                                <option value="ASKED" selected="selected">Pending</option>
614                            [% ELSE %]
615                                <option value="ASKED">Pending</option>
616                            [% END %]
617
618                            [% IF (statusselected_ACCEPTED ) %]
619                                <option value="ACCEPTED" selected="selected">Accepted</option>
620                            [% ELSE %]
621                                <option value="ACCEPTED">Accepted</option>
622                            [% END %]
623
624                            [% IF (statusselected_CHECKED ) %]
625                                <option value="CHECKED" selected="selected">Checked</option>
626                            [% ELSE %]
627                                <option value="CHECKED">Checked</option>
628                            [% END %]
629
630                            [% IF ( statusselected_REJECTED ) %]
631                                <option value="REJECTED" selected="selected">Rejected</option>
632                            [% ELSE %]
633                                <option value="REJECTED">Rejected</option>
634                            [% END %]
635
636                            [% FOREACH s IN SuggestionStatuses %]
637                                <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
638                            [% END %]
639                        </select>
640
641                        <label for="reason">with this reason:</label>
642                        <select name="reason">
643                            <option value=""> -- Choose a reason -- </option>
644                            [% FOREACH reasonsloo IN suggestion.reasonsloop %]
645                                <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
646                            [% END %]
647                            <option value="other">Others...</option>
648                        </select>
649
650                        <span class="other_reason">
651                            <input type="text" size="31" name="other_reason" placeholder="please note your reason here..." />
652                            <a href="#" class="cancel_note">Cancel</a>
653                        </span>
654                     </div>
655
656                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
657                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_status"/>Submit</button></fieldset>
658                 </fieldset>
659             </div>
660             <div class="col-sm-4">
661                 <fieldset>
662                     <label for="itemtype">Update item types with: </label>
663                     [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20  %]
664                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
665                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="update_itemtype"/>Submit</button></fieldset>
666                 </fieldset>
667             </div>
668
669             <div class="col-sm-4">
670                 <fieldset>
671                     <label for="delete_[% loop.count | html %]">Delete selected</label>
672                     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
673                     <fieldset class="action"><button type="submit" class="btn btn-default btn-xs" value="delete"/>Delete</button></fieldset>
674                 </fieldset>
675             </div>
676         </div>
677
678 [% ELSE %]
679     <b>No results.</b>
680 [% END %]
681 </form>
682 </div>
683 [% END %]
684 [% END %]
685
686 [% UNLESS ( op_save ) %]
687     [% UNLESS ( op == 'show' ) %]
688
689             </main>
690         </div> <!-- /.col-sm-10.col-sm-push-2 -->
691
692         <div class="col-sm-2 col-sm-pull-10">
693             <aside>
694
695 <form name="suggestionfilter" action="suggestion.pl" method="get">
696 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
697                 <select name="displayby" id="displayby" style="width:auto;">
698                     [% IF ( displayby == "STATUS" ) %]
699                         <option value="STATUS" selected="selected">Status</option>
700                     [% ELSE %]
701                         <option value="STATUS">Status</option>
702                     [% END %]
703                     [% IF ( displayby == "branchcode" ) %]
704                         <option value="branchcode" selected="selected">Library</option>
705                     [% ELSE %]
706                         <option value="branchcode">Library</option>
707                     [% END %]
708                     [% IF ( displayby == "itemtype" ) %]
709                         <option value="itemtype" selected="selected">Item type</option>
710                     [% ELSE %]
711                         <option value="itemtype">Item type</option>
712                     [% END %]
713                     [% IF ( displayby == "managedby" ) %]
714                         <option value="managedby" selected="selected">Managed by</option>
715                     [% ELSE %]
716                         <option value="managedby">Managed by</option>
717                     [% END %]
718                     [% IF ( displayby == "acceptedby" ) %]
719                         <option value="acceptedby" selected="selected">Accepted by</option>
720                     [% ELSE %]
721                         <option value="acceptedby">Accepted by</option>
722                     [% END %]
723                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
724 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
725                 <div style="display:block;" id="limits">
726
727                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
728                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title | html %]" /></li>
729                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
730                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
731                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
732                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
733                     <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" /></li></ol>
734                 </fieldset>
735                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
736                     <ol>
737                       <li>
738                           <label for="STATUS"> Status:</label>
739                           <select name="STATUS" id="STATUS">
740                               <option value="">Any</option>
741
742                               [% IF (statusselected_ASKED ) %]
743                                   <option value="ASKED" selected="selected">Pending</option>
744                               [% ELSE %]
745                                   <option value="ASKED">Pending</option>
746                               [% END %]
747
748                               [% IF (statusselected_ACCEPTED ) %]
749                                   <option value="ACCEPTED" selected="selected">Accepted</option>
750                               [% ELSE %]
751                                   <option value="ACCEPTED">Accepted</option>
752                               [% END %]
753
754                               [% IF (statusselected_CHECKED ) %]
755                                   <option value="CHECKED" selected="selected">Checked</option>
756                               [% ELSE %]
757                                   <option value="CHECKED">Checked</option>
758                               [% END %]
759
760                               [% IF ( statusselected_REJECTED ) %]
761                                   <option value="REJECTED" selected="selected">Rejected</option>
762                               [% ELSE %]
763                                   <option value="REJECTED">Rejected</option>
764                               [% END %]
765
766                               [% FOREACH s IN SuggestionStatuses %]
767                                   [% IF s.authorised_value == selected_status %]
768                                       <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
769                                   [% ELSE %]
770                                       <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
771                                   [% END %]
772                               [% END %]
773                           </select>
774                       </li>
775
776                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
777 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code | html %]" selected="selected">[% suggestedby_loo.desc | html %]</option>[% ELSE %]<option value="[% suggestedby_loo.code | html %]">[% suggestedby_loo.desc | html %]</option>[% END %][% END %]
778                                                                      </select></li>
779                     <li>
780                         <label for="suggesteddate_from">Suggested date from:</label>
781                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" />
782                     </li>
783                     <li>
784                         <label for="suggesteddate_to">To:</label>
785                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" />
786                     </li>
787                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
788 [% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code | html %]" selected="selected">[% managedby_loo.desc | html %]</option>[% ELSE %]<option value="[% managedby_loo.code | html %]">[% managedby_loo.desc | html %]</option>[% END %][% END %]
789                                                                      </select></li>
790                     <li>
791                         <label for="manageddate_from">Management date from:</label>
792                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from | html %]" />
793                     </li>
794                     <li>
795                         <label for="manageddate_to">To:</label>
796                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to | html %]" />
797                     </li>
798                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
799 [% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code | html %]" selected="selected">[% acceptedby_loo.desc | html %]</option>[% ELSE %]<option value="[% acceptedby_loo.code | html %]">[% acceptedby_loo.desc | html %]</option>[% END %][% END %]
800                                                       </select></li>
801                     <li>
802                         <label for="accepteddate_from">Accepted date from:</label>
803                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from | html %]" />
804                     </li>
805                     <li>
806                         <label for="accepteddate_to">To:</label>
807                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" />
808                     </li>
809                     <li><input type="submit" value="Go" /></li></ol>
810                 </fieldset>
811
812                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
813                     <ol><li><label for="budgetid"> Book fund:</label>
814                     <select name="budgetid" id="budgetid">
815                       <option value="__ANY__">Any</option>
816                       [% IF budgetid == '__NONE__' %]
817                           <option value="__NONE__" selected="selected">None</option>
818                       [% ELSE %]
819                           <option value="__NONE__">None</option>
820                       [% END %]
821                     [% FOREACH budgetsloo IN budgetsloop %]
822                         [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>[% END %]
823                         [% END %]
824                     </select></li>
825                     <li><label for="branchcode">Library:</label>
826                     <select name="branchcode" id="branchcode">
827                         <option value="__ANY__">Any</option>
828                         [% IF branchfilter %]
829                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
830                         [% ELSE %]
831                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
832                         [% END %]
833                     </select></li><li><input type="submit" value="Go" /></li></ol>
834                 </fieldset>
835             </form>
836         [% INCLUDE 'acquisitions-menu.inc' %]
837
838             </aside>
839         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
840      </div> <!-- /.row -->
841
842     [% END %]
843     [% END %]
844 </div>
845 [% END %]
846
847 [% MACRO jsinclude BLOCK %]
848     [% INCLUDE 'calendar.inc' %]
849     [% IF ( op == 'show' || op_else ) %]
850         <script>
851             $(document).ready(function(){
852                 $(".deletesuggestion").on("click",function(){
853                     return confirm(_("Are you sure you want to delete this suggestion?"));
854                 });
855             });
856         </script>
857     [% END %]
858     [% IF ( op_else ) %]
859         [% INCLUDE 'datatables.inc' %]
860         [% INCLUDE 'columns_settings.inc' %]
861         [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
862
863         <script>
864             $(document).ready(function() {
865                 $('#suggestiontabs').tabs();
866
867                 columns_settings = [% ColumnsSettings.GetColumns( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
868                 [% FOREACH suggestion IN suggestions %]
869                     [% IF ( suggestion.suggestions_loop ) %]
870                         KohaTable("table_[% loop.count| html %]", {
871                             "sorting": [[ 1, "asc" ]],
872                             "autoWidth": false,
873                             "columnDefs": [
874                                 { "sortable": false, "searchable": false, 'targets': [ 'NoSort' ] },
875                                 { "sType": "anti-the", "aTargets" : [ "anti-the" ] },
876                             ]
877                         }, columns_settings );
878                     [% END %]
879                 [% END %]
880
881                 $(".checkall").click(function(e){
882                     e.preventDefault();
883                     $(this).parents('form').checkCheckboxes();
884                     return false;
885                 });
886                 $(".uncheckall").click(function(e){
887                     e.preventDefault();
888                     $(this).parents('form').unCheckCheckboxes();
889                     return false;
890                 });
891                 $(".other_reason").hide();
892                 $("select[name='reason']").change(function(){
893                     if($(this).val() == "other"){
894                         $(this).hide();
895                         $(this).siblings(".other_reason").show();
896                     }
897                 });
898
899                 $("a.cancel_note").click(function(e) {
900                     $(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected");
901                     $(this).siblings("input[name='other_reason']").hide();
902                     e.preventDefault();
903                 });
904                 $("h4.local_collapse a").click(function(){
905                     $(this).parent().parent().find("ol").toggle();
906                     return false;
907                 });
908                 // http://jqueryui.com/demos/datepicker/#date-range
909                 var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
910                     changeMonth: true,
911                     numberOfMonths: 1,
912                     onSelect: function( selectedDate ) {
913                         var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
914                             instance = $( this ).data( "datepicker" );
915                             date = $.datepicker.parseDate(
916                                 instance.settings.dateFormat ||
917                                 $.datepicker._defaults.dateFormat,
918                                 selectedDate, instance.settings );
919                         dates.not( this ).datepicker( "option", option, date );
920                     }
921                 });
922                 var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
923                     changeMonth: true,
924                     numberOfMonths: 1,
925                     onSelect: function( selectedDate ) {
926                         var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
927                             instance = $( this ).data( "datepicker" );
928                             date = $.datepicker.parseDate(
929                                 instance.settings.dateFormat ||
930                                 $.datepicker._defaults.dateFormat,
931                                 selectedDate, instance.settings );
932                         datesMD.not( this ).datepicker( "option", option, date );
933                     }
934                 });
935                 var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
936                     changeMonth: true,
937                     numberOfMonths: 1,
938                     onSelect: function( selectedDate ) {
939                         var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
940                             instance = $( this ).data( "datepicker" );
941                             date = $.datepicker.parseDate(
942                                 instance.settings.dateFormat ||
943                                 $.datepicker._defaults.dateFormat,
944                                 selectedDate, instance.settings );
945                         datesAD.not( this ).datepicker( "option", option, date );
946                     }
947                 });
948
949                 $("button[type='submit']").on("click", function(e) {
950                     var form = $(this).parents("form");
951                     var action = $(this).val();
952                     var selected_suggestions = $(form).find("input[name='suggestionid']:checked");
953                     if ( selected_suggestions.length == 0 ) {
954                         alert(_("Please select at least one suggestion"));
955                         e.preventDefault();
956                         return false;
957                     }
958                     if ( action == "delete" ) {
959                         if ( selected_suggestions.length == 1 ) {
960                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
961                                 e.preventDefault();
962                                 return false;
963                             }
964                         } else if ( selected_suggestions.length > 1 ) {
965                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
966                                 e.preventDefault();
967                                 return false;
968                             }
969                         }
970                     }
971
972                     $('<input />').attr('type', 'hidden')
973                                   .attr('name', "op")
974                                   .attr('value', action)
975                                   .appendTo(form);
976                     return true;
977                 });
978             });
979         </script>
980     [% END %]
981     [% IF ( op_save )  %]
982         <script>
983
984             function editManagerPopup() {
985                 window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
986                     'PatronPopup',
987                     'width=740,height=450,location=yes,toolbar=no,'
988                     + 'scrollbars=yes,resize=yes'
989                 );
990             }
991             function select_user(borrowernumber, borrower) {
992                 $("#managedby_name").empty();
993                 $("#managedby").val('');
994                 var borrowername = borrower.firstname + ' ' + borrower.surname;
995                 if (borrowernumber) {
996                     var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
997                         + '?borrowernumber=' + borrowernumber + '">'
998                         + borrowername + '</a>';
999                     $('#managedby_name').html(managerlink);
1000                     $('#managedby').val(borrowernumber);
1001                 }
1002             }
1003
1004             $(document).ready(function(){
1005                 calcNewsuggTotal();
1006                 $("#quantity,#price,#currency").on("change",function(){
1007                     calcNewsuggTotal();
1008                 });
1009
1010                 [% IF other_reason %]
1011                     $(".select-reason").hide();
1012                     $(".select-reason").find("option[value='other']").attr("selected","selected");
1013                     $("#other_reason").show();
1014                 [% ELSE %]
1015                     $("#other_reason").hide();
1016                 [% END %]
1017                 $(".select-reason").change(function(){
1018                     if($(this).val() == "other"){
1019                         $(this).hide();
1020                         $("#other_reason").show();
1021                     }
1022                 });
1023                 $("a[href*=back]").click(function(){
1024                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
1025                     $("#other_reason").hide();
1026                 });
1027
1028                 $("#edit_manager").on("click",function(e){
1029                     e.preventDefault();
1030                     editManagerPopup();
1031                 });
1032                 $("#restore_previous_manager").on("click",function(e){
1033                     e.preventDefault();
1034
1035                     $("#managedby_name").empty();
1036                     $("#managedby").val('');
1037                     var borrowername = "[% managedby_firstname | html %] [% managedby_surname | html %]";
1038                     var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1039                         + '?borrowernumber=[% managedby_borrowernumber | html %]">'
1040                         + borrowername + '</a>';
1041                     $('#managedby_name').html(managerlink);
1042                     $('#managedby').val([% managedby_borrowernumber | html %]);
1043                 });
1044             });
1045         </script>
1046     [% END %]
1047     [% Asset.js("js/acq.js") | $raw %]
1048     [% Asset.js("js/acquisitions-menu.js") | $raw %]
1049 [% END %]
1050
1051 [% INCLUDE 'intranet-bottom.inc' %]