Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% PROCESS 'i18n.inc' %]
2 [% USE raw %]
3 [% USE Asset %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE KohaDates %]
7 [% USE Price %]
8 [% USE TablesSettings %]
9 [% SET footerjs = 1 %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 <title>
12     [% IF op == 'save' %]
13         [% IF ( suggestionid ) %]
14             Edit suggestion #[% suggestionid | html %] &rsaquo; Suggestions
15         [% ELSE %]
16             Add suggestion &rsaquo; Suggestions
17         [% END %]
18
19     [% ELSIF ( op == 'show' ) %]
20            Show suggestion #[% suggestionid | html %] &rsaquo; Suggestions
21
22     [% ELSE %]
23         Suggestions management
24     [% END %] &rsaquo; Acquisitions &rsaquo; Koha
25 </title>
26 [% INCLUDE 'doc-head-close.inc' %]
27 [% IF op == 'else' %]
28     [% FILTER collapse %]
29         <style>
30             h4.local_collapse a {
31                 font-size: 80%;
32                 text-decoration: none;
33             }
34             fieldset.brief ol {
35                 display: none;
36             }
37             .overlay {
38                 background: #eeffd4;
39                 color: #000;
40                 display: none;
41                 left: 50%;
42                 margin-left: -100px;
43                 margin-top: -10px;
44                 padding: .5em;
45                 position: absolute;
46                 text-align: center;
47                 top: 180px;
48                 width: 200px;
49             }
50         </style>
51     [% END %]
52 [% END %]
53 </head>
54
55 <body id="acq_suggestion" class="acq">
56     [% 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"><i class="fa fa-home"></i></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" value="Confirm your suggestion" />
655                         [% ELSE %]
656                             <input type="submit" 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" value="Confirm your suggestion" />
663                         [% ELSE %]
664                             <input type="submit" 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>Suggested on</th>
751                                             <th>Patron reason</th>
752                                             <th>Managed by</th>
753                                             <th>Managed on</th>
754                                             <th>Last modification by</th>
755                                             <th>Last modification on</th>
756                                             <th>Last updated</th>
757                                             <th>Library</th>
758                                             <th>Fund</th>
759                                             <th>Non-public note</th>
760                                             <th>Status</th>
761                                             <th class="NoSort noExport">&nbsp;</th>
762                                         </tr>
763                                     </thead>
764                                     <tbody>
765                                         [% FOREACH s IN suggestion.suggestions %]
766                                             <tr>
767                                                 <td>
768                                                     <input type="checkbox" name="suggestionid" value="[% s.suggestionid | html %]" />
769                                                 </td>
770                                                 <td>
771                                                     <a href="suggestion.pl?suggestionid=[% s.suggestionid | uri %]&amp;op=show" title="suggestion" >
772                                                         [% s.title | html %][% IF ( s.author ) %], by [% s.author | html %][% END %]
773                                                     </a>
774                                                     <br />
775                                                     [% IF ( s.copyrightdate ) %]
776                                                         &copy; <span class="suggestion_copyrightdate">[% s.copyrightdate | html %]</span>
777                                                     [% END %]
778                                                     [% IF ( s.volumedesc ) %]
779                                                         ; <span class="suggestion_volume">Volume:<em>[% s.volumedesc | html %]</em></span>
780                                                     [% END %]
781                                                     [% IF ( s.isbn ) %]
782                                                         ; <span class="suggestion_isbn">ISBN: <em>[% s.isbn | html %]</em></span>
783                                                     [% END %]
784                                                     [% IF ( s.publishercode ) %]
785                                                         ; <span class="suggestion_publishercode">Published by [% s.publishercode | html %]</span>
786                                                     [% END %]
787                                                     [% IF ( s.publicationyear ) %]
788                                                         in <span class="suggestion_publicationyear"><em>[% s.publicationyear | html %]</em></span>
789                                                     [% END %]
790                                                     [% IF ( s.place ) %]
791                                                         in <span class="suggestion_place"><em>[% s.place | html %]</em></span>
792                                                     [% END %]
793                                                     [% IF ( s.collectiontitle ) %]
794                                                         ; <span class="suggestion_collectiontitle">[% s.collectiontitle | html %]</span>
795                                                     [% END %]
796                                                     [% IF ( s.itemtype ) %]
797                                                         ; <span class="suggestion_itype">[% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', s.itemtype, 0 ) | html %]</span>
798                                                     [% END %]
799                                                     <br />
800                                                     [% IF ( s.note ) %]
801                                                         <div class="suggestion_note"><i class="fa fa-comment"></i> [% s.note | html %]</div>
802                                                     [% END %]
803                                                     [% IF s.archived %]
804                                                         <br /><i class="fa fa-archive"></i> Archived
805                                                     [% END %]
806                                                 </td>
807                                                 <td>
808                                                     [% SET suggester = s.suggester %]
809                                                     <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>
810                                                 </td>
811                                                 <td data-order="[% s.suggesteddate | html %]">
812                                                     [% IF ( s.suggesteddate ) %][% s.suggesteddate | $KohaDates %][% END %]
813                                                 </td>
814                                                 <td>[% AuthorisedValues.GetByCode( 'OPAC_SUG', s.patronreason ) | html %]</td>
815                                                 <td>
816                                                     [% SET manager = s.manager %]
817                                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% manager.borrowernumber | uri %]">[% manager.surname | html %][% IF manager.firstname %], [% manager.firstname | html %][% END %]</a>
818                                                 </td>
819                                                 <td data-order="[% s.manageddate | html %]">
820                                                     [% IF ( s.manageddate ) %][% s.manageddate | $KohaDates %][% END %]
821                                                 </td>
822                                                 <td>
823                                                     [% SET last_modifier = s.last_modifier %]
824                                                     <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>
825                                                 </td>
826                                                 <td data-order="[% s.lastmodificationdate | html %]">
827                                                     [% IF ( s.lastmodificationdate ) %][% s.lastmodificationdate | $KohaDates %][% END %]
828                                                 </td>
829                                                 <td>
830                                                     [% s.lastmodificationdate | $KohaDates %]
831                                                 </td>
832                                                 <td>
833                                                     [% Branches.GetName( s.branchcode ) | html %]
834                                                 </td>
835                                                 <td>
836                                                     [% s.fund.budget_name | html %]
837                                                 </td>
838                                                 <td>
839                                                     [% s.staff_note | html %]
840                                                 </td>
841                                                 <td>
842                                                     [% IF s.STATUS == 'ASKED' %]
843                                                         <span>Pending</span>
844                                                     [% ELSIF s.STATUS == 'ACCEPTED' %]
845                                                         <span>Accepted</span>
846                                                     [% ELSIF s.STATUS == 'ORDERED' %]
847                                                         <span>Ordered</span>
848                                                     [% ELSIF s.STATUS == 'REJECTED' %]
849                                                         <span>Rejected</span>
850                                                     [% ELSIF s.STATUS == 'CHECKED' %]
851                                                         <span>Checked</span>
852                                                     [% ELSIF s.STATUS == 'AVAILABLE' %]
853                                                         <span>Available</span>
854                                                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', s.STATUS ) %]
855                                                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', s.STATUS ) | html %]
856                                                     [% ELSE %]
857                                                         <span>Status unknown</span>
858                                                     [% END %]
859
860                                                     [% IF ( s.reason ) %]
861                                                         <br />([% s.reason | html %])
862                                                     [% END %]
863                                                 </td>
864                                                 <td class="actions">
865                                                     <div class="btn-group dropup">
866                                                         <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>
867                                                         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="more_actions_[% s.suggestionid | html %]">
868                                                             <li><a class="deletesuggestion" href="suggestion.pl?op=delete&amp;suggestionid=[% s.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a></li>
869                                                             [% UNLESS s.archived %]
870                                                                 <li><a class="archivesuggestion" href="suggestion.pl?op=archive&amp;suggestionid=[% s.suggestionid | html %]"><i class="fa fa-archive"></i> Archive</a></li>
871                                                             [% ELSE %]
872                                                                 <li><a class="unarchivesuggestion" href="suggestion.pl?op=unarchive&amp;suggestionid=[% s.suggestionid | html %]"><i class="fa fa-archive"></i> Unarchive</a></li>
873                                                             [% END %]
874                                                         </ul>
875                                                     </div>
876                                                 </td>
877                                             </tr>
878                                         [% END # /FOREACH s %]
879                                     </tbody>
880                                 </table> <!-- /#table_[% loop.count | html %] -->
881
882                                 <div class="row">
883                                     <h2 style="padding-left:1em;">Change selected suggestions</h2>
884                                     <div class="col-sm-4">
885                                         <fieldset>
886                                             <div id="select-reason[% loop.index | html %]">
887                                                 <label for="STATUSreason[% loop.index | html %]">Mark selected as: </label>
888                                                 <select name="STATUS" id="STATUSreason[% loop.index | html %]">
889                                                     <option value=""> -- Choose a status --</option>
890
891                                                     [% IF (statusselected_ASKED ) %]
892                                                         <option value="ASKED" selected="selected">Pending</option>
893                                                     [% ELSE %]
894                                                         <option value="ASKED">Pending</option>
895                                                     [% END %]
896
897                                                     [% IF (statusselected_ACCEPTED ) %]
898                                                         <option value="ACCEPTED" selected="selected">Accepted</option>
899                                                     [% ELSE %]
900                                                         <option value="ACCEPTED">Accepted</option>
901                                                     [% END %]
902
903                                                     [% IF (statusselected_CHECKED ) %]
904                                                         <option value="CHECKED" selected="selected">Checked</option>
905                                                     [% ELSE %]
906                                                         <option value="CHECKED">Checked</option>
907                                                     [% END %]
908
909                                                     [% IF ( statusselected_REJECTED ) %]
910                                                         <option value="REJECTED" selected="selected">Rejected</option>
911                                                     [% ELSE %]
912                                                         <option value="REJECTED">Rejected</option>
913                                                     [% END %]
914
915                                                     [% IF ( statusselected_ORDERED ) %]
916                                                         <option value="ORDERED" selected="selected">Ordered</option>
917                                                     [% ELSE %]
918                                                         <option value="ORDERED">Ordered</option>
919                                                     [% END %]
920
921                                                     [% FOREACH s IN SuggestionStatuses %]
922                                                         <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
923                                                     [% END %]
924                                                 </select>
925
926                                                 <label for="choosereason[% loop.index | html %]">with this reason:</label>
927                                                 <select name="reason" id="choosereason[% loop.index | html %]">
928                                                     <option value=""> -- Choose a reason -- </option>
929                                                     [% FOREACH reasonsloo IN suggestion.reasonsloop %]
930                                                         <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
931                                                     [% END %]
932                                                     <option value="other">Others...</option>
933                                                 </select>
934
935                                                 <span class="other_reason">
936                                                     <input type="text" size="31" name="other_reason" placeholder="please note your reason here..." />
937                                                     <a href="#" class="cancel_note">Cancel</a>
938                                                 </span>
939                                             </div>
940
941                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
942                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
943                                             <fieldset class="action">
944                                                 <button type="submit" class="btn btn-default btn-xs" value="update_status">Submit</button>
945                                             </fieldset>
946                                         </fieldset>
947                                     </div> <!-- /.col-sm-4 -->
948
949                                     <div class="col-sm-4">
950                                         <fieldset>
951                                             <label>
952                                                 Update item types with:
953                                                 [% PROCESS 'av-build-dropbox.inc' name="suggestion_itemtype", category="SUGGEST_FORMAT", size = 20  %]
954                                             </label>
955                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
956                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
957                                             <fieldset class="action">
958                                                 <button type="submit" class="btn btn-default btn-xs" value="update_itemtype">Submit</button>
959                                             </fieldset>
960                                         </fieldset>
961                                     </div> <!-- /.col-sm-4 -->
962
963                                     <div class="col-sm-2">
964                                         <fieldset>
965                                             <span class="label">Update manager</span><br/>
966                                             <a id="set_manager_[% loop.count | html %]" data-tab="[% loop.count | html %]" class="set_manager" href="#"><i class="fa fa-search"></i> Select manager</a>
967                                             <span id="managedby_name[% loop.count | html %]"></span>
968                                             <input type="hidden" name="suggestion_managedby" id="managedby[% loop.count | html %]" value="[% logged_in_user.borrowernumber | html %]" />
969                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
970                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
971                                             <fieldset class="action">
972                                                 <button type="submit" class="btn btn-default btn-xs" value="update_manager">Submit</button>
973                                             </fieldset>
974                                         </fieldset>
975                                     </div> <!-- /.col-sm-2 -->
976
977                                     <div class="col-sm-2">
978                                         <fieldset>
979                                             <span class="label">Delete selected</span>
980                                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
981                                             <input type="hidden" name="filter_archived" value="[% filter_archived | html %]" />
982                                             <fieldset class="action">
983                                                 <button type="submit" class="btn btn-default btn-xs" value="delete">Delete</button>
984                                             </fieldset>
985                                         </fieldset>
986                                     </div> <!-- /.col-sm-2 -->
987                                 </div> <!-- /.row -->
988
989                             [% ELSE %]
990                                 <strong>No results.</strong>
991                             [% END # /IF ( suggestion.suggestions_loop ) %]
992                         </form> <!-- /.update_suggestions -->
993                     </div> <!-- /#[% suggestion.suggestiontype | html %] -->
994                 [% END # /FOREACH suggestion %]
995             [% IF suggestions.size && !notabs %]
996                     </div> <!-- /.tab-content -->
997                 </div> <!-- /.notabs -->
998             [% END # /UNLESS notabs %]
999         [% END # /IF op == 'else' %]
1000
1001         [% UNLESS op == 'save' %]
1002             [% UNLESS ( op == 'show' ) %]
1003                 </div> <!-- /.col-sm-10.col-sm-push-2 -->
1004
1005                 <div class="col-sm-2 col-sm-pull-10">
1006                     <aside>
1007                         <form name="suggestionfilter" action="suggestion.pl" method="get">
1008                             <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
1009                             <fieldset class="brief">
1010                                 <ol style="display:block;">
1011                                     <li>
1012                                         <label for="displayby">Organize by: </label>
1013                                         <select name="displayby" id="displayby" style="width:auto;">
1014                                             [% IF ( displayby == "STATUS" ) %]
1015                                                 <option value="STATUS" selected="selected">Status</option>
1016                                             [% ELSE %]
1017                                                 <option value="STATUS">Status</option>
1018                                             [% END %]
1019                                             [% IF ( displayby == "branchcode" ) %]
1020                                                 <option value="branchcode" selected="selected">Library</option>
1021                                             [% ELSE %]
1022                                                 <option value="branchcode">Library</option>
1023                                             [% END %]
1024                                             [% IF ( displayby == "itemtype" ) %]
1025                                                 <option value="itemtype" selected="selected">Item type</option>
1026                                             [% ELSE %]
1027                                                 <option value="itemtype">Item type</option>
1028                                             [% END %]
1029                                             [% IF ( displayby == "managedby" ) %]
1030                                                 <option value="managedby" selected="selected">Managed by</option>
1031                                             [% ELSE %]
1032                                                 <option value="managedby">Managed by</option>
1033                                             [% END %]
1034                                             [% IF ( displayby == "acceptedby" ) %]
1035                                                 <option value="acceptedby" selected="selected">Accepted by</option>
1036                                             [% ELSE %]
1037                                                 <option value="acceptedby">Accepted by</option>
1038                                             [% END %]
1039                                         </select>
1040                                         <input type="submit" value="Go" />
1041                                     </li>
1042                                 </ol>
1043                             </fieldset> <!-- /.brief -->
1044
1045                             <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
1046
1047                             <div id="limits">
1048                                 <fieldset class="brief">
1049                                     <h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
1050                                     <ol>
1051                                         <li>
1052                                             <label for="title"> Title:</label>
1053                                             <input type="text" id="title" name="title" value="[% title | html %]" />
1054                                         </li>
1055                                         <li>
1056                                             <label for="author"> Author:</label>
1057                                             <input type="text" id="author" name="author" value="[% author | html %]" />
1058                                         </li>
1059                                         <li>
1060                                             <label for="isbn"> ISBN:</label>
1061                                             <input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" />
1062                                         </li>
1063                                         <li>
1064                                             <label for="publishercode"> Publisher:</label>
1065                                             <input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" />
1066                                         </li>
1067                                         <li>
1068                                             <label for="copyrightdate_filter"> Copyright date:</label>
1069                                             <input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" />
1070                                         </li>
1071                                         <li>
1072                                             <label for="collectiontitle"> Collection title:</label>
1073                                             <input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" />
1074                                         </li>
1075                                     </ol>
1076                                 </fieldset> <!-- /.brief -->
1077
1078                                 <fieldset class="brief">
1079                                     <h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
1080                                     <ol>
1081                                         <li>
1082                                             <label for="archived" style="display: inline;">Include archived:</label>
1083                                             [% IF filter_archived %]
1084                                                 <input type="checkbox" id="archived" value="1" name="filter_archived" checked="checked" title="Include archived suggestions in the search" />
1085                                             [% ELSE %]
1086                                                 <input type="checkbox" id="archived" value="1" name="filter_archived" title="Include archived suggestions in the search" />
1087                                             [% END %]
1088                                         </li>
1089                                         <li>
1090                                             <label for="STATUS[% loop.index | html %]"> Status:</label>
1091                                             <select name="STATUS" id="STATUS[% loop.index | html %]">
1092                                                 <option value="">Any</option>
1093                                                 [% IF (statusselected_ASKED ) %]
1094                                                     <option value="ASKED" selected="selected">Pending</option>
1095                                                 [% ELSE %]
1096                                                     <option value="ASKED">Pending</option>
1097                                                 [% END %]
1098
1099                                                 [% IF (statusselected_ACCEPTED ) %]
1100                                                     <option value="ACCEPTED" selected="selected">Accepted</option>
1101                                                 [% ELSE %]
1102                                                     <option value="ACCEPTED">Accepted</option>
1103                                                 [% END %]
1104
1105                                                 [% IF (statusselected_CHECKED ) %]
1106                                                     <option value="CHECKED" selected="selected">Checked</option>
1107                                                 [% ELSE %]
1108                                                     <option value="CHECKED">Checked</option>
1109                                                 [% END %]
1110
1111                                                 [% IF ( statusselected_REJECTED ) %]
1112                                                     <option value="REJECTED" selected="selected">Rejected</option>
1113                                                 [% ELSE %]
1114                                                     <option value="REJECTED">Rejected</option>
1115                                                 [% END %]
1116
1117                                                 [% IF ( statusselected_ORDERED ) %]
1118                                                     <option value="ORDERED" selected="selected">Ordered</option>
1119                                                 [% ELSE %]
1120                                                     <option value="ORDERED">Ordered</option>
1121                                                 [% END %]
1122
1123                                                 [% FOREACH s IN SuggestionStatuses %]
1124                                                     [% IF s.authorised_value == selected_status %]
1125                                                         <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
1126                                                     [% ELSE %]
1127                                                         <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
1128                                                     [% END %]
1129                                                 [% END %]
1130                                             </select>
1131                                         </li>
1132
1133                                         <li>
1134                                             <label for="suggestedby"> Suggested by:</label>
1135                                             <select id="suggestedby" name="suggestedby">
1136                                                 <option value="">Any</option>
1137                                                 [% FOREACH suggestedby_loo IN suggestedby_loop %]
1138                                                     [% IF ( suggestedby_loo.selected ) %]
1139                                                         <option value="[% suggestedby_loo.code | html %]" selected="selected">[% suggestedby_loo.desc | html %]</option>
1140                                                     [% ELSE %]
1141                                                         <option value="[% suggestedby_loo.code | html %]">[% suggestedby_loo.desc | html %]</option>
1142                                                     [% END %]
1143                                                 [% END %]
1144                                             </select>
1145                                         </li>
1146                                         <li>
1147                                             <label for="suggesteddate_from">Suggested date from:</label>
1148                                             <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" data-date_to="suggesteddate_to" class="flatpickr" />
1149                                         </li>
1150                                         <li>
1151                                             <label for="suggesteddate_to">To:</label>
1152                                             <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" class="flatpickr" />
1153                                         </li>
1154                                         <li>
1155                                             <label for="managedby"> Managed by:</label>
1156                                             <select id="managedby" name="managedby">
1157                                                 <option value="">Any</option>
1158                                                 [% FOREACH managedby_loo IN managedby_loop %]
1159                                                     [% IF ( managedby_loo.selected ) %]
1160                                                         <option value="[% managedby_loo.code | html %]" selected="selected">[% managedby_loo.desc | html %]</option>
1161                                                     [% ELSE %]
1162                                                         <option value="[% managedby_loo.code | html %]">[% managedby_loo.desc | html %]</option>
1163                                                     [% END %]
1164                                                 [% END %]
1165                                             </select>
1166                                         </li>
1167                                         <li>
1168                                             <label for="manageddate_from">Management date from:</label>
1169                                             <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from | html %]" data-date_to="manageddate_to" class="flatpickr" />
1170                                         </li>
1171                                         <li>
1172                                             <label for="manageddate_to">To:</label>
1173                                             <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to | html %]" class="flatpickr" />
1174                                         </li>
1175                                         <li>
1176                                             <label for="acceptedby"> Accepted by:</label>
1177                                             <select id="acceptedby" name="acceptedby">
1178                                                 <option value="">Any</option>
1179                                                 [% FOREACH acceptedby_loo IN acceptedby_loop %]
1180                                                     [% IF ( acceptedby_loo.selected ) %]
1181                                                         <option value="[% acceptedby_loo.code | html %]" selected="selected">[% acceptedby_loo.desc | html %]</option>
1182                                                     [% ELSE %]
1183                                                         <option value="[% acceptedby_loo.code | html %]">[% acceptedby_loo.desc | html %]</option>
1184                                                     [% END %]
1185                                                 [% END %]
1186                                             </select>
1187                                         </li>
1188                                         <li>
1189                                             <label for="accepteddate_from">Accepted date from:</label>
1190                                             <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from | html %]" data-date_to="accepteddate_to" class="flatpickr" />
1191                                         </li>
1192                                         <li>
1193                                             <label for="accepteddate_to">To:</label>
1194                                             <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" class="flatpickr" />
1195                                         </li>
1196                                         <li>
1197                                             <input type="submit" value="Go" />
1198                                         </li>
1199                                     </ol>
1200                                 </fieldset>
1201
1202                                 <fieldset class="brief">
1203                                     <h4 class="local_collapse">
1204                                         <a href="#">Acquisition information</a>
1205                                     </h4>
1206                                     <ol>
1207                                         <li>
1208                                             <label for="budgetid"> Book fund:</label>
1209                                             <select name="budgetid" id="budgetid">
1210                                                 <option value="__ANY__">Any</option>
1211                                                 [% IF budgetid == '__NONE__' %]
1212                                                     <option value="__NONE__" selected="selected">None</option>
1213                                                 [% ELSE %]
1214                                                     <option value="__NONE__">None</option>
1215                                                 [% END %]
1216                                                 [% FOREACH budgetsloo IN budgetsloop %]
1217                                                     [% IF ( budgetsloo.selected ) %]
1218                                                         <option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>
1219                                                     [% ELSE %]
1220                                                         <option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>
1221                                                     [% END %]
1222                                                 [% END %]
1223                                             </select>
1224                                         </li>
1225                                         <li>
1226                                             <input type="submit" value="Go" />
1227                                         </li>
1228                                     </ol>
1229                                 </fieldset>
1230                             </div> <!-- /#limits -->
1231                         </form> <!-- /suggestionsfilter -->
1232
1233                         [% INCLUDE 'acquisitions-menu.inc' %]
1234
1235                     </aside>
1236                 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
1237             [% END # /UNLESS ( op == 'show' ) %]
1238         [% END # /UNLESS op == 'save' %]
1239         </div> <!-- /.row -->
1240
1241     [% END # /IF op == "show" %]
1242
1243 [% MACRO jsinclude BLOCK %]
1244     [% INCLUDE 'calendar.inc' %]
1245
1246     <script>
1247         var tab = '';
1248         function editManagerPopup(selected_tab) {
1249             tab = selected_tab;
1250             window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,branch,category,action&selection_type=select&callback=select_manager&filter=suggestions_managers",
1251                 'PatronPopup',
1252                 'width=1024,height=768,scrollbars=yes,toolbar=no,'
1253                 + 'scrollbars=yes,resize=yes'
1254             );
1255         }
1256         function select_manager(borrowernumber, borrower) {
1257             var managedby_name = $("#managedby_name"+tab);
1258             var managedby = $("#managedby"+tab);
1259             managedby_name.empty();
1260             managedby.val('');
1261             var borrowername = borrower.firstname + ' ' + borrower.surname;
1262             if (borrowernumber) {
1263                 var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1264                     + '?borrowernumber=' + borrowernumber + '">'
1265                     + borrowername + '</a>';
1266                 managedby_name.html(managerlink);
1267                 managedby.val(borrowernumber);
1268             }
1269
1270             [% IF op == "save" %]
1271                 var notify = $('#notify');
1272                 if ( notify.length ) {
1273                     [% IF managedby_patron %]
1274                         if ( borrowernumber == [% logged_in_user.borrowernumber | html %] || borrowernumber == [% managedby_patron.borrowernumber | html %] ) {
1275                     [% ELSE %]
1276                         if ( borrowernumber == [% logged_in_user.borrowernumber | html %] ) {
1277                     [% END %]
1278                         $(notify).prop('checked', false).prop('disabled', true);
1279                     } else {
1280                         $(notify).prop('disabled', false);
1281                     }
1282                 }
1283             [% END %]
1284         }
1285
1286         function editSuggesterPopup() {
1287             window.open("/cgi-bin/koha/members/search.pl?columns=cardnumber,name,branch,category,action&selection_type=select&callback=select_suggester",
1288                 'PatronPopup',
1289                 'width=1024,height=768,scrollbars=yes,toolbar=no,'
1290                 + 'scrollbars=yes,resize=yes'
1291             );
1292         }
1293
1294         function select_suggester(borrowernumber, borrower) {
1295             var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + borrowernumber + '" />';
1296             suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + borrowernumber + '">';
1297             suggested += borrower.surname + ', ' + borrower.firstname + ' (' + borrower.cardnumber + ')';
1298             suggested += '</a> ';
1299             suggested += borrower.branchname + ' (' + borrower.category_description + ')';
1300             $("#tdsuggestedby").html(suggested);
1301             return 0;
1302         }
1303         $(document).ready(function(){
1304             $("#edit_manager").on("click",function(e){
1305                 e.preventDefault();
1306                 editManagerPopup('');
1307             });
1308             $(".set_manager").on("click",function(e){
1309                 e.preventDefault();
1310                 var selected_tab = $(this).data('tab');
1311                 editManagerPopup(selected_tab);
1312             });
1313
1314             $("#edit_suggester").on("click", function(e){
1315                 e.preventDefault();
1316                 editSuggesterPopup();
1317             });
1318         });
1319     </script>
1320
1321     [% IF ( op == 'show' || op == 'else' ) %]
1322         <script>
1323             $(document).ready(function(){
1324                 $(".deletesuggestion").on("click",function(){
1325                     return confirm(_("Are you sure you want to delete this suggestion?"));
1326                 });
1327             });
1328         </script>
1329     [% END %]
1330     [% IF op == 'else' %]
1331         [% INCLUDE 'datatables.inc' %]
1332         [% INCLUDE 'columns_settings.inc' %]
1333         <script>
1334             $(document).ready(function() {
1335                 if( $("#suggestiontabs .tab-pane.active").length < 1 ){
1336                     $("#suggestiontabs a:first").tab("show");
1337                 }
1338
1339                 table_settings = [% TablesSettings.GetTableSettings( 'acqui', 'suggestions', 'suggestions', 'json' ) | $raw %]
1340                 [% FOREACH suggestion IN suggestions %]
1341                     [% IF suggestion.suggestions.size %]
1342                         KohaTable("table_[% loop.count| html %]", {
1343                             "sorting": [[ 3, "asc" ]],
1344                             "autoWidth": false,
1345                         }, table_settings );
1346                     [% END %]
1347                 [% END %]
1348
1349                 $("#branchcode").on('change',function(){
1350                 [%# Modify the hidden input in the filters block from the library %]
1351                 [%# dropdown list at the top of suggestion list %]
1352                     let branchcode = $(this).val();
1353                     $('input[name="branchcode"]').val( branchcode );
1354                     $('form[name="suggestionfilter"]').submit();
1355                 });
1356
1357                 $(".checkall").click(function(e){
1358                     e.preventDefault();
1359                     $(this).parents('form').find("input:checkbox").each(function(){
1360                         $(this).prop("checked", true);
1361                     });
1362                 });
1363                 $(".uncheckall").click(function(e){
1364                     e.preventDefault();
1365                     $(this).parents('form').find("input:checkbox").each(function(){
1366                         $(this).prop("checked", false);
1367                     });
1368                 });
1369                 $(".other_reason").hide();
1370                 $("select[name='reason']").change(function(){
1371                     if($(this).val() == "other"){
1372                         $(this).hide();
1373                         $(this).siblings(".other_reason").show();
1374                     }
1375                 });
1376
1377                 $("a.cancel_note").click(function(e) {
1378                     $(this).parent().siblings("select").show().find("option[value='']").attr("selected","selected");
1379                     $(this).siblings("input[name='other_reason']").hide();
1380                     e.preventDefault();
1381                 });
1382                 $("h4.local_collapse a").click(function(){
1383                     $(this).parent().parent().find("ol").toggle();
1384                     return false;
1385                 });
1386
1387                 $("button[type='submit']").on("click", function(e) {
1388                     var submit_button = this;
1389                     var form = $(submit_button).parents("form");
1390                     var action = $(submit_button).val();
1391                     var selected_suggestions = $(form).find("input[name='suggestionid']:checked");
1392                     if ( selected_suggestions.length == 0 ) {
1393                         alert(_("Please select at least one suggestion"));
1394                         e.preventDefault();
1395                         return false;
1396                     }
1397                     if ( action == "delete" ) {
1398                         if ( selected_suggestions.length == 1 ) {
1399                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
1400                                 e.preventDefault();
1401                                 return false;
1402                             }
1403                         } else if ( selected_suggestions.length > 1 ) {
1404                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
1405                                 e.preventDefault();
1406                                 return false;
1407                             }
1408                         }
1409                     } else if ( action == "update_manager" ) {
1410                         var managedby = $(submit_button).siblings("suggestion_managedby");
1411                         if ( managedby.val() == "" ) {
1412                             alert(_("Please select a manager to assign to the selected suggestions"));
1413                             e.preventDefault();
1414                             return false;
1415                         }
1416                     }
1417
1418                     $('<input />').attr('type', 'hidden')
1419                                   .attr('name', "op")
1420                                   .attr('value', action)
1421                                   .appendTo(form);
1422                     return true;
1423                 });
1424             });
1425         </script>
1426     [% END %]
1427     [% IF op == 'save'  %]
1428         <script>
1429
1430             $(document).ready(function(){
1431                 calcNewsuggTotal();
1432                 $("#quantity,#price,#currency").on("change",function(){
1433                     calcNewsuggTotal();
1434                 });
1435
1436                 [% IF other_reason %]
1437                     $(".select-reason").hide();
1438                     $(".select-reason").find("option[value='other']").attr("selected","selected");
1439                     $("#other_reason").show();
1440                 [% ELSE %]
1441                     $("#other_reason").hide();
1442                 [% END %]
1443                 $(".select-reason").change(function(){
1444                     if($(this).val() == "other"){
1445                         $(this).hide();
1446                         $("#other_reason").show();
1447                     }
1448                 });
1449                 $("a[href*=back]").click(function(){
1450                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
1451                     $("#other_reason").hide();
1452                 });
1453
1454                 $("#restore_previous_manager").on("click",function(e){
1455                     e.preventDefault();
1456
1457                     $("#managedby_name").empty();
1458                     $("#managedby").val('');
1459                     var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]";
1460                     var managerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
1461                         + '?borrowernumber=[% managedby_patron.borrowernumber | html %]">'
1462                         + borrowername + '</a>';
1463                     $('#managedby_name').html(managerlink);
1464                     $('#managedby').val([% managedby_patron.borrowernumber | html %]);
1465                     $('#notify').prop('checked', false).prop('disabled', true);
1466                 });
1467
1468                 //keep a copy of all budgets before removing the inactives
1469                 var budgetId = $("form#add_edit #budgetid");
1470                 var disabledBudgetsCopy = budgetId.html();
1471                 $('.b_inactive').remove();
1472
1473                 $('#showallfunds').click(function() {
1474                     if ($(this).is(":checked")) {
1475                         budgetId.html(disabledBudgetsCopy); //Puts back all the funds
1476                     }
1477                     else {
1478                         $('.b_inactive').remove();
1479                     }
1480                 });
1481
1482             });
1483         </script>
1484     [% END %]
1485     [% Asset.js("js/acq.js") | $raw %]
1486     [% Asset.js("js/acquisitions-menu.js") | $raw %]
1487 [% END %]
1488 [% INCLUDE 'intranet-bottom.inc' %]