Bug 21526: Use the 'url' filter when needed
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / suggestion / suggestion.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Branches %]
4 [% USE AuthorisedValues %]
5 [% USE KohaDates %]
6 [% USE Price %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha &rsaquo; Acquisitions  &rsaquo;
10     [% IF ( op_save ) %]
11         [% IF ( suggestionid ) %]
12             Suggestions &rsaquo;  Edit suggestion #[% suggestionid | html %]
13         [% ELSE %]
14             Suggestions &rsaquo; Add suggestion
15         [% END %]
16     [% ELSIF ( op == 'show' ) %]
17            Suggestions &rsaquo; Show suggestion #[% suggestionid | html %]
18     [% ELSE %]
19         Suggestions management
20     [% END %]
21 </title>
22 [% INCLUDE 'doc-head-close.inc' %]
23 [% IF ( op_else ) %]
24     [% Asset.css("css/datatables.css") | $raw %]
25 [% END %]
26 [% IF ( op_else ) %]
27     <style>
28         h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief ol { display : none; }
29         .overlay { top: 180px; left: 50%; position: absolute; margin-left: -100px; width: 200px; text-align: center; display: none; margin-top: -10px; background: #eeffd4; padding: .5em; color: #000; } .note { -moz-border-radius: 3px; border-radius:3px; background: transparent url("[% interface | html %]/[% theme | html %]/img/famfamfam/silk/comment.png") top left no-repeat; padding : 1px 3px 1px 18px; font-size : 90%; }
30     </style>
31 [% END %]
32 </head>
33
34 <body id="acq_suggestion" class="acq">
35 [% INCLUDE 'header.inc' %]
36 [% INCLUDE 'cat-search.inc' %]
37 <div id="breadcrumbs">
38     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo;
39     [% IF ( op_save ) %]
40         [% IF ( suggestionid ) %]
41             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo;  Edit suggestion #[% suggestionid | html %]
42         [% ELSE %]
43             <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Add suggestion
44         [% END %]
45     [% ELSIF ( op == 'show' ) %]
46            <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> &rsaquo; Show suggestion #[% suggestionid | html %]
47     [% ELSE %]
48         Suggestions management
49     [% END %]
50 </div>
51
52 [% IF ( op == 'show' ) %]
53     <div class="main container-fluid">
54         <div class="row">
55             <div class="col-md-8 col-md-offset-2">
56
57     <div id="toolbar" class="btn-toolbar">
58         <a class="btn btn-default btn-sm" id="editsuggestion" href="suggestion.pl?op=edit&amp;suggestionid=[% suggestionid | html %]"><i class="fa fa-pencil"></i> Edit</a>
59         <a class="btn btn-default btn-sm deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
60     </div>
61
62     <fieldset class="rows">
63       <legend>Bibliographic information</legend>
64       <ol>
65             [% IF ( title ) %]
66                 <li>
67                     <span class="label">Title:</span>
68                     [% title | html %]
69                 </li>
70             [% END %]
71             [% IF ( author ) %]
72                 <li>
73                     <span class="label">Author:</span>
74                     [% author | html %]
75                 </li>
76             [% END %]
77             [% IF ( copyrightdate ) %]
78                 <li>
79                     <span class="label">Copyright date:</span>
80                     [% copyrightdate | html %]
81                 </li>
82             [% END %]
83             [% IF ( isbn ) %]
84                 <li>
85                     <span class="label">ISBN or ISSN or other standard number:</span>
86                     [% isbn | html %]
87                 </li>
88             [% END %]
89             [% IF ( publishercode ) %]
90                 <li>
91                     <span class="label">Publisher:</span>
92                     [% publishercode | html %]
93                 </li>
94             [% END %]
95             [% IF ( place ) %]
96                 <li>
97                     <span class="label">Publication place:</span>
98                     [% place | html %]
99                 </li>
100             [% END %]
101             [% IF ( collectiontitle ) %]
102                 <li>
103                     <span class="label">Collection title:</span>
104                     [% collectiontitle | html %]
105                 </li>
106             [% END %]
107             [% IF ( itemtype ) %]
108                 <li>
109                     <span class="label">Document type:</span>
110                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
111                 </li>
112             [% END %]
113         [% IF ( patron_reason_loop ) %]
114           <li><span class="label">Reason for suggestion: </span>
115             [% FOREACH patron_reason_loo IN patron_reason_loop %]
116               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib | html %][% END %]
117             [% END %]
118           </li>
119         [% END %]
120             [% IF ( note ) %]
121                 <li>
122                     <span class="label">Notes:</span>
123                     [% note | html %]
124                 </li>
125             [% END %]
126       </ol>
127     </fieldset>
128     <fieldset class="rows"> <legend>Suggestion management</legend>
129       <ol>
130         <li>
131           <span class="label">Status:</span>
132           [% SET status_found = 0 %]
133           [% IF ( STATUS == 'ASKED' ) %]
134               Pending
135               [% SET status_found = 1 %]
136           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
137               Accepted
138               [% SET status_found = 1 %]
139           [% ELSIF ( STATUS == 'CHECKED' ) %]
140               Checked
141               [% SET status_found = 1 %]
142           [% ELSIF ( STATUS == 'REJECTED' ) %]
143               Rejected
144               [% SET status_found = 1 %]
145           [% ELSE %]
146               [% FOREACH s IN SuggestionStatuses %]
147                   [% IF STATUS == s.authorised_value %]
148                       [% s.lib | html %]
149                       [% SET status_found = 1 %]
150                   [% END %]
151               [% END %]
152           [% END %]
153
154         </li>
155         <li>
156           <table>
157             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
158             <tbody>
159             <tr>
160                 <th>Created by:</th>
161                 <td>[% suggesteddate | $KohaDates %]</td>
162                 <td>
163                     [% IF ( suggestedby_borrowernumber ) %]
164                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
165                         [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])
166                     [% END %]
167                 </td>
168             </tr>
169             <tr>
170                 <th>Managed by:</th>
171                 <td>[% manageddate | $KohaDates %]</td>
172                 <td>
173                         [% IF ( managedby_borrowernumber ) %]
174                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | uri %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
175                             [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])
176                         [% END %]
177                 </td>
178             </tr>
179             <tr>
180                 <th>Accepted on:</th>
181                 <td>[% accepteddate | $KohaDates %]</td>
182                 <td>
183                     [% IF ( acceptedby_borrowernumber ) %]
184                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
185                         [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])
186                     [% END %]
187                 </td>
188             </tr>
189             </tbody>
190         </table></li></ol>
191     </fieldset>
192     <fieldset class="rows"> <legend>Acquisition information</legend>
193       <ol>
194         <li>
195           <span class="label">Library:</span> [% Branches.GetName( branchcode ) | html %]
196         </li>
197         <li>
198           <span class="label">Fund:</span> [% budgetname | html %]
199         </li>
200         <li>
201           <span class="label">Copies:</span>[% quantity | html %]
202         </li>
203         <li>
204           <span class="label">Currency:</span>[% currency | html %]
205         </li>
206         <li>
207           <span class="label">Price:</span>[% price | $Price %]
208         </li>
209         <li>
210           <span class="label">Total</span>[% total | $Price %]
211         </li>
212       </ol>
213     </fieldset>
214
215     <fieldset class="action">
216         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
217     </fieldset>
218
219     </div>
220     </div>
221 </div>
222 [% ELSE %]
223
224 [% IF ( op_save ) %]
225     <div class="main container-fluid">
226         <div class="row">
227             <div class="col-md-8 col-md-offset-2">
228 [% ELSE %]
229     <div class="main container-fluid">
230         <div class="row">
231             <div class="col-sm-10 col-sm-push-2">
232                 <main>
233
234 [% END %]
235
236 [% IF ( op_save ) %]
237     <form id="add_edit" action="suggestion.pl" method="post" class="validated">
238     <input type="hidden" name="redirect" id="redirect" value="[% redirect | html %]" />
239     <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber | html %]" />
240     [% IF ( suggestionid ) %]
241         <h1>Edit purchase suggestion #[% suggestionid | html %]</h1>
242         <input type="hidden" name="suggestionid" value="[% suggestionid | html %]"/>
243     [% ELSE %]
244         <h1>Enter a new purchase suggestion</h1>
245     [% END %]
246     <fieldset class="rows"> <legend>Bibliographic information</legend><ol>
247         <li>
248             <label for="title" class="required">Title:</label>
249             <input type="text" id="title" name="title" size="80" maxlength="255" value="[% title | html %]" required="required" class="required" />
250             <span class="required">Required</span>
251         </li>
252         <li><label for="author">Author:</label><input type="text" id="author" name="author" size="50" maxlength="80" value="[% author | html %]"/></li>
253         <li><label for="copyrightdate">Copyright date:</label><input type="text" id="copyrightdate" name="copyrightdate" size="4" maxlength="4" value="[% copyrightdate | html %]" /></li>
254         <li><label for="isbn">ISBN or ISSN or other standard number:</label><input type="text" id="isbn" name="isbn" size="50" maxlength="80" value="[% isbn | html %]"/></li>
255         <li><label for="publishercode">Publisher:</label><input type="text" id="publishercode" name="publishercode" size="50" maxlength="80" value="[% publishercode | html %]"/></li>
256         <li><label for="place">Publication place:</label><input type="text" id="place" name="place" size="50" maxlength="80" value="[% place | html %]"/></li>
257         <li><label for="collectiontitle">Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" size="50" maxlength="80" value="[% collectiontitle | html %]"/></li>
258         <li><label for="itemtype">Document type:</label>
259             [% PROCESS 'av-build-dropbox.inc' name="itemtype", category="SUGGEST_FORMAT", size = 20, default=itemtype %]
260         </li>
261         [% IF patron_reason_loop %]
262             <li>
263                 <label for="patronreason">Reason for suggestion: </label>
264                 <select name="patronreason" id="patronreason">
265                     <option value=""> -- Choose -- </option>
266                     [% FOREACH patron_reason_loo IN patron_reason_loop %]
267                         [% IF patron_reason_loo.authorised_value == patronreason %]
268                             <option value="[% patron_reason_loo.authorised_value | html %]" selected="selected">[% patron_reason_loo.lib | html %]</option>
269                         [% ELSE %]
270                             <option value="[% patron_reason_loo.authorised_value | html %]">[% patron_reason_loo.lib | html %]</option>
271                         [% END %]
272                     [% END %]
273                 </select>
274             </li>
275         [% END %]
276         <li><label for="note">Notes:</label><textarea name="note" id="note" rows="5" cols="40">[% note | html %]</textarea></li>
277         </ol>
278     </fieldset>
279     <fieldset class="rows"> <legend>Suggestion management</legend>
280        <ol>
281             [% IF ( suggestionid ) %]
282                 <li>
283                     <label for="STATUS">Status:</label>
284                     <select id="STATUS" name="STATUS">
285                         <option value="">No Status</option>
286
287                         [% IF (statusselected_ASKED ) %]
288                             <option value="ASKED" selected="selected">Pending</option>
289                         [% ELSE %]
290                             <option value="ASKED">Pending</option>
291                         [% END %]
292
293                         [% IF (statusselected_ACCEPTED ) %]
294                             <option value="ACCEPTED" selected="selected">Accepted</option>
295                         [% ELSE %]
296                             <option value="ACCEPTED">Accepted</option>
297                         [% END %]
298
299                         [% IF (statusselected_CHECKED ) %]
300                             <option value="CHECKED" selected="selected">Checked</option>
301                         [% ELSE %]
302                             <option value="CHECKED">Checked</option>
303                         [% END %]
304
305                         [% IF ( statusselected_REJECTED ) %]
306                             <option value="REJECTED" selected="selected">Rejected</option>
307                         [% ELSE %]
308                             <option value="REJECTED">Rejected</option>
309                         [% END %]
310
311                         [% FOREACH s IN SuggestionStatuses %]
312                             [% IF s.authorised_value == suggestion.STATUS %]
313                                 <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
314                             [% ELSE %]
315                                 <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
316                             [% END %]
317                         [% END %]
318                     </select>
319                 </li>
320                 <li>
321                     <label for="reason">Reason</label>
322                     <select class="select-reason" id="reason" name="reason">
323                         <option value=""> -- Choose a reason -- </option>
324                         [% FOREACH reasonsloo IN suggestion.reasonsloop %]
325                             [% IF (reasonsloo.lib == suggestion.reason) %]
326                                 <option value="[% reasonsloo.lib | html %]" selected="selected">[% reasonsloo.lib | html %]</option>
327                             [% ELSE %]
328                                 <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
329                             [% END %]
330                         [% END %]
331                         <option value="other">Others...</option>
332                     </select>
333
334                     <span id="other_reason" name="other_reason">
335                         [% IF other_reason %]
336                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
337                         [% ELSE %]
338                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
339                         [% END %]
340                         <a href="#back">Cancel</a>
341                     </span>
342                 </li>
343             [% END %]
344         <li><table>
345             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
346             <tbody>
347             <tr>
348                 <th><label for="suggesteddate">Created by:</label> </th>
349                 <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td>
350                 <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>  [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %]
351                 </td>
352             </tr>
353             <tr>
354                 <th><label for="managedon">Managed by:</label> </th>
355                 <td><input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
356                 <td><input type="hidden" id="managedby" name="managedby" value="[% managedby | html %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | uri %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])[% END %]</td>
357             </tr>
358             <tr>
359                 <th><label for="accepteddate">Accepted on:</label> </th>
360                 <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td>
361                 <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])[% END %]</td>
362             </tr>
363             </tbody>
364         </table></li></ol>
365     </fieldset>
366     <fieldset class="rows"> <legend>Acquisition information</legend><ol>
367         <li><label for="branchcode">Library:</label>
368             <select name="branchcode" id="branchcode">
369                 <option value="">Any</option>
370                 [% IF branchfilter %]
371                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
372                 [% ELSE %]
373                     [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
374                 [% END %]
375             </select>
376         </li>
377         <li><label for="budgetid">Fund:</label>
378             <select name="budgetid" id="budgetid">
379                 <option value="">Any</option>[% FOREACH budgetsloo IN budgetsloop %]
380                 [% IF ( budgetsloo.selected ) %]<option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option>[% ELSE %]<option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option>[% END %][% END %]
381             </select>
382                 </li><li><label for="quantity">Copies:</label>
383             <input type="text" size="10" id="quantity" name="quantity" value="[% quantity | html %]" />
384                 </li>
385                 <li>
386                     <label for="currency">Currency:</label>
387                     [% FOREACH c IN currencies %]
388                         <input type="hidden" value="[% c.rate | html %]" id="currency_rate_[% c.currency | html %]" name="currency_rate_[% c.currency | html %]" />
389                         <input type="hidden" id="[% c.currency | html %]" name="[% c.currency | html %]" value="[% c.rate | html %]" />
390                     [% END %]
391
392                     <select name="currency" id="currency">
393                         [% FOREACH c IN currencies %]
394                             [% IF suggestionid and suggestion.currency == c.currency or not suggestionid and c.active %]
395                                 <option value="[% c.currency | html %]" selected="selected">[% c.currency | html %]</option>
396                             [% ELSIF not c.archived %]
397                                 <option value="[% c.currency | html %]">[% c.currency | html %]</option>
398                             [% END %]
399                         [% END %]
400                     </select>
401                 </li>
402                 <li><label for="price">Price:</label>
403             <input type="text" size="20" name="price" id="price" value="[% price | html %]" />
404                 </li><li><label for="total">Total: </label>
405                         <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total | html %]"/>
406                 </li></ol>
407     </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby | html %][% ELSE %]noone[% END %]"/>
408     <fieldset class="action"><input type="hidden" name="op" value="[% op | html %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby | uri %]#suggestions[% ELSE %]suggestion.pl[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit your suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %]
409     </fieldset>
410     </form>
411 [% END %]
412
413 [% IF ( op_else ) %]
414 <div id="toolbar" class="btn-toolbar">
415     <a class="btn btn-default btn-sm" id="newsuggestion" href="suggestion.pl?op=add"><i class="fa fa-plus"></i> New purchase suggestion</a>
416 </div>
417
418 <h1>Suggestions management</h1>
419
420
421 [% FOR m IN messages %]
422     <div class="dialog [% m.type | html %]">
423         [% SWITCH m.code %]
424         [% CASE 'already_exists' %]
425             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>)
426         [% CASE %]
427             [% m.code | html %]
428         [% END %]
429     </div>
430 [% END %]
431
432 [% UNLESS ( notabs ) %]
433     <div id="suggestiontabs" class="toptabs">
434     <ul class="ui-tabs-nav">
435         [% FOREACH suggestion IN suggestions %]
436                 <li>
437             <a href="#[% suggestion.suggestiontype | uri %]">
438             [% IF ( suggestion.suggestiontypelabel ) %]
439                 [% IF (suggestion.suggestiontypelabel == "Pending") %]Pending
440                 [% ELSIF (suggestion.suggestiontypelabel == "Accepted") %]Accepted
441                 [% ELSIF (suggestion.suggestiontypelabel == "Checked") %]Checked
442                 [% ELSIF (suggestion.suggestiontypelabel == "Rejected") %]Rejected
443                 [% ELSIF (suggestion.suggestiontypelabel == "Available") %]Available
444                 [% ELSIF (suggestion.suggestiontypelabel == "Ordered") %]Ordered
445                 [% ELSIF (suggestion.suggestiontypelabel == "Unknown") %]Status unknown
446                 [% ELSE %][% suggestion.suggestiontypelabel | html %][% END %]
447             [% ELSE %]
448                 [% IF ( suggestion.suggestiontype ) %]
449                     [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestion.suggestiontype ) | html %]
450                 [% ELSE %]
451                     No name
452                 [% END %]
453             [% END %]
454             ([% suggestion.suggestions_loop.size | html %])</a></li>
455
456         [% END %]
457     </ul>
458 [% END %]
459
460 [% FOREACH suggestion IN suggestions %]
461 <div id="[% suggestion.suggestiontype | html %]">
462 <form class="update_suggestions" name="f[% suggestion.suggestiontype | html %]" method="post" action="/cgi-bin/koha/suggestion/suggestion.pl#[% suggestion.suggestiontype | html %]">
463
464 [% IF ( suggestion.suggestions_loop ) %]
465 <p><a id="CheckAll[% suggestion.suggestiontype | html %]" href="#">Check all</a> | <a id="UncheckAll[% suggestion.suggestiontype | html %]" href="#">Uncheck all</a></p>
466     <table id="[% suggestion.suggestiontype | html %]t" class="sorted">
467         <thead>
468             <tr>
469                 <th class="NoSort">&nbsp;</th>
470                 <th class="anti-the">Suggestion</th>
471                 <th>Suggested by - on</th>
472                 <th>Managed by - on</th>
473                 <th>Library</th>
474                 <th>Fund</th>
475                 <th>Status</th>
476                 <th class="NoSort">&nbsp;</th>
477             </tr>
478     </thead>
479         <tbody>
480             [% FOREACH suggestions_loo IN suggestion.suggestions_loop %]
481                 <tr>
482                 <td>
483                     <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid | html %]" />
484                 </td>
485                 <td>
486                     <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | uri %]&amp;op=show" title="suggestion" >
487                         [% suggestions_loo.title | html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author | html %][% END %]</a>
488                     <br />
489                     [% IF ( suggestions_loo.copyrightdate ) %]&copy; [% suggestions_loo.copyrightdate | html %] [% END %]
490                         [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc | html %]</i> [% END %]
491                         [% IF ( suggestions_loo.isbn ) %]; ISBN:<i>[% suggestions_loo.isbn | html %]</i> [% END %][% IF ( suggestions_loo.publishercode ) %]; Published by [% suggestions_loo.publishercode | html %] [% END %][% IF ( suggestions_loo.publicationyear ) %] in <i>[% suggestions_loo.publicationyear | html %]</i> [% END %][% IF ( suggestions_loo.place ) %] in <i>[% suggestions_loo.place | html %]</i> [% END %][% IF ( suggestions_loo.collectiontitle ) %]; [% suggestions_loo.collectiontitle | html %] [% END %][% IF ( suggestions_loo.itemtype ) %]; [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', suggestions_loo.itemtype, 0 ) | html %] [% END %]<br />[% IF ( suggestions_loo.note ) %]<span class="note">[% suggestions_loo.note | html %]</span>[% END %]
492                 </td>
493                 <td>
494                     <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>
495                     [% IF ( suggestions_loo.suggesteddate ) %] - [% suggestions_loo.suggesteddate | $KohaDates %][% END %]
496                 </td>
497                 <td>
498                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestions_loo.suggestedby | uri %]">[% suggestions_loo.surnamemanagedby | html %][% IF ( suggestions_loo.firstnamemanagedby ) %], [% suggestions_loo.firstnamemanagedby | html %][% END %]</a>
499                     [% IF ( suggestions_loo.manageddate ) %] - [% suggestions_loo.manageddate | $KohaDates %][% END %]
500                 </td>
501                 <td>
502                     [% Branches.GetName( suggestions_loo.branchcode ) | html %]
503                 </td>
504                 <td>
505                     [% suggestions_loo.budget_name | html %]
506                 </td>
507                 <td>
508                     [% IF ( suggestions_loo.ASKED ) %]
509                         Pending
510                     [% ELSIF ( suggestions_loo.ACCEPTED ) %]
511                         Accepted
512                     [% ELSIF ( suggestions_loo.ORDERED ) %]
513                         Ordered
514                     [% ELSIF ( suggestions_loo.REJECTED ) %]
515                         Rejected
516                     [% ELSIF ( suggestions_loo.CHECKED ) %]
517                         Checked
518                     [% ELSIF AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) %]
519                         [% AuthorisedValues.GetByCode( 'SUGGEST_STATUS', suggestions_loo.STATUS ) | html %]
520                     [% ELSE %]
521                         Status unknown
522                     [% END %]
523
524                     [% IF ( suggestions_loo.reason ) %]
525                         <br />([% suggestions_loo.reason | html %])
526                     [% END %]
527                 </td>
528                 <td class="actions">
529                     <a class="btn btn-xs btn-default" href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid | html %]&amp;op=edit"><i class="fa fa-pencil"></i> Edit</a>
530                     <a class="btn btn-default btn-xs deletesuggestion" href="suggestion.pl?op=delete&amp;edit_field=[% suggestions_loo.suggestionid | html %]"><i class="fa fa-trash"></i> Delete</a>
531                 </td>
532         </tr>
533         [% END %]</tbody>
534         </table>  <fieldset>
535     <div id="select-reason[% suggestion.suggestiontype | html %]">
536         <div id="status[% suggestion.suggestiontype | html %]">
537             <label for="STATUS[% suggestion.suggestiontype | html %]">Mark selected as: </label>
538             <select name="STATUS" id="STATUS[% suggestion.suggestiontype | html %]">
539                 <option value=""> -- Choose a status --</option>
540
541                 [% IF (statusselected_ASKED ) %]
542                     <option value="ASKED" selected="selected">Pending</option>
543                 [% ELSE %]
544                     <option value="ASKED">Pending</option>
545                 [% END %]
546
547                 [% IF (statusselected_ACCEPTED ) %]
548                     <option value="ACCEPTED" selected="selected">Accepted</option>
549                 [% ELSE %]
550                     <option value="ACCEPTED">Accepted</option>
551                 [% END %]
552
553                 [% IF (statusselected_CHECKED ) %]
554                     <option value="CHECKED" selected="selected">Checked</option>
555                 [% ELSE %]
556                     <option value="CHECKED">Checked</option>
557                 [% END %]
558
559                 [% IF ( statusselected_REJECTED ) %]
560                     <option value="REJECTED" selected="selected">Rejected</option>
561                 [% ELSE %]
562                     <option value="REJECTED">Rejected</option>
563                 [% END %]
564
565                 [% FOREACH s IN SuggestionStatuses %]
566                     <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
567                 [% END %]
568             </select>
569
570             <label for="reason[% suggestion.suggestiontype | html %]">with this reason:</label>
571             <select id="reason[% suggestion.suggestiontype | html %]" name="reason[% suggestion.suggestiontype | html %]">
572                 <option value=""> -- Choose a reason -- </option>
573                 [% FOREACH reasonsloo IN suggestion.reasonsloop %]
574                     <option value="[% reasonsloo.lib | html %]">[% reasonsloo.lib | html %]</option>
575                 [% END %]
576                 <option value="other">Others...</option>
577             </select>
578
579             <span id="other_reason[% suggestion.suggestiontype | html %]">
580                 <input type="text" size="31" id="select-other_reason[% suggestion.suggestiontype | html %]" name="other_reason[% suggestion.suggestiontype | html %]" placeholder="please note your reason here..." />
581                 <a href="#back[% suggestion.suggestiontype | uri %]">Cancel</a>
582             </span>
583
584             <strong style="padding: 0 1em;">OR:</strong>
585
586             <label for="[% suggestion.suggestiontype | html %]delete">Delete selected</label>
587             <input type="checkbox" name="op" id="[% suggestion.suggestiontype | html %]delete" />
588         </div>
589     </div>
590
591     <input type="hidden" name="branchcode" value="[% branchfilter | html %]" />
592     <input type="hidden" name="tabcode" value="[% suggestion.suggestiontype | html %]" />
593     <input type="hidden" name="op" value="change" />
594 </fieldset>
595         <fieldset class="action">
596     <input type="submit" value="Submit" /></fieldset>
597 </form>
598 [% ELSE %]
599     <b>No results.</b>
600 [% END %]
601 </div>
602 [% END %]
603     </div>
604 [% END %]
605
606 [% UNLESS ( op_save ) %]
607     [% UNLESS ( op == 'show' ) %]
608
609             </main>
610         </div> <!-- /.col-sm-10.col-sm-push-2 -->
611
612         <div class="col-sm-2 col-sm-pull-10">
613             <aside>
614
615 <form name="suggestionfilter" action="suggestion.pl" method="get">
616 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
617                 <select name="displayby" id="displayby" style="width:auto;">
618                     [% IF ( displayby == "STATUS" ) %]
619                         <option value="STATUS" selected="selected">Status</option>
620                     [% ELSE %]
621                         <option value="STATUS">Status</option>
622                     [% END %]
623                     [% IF ( displayby == "branchcode" ) %]
624                         <option value="branchcode" selected="selected">Library</option>
625                     [% ELSE %]
626                         <option value="branchcode">Library</option>
627                     [% END %]
628                     [% IF ( displayby == "itemtype" ) %]
629                         <option value="itemtype" selected="selected">Item type</option>
630                     [% ELSE %]
631                         <option value="itemtype">Item type</option>
632                     [% END %]
633                     [% IF ( displayby == "managedby" ) %]
634                         <option value="managedby" selected="selected">Managed by</option>
635                     [% ELSE %]
636                         <option value="managedby">Managed by</option>
637                     [% END %]
638                     [% IF ( displayby == "acceptedby" ) %]
639                         <option value="acceptedby" selected="selected">Accepted by</option>
640                     [% ELSE %]
641                         <option value="acceptedby">Accepted by</option>
642                     [% END %]
643                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
644 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
645                 <div style="display:block;" id="limits">
646
647                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
648                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title | html %]" /></li>
649                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
650                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
651                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
652                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
653                     <li><label for="collectiontitle"> Collection title:</label><input type="text" id="collectiontitle" name="collectiontitle" value="[% collectiontitle | html %]" /></li><li><input type="submit" value="Go" /></li></ol>
654                 </fieldset>
655                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
656                     <ol>
657                       <li>
658                           <label for="STATUS"> Status:</label>
659                           <select name="STATUS" id="STATUS">
660                               <option value="">Any</option>
661
662                               [% IF (statusselected_ASKED ) %]
663                                   <option value="ASKED" selected="selected">Pending</option>
664                               [% ELSE %]
665                                   <option value="ASKED">Pending</option>
666                               [% END %]
667
668                               [% IF (statusselected_ACCEPTED ) %]
669                                   <option value="ACCEPTED" selected="selected">Accepted</option>
670                               [% ELSE %]
671                                   <option value="ACCEPTED">Accepted</option>
672                               [% END %]
673
674                               [% IF (statusselected_CHECKED ) %]
675                                   <option value="CHECKED" selected="selected">Checked</option>
676                               [% ELSE %]
677                                   <option value="CHECKED">Checked</option>
678                               [% END %]
679
680                               [% IF ( statusselected_REJECTED ) %]
681                                   <option value="REJECTED" selected="selected">Rejected</option>
682                               [% ELSE %]
683                                   <option value="REJECTED">Rejected</option>
684                               [% END %]
685
686                               [% FOREACH s IN SuggestionStatuses %]
687                                   [% IF s.authorised_value == selected_status %]
688                                       <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
689                                   [% ELSE %]
690                                       <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
691                                   [% END %]
692                               [% END %]
693                           </select>
694                       </li>
695
696                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
697 [% FOREACH suggestedby_loo IN suggestedby_loop %][% IF ( suggestedby_loo.selected ) %]<option value="[% suggestedby_loo.code | html %]" selected="selected">[% suggestedby_loo.desc | html %]</option>[% ELSE %]<option value="[% suggestedby_loo.code | html %]">[% suggestedby_loo.desc | html %]</option>[% END %][% END %]
698                                                                      </select></li>
699                     <li>
700                         <label for="suggesteddate_from">Suggested date from:</label>
701                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" />
702                     </li>
703                     <li>
704                         <label for="suggesteddate_to">To:</label>
705                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" />
706                     </li>
707                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
708 [% FOREACH managedby_loo IN managedby_loop %][% IF ( managedby_loo.selected ) %]<option value="[% managedby_loo.code | html %]" selected="selected">[% managedby_loo.desc | html %]</option>[% ELSE %]<option value="[% managedby_loo.code | html %]">[% managedby_loo.desc | html %]</option>[% END %][% END %]
709                                                                      </select></li>
710                     <li>
711                         <label for="manageddate_from">Management date from:</label>
712                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from | html %]" />
713                     </li>
714                     <li>
715                         <label for="manageddate_to">To:</label>
716                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to | html %]" />
717                     </li>
718                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
719 [% FOREACH acceptedby_loo IN acceptedby_loop %][% IF ( acceptedby_loo.selected ) %] <option value="[% acceptedby_loo.code | html %]" selected="selected">[% acceptedby_loo.desc | html %]</option>[% ELSE %]<option value="[% acceptedby_loo.code | html %]">[% acceptedby_loo.desc | html %]</option>[% END %][% END %]
720                                                       </select></li>
721                     <li>
722                         <label for="accepteddate_from">Accepted date from:</label>
723                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from | html %]" />
724                     </li>
725                     <li>
726                         <label for="accepteddate_to">To:</label>
727                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" />
728                     </li>
729                     <li><input type="submit" value="Go" /></li></ol>
730                 </fieldset>
731
732                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
733                     <ol><li><label for="budgetid"> Book fund:</label>
734                     <select name="budgetid" id="budgetid">
735                       <option value="__ANY__">Any</option>
736                       [% IF budgetid == '__NONE__' %]
737                           <option value="__NONE__" selected="selected">None</option>
738                       [% ELSE %]
739                           <option value="__NONE__">None</option>
740                       [% END %]
741                     [% FOREACH budgetid_loo IN budgetid_loop %]
742                         [% IF ( budgetid_loo.selected ) %] <option value="[% budgetid_loo.code | html %]" selected="selected">[% budgetid_loo.desc | html %]</option>[% ELSE %]<option value="[% budgetid_loo.code | html %]">[% budgetid_loo.desc | html %]</option>[% END %]
743                         [% END %]
744                     </select></li>
745                     <li><label for="branchcode">Library:</label>
746                     <select name="branchcode" id="branchcode">
747                         <option value="__ANY__">Any</option>
748                         [% IF branchfilter %]
749                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
750                         [% ELSE %]
751                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
752                         [% END %]
753                     </select></li><li><input type="submit" value="Go" /></li></ol>
754                 </fieldset>
755             </form>
756         [% INCLUDE 'acquisitions-menu.inc' %]
757
758             </aside>
759         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
760      </div> <!-- /.row -->
761
762     [% END %]
763     [% END %]
764 </div>
765 [% END %]
766
767 [% MACRO jsinclude BLOCK %]
768     [% INCLUDE 'calendar.inc' %]
769     [% IF ( op == 'show' || op_else ) %]
770         <script type="text/javascript">
771             $(document).ready(function(){
772                 $(".deletesuggestion").on("click",function(){
773                     return confirm(_("Are you sure you want to delete this suggestion?"));
774                 });
775             });
776         </script>
777     [% END %]
778     [% IF ( op_else ) %]
779         [% INCLUDE 'datatables.inc' %]
780         [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
781         <script type="text/javascript">
782             /**
783             *  displayOther.
784             *  This function display the select or an textaera to write a reason.
785             */
786             function displayOther(id,show,hide){
787                 $("#"+hide+id).hide();
788                 $("#"+show+id).show();
789             }
790             $(document).ready(function() {
791                 $('#suggestiontabs').tabs({
792                     // Correct table sizing for tables hidden in tabs
793                     // http://www.datatables.net/examples/api/tabs_and_scrolling.html
794                     "activate": function(event, ui) {
795                         $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
796                     }
797                 });
798                 $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
799                     "aoColumnDefs": [
800                         { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
801                         { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
802                     ],
803                     "sPaginationType": "four_button"
804                 }));
805             [% FOREACH suggestion IN suggestions %]
806                 // functions for [% suggestion.suggestiontype | html %] interactions
807                 $("#CheckAll[% suggestion.suggestiontype | html %]").click(function(e){
808                     $("#[% suggestion.suggestiontype | html %]t").checkCheckboxes();
809                     e.preventDefault();
810                 });
811                 $("#UncheckAll[% suggestion.suggestiontype | html %]").click(function(e){
812                     $("#[% suggestion.suggestiontype | html %]t").unCheckCheckboxes();
813                     e.preventDefault();
814                 });
815                 $("#other_reason[% suggestion.suggestiontype | html %]").hide();
816                 $("#reason[% suggestion.suggestiontype | html %]").change(function(){
817                     if($(this).val() == "other"){
818                         $(this).hide();
819                         $("#other_reason[% suggestion.suggestiontype | html %]").show();
820                 }
821                 });
822                 $("#[% suggestion.suggestiontype | html %]delete").change(function(){
823                     if(this.checked){
824                         $("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","delete");
825                     } else {
826                         $("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","change");
827                     }
828                 });
829
830             [% END %]
831                 $("a[href*=back]").click(function(){
832                 var sid = $(this).attr("href").replace(/#back/,"");
833                     $("#reason"+sid).show().find("option[value='']").attr("selected","selected");
834                     $("#other_reason"+sid).hide();
835                 });
836                 $("h4.local_collapse a").click(function(){
837                     $(this).parent().parent().find("ol").toggle();
838                     return false;
839                 });
840                 // http://jqueryui.com/demos/datepicker/#date-range
841                 var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
842                     changeMonth: true,
843                     numberOfMonths: 1,
844                     onSelect: function( selectedDate ) {
845                         var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
846                             instance = $( this ).data( "datepicker" );
847                             date = $.datepicker.parseDate(
848                                 instance.settings.dateFormat ||
849                                 $.datepicker._defaults.dateFormat,
850                                 selectedDate, instance.settings );
851                         dates.not( this ).datepicker( "option", option, date );
852                     }
853                 });
854                 var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
855                     changeMonth: true,
856                     numberOfMonths: 1,
857                     onSelect: function( selectedDate ) {
858                         var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
859                             instance = $( this ).data( "datepicker" );
860                             date = $.datepicker.parseDate(
861                                 instance.settings.dateFormat ||
862                                 $.datepicker._defaults.dateFormat,
863                                 selectedDate, instance.settings );
864                         datesMD.not( this ).datepicker( "option", option, date );
865                     }
866                 });
867                 var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
868                     changeMonth: true,
869                     numberOfMonths: 1,
870                     onSelect: function( selectedDate ) {
871                         var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
872                             instance = $( this ).data( "datepicker" );
873                             date = $.datepicker.parseDate(
874                                 instance.settings.dateFormat ||
875                                 $.datepicker._defaults.dateFormat,
876                                 selectedDate, instance.settings );
877                         datesAD.not( this ).datepicker( "option", option, date );
878                     }
879                 });
880
881                 $("form.update_suggestions").on("submit", function(e){
882                     var form = this;
883                     var action_delete_selected = $(this).find("input[value='delete']").is(":checked");
884                     if ( action_delete_selected ) {
885                         var suggestions_to_delete = $(this).find("input[name='edit_field']:checked");
886                         if ( suggestions_to_delete.length == 0 ) {
887                             alert(_("Please select at least one suggestion to delete"));
888                             e.preventDefault();
889                             return false;
890                         } else if ( suggestions_to_delete.length == 1 ) {
891                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
892                                 e.preventDefault();
893                                 return false;
894                             }
895                         } else if ( suggestions_to_delete.length > 1 ) {
896                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
897                                 e.preventDefault();
898                                 return false;
899                             }
900                         }
901                     }
902                     return true;
903                 });
904             });
905         </script>
906     [% END %]
907     [% IF ( op_save )  %]
908         <script type="text/javascript">
909             $(document).ready(function(){
910                 calcNewsuggTotal();
911                 $("#quantity,#price,#currency").on("change",function(){
912                     calcNewsuggTotal();
913                 });
914
915                 [% IF other_reason %]
916                     $(".select-reason").hide();
917                     $(".select-reason").find("option[value='other']").attr("selected","selected");
918                     $("#other_reason").show();
919                 [% ELSE %]
920                     $("#other_reason").hide();
921                 [% END %]
922                 $(".select-reason").change(function(){
923                     if($(this).val() == "other"){
924                         $(this).hide();
925                         $("#other_reason").show();
926                     }
927                 });
928                 $("a[href*=back]").click(function(){
929                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
930                     $("#other_reason").hide();
931                 });
932             });
933         </script>
934     [% END %]
935     [% Asset.js("js/acq.js") | $raw %]
936     [% Asset.js("js/acquisitions-menu.js") | $raw %]
937 [% END %]
938
939 [% INCLUDE 'intranet-bottom.inc' %]