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