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