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