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