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