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