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