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