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