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