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