Bug 32366: (bug 30460 follow-up) Add tests
[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>Offline circulation &rsaquo; Circulation &rsaquo; Koha</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     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
14         <ol>
15             <li>
16                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
17             </li>
18             <li>
19                 <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a>
20             </li>
21             <li>
22                 <a href="#" aria-current="page">
23                     Offline circulation
24                 </a>
25             </li>
26         </ol>
27     </nav>
28
29 <div class="main container-fluid">
30     <div class="row">
31         <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
32
33         <h1>Offline circulation</h1>
34
35             [% IF ( pending_operations ) %]
36
37                 <form>
38                 <p>
39                     <a id="CheckAll" href="#"><i class="fa fa-check"></i> Check all</a>
40                     <a id="CheckNone" href="#"><i class="fa fa-remove"></i> Uncheck all</a>
41                 </p>
42
43                 <table id="operations">
44                     <thead>
45                             <tr>
46                                 <th>&nbsp;</th>
47                                     <th>Date</th>
48                                     <th>Action</th>
49                                     <th>Barcode</th>
50                                     <th>Card number</th>
51                                     <th>Amount</th>
52                             </tr>
53                         </thead>
54                         <tbody>
55                             [% FOREACH operation IN pending_operations %]
56                                 <tr class="oc-[% operation.action | html %]">
57                             <td><input type="checkbox" name="operationid" id="operationid[% operation.operationid | html %]" value="[% operation.operationid | html %]" /></td>
58                             <td>
59                                 <label for="operationid[% operation.operationid | html %]">[% operation.timestamp | html %]</label>
60                             </td>
61                             <td>
62                                 [% SWITCH ( operation.action ) -%]
63                                     [%   CASE "issue" -%]
64                                         <span>Check out</span>
65                                     [%   CASE "return" -%]
66                                         <span>Check in</span>
67                                     [%   CASE "payment" -%]
68                                         <span>Payment</span>
69                                     [%   CASE # default case -%]
70                                         <span>[% operation.action | html %]</span>
71                                 [% END -%]
72                             </td>
73                                         <td>
74                                 [% IF ( operation.biblionumber ) %]
75                                     <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% operation.biblionumber | uri %]" title="[% operation.bibliotitle | html %]">[% operation.barcode | html %]</a>
76                                             [% ELSE %]
77                                                 <span class="error">[% operation.barcode | html %]</span>
78                                             [% END %]
79                                         </td>
80                                         <td>
81                                         [% IF ( operation.actionissue || operation.actionpayment) %]
82                                         [% IF ( operation.borrowernumber ) %]
83                                     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% operation.borrowernumber | uri %]" title="[% operation.borrower | html %]">[% operation.cardnumber | html %]</a>
84                                         [% ELSE %]
85                                             <span class="error">[% operation.cardnumber | html %]</span>
86                                         [% END %]
87                                         [% END %]
88                                         </td>
89                                         <td>[% operation.amount | html %]</td>
90                                 </tr>
91                             [% END %]
92                         </tbody>
93                 </table>
94
95             <p id="actions">For the selected operations:
96             <input type="button" id="process" value="Process" />
97             <input type="button" id="delete" value="Delete" /></p>
98
99             </form>
100
101         [% ELSE %]
102
103             <p>There are no pending offline operations.</p>
104
105         [% END %]
106
107     </div>
108 </div>
109
110 [% MACRO jsinclude BLOCK %]
111     <script>
112         $(document).ready(function() {
113
114             $('#CheckNone').click(function(e) {
115                 e.preventDefault();
116                 $("#operations input:checkbox").prop("checked", false );
117             });
118             $('#CheckAll').click(function(e) {
119                 e.preventDefault();
120                 $("#operations input:checkbox").prop("checked", true );
121             });
122             $('#process,#delete').click(function() {
123                 var action = $(this).attr("id");
124                 $(":checkbox[name=operationid]:checked").each(function() {
125                     var cb = $(this);
126                     $.ajax({
127                         url: "process.pl",
128                         data: { 'action': action, 'operationid': this.value },
129                         async: false,
130                         dataType: "text",
131                         success: function(data) {
132                             if( data == "Added." ){
133                                 cb.replaceWith(_("Added."));
134                             } else if ( data == "Deleted."){
135                                 cb.replaceWith(_("Deleted."));
136                             } else if ( data == "Success."){
137                                 cb.replaceWith(_("Success."));
138                             } else if ( data == "Item not issued."){
139                                 cb.replaceWith(_("Item not checked out."));
140                             } else if ( data == "Item not found."){
141                                 cb.replaceWith(_("Item not found."));
142                             } else if ( data == "Barcode not found."){
143                                 cb.replaceWith(_("Item not found."));
144                             } else if ( data == "Borrower not found."){
145                                 cb.replaceWith(_("Patron not found."));
146                             } else {
147                                 cb.replaceWith(data);
148                             }
149                         }});
150                 });
151                 if( $('#operations tbody :checkbox').size() == 0 ) {
152                     $('#actions').hide();
153                 }
154             });
155         });
156     </script>
157 [% END %]
158
159 [% INCLUDE 'intranet-bottom.inc' %]