Bug 30510: Add Patron reason column to suggestion tables
[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>
12     [% IF op == 'save' %]
13         [% IF ( suggestionid ) %]
14             Edit suggestion #[% suggestionid | html %] &rsaquo; Suggestions
15         [% ELSE %]
16             Add suggestion &rsaquo; Suggestions
17         [% END %]
18
19     [% ELSIF ( op == 'show' ) %]
20            Show suggestion #[% suggestionid | html %] &rsaquo; Suggestions
21
22     [% ELSE %]
23         Suggestions management
24     [% END %] &rsaquo; Acquisitions &rsaquo; Koha
25 </title>
26 [% INCLUDE 'doc-head-close.inc' %]
27 [% IF op == 'else' %]
28     [% FILTER collapse %]
29         <style>
30             h4.local_collapse a {
31                 font-size: 80%;
32                 text-decoration: none;
33             }
34             fieldset.brief ol {
35                 display: none;
36             }
37             .overlay {
38                 background: #eeffd4;
39                 color: #000;
40                 display: none;
41                 left: 50%;
42                 margin-left: -100px;
43                 margin-top: -10px;
44                 padding: .5em;
45                 position: absolute;
46                 text-align: center;
47                 top: 180px;
48                 width: 200px;
49             }
50         </style>
51     [% END %]
52 [% END %]
53 </head>
54
55 <body id="acq_suggestion" class="acq">
56     [% INCLUDE 'header.inc' %]
57     [% INCLUDE 'cat-search.inc' %]
58
59     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
60         <ol>
61             <li>
62                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
63             </li>
64             <li>
65                 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
66             </li>
67
68             [% IF op == 'save' %]
69                 [% IF ( suggestionid ) %]
70                     <li>
71                         <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a>
72                     </li>
73                     <li>
74                         <a href="#" aria-current="page">
75                             Edit suggestion #[% suggestionid | html %]
76                         </a>
77                     </li>
78                 [% ELSE %]
79                     <li>
80                         <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a>
81                     </li>
82                     <li>
83                         <a href="#" aria-current="page">
84                             Add suggestion
85                         </a>
86                     </li>
87                 [% END %]
88             [% ELSIF ( op == 'show' ) %]
89                 <li>
90                     <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a>
91                 </li>
92                 <li>
93                     <a href="#" aria-current="page">
94                         Show suggestion #[% suggestionid | html %]
95                     </a>
96                 </li>
97             [% ELSE %]
98                 <li>
99                     <a href="#" aria-current="page">
100                         Suggestions management
101                     </a>
102                 </li>
103             [% END %]
104         </ol>
105     </nav> <!-- /.breadcrumbs -->
106
107     [% IF ( op == 'show' ) %]
108         <div class="main container-fluid">
109             <div class="row">
110                 <div class="col-md-8 col-md-offset-2">
111
112                     <div id="toolbar" class="btn-toolbar">
113                         <a class="btn btn-default" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a>
114                         <a class="btn btn-default deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
115                     </div>
116
117                     <fieldset class="rows">
118                         <legend>Bibliographic information</legend>
119                             <ol>
120                                 [% IF ( title ) %]
121                                     <li>
122                                         <span class="label">Title:</span>
123                                         [% IF suggestion.biblionumber %]
124                                             <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% suggestion.biblionumber | uri %]">[% suggestion.title | html %]</a>
125                                         [% ELSE %]
126                                             [% title | html %]
127                                         [% END %]
128                                     </li>
129                                 [% END %]
130                                 [% IF ( author ) %]
131                                 <li>
132                                     <span class="label">Author:</span>
133                                     [% author | html %]
134                                 </li>
135                             [% END %]
136                             [% IF ( copyrightdate ) %]
137                                 <li>
138                                     <span class="label">Copyright date:</span>
139                                     [% copyrightdate | html %]
140                                 </li>
141                             [% END %]
142                             [% IF ( isbn ) %]
143                                 <li>
144                                     <span class="label">ISBN or ISSN or other standard number:</span>
145                                     [% isbn | html %]
146                                 </li>
147                             [% END %]
148                             [% IF ( publishercode ) %]
149                                 <li>
150                                     <span class="label">Publisher:</span>
151                                     [% publishercode | html %]
152                                 </li>
153                             [% END %]
154                             [% IF ( place ) %]
155                                 <li>
156                                     <span class="label">Publication place:</span>
157                                     [% place | html %]
158                                 </li>
159                             [% END %]
160                             [% IF ( collectiontitle ) %]
161                                 <li>
162                                     <span class="label">Collection title:</span>
163                                     [% collectiontitle | html %]
164                                 </li>
165                             [% END %]
166                             [% IF ( itemtype ) %]
167                                 <li>
168                                     <span class="label">Document type:</span>
169                                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
170                                 </li>
171                             [% END %]
172                             [% IF ( patron_reason_loop ) %]
173                                 <li>
174                                     <span class="label">Reason for suggestion: </span>
175                                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
176                                         [% IF patron_reason_loo.authorised_value == patronreason %]
177                                             [% patron_reason_loo.lib | html %]
178                                         [% END %]
179                                     [% END %]
180                                 </li>
181                             [% END %]
182                             [% IF ( note ) %]
183                                 <li>
184                                     <span class="label">Notes:</span>
185                                     [% note | html %]
186                                 </li>
187                             [% END %]
188                         </ol>
189                     </fieldset>
190
191                     <fieldset class="rows">
192                         <legend>Suggestion management</legend>
193                         <ol>
194                             <li>
195                                 <span class="label">Status:</span>
196                                 [% SET status_found = 0 %]
197                                 [% IF ( STATUS == 'ASKED' ) %]
198                                     <span>Pending</span>
199                                     [% SET status_found = 1 %]
200                                 [% ELSIF ( STATUS == 'ACCEPTED' ) %]
201                                     <span>Accepted</span>
202                                     [% SET status_found = 1 %]
203                                 [% ELSIF ( STATUS == 'CHECKED' ) %]
204                                     <span>Checked</span>
205                                     [% SET status_found = 1 %]
206                                 [% ELSIF ( STATUS == 'REJECTED' ) %]
207                                     <span>Rejected</span>
208                                     [% SET status_found = 1 %]
209                                 [% ELSIF ( STATUS == 'ORDERED' ) %]
210                                     <span>Ordered</span>
211                                     [% SET status_found = 1 %]
212                                 [% ELSIF ( STATUS == 'AVAILABLE' ) %]
213                                     <span>Available</span>
214                                     [% SET status_found = 1 %]
215                                 [% ELSE %]
216                                     [% FOREACH s IN SuggestionStatuses %]
217                                         [% IF STATUS == s.authorised_value %]
218                                             [% s.lib | html %]
219                                             [% SET status_found = 1 %]
220                                         [% END %]
221                                     [% END %]
222                                 [% END %]
223                             </li>
224                             <li>
225                                 <span class="label">Reason:</span>
226                                 [% IF ( reason ) %]
227                                     [% AuthorisedValues.GetByCode( 'SUGGEST', reason, 0 ) | html %]
228                                 [% END %]
229                             </li>
230                         </ol>
231
232                         <table>
233                             <thead>
234                                 <tr>
235                                     <th>&nbsp;</th>
236                                     <th>Date</th>
237                                     <th>By</th>
238                                 </tr>
239                             </thead>
240                             <tbody>
241                                 <tr>
242                                     <th>[% tp('purchase suggestion created by', 'Created by:') | html %]</th>
243                                     <td>[% suggesteddate | $KohaDates %]</td>
244                                     <td>
245                                         [% IF ( suggestedby_patron.borrowernumber ) %]
246                                             <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>
247                                             [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])
248                                         [% END %]
249                                     </td>
250                                 </tr>
251                                 <tr>
252                                     <th>Managed by:</th>
253                                     <td>[% manageddate | $KohaDates %]</td>
254                                     <td>
255                                         [% IF ( managedby_patron.borrowernumber ) %]
256                                             <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>
257                                             [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %])
258                                         [% END %]
259                                     </td>
260                                 </tr>
261                                 <tr>
262                                     <th>Accepted on:</th>
263                                     <td>[% accepteddate | $KohaDates %]</td>
264                                     <td>
265                                         [% IF ( acceptedby_patron.borrowernumber ) %]
266                                             <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>
267                                             [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
268                                         [% END %]
269                                     </td>
270                                 </tr>
271                                 <tr>
272                                     <th>Last modification on:</th>
273                                     <td>[% lastmodificationdate | $KohaDates %]</td>
274                                     <td>
275                                         [% IF ( lastmodificationby_patron.borrowernumber ) %]
276                                             <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>
277                                             [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
278                                         [% END %]
279                                     </td>
280                                 </tr>
281                             </tbody>
282                         </table>
283                     </fieldset>
284
285                     <fieldset class="rows">
286                         <legend>Acquisition information</legend>
287                         <ol>
288                             <li>
289                                 <span class="label">Library:</span>
290                                 [% Branches.GetName( branchcode ) | html %]
291                             </li>
292                             <li>
293                                 <span class="label">Fund:</span>
294                                 [% budgetname | html %]
295                             </li>
296                             <li>
297                                 <span class="label">Copies:</span>
298                                 [% quantity | html %]
299                             </li>
300                             <li>
301                                 <span class="label">Currency:</span>
302                                 [% currency | html %]
303                             </li>
304                             <li>
305                                 <span class="label">Price:</span>
306                                 [% price | $Price %]
307                             </li>
308                             <li>
309                                 <span class="label">Total</span>
310                                 [% total | $Price %]
311                             </li>
312                         </ol>
313                     </fieldset>
314
315                     <fieldset class="action">
316                         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
317                     </fieldset>
318
319                 </div> <!-- /.col-md-8 col-md-offset-2 -->
320             </div> <!-- /.row -->
321     [% ELSE # IF op == "show" %]
322
323         [% IF op == 'save' %]
324             <div class="main container-fluid">
325                 <div class="row">
326                     <div class="col-md-8 col-md-offset-2">
327         [% ELSE %]
328             <div class="main container-fluid">
329                 <div class="row">
330                     <div class="col-sm-10 col-sm-push-2">
331         [% END %]
332
333         [% IF op == 'save' %]
334             [% FOR m IN messages %]
335                 <div class="dialog [% m.type | html %]">
336                     [% SWITCH m.code %]
337                     [% CASE 'biblio_exists' %]
338                         <span>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.</span>
339                     [%  CASE 'manager_not_enough_permissions' %]
340                         <span>The manager you selected does not have sufficient permissions.</span>
341                     [% CASE %]
342                         <span>[% m.code | html %]</span>
343                     [% END %]
344                 </div> <!-- /.dialog -->
345             [% END %]
346
347             <form id="add_edit" action="suggestion.pl" method="post" class="validated">
348                 <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
349                 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
350                 [% IF ( suggestionid ) %]
351                     <h1>Edit purchase suggestion #[% suggestionid | html %]</h1>
352                     <input type="hidden" name="suggestionid" value="[% suggestionid | html %]"/>
353                 [% ELSE %]
354                     <h1>Enter a new purchase suggestion</h1>
355                 [% END %]
356
357                 <fieldset class="rows">
358                     <legend>Bibliographic information</legend>
359                     <ol>
360                         <li>
361                             <label for="title" class="required">Title:</label>
362                             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title | html %]" required="required" class="required" />
363                             <span class="required">Required</span>
364                         </li>
365                         <li>
366                             <label for="author">Author:</label>
367                             <input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/>
368                         </li>
369                         <li>
370                             <label for="copyrightdate">Copyright date:</label>
371                             <input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" />
372                         </li>
373                         <li>
374                             <label for="isbn">ISBN or ISSN or other standard number:</label>
375                             <input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]"/>
376                         </li>
377                         <li>
378                             <label for="publishercode">Publisher:</label>
379                             <input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/>
380                         </li>
381                         <li>
382                             <label for="place">Publication place:</label>
383                             <input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/>
384                         </li>
385                         <li>
386                             <label for="collectiontitle">Collection title:</label>
387                             <input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/>
388                         </li>
389                         <li>
390                             <label for="itemtype">Document type:</label>
391                             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
392                         </li>
393                         [% IF patron_reason_loop %]
394                             <li>
395                                 <label for="patronreason">Reason for suggestion: </label>
396                                 <select name="patronreason" id="patronreason">
397                                     <option value=""> -- Choose -- </option>
398                                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
399                                         [% IF patron_reason_loo.authorised_value == patronreason %]
400                                             <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
401                                         [% ELSE %]
402                                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
403                                         [% END %]
404                                     [% END %]
405                                 </select>
406                             </li>
407                         [% END # /IF patron_reason_loop %]
408                         <li>
409                             <label for="note">Notes:</label>
410                             <textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea>
411                         </li>
412                     </ol>
413                 </fieldset>
414
415                 <fieldset class="rows">
416                     <legend>Suggestion management</legend>
417                     <ol>
418                         [% IF ( suggestionid ) %]
419                             <li>
420                                 <label for="STATUS">Status:</label>
421                                 <select id="STATUS" name="STATUS">
422                                     <option value="">No status</option>
423
424                                     [% IF (statusselected_ASKED ) %]
425                                         <option value="ASKED" selected="selected">Pending</option>
426                                     [% ELSE %]
427                                         <option value="ASKED">Pending</option>
428                                     [% END %]
429
430                                     [% IF (statusselected_ACCEPTED ) %]
431                                         <option value="ACCEPTED" selected="selected">Accepted</option>
432                                     [% ELSE %]
433                                         <option value="ACCEPTED">Accepted</option>
434                                     [% END %]
435
436                                     [% IF (statusselected_CHECKED ) %]
437                                         <option value="CHECKED" selected="selected">Checked</option>
438                                     [% ELSE %]
439                                         <option value="CHECKED">Checked</option>
440                                     [% END %]
441
442                                     [% IF ( statusselected_REJECTED ) %]
443                                         <option value="REJECTED" selected="selected">Rejected</option>
444                                     [% ELSE %]
445                                         <option value="REJECTED">Rejected</option>
446                                     [% END %]
447
448                                     [% IF ( statusselected_ORDERED ) %]
449                                         <option value="ORDERED" selected="selected">Ordered</option>
450                                     [% ELSE %]
451                                         <option value="ORDERED">Ordered</option>
452                                     [% END %]
453
454                                     [% FOREACH s IN SuggestionStatuses %]
455                                         [% IF s.authorised_value == suggestion.STATUS %]
456                                             <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
457                                         [% ELSE %]
458                                             <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
459                                         [% END %]
460                                     [% END %]
461                                 </select>
462                             </li>
463                             <li>
464                                 <label for="reason">Reason:</label>
465                                 <select class="select-reason" id="reason" name="reason">
466                                     <option value=""> -- Choose a reason -- </option>
467                                     [% FOREACH reasonsloo IN suggestion.reasonsloop %]
468                                         [% IF (reasonsloo.lib == suggestion.reason) %]
469                                             <option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
470                                         [% ELSE %]
471                                             <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
472                                         [% END %]
473                                     [% END %]
474                                     <option value="other">Others...</option>
475                                 </select>
476
477                                 <span id="other_reason" name="other_reason">
478                                     [% IF other_reason %]
479                                         <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
480                                     [% ELSE %]
481                                         <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
482                                     [% END %]
483                                     <a href="#back">Cancel</a>
484                                 </span>
485                             </li>
486                         [% END %]
487                         <li>
488                             <table>
489                                 <thead>
490                                     <tr>
491                                         <th>&nbsp;</th>
492                                         <th>Date</th>
493                                         <th>By</th>
494                                         <th>Action</th>
495                                     </tr>
496                                 </thead>
497                                 <tbody>
498                                     <tr>
499                                         <th>
500                                             <label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label>
501                                         </th>
502                                         <td>
503                                             <input type="text" id="suggesteddate" name="suggesteddate" class="flatpickr" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/> [% INCLUDE 'date-format.inc' %]
504                                         </td>
505                                         <td id="tdsuggestedby">
506                                             <input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>
507                                             [% IF ( suggestedby_patron.borrowernumber ) %]
508                                                 <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 %])
509                                             [% END %]
510                                         </td>
511                                         <td>
512                                             <a href="#" id="edit_suggester" class="btn btn-default">Set to patron</a>
513                                         </td>
514                                     </tr>
515                                     <tr>
516                                         <th>
517                                             <label for="accepteddate">Accepted on:</label>
518                                         </th>
519                                         <td>
520                                             <input type="text" id="accepteddate" name="accepteddate" class="flatpickr" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
521                                         </td>
522                                         <td>
523                                             <input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>
524                                             [% IF ( acceptedby_patron.borrowernumber ) %]
525                                                 <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>
526                                                 [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])
527                                             [% END %]
528                                         </td>
529                                         <td></td>
530                                     </tr>
531                                     <tr>
532                                         <th>
533                                             <label for="lastmodificationdate">Last modification on:</label>
534                                         </th>
535                                         <td>
536                                             [% lastmodificationdate | $KohaDates %]
537                                         </td>
538                                         <td>
539                                             [% IF lastmodificationby_patron %]
540                                                 [% INCLUDE 'patron-title.inc' patron=lastmodificationby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( lastmodificationby_patron.branchcode ) | html %] ([% lastmodificationby_patron.category.description | html %])
541                                             [% END %]
542                                         </td>
543                                         <td></td>
544                                     </tr>
545                                 </tbody>
546                             </table>
547                         </li>
548                         <li>
549                             <label for="managedon">Managed on:</label>
550                             <input type="text" id="managedon" name="manageddate" class="flatpickr" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]
551                         </li>
552                         <li>
553                             <label for="managedby_name">by:</label>
554                             <div>
555                                 <span id="managedby_name" name="managedby_name">
556                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% logged_in_user.borrowernumber | uri %]">You</a>
557                                 </span>
558                                 [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
559                                     | 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 %])
560                                 [% END %]
561                                 <br />
562                                 <a id="edit_manager" class="new_window" href="#"><i class="fa fa-search"></i> Select manager</a>
563                                 [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %]
564                                     <a id="restore_previous_manager" href="#"><i class="fa fa-trash"></i> Keep existing manager</a>
565                                 [% END %]
566                                 <input type="hidden" name="managedby" id="managedby" value="[% logged_in_user.borrowernumber | html %]" />
567
568                                 <br/>
569                                 <label for="notify">Notify manager:</label>
570                                 <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." />
571                             </div> <!-- /div -->
572                         </li>
573                     </ol>
574                 </fieldset>
575
576                 <fieldset class="rows">
577                     <legend>Acquisition information</legend>
578                     <ol>
579                         <li>
580                             <label for="branchcode">Library:</label>
581                             <select name="branchcode" id="branchcode">
582                                 <option value="">Any</option>
583                                 [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
584                             </select>
585                         </li>
586                         <li>
587                             <label for="budgetid">Fund:</label>
588                             <select name="budgetid" id="budgetid">
589                                 <option value="">Any</option>
590                                 [% FOREACH budget IN sugg_budgets %]
591                                     [% IF ( budget.selected ) %]
592                                         <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
593                                     [% ELSIF ( budget.b_active ) %]
594                                         <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
595                                     [% ELSE %]
596                                         <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
597                                     [% END %]
598                                 [% END %]
599                             </select>
600                             <label for="showallfunds" style="float:none;width:auto;">&nbsp;Show inactive:</label>
601                             <input type="checkbox" id="showallfunds" />
602                         </li>
603                         <li>
604                             <label for="quantity">Copies:</label>
605                             <input type="text" size="10" id="quantity" name="quantity" value="[% quantity | html %]" />
606                         </li>
607                         <li>
608                             <label for="currency">Currency:</label>
609                             [% FOREACH c IN currencies %]
610                                 <input type="hidden" value="[% c.rate | html %]" id="currency_rate_[% c.currency | html %]" name="currency_rate_[% c.currency | html %]" />
611                                 <input type="hidden" id="[% c.currency | html %]" name="[% c.currency | html %]" value="[% c.rate | html %]" />
612                             [% END %]
613                             <select name="currency" id="currency">
614                                 [% FOREACH c IN currencies %]
615                                     [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
616                                         <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
617                                     [% ELSIF not c.archived %]
618                                         <option value="[% c.currency | html %]">[% c.currency | html %]</option>
619                                     [% END %]
620                                 [% END %]
621                             </select>
622                         </li>
623                         <li>
624                             <label for="price">Price:</label>
625                             <input type="text" size="20" name="price" id="price" value="[% price | html %]" />
626                         </li>
627                         <li>
628                             <label for="total">Total: </label>
629                             <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]"/>
630                         </li>
631                     </ol>
632                 </fieldset> <!-- /.rows -->
633
634                 <input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]noone[% END %]"/>
635
636                 <fieldset class="action">
637                     <input type="hidden" name="op" value="[% op | html %]" />
638                     [% IF ( suggestionid ) %]
639                         [% IF ( need_confirm ) %]
640                             <input type="hidden" name="save_confirmed" value="1" />
641                             <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
642                         [% ELSE %]
643                             <input type="submit" value="Save" />
644                         [% END %]
645                         <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby | uri %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>
646                     [% ELSE %]
647                         [% IF ( need_confirm ) %]
648                             <input type="hidden" name="save_confirmed" value="1" />
649                             <input onclick="this.form.op.value = 'save'; this.form.submit();" type="submit" value="Confirm your suggestion" />
650                         [% ELSE %]
651                             <input type="submit" value="Submit your suggestion" />
652                         [% END %]
653                         <a class="cancel" href="suggestion.pl">Cancel</a>
654                     [% END %]
655                 </fieldset> <!-- /.action -->
656             </form> <!-- /#add_edit -->
657         [% END # /IF op == 'save' %]
658
659         [% IF op == 'else' %]
660             <div id="toolbar" class="btn-toolbar">
661                 <a class="btn btn-default" id="newsuggestion" href="suggestion.pl?op=add&branchcode=[% branchcode | uri %]"><i class="fa fa-plus"></i> New purchase suggestion</a>
662             </div>
663
664             <h1>Suggestions management</h1>
665
666             [% IF ( displayby != "branchcode" ) %]
667                 <label for="branchcode">Viewing suggestions for library:</label>
668                 <select name="branchcode" id="branchcode">
669                     <option value="__ANY__">Any</option>
670                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter || branchcode ) %]
671                 </select>
672             [% END %]
673
674             [% FOR m IN messages %]
675                 <div class="dialog [% m.type | html %]">
676                     [% SWITCH m.code %]
677                     [% CASE 'already_exists' %]
678                         <span>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>)</span>
679                     [% CASE 'biblio_exists' %]
680                         <span>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.</span>
681                     [% CASE %]
682                         <span>[% m.code | html %]</span>
683                     [% END %]
684                 </div> <!-- /.dialog -->
685             [% END # /FOR m %]
686
687             [% UNLESS ( notabs ) %]
688                 <div id="suggestiontabs" class="toptabs">
689                     <ul class="nav nav-tabs" role="tablist">
690                         [% FOREACH suggestion IN suggestions %]
691                             <li role="presentation">
692                             <a href="#[% suggestion.suggestiontype | uri %]" aria-controls="[% suggestion.suggestiontype | uri %]" role="tab" data-toggle="tab">
693                             [% IF ( suggestion.suggestiontypelabel ) %]
694                                 [% IF (suggestion.suggestiontypelabel == "Pending") %]<span>Pending</span>
695                                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]<span>Accepted</span>
696                                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]<span>Checked</span>
697                                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]<span>Rejected</span>
698                                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]<span>Available</span>
699                                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]<span>Ordered</span>
700                                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]<span>Status unknown</span>
701                                 [% ELSIF (suggestion.suggestiontypelabel == "__ANY__") %]<span>Any</span>
702                                 [% ELSE %][% suggestion.suggestiontypelabel | html %][% END %]
703                             [% ELSE %]
704                                 [% IF ( suggestion.suggestiontype ) %]
705                                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) | html %]
706                                 [% ELSE %]
707                                     <span>No name</span>
708                                 [% END %]
709                             [% END %]
710                             ([% suggestion.suggestions_loop.size | html %])
711                             </a>
712                             </li>
713                         [% END # /FOREACH suggestion %]
714                     </ul> <!-- /.ui-tabs-nav -->
715                     <div class="tab-content">
716             [% END # /UNLESS notabs %]
717
718                 [% FOREACH suggestion IN suggestions %]
719                     <div id="[% suggestion.suggestiontype | html %]" role="tabpanel" class="tab-pane">
720                         <form class="update_suggestions" name="f" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype| uri %]">
721
722                             [% IF ( suggestion.suggestions_loop ) %]
723                                 <p>
724                                     <a class="checkall" href="#">Check all</a> | <a class="uncheckall" href="#">Uncheck all</a>
725                                 </p>
726
727                                 <table id="table_[% loop.count | html %]" class="sorted">
728                                     <thead>
729                                         <tr>
730                                             <th class="NoSort noExport">&nbsp;</th>
731                                             <th class="anti-the">Suggestion</th>
732                                             <th>Suggested by</th>
733                                             <th>Suggested on</th>
734                                             <th>Patron reason</th>
735                                             <th>Managed by</th>
736                                             <th>Managed on</th>
737                                             <th>Last modification by</th>
738                                             <th>Last modification on</th>
739                                             <th>Last updated</th>
740                                             <th>Library</th>
741                                             <th>Fund</th>
742                                             <th>Status</th>
743                                             <th class="NoSort noExport">&nbsp;</th>
744                                         </tr>
745                                     </thead>
746                                     <tbody>
747                                         [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
748                                             <tr>
749                                                 <td>
750                                                     <input type="checkbox" name="suggestionid" value="[% suggestions_loo.suggestionid | html %]" />
751                                                 </td>
752                                                 <td>
753                                                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&amp;op=show" title="suggestion" >
754                                                         [% suggestions_loo.title | html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author | html %][% END %]
755                                                     </a>
756                                                     <br />
757                                                     [% IF ( suggestions_loo.copyrightdate ) %]
758                                                         &copy; <span class="suggestion_copyrightdate">[% suggestions_loo.copyrightdate | html %]</span>
759                                                     [% END %]
760                                                     [% IF ( suggestions_loo.volumedesc ) %]
761                                                         ; <span class="suggestion_volume">Volume:<em>[% suggestions_loo.volumedesc | html %]</em></span>
762                                                     [% END %]
763                                                     [% IF ( suggestions_loo.isbn ) %]
764                                                         ; <span class="suggestion_isbn">ISBN: <em>[% suggestions_loo.isbn | html %]</em></span>
765                                                     [% END %]
766                                                     [% IF ( suggestions_loo.publishercode ) %]
767                                                         ; <span class="suggestion_publishercode">Published by [% suggestions_loo.publishercode | html %]</span>
768                                                     [% END %]
769                                                     [% IF ( suggestions_loo.publicationyear ) %]
770                                                         in <span class="suggestion_publicationyear"><em>[% suggestions_loo.publicationyear | html %]</em></span>
771                                                     [% END %]
772                                                     [% IF ( suggestions_loo.place ) %]
773                                                         in <span class="suggestion_place"><em>[% suggestions_loo.place | html %]</em></span>
774                                                     [% END %]
775                                                     [% IF ( suggestions_loo.collectiontitle ) %]
776                                                         ; <span class="suggestion_collectiontitle">[% suggestions_loo.collectiontitle | html %]</span>
777                                                     [% END %]
778                                                     [% IF ( suggestions_loo.itemtype ) %]
779                                                         ; <span class="suggestion_itype">[% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %]</span>
780                                                     [% END %]
781                                                     <br />
782                                                     [% IF ( suggestions_loo.note ) %]
783                                                         <div class="suggestion_note"><i class="fa fa-comment"></i> [% suggestions_loo.note | html %]</div>
784                                                     [% END %]
785                                                     [% IF suggestions_loo.archived %]
786                                                         <br /><i class="fa fa-archive"></i> Archived
787                                                     [% END %]
788                                                 </td>
789                                                 <td>
790                                                     <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>
791                                                 </td>
792                                                 <td data-order="[% suggestions_loo.suggesteddate | html %]">
793                                                     [% IF ( suggestions_loo.suggesteddate ) %][% suggestions_loo.suggesteddate | $KohaDates %][% END %]
794                                                 </td>
795                                                 <td>[% AuthorisedValues.GetByCode( 'OPAC_SUG', suggestions_loo.patronreason ) | html %]</td>
796                                                 <td>
797                                                     <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>
798                                                 </td>
799                                                 <td data-order="[% suggestions_loo.manageddate | html %]">
800                                                     [% IF ( suggestions_loo.manageddate ) %][% suggestions_loo.manageddate | $KohaDates %][% END %]
801                                                 </td>
802                                                 <td>
803                                                     <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>
804                                                 </td>
805                                                 <td data-order="[% suggestions_loo.lastmodificationdate | html %]">
806                                                     [% IF ( suggestions_loo.lastmodificationdate ) %][% suggestions_loo.lastmodificationdate | $KohaDates %][% END %]
807                                                 </td>
808                                                 <td>
809                                                     [% suggestions_loo.date | $KohaDates %]
810                                                 </td>
811                                                 <td>
812                                                     [% Branches.GetName( suggestions_loo.branchcode ) | html %]
813                                                 </td>
814                                                 <td>
815                                                     [% suggestions_loo.budget_name | html %]
816                                                 </td>
817                                                 <td>
818                                                     [% IF ( suggestions_loo.ASKED ) %]
819                                                         Pending
820                                                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
821                                                         Accepted
822                                                     [% ELSIF ( suggestions_loo.ORDERED ) %]
823                                                         Ordered
824                                                     [% ELSIF ( suggestions_loo.REJECTED ) %]
825                                                         Rejected
826                                                     [% ELSIF ( suggestions_loo.CHECKED ) %]
827                                                         Checked
828                                                     [% ELSIF ( suggestions_loo.AVAILABLE ) %]
829                                                         Available
830                                                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
831                                                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) | html %]
832                                                     [% ELSE %]
833                                                         Status unknown
834                                                     [% END %]
835
836                                                     [% IF ( suggestions_loo.reason ) %]
837                                                         <br />([% suggestions_loo.reason | html %])
838                                                     [% END %]
839                                                 </td>
840                                                 <td class="actions">
841                                                     <div class="btn-group dropup">
842                                                         <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>
843                                                         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="more_actions_[% suggestions_loo.suggestionid | html %]">
844                                                             <li><a class="deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a></li>
845                                                             [% UNLESS suggestions_loo.archived %]
846                                                                 <li><a class="archivesuggestion" href="suggestion.pl?op=archive&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Archive</a></li>
847                                                             [% ELSE %]
848                                                                 <li><a class="unarchivesuggestion" href="suggestion.pl?op=unarchive&amp;suggestionid=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-archive"></i> Unarchive</a></li>
849                                                             [% END %]
850                                                         </ul>
851                                                     </div>
852                                                 </td>
853                                             </tr>
854                                         [% END # /FOREACH suggestions_loo %]
855                                     </tbody>
856                                 </table> <!-- /#table_[% loop.count | html %] -->
857
858                                 <div class="row">
859                                     <h2 style="padding-left:1em;">Change selected suggestions</h2>
860                                     <div class="col-sm-4">
861                                         <fieldset>
862                                             <div id="select-reason[% loop.index | html %]">
863                                                 <label for="STATUSreason[% loop.index | html %]">Mark selected as: </label>
864                                                 <select name="STATUS" id="STATUSreason[% loop.index | html %]">
865                                                     <option value=""> -- Choose a status --</option>
866
867                                                     [% IF (statusselected_ASKED ) %]
868                                                         <option value="ASKED" selected="selected">Pending</option>
869                                                     [% ELSE %]
870                                                         <option value="ASKED">Pending</option>
871                                                     [% END %]
872
873                                                     [% IF (statusselected_ACCEPTED ) %]
874                                                         <option value="ACCEPTED" selected="selected">Accepted</option>
875                                                     [% ELSE %]
876                                                         <option value="ACCEPTED">Accepted</option>
877                                                     [% END %]
878
879                                                     [% IF (statusselected_CHECKED ) %]
880                                                         <option value="CHECKED" selected="selected">Checked</option>
881                                                     [% ELSE %]
882                                                         <option value="CHECKED">Checked</option>
883                                                     [% END %]
884
885                                                     [% IF ( statusselected_REJECTED ) %]
886                                                         <option value="REJECTED" selected="selected">Rejected</option>
887                                                     [% ELSE %]
888                                                         <option value="REJECTED">Rejected</option>
889                                                     [% END %]
890
891                                                     [% IF ( statusselected_ORDERED ) %]
892                                                         <option value="ORDERED" selected="selected">Ordered</option>
893                                                     [% ELSE %]
894                                                         <option value="ORDERED">Ordered</option>
895                                                     [% END %]
896
897                                                     [% FOREACH s IN SuggestionStatuses %]
898                                                         <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
899                                                     [% END %]
900                                                 </select>
901
902                                                 <label for="choosereason[% loop.index | html %]">with this reason:</label>
903                                                 <select name="reason" id="choosereason[% loop.index | html %]">
904                                                     <option value=""> -- Choose a reason -- </option>
905                                                     [% FOREACH reasonsloo IN suggestion.reasonsloop %]
906                                                         <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
907                                                     [% END %]
908                                                     <option value="other">Others...</option>
909                                                 </select>
910
911                                                 <span class="other_reason">
912                                                     <input type="text" size="31" name="other_reason" placeholder="please note your reason here..." />
913                                                     <a href="#" class="cancel_note">Cancel</a>
914                                                 </span>
915                                             </div>
916
917                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
918                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
919                                             <fieldset class="action">
920                                                 <button type="submit" class="btn btn-default btn-xs" value="update_status">Submit</button>
921                                             </fieldset>
922                                         </fieldset>
923                                     </div> <!-- /.col-sm-4 -->
924
925                                     <div class="col-sm-4">
926                                         <fieldset>
927                                             <label>
928                                                 Update item types with:
929                                                 [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20  %]
930                                             </label>
931                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
932                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
933                                             <fieldset class="action">
934                                                 <button type="submit" class="btn btn-default btn-xs" value="update_itemtype">Submit</button>
935                                             </fieldset>
936                                         </fieldset>
937                                     </div> <!-- /.col-sm-4 -->
938
939                                     <div class="col-sm-2">
940                                         <fieldset>
941                                             <span class="label">Update manager</span><br/>
942                                             <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>
943                                             <span id="managedby_name[% loop.count | html %]"></span>
944                                             <input type="hidden" name="suggestion_managedby" id="managedby[% loop.count | html %]" value="[% logged_in_user.borrowernumber | html %]" />
945                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
946                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
947                                             <fieldset class="action">
948                                                 <button type="submit" class="btn btn-default btn-xs" value="update_manager">Submit</button>
949                                             </fieldset>
950                                         </fieldset>
951                                     </div> <!-- /.col-sm-2 -->
952
953                                     <div class="col-sm-2">
954                                         <fieldset>
955                                             <span class="label">Delete selected</span>
956                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
957                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
958                                             <fieldset class="action">
959                                                 <button type="submit" class="btn btn-default btn-xs" value="delete">Delete</button>
960                                             </fieldset>
961                                         </fieldset>
962                                     </div> <!-- /.col-sm-2 -->
963                                     <div class="col-sm-2">
964                                         <fieldset>
965                                             <span class="label">Archive selected</span>
966                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
967                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
968                                             <fieldset class="action">
969                                                 <button type="submit" class="btn btn-default btn-xs" value="archive">Archive</button>
970                                             </fieldset>
971                                         </fieldset>
972                                     </div> <!-- /.col-sm-2 -->
973                                 </div> <!-- /.row -->
974
975                             [% ELSE %]
976                                 <strong>No results.</strong>
977                             [% END # /IF ( suggestion.suggestions_loop ) %]
978                         </form> <!-- /.update_suggestions -->
979                     </div> <!-- /#[% suggestion.suggestiontype | html %] -->
980                 [% END # /FOREACH suggestion %]
981             [% UNLESS ( notabs ) %]
982                     </div> <!-- /.tab-content -->
983                 </div> <!-- /.notabs -->
984             [% END # /UNLESS notabs %]
985         [% END # /IF op == 'else' %]
986
987         [% UNLESS op == 'save' %]
988             [% UNLESS ( op == 'show' ) %]
989                 </div> <!-- /.col-sm-10.col-sm-push-2 -->
990
991                 <div class="col-sm-2 col-sm-pull-10">
992                     <aside>
993                         <form name="suggestionfilter" action="suggestion.pl" method="get">
994                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
995                             <fieldset class="brief">
996                                 <ol style="display:block;">
997                                     <li>
998                                         <label for="displayby">Organize by: </label>
999                                         <select name="displayby" id="displayby" style="width:auto;">
1000                                             [% IF ( displayby == "STATUS" ) %]
1001                                                 <option value="STATUS" selected="selected">Status</option>
1002                                             [% ELSE %]
1003                                                 <option value="STATUS">Status</option>
1004                                             [% END %]
1005                                             [% IF ( displayby == "branchcode" ) %]
1006                                                 <option value="branchcode" selected="selected">Library</option>
1007                                             [% ELSE %]
1008                                                 <option value="branchcode">Library</option>
1009                                             [% END %]
1010                                             [% IF ( displayby == "itemtype" ) %]
1011                                                 <option value="itemtype" selected="selected">Item type</option>
1012                                             [% ELSE %]
1013                                                 <option value="itemtype">Item type</option>
1014                                             [% END %]
1015                                             [% IF ( displayby == "managedby" ) %]
1016                                                 <option value="managedby" selected="selected">Managed by</option>
1017                                             [% ELSE %]
1018                                                 <option value="managedby">Managed by</option>
1019                                             [% END %]
1020                                             [% IF ( displayby == "acceptedby" ) %]
1021                                                 <option value="acceptedby" selected="selected">Accepted by</option>
1022                                             [% ELSE %]
1023                                                 <option value="acceptedby">Accepted by</option>
1024                                             [% END %]
1025                                         </select>
1026                                         <input type="submit" value="Go" />
1027                                     </li>
1028                                 </ol>
1029                             </fieldset> <!-- /.brief -->
1030
1031                             <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
1032
1033                             <div id="limits">
1034                                 <fieldset class="brief">
1035                                     <h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
1036                                     <ol>
1037                                         <li>
1038                                             <label for="title"> Title:</label>
1039                                             <input type="text" id="title" name="title" value="[% title | html %]" />
1040                                         </li>
1041                                         <li>
1042                                             <label for="author"> Author:</label>
1043                                             <input type="text" id="author" name="author" value="[% author | html %]" />
1044                                         </li>
1045                                         <li>
1046                                             <label for="isbn"> ISBN:</label>
1047                                             <input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" />
1048                                         </li>
1049                                         <li>
1050                                             <label for="publishercode"> Publisher:</label>
1051                                             <input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" />
1052                                         </li>
1053                                         <li>
1054                                             <label for="copyrightdate_filter"> Copyright date:</label>
1055                                             <input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" />
1056                                         </li>
1057                                         <li>
1058                                             <label for="collectiontitle"> Collection title:</label>
1059                                             <input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" />
1060                                         </li>
1061                                     </ol>
1062                                 </fieldset> <!-- /.brief -->
1063
1064                                 <fieldset class="brief">
1065                                     <h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
1066                                     <ol>
1067                                         <li>
1068                                             <label for="archived" style="display: inline;">Include archived:</label>
1069                                             [% IF filter_archived %]
1070                                                 <input type="checkbox" id="archived" name="filter_archived" checked="checked" title="Include archived suggestions in the search" />
1071                                             [% ELSE %]
1072                                                 <input type="checkbox" id="archived" name="filter_archived" title="Include archived suggestions in the search" />
1073                                             [% END %]
1074                                         </li>
1075                                         <li>
1076                                             <label for="STATUS[% loop.index | html %]"> Status:</label>
1077                                             <select name="STATUS" id="STATUS[% loop.index | html %]">
1078                                                 <option value="">Any</option>
1079                                                 [% IF (statusselected_ASKED ) %]
1080                                                     <option value="ASKED" selected="selected">Pending</option>
1081                                                 [% ELSE %]
1082                                                     <option value="ASKED">Pending</option>
1083                                                 [% END %]
1084
1085                                                 [% IF (statusselected_ACCEPTED ) %]
1086                                                     <option value="ACCEPTED" selected="selected">Accepted</option>
1087                                                 [% ELSE %]
1088                                                     <option value="ACCEPTED">Accepted</option>
1089                                                 [% END %]
1090
1091                                                 [% IF (statusselected_CHECKED ) %]
1092                                                     <option value="CHECKED" selected="selected">Checked</option>
1093                                                 [% ELSE %]
1094                                                     <option value="CHECKED">Checked</option>
1095                                                 [% END %]
1096
1097                                                 [% IF ( statusselected_REJECTED ) %]
1098                                                     <option value="REJECTED" selected="selected">Rejected</option>
1099                                                 [% ELSE %]
1100                                                     <option value="REJECTED">Rejected</option>
1101                                                 [% END %]
1102
1103                                                 [% IF ( statusselected_ORDERED ) %]
1104                                                     <option value="ORDERED" selected="selected">Ordered</option>
1105                                                 [% ELSE %]
1106                                                     <option value="ORDERED">Ordered</option>
1107                                                 [% END %]
1108
1109                                                 [% FOREACH s IN SuggestionStatuses %]
1110                                                     [% IF s.authorised_value == selected_status %]
1111                                                         <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
1112                                                     [% ELSE %]
1113                                                         <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
1114                                                     [% END %]
1115                                                 [% END %]
1116                                             </select>
1117                                         </li>
1118
1119                                         <li>
1120                                             <label for="suggestedby"> Suggested by:</label>
1121                                             <select id="suggestedby" name="suggestedby">
1122                                                 <option value="">Any</option>
1123                                                 [% FOREACH suggestedby_loo IN suggestedby_loop %]
1124                                                     [% IF ( suggestedby_loo.selected ) %]
1125                                                         <option value="[% suggestedby_loo.code | html %]" selected="selected">[% suggestedby_loo.desc | html %]</option>
1126                                                     [% ELSE %]
1127                                                         <option value="[% suggestedby_loo.code | html %]">[% suggestedby_loo.desc | html %]</option>
1128                                                     [% END %]
1129                                                 [% END %]
1130                                             </select>
1131                                         </li>
1132                                         <li>
1133                                             <label for="suggesteddate_from">Suggested date from:</label>
1134                                             <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" data-date_to="suggesteddate_to" class="flatpickr" />
1135                                         </li>
1136                                         <li>
1137                                             <label for="suggesteddate_to">To:</label>
1138                                             <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" class="flatpickr" />
1139                                         </li>
1140                                         <li>
1141                                             <label for="managedby"> Managed by:</label>
1142                                             <select id="managedby" name="managedby">
1143                                                 <option value="">Any</option>
1144                                                 [% FOREACH managedby_loo IN managedby_loop %]
1145                                                     [% IF ( managedby_loo.selected ) %]
1146                                                         <option value="[% managedby_loo.code | html %]" selected="selected">[% managedby_loo.desc | html %]</option>
1147                                                     [% ELSE %]
1148                                                         <option value="[% managedby_loo.code | html %]">[% managedby_loo.desc | html %]</option>
1149                                                     [% END %]
1150                                                 [% END %]
1151                                             </select>
1152                                         </li>
1153                                         <li>
1154                                             <label for="manageddate_from">Management date from:</label>
1155                                             <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from | html %]" data-date_to="manageddate_to" class="flatpickr" />
1156                                         </li>
1157                                         <li>
1158                                             <label for="manageddate_to">To:</label>
1159                                             <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to | html %]" class="flatpickr" />
1160                                         </li>
1161                                         <li>
1162                                             <label for="acceptedby"> Accepted by:</label>
1163                                             <select id="acceptedby" name="acceptedby">
1164                                                 <option value="">Any</option>
1165                                                 [% FOREACH acceptedby_loo IN acceptedby_loop %]
1166                                                     [% IF ( acceptedby_loo.selected ) %]
1167                                                         <option value="[% acceptedby_loo.code | html %]" selected="selected">[% acceptedby_loo.desc | html %]</option>
1168                                                     [% ELSE %]
1169                                                         <option value="[% acceptedby_loo.code | html %]">[% acceptedby_loo.desc | html %]</option>
1170                                                     [% END %]
1171                                                 [% END %]
1172                                             </select>
1173                                         </li>
1174                                         <li>
1175                                             <label for="accepteddate_from">Accepted date from:</label>
1176                                             <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from | html %]" data-date_to="accepteddate_to" class="flatpickr" />
1177                                         </li>
1178                                         <li>
1179                                             <label for="accepteddate_to">To:</label>
1180                                             <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" class="flatpickr" />
1181                                         </li>
1182                                         <li>
1183                                             <input type="submit" value="Go" />
1184                                         </li>
1185                                     </ol>
1186                                 </fieldset>
1187
1188                                 <fieldset class="brief">
1189                                     <h4 class="local_collapse">
1190                                         <a href="#">Acquisition information</a>
1191                                     </h4>
1192                                     <ol>
1193                                         <li>
1194                                             <label for="budgetid"> Book fund:</label>
1195                                             <select name="budgetid" id="budgetid">
1196                                                 <option value="__ANY__">Any</option>
1197                                                 [% IF budgetid == '__NONE__' %]
1198                                                     <option value="__NONE__" selected="selected">None</option>
1199                                                 [% ELSE %]
1200                                                     <option value="__NONE__">None</option>
1201                                                 [% END %]
1202                                                 [% FOREACH budgetsloo IN budgetsloop %]
1203                                                     [% IF ( budgetsloo.selected ) %]
1204                                                         <option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>
1205                                                     [% ELSE %]
1206                                                         <option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>
1207                                                     [% END %]
1208                                                 [% END %]
1209                                             </select>
1210                                         </li>
1211                                         <li>
1212                                             <input type="submit" value="Go" />
1213                                         </li>
1214                                     </ol>
1215                                 </fieldset>
1216                             </div> <!-- /#limits -->
1217                         </form> <!-- /suggestionsfilter -->
1218
1219                         [% INCLUDE 'acquisitions-menu.inc' %]
1220
1221                     </aside>
1222                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1223             [% END # /UNLESS ( op == 'show' ) %]
1224         [% END # /UNLESS op == 'save' %]
1225         </div> <!-- /.row -->
1226
1227     [% END # /IF op == "show" %]
1228
1229 [% MACRO jsinclude BLOCK %]
1230     [% INCLUDE 'calendar.inc' %]
1231
1232     <script>
1233         var tab = '';
1234         function editManagerPopup(selected_tab) {
1235             tab = selected_tab;
1236             window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,branch,category,action&selection_type=select&callback=select_manager&filter=suggestions_managers",
1237                 'PatronPopup',
1238                 'width=1024,height=768,scrollbars=yes,toolbar=no,'
1239                 + 'scrollbars=yes,resize=yes'
1240             );
1241         }
1242         function select_manager(borrowernumber, borrower) {
1243             var managedby_name = $("#managedby_name"+tab);
1244             var managedby = $("#managedby"+tab);
1245             managedby_name.empty();
1246             managedby.val('');
1247             var borrowername = borrower.firstname + ' ' + borrower.surname;
1248             if (borrowernumber) {
1249                 var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1250                     + '?borrowernumber=' + borrowernumber + '">'
1251                     + borrowername + '</a>';
1252                 managedby_name.html(managerlink);
1253                 managedby.val(borrowernumber);
1254             }
1255
1256             [% IF op == "save" %]
1257                 var notify = $('#notify');
1258                 if ( notify.length ) {
1259                     [% IF managedby_patron %]
1260                         if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% managedby_patron.borrowernumber | html %] ) {
1261                     [% ELSE %]
1262                         if ( borrowernumber == [% logged_in_user.borrowernumber | html %] ) {
1263                     [% END %]
1264                         $(notify).prop('checked', false).prop('disabled', true);
1265                     } else {
1266                         $(notify).prop('disabled', false);
1267                     }
1268                 }
1269             [% END %]
1270         }
1271
1272         function editSuggesterPopup() {
1273             window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,branch,category,action&selection_type=select&callback=select_suggester",
1274                 'PatronPopup',
1275                 'width=1024,height=768,scrollbars=yes,toolbar=no,'
1276                 + 'scrollbars=yes,resize=yes'
1277             );
1278         }
1279
1280         function select_suggester(borrowernumber, borrower) {
1281             var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + borrowernumber + '" />';
1282             suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + borrowernumber + '">';
1283             suggested += borrower.surname + ', ' + borrower.firstname + ' (' + borrower.cardnumber + ')';
1284             suggested += '</a> ';
1285             suggested += borrower.branchname + ' (' + borrower.category_description + ')';
1286             $("#tdsuggestedby").html(suggested);
1287             return 0;
1288         }
1289         $(document).ready(function(){
1290             $("#edit_manager").on("click",function(e){
1291                 e.preventDefault();
1292                 editManagerPopup('');
1293             });
1294             $(".set_manager").on("click",function(e){
1295                 e.preventDefault();
1296                 var selected_tab = $(this).data('tab');
1297                 editManagerPopup(selected_tab);
1298             });
1299
1300             $("#edit_suggester").on("click", function(e){
1301                 e.preventDefault();
1302                 editSuggesterPopup();
1303             });
1304         });
1305     </script>
1306
1307     [% IF ( op == 'show' || op == 'else' ) %]
1308         <script>
1309             $(document).ready(function(){
1310                 $(".deletesuggestion").on("click",function(){
1311                     return confirm(_("Are you sure you want to delete this suggestion?"));
1312                 });
1313             });
1314         </script>
1315     [% END %]
1316     [% IF op == 'else' %]
1317         [% INCLUDE 'datatables.inc' %]
1318         [% INCLUDE 'columns_settings.inc' %]
1319         <script>
1320             $(document).ready(function() {
1321                 if( $("#suggestiontabs .tab-pane.active").length < 1 ){
1322                     $("#suggestiontabs a:first").tab("show");
1323                 }
1324                 table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
1325                 [% FOREACH suggestion IN suggestions %]
1326                     [% IF ( suggestion.suggestions_loop ) %]
1327                         KohaTable("table_[% loop.count| html %]", {
1328                             "sorting": [[ 3, "asc" ]],
1329                             "autoWidth": false,
1330                         }, table_settings );
1331                     [% END %]
1332                 [% END %]
1333
1334                 $("#branchcode").on('change',function(){
1335                 [%# Modify the hidden input in the filters block from the library %]
1336                 [%# dropdown list at the top of suggestion list %]
1337                     let branchcode = $(this).val();
1338                     $('input[name="branchcode"]').val( branchcode );
1339                     $('form[name="suggestionfilter"]').submit();
1340                 });
1341
1342                 $(".checkall").click(function(e){
1343                     e.preventDefault();
1344                     $(this).parents('form').find("input:checkbox").each(function(){
1345                         $(this).prop("checked", true);
1346                     });
1347                 });
1348                 $(".uncheckall").click(function(e){
1349                     e.preventDefault();
1350                     $(this).parents('form').find("input:checkbox").each(function(){
1351                         $(this).prop("checked", false);
1352                     });
1353                 });
1354                 $(".other_reason").hide();
1355                 $("select[name='reason']").change(function(){
1356                     if($(this).val() == "other"){
1357                         $(this).hide();
1358                         $(this).siblings(".other_reason").show();
1359                     }
1360                 });
1361
1362                 $("a.cancel_note").click(function(e) {
1363                     $(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected");
1364                     $(this).siblings("input[name='other_reason']").hide();
1365                     e.preventDefault();
1366                 });
1367                 $("h4.local_collapse a").click(function(){
1368                     $(this).parent().parent().find("ol").toggle();
1369                     return false;
1370                 });
1371
1372                 $("button[type='submit']").on("click", function(e) {
1373                     var submit_button = this;
1374                     var form = $(submit_button).parents("form");
1375                     var action = $(submit_button).val();
1376                     var selected_suggestions = $(form).find("input[name='suggestionid']:checked");
1377                     if ( selected_suggestions.length == 0 ) {
1378                         alert(_("Please select at least one suggestion"));
1379                         e.preventDefault();
1380                         return false;
1381                     }
1382                     if ( action == "delete" ) {
1383                         if ( selected_suggestions.length == 1 ) {
1384                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
1385                                 e.preventDefault();
1386                                 return false;
1387                             }
1388                         } else if ( selected_suggestions.length > 1 ) {
1389                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
1390                                 e.preventDefault();
1391                                 return false;
1392                             }
1393                         }
1394                     } else if ( action == "update_manager" ) {
1395                         var managedby = $(submit_button).siblings("suggestion_managedby");
1396                         if ( managedby.val() == "" ) {
1397                             alert(_("Please select a manager to assign to the selected suggestions"));
1398                             e.preventDefault();
1399                             return false;
1400                         }
1401                     }
1402
1403                     $('<input />').attr('type', 'hidden')
1404                                   .attr('name', "op")
1405                                   .attr('value', action)
1406                                   .appendTo(form);
1407                     return true;
1408                 });
1409             });
1410         </script>
1411     [% END %]
1412     [% IF op == 'save'  %]
1413         <script>
1414
1415             $(document).ready(function(){
1416                 calcNewsuggTotal();
1417                 $("#quantity,#price,#currency").on("change",function(){
1418                     calcNewsuggTotal();
1419                 });
1420
1421                 [% IF other_reason %]
1422                     $(".select-reason").hide();
1423                     $(".select-reason").find("option[value='other']").attr("selected","selected");
1424                     $("#other_reason").show();
1425                 [% ELSE %]
1426                     $("#other_reason").hide();
1427                 [% END %]
1428                 $(".select-reason").change(function(){
1429                     if($(this).val() == "other"){
1430                         $(this).hide();
1431                         $("#other_reason").show();
1432                     }
1433                 });
1434                 $("a[href*=back]").click(function(){
1435                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
1436                     $("#other_reason").hide();
1437                 });
1438
1439                 $("#restore_previous_manager").on("click",function(e){
1440                     e.preventDefault();
1441
1442                     $("#managedby_name").empty();
1443                     $("#managedby").val('');
1444                     var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]";
1445                     var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1446                         + '?borrowernumber=[% managedby_patron.borrowernumber | html %]">'
1447                         + borrowername + '</a>';
1448                     $('#managedby_name').html(managerlink);
1449                     $('#managedby').val([% managedby_patron.borrowernumber | html %]);
1450                     $('#notify').prop('checked', false).prop('disabled', true);
1451                 });
1452
1453                 //keep a copy of all budgets before removing the inactives
1454                 var budgetId = $("form#add_edit #budgetid");
1455                 var disabledBudgetsCopy = budgetId.html();
1456                 $('.b_inactive').remove();
1457
1458                 $('#showallfunds').click(function() {
1459                     if ($(this).is(":checked")) {
1460                         budgetId.html(disabledBudgetsCopy); //Puts back all the funds
1461                     }
1462                     else {
1463                         $('.b_inactive').remove();
1464                     }
1465                 });
1466
1467             });
1468         </script>
1469     [% END %]
1470     [% Asset.js("js/acq.js") | $raw %]
1471     [% Asset.js("js/acquisitions-menu.js") | $raw %]
1472 [% END %]
1473 [% INCLUDE 'intranet-bottom.inc' %]