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