Bug 21454: Remove html filter for Price filtered variables
[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 type="text/css">
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 id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> -->
54 <div id="bd">
55     <div id="yui-main">
56     <div class="yui-b">
57
58     <div id="toolbar" class="btn-toolbar">
59         <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>
60         <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>
61     </div>
62
63     <fieldset class="rows">
64       <legend>Bibliographic information</legend>
65       <ol>
66             [% IF ( title ) %]
67                 <li>
68                     <span class="label">Title:</span>
69                     [% title | html %]
70                 </li>
71             [% END %]
72             [% IF ( author ) %]
73                 <li>
74                     <span class="label">Author:</span>
75                     [% author | html %]
76                 </li>
77             [% END %]
78             [% IF ( copyrightdate ) %]
79                 <li>
80                     <span class="label">Copyright date:</span>
81                     [% copyrightdate | html %]
82                 </li>
83             [% END %]
84             [% IF ( isbn ) %]
85                 <li>
86                     <span class="label">ISBN or ISSN or other standard number:</span>
87                     [% isbn | html %]
88                 </li>
89             [% END %]
90             [% IF ( publishercode ) %]
91                 <li>
92                     <span class="label">Publisher:</span>
93                     [% publishercode | html %]
94                 </li>
95             [% END %]
96             [% IF ( place ) %]
97                 <li>
98                     <span class="label">Publication place:</span>
99                     [% place | html %]
100                 </li>
101             [% END %]
102             [% IF ( collectiontitle ) %]
103                 <li>
104                     <span class="label">Collection title:</span>
105                     [% collectiontitle | html %]
106                 </li>
107             [% END %]
108             [% IF ( itemtype ) %]
109                 <li>
110                     <span class="label">Document type:</span>
111                     [% AuthorisedValues.GetByCode( 'SUGGEST_FORMAT', itemtype, 0 ) | html %]
112                 </li>
113             [% END %]
114         [% IF ( patron_reason_loop ) %]
115           <li><span class="label">Reason for suggestion: </span>
116             [% FOREACH patron_reason_loo IN patron_reason_loop %]
117               [% IF patron_reason_loo.authorised_value == patronreason %][% patron_reason_loo.lib | html %][% END %]
118             [% END %]
119           </li>
120         [% END %]
121             [% IF ( note ) %]
122                 <li>
123                     <span class="label">Notes:</span>
124                     [% note | html %]
125                 </li>
126             [% END %]
127       </ol>
128     </fieldset>
129     <fieldset class="rows"> <legend>Suggestion management</legend>
130       <ol>
131         <li>
132           <span class="label">Status:</span>
133           [% SET status_found = 0 %]
134           [% IF ( STATUS == 'ASKED' ) %]
135               Pending
136               [% SET status_found = 1 %]
137           [% ELSIF ( STATUS == 'ACCEPTED' ) %]
138               Accepted
139               [% SET status_found = 1 %]
140           [% ELSIF ( STATUS == 'CHECKED' ) %]
141               Checked
142               [% SET status_found = 1 %]
143           [% ELSIF ( STATUS == 'REJECTED' ) %]
144               Rejected
145               [% SET status_found = 1 %]
146           [% ELSE %]
147               [% FOREACH s IN SuggestionStatuses %]
148                   [% IF STATUS == s.authorised_value %]
149                       [% s.lib | html %]
150                       [% SET status_found = 1 %]
151                   [% END %]
152               [% END %]
153           [% END %]
154
155         </li>
156         <li>
157           <table>
158             <thead><tr><th>&nbsp;</th><th>Date</th><th>By</th></tr></thead>
159             <tbody>
160             <tr>
161                 <th>Created by:</th>
162                 <td>[% suggesteddate | $KohaDates %]</td>
163                 <td>
164                     [% IF ( suggestedby_borrowernumber ) %]
165                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | html %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
166                         [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])
167                     [% END %]
168                 </td>
169             </tr>
170             <tr>
171                 <th>Managed by:</th>
172                 <td>[% manageddate | $KohaDates %]</td>
173                 <td>
174                         [% IF ( managedby_borrowernumber ) %]
175                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | html %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
176                             [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])
177                         [% END %]
178                 </td>
179             </tr>
180             <tr>
181                 <th>Accepted on:</th>
182                 <td>[% accepteddate | $KohaDates %]</td>
183                 <td>
184                     [% IF ( acceptedby_borrowernumber ) %]
185                         <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | html %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a>
186                         [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])
187                     [% END %]
188                 </td>
189             </tr>
190             </tbody>
191         </table></li></ol>
192     </fieldset>
193     <fieldset class="rows"> <legend>Acquisition information</legend>
194       <ol>
195         <li>
196           <span class="label">Library:</span> [% Branches.GetName( branchcode ) | html %]
197         </li>
198         <li>
199           <span class="label">Fund:</span> [% budgetname | html %]
200         </li>
201         <li>
202           <span class="label">Copies:</span>[% quantity | html %]
203         </li>
204         <li>
205           <span class="label">Currency:</span>[% currency | html %]
206         </li>
207         <li>
208           <span class="label">Price:</span>[% price | $Price %]
209         </li>
210         <li>
211           <span class="label">Total</span>[% total | $Price %]
212         </li>
213       </ol>
214     </fieldset>
215
216     <fieldset class="action">
217         <a href="suggestion.pl">&lt;&lt; Back to suggestions</a>
218     </fieldset>
219
220     </div>
221     </div>
222 </div>
223 [% ELSE %]
224
225 [% IF ( op_save ) %]
226     <div class="main container-fluid">
227         <div class="row">
228             <div class="col-md-8 col-md-offset-2">
229 [% ELSE %]
230     <div id="doc3" class="yui-t2">
231         <div id="bd">
232             <div id="yui-main">
233                 <div class="yui-b">
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 | html %]">[% 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 | html %]">[% 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 | html %]">[% 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 | html %]#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 | html %]">
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 | html %]&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 | html %]">[% 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 | html %]">[% 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 | html %]">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 </div>
606 </div>
607
608       [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b">
609 <form name="suggestionfilter" action="suggestion.pl" method="get">
610 <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label>
611                 <select name="displayby" id="displayby" style="width:auto;">
612                     [% IF ( displayby == "STATUS" ) %]
613                         <option value="STATUS" selected="selected">Status</option>
614                     [% ELSE %]
615                         <option value="STATUS">Status</option>
616                     [% END %]
617                     [% IF ( displayby == "branchcode" ) %]
618                         <option value="branchcode" selected="selected">Library</option>
619                     [% ELSE %]
620                         <option value="branchcode">Library</option>
621                     [% END %]
622                     [% IF ( displayby == "itemtype" ) %]
623                         <option value="itemtype" selected="selected">Item type</option>
624                     [% ELSE %]
625                         <option value="itemtype">Item type</option>
626                     [% END %]
627                     [% IF ( displayby == "managedby" ) %]
628                         <option value="managedby" selected="selected">Managed by</option>
629                     [% ELSE %]
630                         <option value="managedby">Managed by</option>
631                     [% END %]
632                     [% IF ( displayby == "acceptedby" ) %]
633                         <option value="acceptedby" selected="selected">Accepted by</option>
634                     [% ELSE %]
635                         <option value="acceptedby">Accepted by</option>
636                     [% END %]
637                 </select> <input type="submit" value="Go" /></li></ol></fieldset>
638 <h4>Filter by: <a style="font-size:80%;font-weight:normal;" href="/cgi-bin/koha/suggestion/suggestion.pl">[clear]</a></h4>
639                 <div style="display:block;" id="limits">
640
641                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Bibliographic information</a></h4>
642                    <ol> <li><label for="title"> Title:</label><input type="text" id="title" name="title" value="[% title | html %]" /></li>
643                     <li><label for="author"> Author:</label><input type="text" id="author" name="author" value="[% author | html %]" /></li>
644                     <li><label for="isbn"> ISBN:</label><input type="text" id="isbn"  name="isbn" value="[% isbn | html %]" /></li>
645                     <li><label for="publishercode"> Publisher:</label><input type="text" id="publishercode" name="publishercode" value="[% publishercode | html %]" /></li>
646                     <li><label for="copyrightdate_filter"> Copyright date:</label><input type="text" id="copyrightdate_filter" name="copyrightdate" value="[% copyrightdate | html %]" /></li>
647                     <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>
648                 </fieldset>
649                                  <fieldset class="brief"><h4 class="local_collapse"><a href="#">Suggestion information</a></h4>
650                     <ol>
651                       <li>
652                           <label for="STATUS"> Status:</label>
653                           <select name="STATUS" id="STATUS">
654                               <option value="">Any</option>
655
656                               [% IF (statusselected_ASKED ) %]
657                                   <option value="ASKED" selected="selected">Pending</option>
658                               [% ELSE %]
659                                   <option value="ASKED">Pending</option>
660                               [% END %]
661
662                               [% IF (statusselected_ACCEPTED ) %]
663                                   <option value="ACCEPTED" selected="selected">Accepted</option>
664                               [% ELSE %]
665                                   <option value="ACCEPTED">Accepted</option>
666                               [% END %]
667
668                               [% IF (statusselected_CHECKED ) %]
669                                   <option value="CHECKED" selected="selected">Checked</option>
670                               [% ELSE %]
671                                   <option value="CHECKED">Checked</option>
672                               [% END %]
673
674                               [% IF ( statusselected_REJECTED ) %]
675                                   <option value="REJECTED" selected="selected">Rejected</option>
676                               [% ELSE %]
677                                   <option value="REJECTED">Rejected</option>
678                               [% END %]
679
680                               [% FOREACH s IN SuggestionStatuses %]
681                                   [% IF s.authorised_value == selected_status %]
682                                       <option value="[% s.authorised_value | html %]" selected="selected">[% s.lib | html %]</option>
683                                   [% ELSE %]
684                                       <option value="[% s.authorised_value | html %]">[% s.lib | html %]</option>
685                                   [% END %]
686                               [% END %]
687                           </select>
688                       </li>
689
690                     <li><label for="suggestedby"> Suggested by:</label><select id="suggestedby" name="suggestedby"><option value="">Any</option>
691 [% 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 %]
692                                                                      </select></li>
693                     <li>
694                         <label for="suggesteddate_from">Suggested date from:</label>
695                         <input type="text" id="suggesteddate_from" size="10" name="suggesteddate_from" value="[% suggesteddate_from | html %]" />
696                     </li>
697                     <li>
698                         <label for="suggesteddate_to">To:</label>
699                         <input type="text" id="suggesteddate_to" size="10" name="suggesteddate_to" value="[% suggesteddate_to | html %]" />
700                     </li>
701                     <li><label for="managedby"> Managed by:</label><select id="managedby" name="managedby"><option value="">Any</option>
702 [% 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 %]
703                                                                      </select></li>
704                     <li>
705                         <label for="manageddate_from">Management date from:</label>
706                         <input type="text" id="manageddate_from" size="10" name="manageddate_from" value="[% manageddate_from | html %]" />
707                     </li>
708                     <li>
709                         <label for="manageddate_to">To:</label>
710                         <input type="text" id="manageddate_to" size="10" name="manageddate_to" value="[% manageddate_to | html %]" />
711                     </li>
712                     <li><label for="acceptedby"> Accepted by:</label><select id="acceptedby" name="acceptedby"><option value="">Any</option>
713 [% 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 %]
714                                                       </select></li>
715                     <li>
716                         <label for="accepteddate_from">Accepted date from:</label>
717                         <input type="text" id="accepteddate_from" size="10" name="accepteddate_from" value="[% accepteddate_from | html %]" />
718                     </li>
719                     <li>
720                         <label for="accepteddate_to">To:</label>
721                         <input type="text" id="accepteddate_to" size="10" name="accepteddate_to" value="[% accepteddate_to | html %]" />
722                     </li>
723                     <li><input type="submit" value="Go" /></li></ol>
724                 </fieldset>
725
726                                 <fieldset class="brief"><h4 class="local_collapse"><a href="#">Acquisition information</a></h4>
727                     <ol><li><label for="budgetid"> Book fund:</label>
728                     <select name="budgetid" id="budgetid">
729                       <option value="__ANY__">Any</option>
730                       [% IF budgetid == '__NONE__' %]
731                           <option value="__NONE__" selected="selected">None</option>
732                       [% ELSE %]
733                           <option value="__NONE__">None</option>
734                       [% END %]
735                     [% FOREACH budgetid_loo IN budgetid_loop %]
736                         [% 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 %]
737                         [% END %]
738                     </select></li>
739                     <li><label for="branchcode">Library:</label>
740                     <select name="branchcode" id="branchcode">
741                         <option value="__ANY__">Any</option>
742                         [% IF branchfilter %]
743                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchfilter ) %]
744                         [% ELSE %]
745                             [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
746                         [% END %]
747                     </select></li><li><input type="submit" value="Go" /></li></ol>
748                 </fieldset>
749     </div>
750             </form>
751         [% INCLUDE 'acquisitions-menu.inc' %]
752         </div>
753     [% END %]
754     [% END %]
755 </div>
756 [% END %]
757
758 [% MACRO jsinclude BLOCK %]
759     [% INCLUDE 'calendar.inc' %]
760     [% IF ( op == 'show' || op_else ) %]
761         <script type="text/javascript">
762             $(document).ready(function(){
763                 $(".deletesuggestion").on("click",function(){
764                     return confirm(_("Are you sure you want to delete this suggestion?"));
765                 });
766             });
767         </script>
768     [% END %]
769     [% IF ( op_else ) %]
770         [% INCLUDE 'datatables.inc' %]
771         [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
772         <script type="text/javascript">
773             /**
774             *  displayOther.
775             *  This function display the select or an textaera to write a reason.
776             */
777             function displayOther(id,show,hide){
778                 $("#"+hide+id).hide();
779                 $("#"+show+id).show();
780             }
781             $(document).ready(function() {
782                 $('#suggestiontabs').tabs({
783                     // Correct table sizing for tables hidden in tabs
784                     // http://www.datatables.net/examples/api/tabs_and_scrolling.html
785                     "activate": function(event, ui) {
786                         $( $.fn.dataTable.tables( true ) ).DataTable().columns.adjust();
787                     }
788                 });
789                 $(".sorted").dataTable($.extend(true, {}, dataTablesDefaults, {
790                     "aoColumnDefs": [
791                         { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] },
792                         { "sType": "anti-the", "aTargets" : [ "anti-the" ] }
793                     ],
794                     "sPaginationType": "four_button"
795                 }));
796             [% FOREACH suggestion IN suggestions %]
797                 // functions for [% suggestion.suggestiontype | html %] interactions
798                 $("#CheckAll[% suggestion.suggestiontype | html %]").click(function(e){
799                     $("#[% suggestion.suggestiontype | html %]t").checkCheckboxes();
800                     e.preventDefault();
801                 });
802                 $("#UncheckAll[% suggestion.suggestiontype | html %]").click(function(e){
803                     $("#[% suggestion.suggestiontype | html %]t").unCheckCheckboxes();
804                     e.preventDefault();
805                 });
806                 $("#other_reason[% suggestion.suggestiontype | html %]").hide();
807                 $("#reason[% suggestion.suggestiontype | html %]").change(function(){
808                     if($(this).val() == "other"){
809                         $(this).hide();
810                         $("#other_reason[% suggestion.suggestiontype | html %]").show();
811                 }
812                 });
813                 $("#[% suggestion.suggestiontype | html %]delete").change(function(){
814                     if(this.checked){
815                         $("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","delete");
816                     } else {
817                         $("form[name='f[% suggestion.suggestiontype | html %]'] input[name=op]").attr("value","change");
818                     }
819                 });
820
821             [% END %]
822                 $("a[href*=back]").click(function(){
823                 var sid = $(this).attr("href").replace(/#back/,"");
824                     $("#reason"+sid).show().find("option[value='']").attr("selected","selected");
825                     $("#other_reason"+sid).hide();
826                 });
827                 $("h4.local_collapse a").click(function(){
828                     $(this).parent().parent().find("ol").toggle();
829                     return false;
830                 });
831                 // http://jqueryui.com/demos/datepicker/#date-range
832                 var dates = $( "#suggesteddate_from, #suggesteddate_to" ).datepicker({
833                     changeMonth: true,
834                     numberOfMonths: 1,
835                     onSelect: function( selectedDate ) {
836                         var option = this.id == "suggesteddate_from" ? "minDate" : "maxDate",
837                             instance = $( this ).data( "datepicker" );
838                             date = $.datepicker.parseDate(
839                                 instance.settings.dateFormat ||
840                                 $.datepicker._defaults.dateFormat,
841                                 selectedDate, instance.settings );
842                         dates.not( this ).datepicker( "option", option, date );
843                     }
844                 });
845                 var datesMD = $( "#manageddate_from, #manageddate_to" ).datepicker({
846                     changeMonth: true,
847                     numberOfMonths: 1,
848                     onSelect: function( selectedDate ) {
849                         var option = this.id == "manageddate_from" ? "minDate" : "maxDate",
850                             instance = $( this ).data( "datepicker" );
851                             date = $.datepicker.parseDate(
852                                 instance.settings.dateFormat ||
853                                 $.datepicker._defaults.dateFormat,
854                                 selectedDate, instance.settings );
855                         datesMD.not( this ).datepicker( "option", option, date );
856                     }
857                 });
858                 var datesAD = $( "#accepteddate_from, #accepteddate_to" ).datepicker({
859                     changeMonth: true,
860                     numberOfMonths: 1,
861                     onSelect: function( selectedDate ) {
862                         var option = this.id == "accepteddate_from" ? "minDate" : "maxDate",
863                             instance = $( this ).data( "datepicker" );
864                             date = $.datepicker.parseDate(
865                                 instance.settings.dateFormat ||
866                                 $.datepicker._defaults.dateFormat,
867                                 selectedDate, instance.settings );
868                         datesAD.not( this ).datepicker( "option", option, date );
869                     }
870                 });
871
872                 $("form.update_suggestions").on("submit", function(e){
873                     var form = this;
874                     var action_delete_selected = $(this).find("input[value='delete']").is(":checked");
875                     if ( action_delete_selected ) {
876                         var suggestions_to_delete = $(this).find("input[name='edit_field']:checked");
877                         if ( suggestions_to_delete.length == 0 ) {
878                             alert(_("Please select at least one suggestion to delete"));
879                             e.preventDefault();
880                             return false;
881                         } else if ( suggestions_to_delete.length == 1 ) {
882                             if ( ! confirm(_("Are you sure you want to delete this suggestion?")) ) {
883                                 e.preventDefault();
884                                 return false;
885                             }
886                         } else if ( suggestions_to_delete.length > 1 ) {
887                             if ( ! confirm(_("Are you sure you want to delete these suggestions?")) ) {
888                                 e.preventDefault();
889                                 return false;
890                             }
891                         }
892                     }
893                     return true;
894                 });
895             });
896         </script>
897     [% END %]
898     [% IF ( op_save )  %]
899         <script type="text/javascript">
900             $(document).ready(function(){
901                 calcNewsuggTotal();
902                 $("#quantity,#price,#currency").on("change",function(){
903                     calcNewsuggTotal();
904                 });
905
906                 [% IF other_reason %]
907                     $(".select-reason").hide();
908                     $(".select-reason").find("option[value='other']").attr("selected","selected");
909                     $("#other_reason").show();
910                 [% ELSE %]
911                     $("#other_reason").hide();
912                 [% END %]
913                 $(".select-reason").change(function(){
914                     if($(this).val() == "other"){
915                         $(this).hide();
916                         $("#other_reason").show();
917                     }
918                 });
919                 $("a[href*=back]").click(function(){
920                     $(".select-reason").show().find("option[value='']").attr("selected","selected");
921                     $("#other_reason").hide();
922                 });
923             });
924         </script>
925     [% END %]
926     [% Asset.js("js/acq.js") | $raw %]
927     [% Asset.js("js/acquisitions-menu.js") | $raw %]
928 [% END %]
929
930 [% INCLUDE 'intranet-bottom.inc' %]