Bug 18327: Style 'Multi receiving' button like others
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / clubs / clubs.tt
1 [% USE Asset %]
2 [% USE KohaDates %]
3 [% USE Branches %]
4 [% USE Koha %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Tools &rsaquo; Patron clubs</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9
10 [% Asset.css("css/datatables.css") %]
11 </head>
12
13 <body id="clubs_clubs" class="clubs">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
16 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Patron clubs</div>
17
18 <div id="doc3" class="yui-t2">
19    <div id="bd">
20         <div id="yui-main">
21             <div class="yui-b">
22                 <h1>Patron clubs</h1>
23
24                 [% IF club_template %]
25                     <div class="dialog message">
26                         [% IF stored == 'updated' %]
27                             <p>Club template <i>[% club_template.name %]</i> was updated.</p>
28                         [% ELSE %]
29                             <p>Club template <i>[% club_template.name %]</i> was saved.</p>
30                         [% END %]
31                     </div>
32                 [% ELSIF club %]
33                     <div class="dialog message">
34                         [% IF stored == 'updated' %]
35                             <p>Club <i>[% club.name %]</i> was updated.</p>
36                         [% ELSE %]
37                             <p>Club <i>[% club.name %]</i> was saved.</p>
38                         [% END %]
39                     </div>
40                 [% END %]
41
42                 <h3>Club templates</h3>
43
44                 [% IF CAN_user_clubs_edit_templates %]
45                     <div class="btn-toolbar">
46                         <div class="btn-group">
47                             <a class="btn btn-sm btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
48                         </div>
49                     </div>
50                 [% END %]
51
52                 [% IF club_templates %]
53                     <table id="club-templates-table">
54                         <thead>
55                             <tr>
56                                 <th>Name</th>
57                                 <th>Description</th>
58                                 <th>Public enrollment</th>
59                                 <th>Email required</th>
60                                 <th>Library</th>
61                                 <th>Actions</th>
62                             </tr>
63                         </thead>
64                         <tbody>
65                             [% FOREACH t IN club_templates %]
66                                 <tr>
67                                     <td>[% t.name %]</td>
68                                     <td>[% t.description %]</td>
69                                     <td>
70                                         [% IF t.is_enrollable_from_opac %]
71                                             Yes
72                                         [% ELSE %]
73                                             No
74                                         [% END %]
75                                     </td>
76                                     <td>
77                                         [% IF t.is_email_required %]
78                                             Yes
79                                         [% ELSE %]
80                                             No
81                                         [% END %]
82                                     </td>
83                                     <td>[% Branches.GetName( t.branchcode ) %]</td>
84                                     <td class="actions">
85                                         [% IF CAN_user_clubs_edit_templates %]
86                                             <a class="btn btn-xs btn-default" style="white-space:nowrap"  href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id %]">
87                                                 <i class="fa fa-pencil"></i> Edit
88                                             </a>
89                                             <a class="btn btn-xs btn-default" href="#" onclick='ConfirmDeleteTemplate([% t.id %], "[% t.name | html %]", $(this) ); return false;'>
90                                                 <i class="fa fa-trash"></i> Delete
91                                             </a>
92                                         [% END %]
93                                     </td>
94                                 </tr>
95                             [% END %]
96                         </tbody>
97                     </table>
98                 [% ELSE %]
99                     <div class="dialog message">No club templates defined.</div>
100                 [% END %]
101
102                 <h3>Clubs</h3>
103
104                 [% IF CAN_user_clubs_edit_clubs %]
105                     <div class="btn-toolbar">
106                         <div class="btn-group">
107                             [% IF club_templates %]
108                                 <button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
109                             [% ELSE %]
110                                 <button disabled="disabled" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
111                             [% END %]
112                             <ul class="dropdown-menu">
113                                 [% FOREACH t IN club_templates %]
114                                     <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id %]">[% t.name %]</a></li>
115                                 [% END %]
116                             </ul>
117                         </div>
118                     </div>
119                 [% END %]
120
121                 [% IF clubs %]
122                     <table id="clubs-table">
123                         <thead>
124                             <tr>
125                                 <th>Name</th>
126                                 <th>Template</th>
127                                 <th>Description</th>
128                                 <th>Public enrollment</th>
129                                 <th>Email required</th>
130                                 <th>Library</th>
131                                 <th>Start date</th>
132                                 <th>End date</th>
133                                 <th>Enrolled patrons</th>
134                                 <th>&nbsp;</th>
135                             </tr>
136                         </thead>
137                         <tbody>
138                             [% FOREACH c IN clubs %]
139                                 <tr>
140                                     <td>[% c.name %]</td>
141                                     <td>[% c.club_template.name %]</td>
142                                     <td>[% c.description %]</td>
143                                     <td>
144                                         [% IF c.club_template.is_enrollable_from_opac %]
145                                             Yes
146                                         [% ELSE %]
147                                             No
148                                         [% END %]
149                                     </td>
150                                     <td>
151                                         [% IF c.club_template.is_email_required %]
152                                             Yes
153                                         [% ELSE %]
154                                             No
155                                         [% END %]
156                                     </td>
157                                     <td>[% Branches.GetName( c.branchcode ) %]</td>
158                                     <td>
159                                         [% IF c.date_start %]
160                                             [% c.date_start | $KohaDates %]
161                                         [% END %]
162                                     </td>
163                                     <td>
164                                         [% IF c.date_end %]
165                                             [% c.date_end | $KohaDates %]
166                                         [% END %]
167                                     </td>
168                                     <td>
169                                         [% c.club_enrollments.count %]
170                                     </td>
171                                     <td class="actions">
172                                         <div class="dropdown">
173                                             <a class="btn btn-default btn-xs dropdown-toggle" id="clubactions[% c.id %]" role="button" data-toggle="dropdown" href="#">
174                                                 Actions <b class="caret"></b>
175                                             </a>
176                                             <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="clubactions[% c.id %]">
177                                                 [% IF ( c.club_enrollments.count ) %]
178                                                     <li>
179                                                         <a href="club-enrollments.pl?id=[% c.id %]">
180                                                             <i class="fa fa-list-ul"></i> Enrollments
181                                                         </a>
182                                                     </li>
183                                                 [% ELSE %]
184                                                     <li class="disabled">
185                                                         <a href="club-enrollments.pl?id=[% c.id %]">
186                                                             <i class="fa fa-list-ul"></i> Enrollments
187                                                         </a>
188                                                     </li>
189                                                 [% END %]
190                                                 [% IF CAN_user_clubs_edit_clubs %]
191                                                     <li>
192                                                         <a href="clubs-add-modify.pl?id=[% c.id %]">
193                                                             <i class="fa fa-pencil"></i> Edit
194                                                         </a>
195                                                     </li>
196                                                     <li>
197                                                         <a href="#" onclick='ConfirmDeleteClub([% c.id %], "[% c.name | html %]", $(this) ); return false;'>
198                                                             <i class="fa fa-trash"></i> Delete
199                                                         </a>
200                                                     </li>
201                                                 [% END %]
202                                             </ul>
203                                         </div>
204                                     </td>
205                                 </tr>
206                             [% END %]
207                         </tbody>
208                     </table> <!-- /.clubs-table -->
209                 [% ELSE %]
210                     [% IF club_templates %]
211                         <div class="dialog message">No clubs defined.</div>
212                     [% ELSE %]
213                         <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
214                     [% END %]
215                 [% END %]
216             </div> <!-- /.yui-b -->
217         </div> <!-- /.yui-main -->
218         <div class="yui-b noprint">
219             [% INCLUDE 'tools-menu.inc' %]
220         </div>
221     </div> <!-- /#bd -->
222
223 [% MACRO jsinclude BLOCK %]
224     [% INCLUDE 'datatables.inc' %]
225     [% Asset.js("js/tools-menu.js") %]
226     <script type="text/javascript">
227         $(document).ready(function() {
228             tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
229                 "sPaginationType": "four_button",
230                 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
231                 "aoColumnDefs": [
232                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
233                 ]
234             } ));
235
236             cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
237                 "sPaginationType": "four_button",
238                 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
239                 "aoColumnDefs": [
240                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
241                 ]
242             } ));
243         });
244
245         function ConfirmDeleteTemplate( id, name, a ) {
246             if ( confirm( _("Are you sure you want to delete the club template %s? This will delete all clubs using this template and cancel patron enrollments" ).format(name) ) ) {
247                 $.ajax({
248                     type: "POST",
249                     url: '/cgi-bin/koha/svc/club/template/delete',
250                     data: { id: id },
251                     success: function( data ) {
252                         if ( data.success ) {
253                             location.reload();
254                         } else {
255                             alert(_("Unable to delete template!"));
256                         }
257                     },
258                     dataType: 'json'
259                 });
260             }
261         }
262
263         function ConfirmDeleteClub( id, name, a ) {
264             if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
265                 $.ajax({
266                     type: "POST",
267                     url: '/cgi-bin/koha/svc/club/delete',
268                     data: { id: id },
269                     success: function( data ) {
270                         if ( data.success ) {
271                             location.reload();
272                         } else {
273                             alert(_("Unable to delete club!"));
274                         }
275                     },
276                     dataType: 'json'
277                 });
278             }
279         }
280     </script>
281 [% END %]
282
283 [% INCLUDE 'intranet-bottom.inc' %]