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