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