7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Tools › Patron clubs</title>
9 [% INCLUDE 'doc-head-close.inc' %]
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> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Patron clubs</div>
18 <div class="main container-fluid">
20 <div class="col-sm-10 col-sm-push-2">
25 [% IF club_template %]
26 <div class="dialog message">
27 [% IF stored == 'updated' %]
28 <p>Club template <i>[% club_template.name | html %]</i> was updated.</p>
30 <p>Club template <i>[% club_template.name | html %]</i> was saved.</p>
34 <div class="dialog message">
35 [% IF stored == 'updated' %]
36 <p>Club <i>[% club.name | html %]</i> was updated.</p>
38 <p>Club <i>[% club.name | html %]</i> was saved.</p>
43 <h3>Club templates</h3>
45 [% IF CAN_user_clubs_edit_templates %]
46 <div class="btn-toolbar">
47 <div class="btn-group">
48 <a class="btn btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
53 [% IF club_templates %]
54 <table id="club-templates-table">
59 <th>Public enrollment</th>
60 <th>Email required</th>
66 [% FOREACH t IN club_templates %]
68 <td>[% t.name | html %]</td>
69 <td>[% t.description | html %]</td>
71 [% IF t.is_enrollable_from_opac %]
78 [% IF t.is_email_required %]
84 <td>[% Branches.GetName( t.branchcode ) | html %]</td>
86 [% IF CAN_user_clubs_edit_templates %]
87 <a class="btn btn-xs btn-default" style="white-space:nowrap" href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
88 <i class="fa fa-pencil"></i> Edit
90 <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
91 <i class="fa fa-trash"></i> Delete
100 <div class="dialog message">No club templates defined.</div>
105 [% IF CAN_user_clubs_edit_clubs %]
106 <div class="btn-toolbar">
107 <div class="btn-group">
108 [% IF club_templates %]
109 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
111 <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>
113 <ul class="dropdown-menu">
114 [% FOREACH t IN club_templates %]
115 <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
123 [% INCLUDE 'clubs-table.inc' %]
125 [% IF club_templates %]
126 <div class="dialog message">No clubs defined.</div>
128 <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
133 </div> <!-- /.col-sm-10.col-sm-push-2 -->
135 <div class="col-sm-2 col-sm-pull-10">
137 [% INCLUDE 'tools-menu.inc' %]
139 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
140 </div> <!-- /.row -->
142 [% MACRO jsinclude BLOCK %]
143 [% INCLUDE 'datatables.inc' %]
144 [% Asset.js("js/tools-menu.js") | $raw %]
146 $(document).ready(function() {
147 tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
148 "sPaginationType": "full",
149 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
151 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
155 cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
156 "sPaginationType": "full",
157 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
159 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
163 $(".delete_club").on("click", function(e){
165 var club_id = $(this).data("id");
166 var club_name = $(this).data("name");
167 ConfirmDeleteClub( club_id, club_name );
170 $(".delete_template").on("click", function(e){
172 var template_id = $(this).data("id");
173 var template_name = $(this).data("name");
174 ConfirmDeleteTemplate( template_id, template_name );
177 $(".club_hold_search").on("click", function(e){
179 var club_id = $(this).data("id");
180 SearchToHold( club_id );
184 function ConfirmDeleteTemplate( id, name ) {
185 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) ) ) {
188 url: '/cgi-bin/koha/svc/club/template/delete',
190 success: function( data ) {
191 if ( data.success ) {
194 alert(_("Unable to delete template!"));
202 function ConfirmDeleteClub( id, name ) {
203 if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
206 url: '/cgi-bin/koha/svc/club/delete',
208 success: function( data ) {
209 if ( data.success ) {
212 alert(_("Unable to delete club!"));
220 function SearchToHold(club_id) {
221 var date = new Date();
222 date.setTime(date.getTime() + (10 * 60 * 1000));
223 $.cookie("holdforclub", club_id, { path: "/", expires: date });
224 location.href="/cgi-bin/koha/catalogue/search.pl";
229 [% INCLUDE 'intranet-bottom.inc' %]