Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / offline_circ / list.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4     [% INCLUDE "doc-head-open.inc" %]
5     <title>Koha &rsaquo; Circulation &rsaquo; Offline circulation</title>
6     [% INCLUDE "doc-head-close.inc" %]
7 </head>
8
9 <body id="ocirc_list" class="circ ocirc">
10     [% INCLUDE 'header.inc' %]
11     [% INCLUDE 'circ-search.inc' %]
12
13     <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo; Offline circulation</div>
14
15 <div class="main container-fluid">
16     <div class="row">
17         <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
18
19         <h2>Offline circulation</h2>
20
21             [% IF ( pending_operations ) %]
22
23                 <form>
24              <p><span class="checkall"></span> |
25              <span class="clearall"></span></p>
26                 <table id="operations">
27                     <thead>
28                             <tr>
29                                 <th>&nbsp;</th>
30                                     <th>Date</th>
31                                     <th>Action</th>
32                                     <th>Barcode</th>
33                                     <th>Card number</th>
34                                     <th>Amount</th>
35                             </tr>
36                         </thead>
37                         <tbody>
38                             [% FOREACH operation IN pending_operations %]
39                                 <tr class="oc-[% operation.action | html %]">
40                                     <td><input type="checkbox" name="operationid" value="[% operation.operationid | html %]" /></td>
41                                         <td>[% operation.timestamp | html %]</td>
42                             <td>
43                                 [% SWITCH ( operation.action ) -%]
44                                     [%   CASE "issue" -%]
45                                         Check out
46                                     [%   CASE "return" -%]
47                                         Check in
48                                     [%   CASE "payment" -%]
49                                         Payment
50                                     [%   CASE # default case -%]
51                                         [% operation.action | html %]
52                                 [% END -%]
53                             </td>
54                                         <td>
55                                 [% IF ( operation.biblionumber ) %]
56                                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% operation.biblionumber | html %]" title="[% operation.bibliotitle | html %]">[% operation.barcode | html %]</a>
57                                             [% ELSE %]
58                                                 <span class="error">[% operation.barcode | html %]</span>
59                                             [% END %]
60                                         </td>
61                                         <td>
62                                         [% IF ( operation.actionissue || operation.actionpayment) %]
63                                         [% IF ( operation.borrowernumber ) %]
64                                             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% operation.borrowernumber | html %]" title="[% operation.borrower | html %]">[% operation.cardnumber | html %]</a>
65                                         [% ELSE %]
66                                             <span class="error">[% operation.cardnumber | html %]</span>
67                                         [% END %]
68                                         [% END %]
69                                         </td>
70                                         <td>[% operation.amount | html %]</td>
71                                 </tr>
72                             [% END %]
73                         </tbody>
74                 </table>
75
76             <p id="actions">For the selected operations:
77             <input type="button" id="process" value="Process" />
78             <input type="button" id="delete" value="Delete" /></p>
79
80             </form>
81
82         [% ELSE %]
83
84             <p>There are no pending offline operations.</p>
85
86         [% END %]
87
88     </div>
89 </div>
90
91 [% MACRO jsinclude BLOCK %]
92     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
93     <script type="text/javascript">
94         $(document).ready(function() {
95
96         $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/offline_circ/list.pl\">"+_("Uncheck all")+"<\/a>");
97         $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/offline_circ/list.pl\">"+_("Check all")+"<\/a>");
98             $('#CheckNone').click(function() {
99                 $("#operations").unCheckCheckboxes();
100                 return false;
101             });
102             $('#CheckAll').click(function() {
103                 $("#operations").checkCheckboxes();
104                 return false;
105             });
106             $('#process,#delete').click(function() {
107                 var action = $(this).attr("id");
108                 $(":checkbox[name=operationid]:checked").each(function() {
109                     var cb = $(this);
110                     $.ajax({
111                         url: "process.pl",
112                         data: { 'action': action, 'operationid': this.value },
113                         async: false,
114                         dataType: "text",
115                         success: function(data) {
116                             if( data == "Added." ){
117                                 cb.replaceWith(_("Added."));
118                             } else if ( data == "Deleted."){
119                                 cb.replaceWith(_("Deleted."));
120                             } else if ( data == "Success."){
121                                 cb.replaceWith(_("Success."));
122                             } else if ( data == "Item not issued."){
123                                 cb.replaceWith(_("Item not checked out."));
124                             } else if ( data == "Item not found."){
125                                 cb.replaceWith(_("Item not found."));
126                             } else if ( data == "Barcode not found."){
127                                 cb.replaceWith(_("Item not found."));
128                             } else if ( data == "Borrower not found."){
129                                 cb.replaceWith(_("Patron not found."));
130                             } else {
131                                 cb.replaceWith(data);
132                             }
133                         }});
134                 });
135                 if( $('#operations tbody :checkbox').size() == 0 ) {
136                     $('#actions').hide();
137                 }
138             });
139         });
140     </script>
141 [% END %]
142
143 [% INCLUDE 'intranet-bottom.inc' %]