7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Patron clubs › Tools › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="clubs_clubs" class="clubs">
14 [% WRAPPER 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
18 [% WRAPPER 'sub-header.inc' %]
19 [% WRAPPER breadcrumbs %]
20 [% WRAPPER breadcrumb_item %]
21 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
23 [% WRAPPER breadcrumb_item bc_active= 1 %]
24 <span>Patron clubs</span>
26 [% END #/ WRAPPER breadcrumbs %]
27 [% END #/ WRAPPER sub-header.inc %]
29 <div class="main container-fluid">
31 <div class="col-sm-10 col-sm-push-2">
36 [% IF club_template %]
37 <div class="dialog message">
38 [% IF stored == 'updated' %]
39 <p>Club template <em>[% club_template.name | html %]</em> was updated.</p>
41 <p>Club template <em>[% club_template.name | html %]</em> was saved.</p>
45 <div class="dialog message">
46 [% IF stored == 'updated' %]
47 <p>Club <em>[% club.name | html %]</em> was updated.</p>
49 <p>Club <em>[% club.name | html %]</em> was saved.</p>
54 <h3>Club templates</h3>
56 [% IF CAN_user_clubs_edit_templates %]
57 <div class="btn-toolbar">
58 <div class="btn-group">
59 <a class="btn btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
64 [% IF club_templates.count %]
65 <div class="page-section">
66 <table id="club-templates-table">
71 <th>Public enrollment</th>
72 <th>Email required</th>
74 <th class="noExport">Actions</th>
78 [% FOREACH t IN club_templates %]
80 <td>[% t.name | html %]</td>
81 <td>[% t.description | html %]</td>
83 [% IF t.is_enrollable_from_opac %]
90 [% IF t.is_email_required %]
96 <td>[% Branches.GetName( t.branchcode ) | html %]</td>
98 [% IF CAN_user_clubs_edit_templates %]
99 <a class="btn btn-xs btn-default" style="white-space:nowrap" href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
100 <i class="fa fa-pencil-alt"></i> Edit
102 <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
103 <i class="fa fa-trash-can"></i> Delete
111 </div> <!-- /.page-section -->
113 <div class="dialog message">No club templates defined.</div>
118 [% IF CAN_user_clubs_edit_clubs %]
119 <div class="btn-toolbar">
120 <div class="btn-group">
121 [% IF club_templates.count %]
122 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
124 <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>
126 <ul class="dropdown-menu">
127 [% FOREACH t IN club_templates %]
128 <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
136 <div class="page-section">
137 [% INCLUDE 'clubs-table.inc' %]
138 </div> <!-- /.page-section -->
140 [% IF club_templates.count %]
141 <div class="dialog message">No clubs defined.</div>
143 <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
148 </div> <!-- /.col-sm-10.col-sm-push-2 -->
150 <div class="col-sm-2 col-sm-pull-10">
152 [% INCLUDE 'tools-menu.inc' %]
154 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
155 </div> <!-- /.row -->
157 [% MACRO jsinclude BLOCK %]
158 [% INCLUDE 'datatables.inc' %]
159 [% Asset.js("js/tools-menu.js") | $raw %]
161 $(document).ready(function() {
162 tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
163 "sPaginationType": "full",
164 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
166 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
170 cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
171 "sPaginationType": "full",
172 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
174 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
178 $("body").on("click", ".delete_club", function(e){
180 var club_id = $(this).data("id");
181 var club_name = $(this).data("name");
182 ConfirmDeleteClub( club_id, club_name );
185 $("body").on("click", ".delete_template", function(e){
187 var template_id = $(this).data("id");
188 var template_name = $(this).data("name");
189 ConfirmDeleteTemplate( template_id, template_name );
192 $("body").on("click", ".club_hold_search", function(e){
194 var club_id = $(this).data("id");
195 SearchToHold( club_id );
199 function ConfirmDeleteTemplate( id, name ) {
200 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) ) ) {
203 url: '/cgi-bin/koha/svc/club/template/delete',
205 success: function( data ) {
206 if ( data.success ) {
209 alert(_("Unable to delete template!"));
217 function ConfirmDeleteClub( id, name ) {
218 if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
221 url: '/cgi-bin/koha/svc/club/delete',
223 success: function( data ) {
224 if ( data.success ) {
227 alert(_("Unable to delete club!"));
235 function SearchToHold(club_id) {
236 var date = new Date();
237 date.setTime(date.getTime() + (10 * 60 * 1000));
238 Cookies.set("holdforclub", club_id, { path: "/", expires: date, sameSite: 'Lax' });
239 location.href="/cgi-bin/koha/catalogue/search.pl";
244 [% INCLUDE 'intranet-bottom.inc' %]