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