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