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