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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
25 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
28 <a href="#" aria-current="page">
36 <div class="main container-fluid">
38 <div class="col-sm-10 col-sm-push-2">
43 [% IF club_template %]
44 <div class="dialog message">
45 [% IF stored == 'updated' %]
46 <p>Club template <em>[% club_template.name | html %]</em> was updated.</p>
48 <p>Club template <em>[% club_template.name | html %]</em> was saved.</p>
52 <div class="dialog message">
53 [% IF stored == 'updated' %]
54 <p>Club <em>[% club.name | html %]</em> was updated.</p>
56 <p>Club <em>[% club.name | html %]</em> was saved.</p>
61 <h3>Club templates</h3>
63 [% IF CAN_user_clubs_edit_templates %]
64 <div class="btn-toolbar">
65 <div class="btn-group">
66 <a class="btn btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
71 [% IF club_templates.count %]
72 <table id="club-templates-table">
77 <th>Public enrollment</th>
78 <th>Email required</th>
80 <th class="noExport">Actions</th>
84 [% FOREACH t IN club_templates %]
86 <td>[% t.name | html %]</td>
87 <td>[% t.description | html %]</td>
89 [% IF t.is_enrollable_from_opac %]
96 [% IF t.is_email_required %]
102 <td>[% Branches.GetName( t.branchcode ) | html %]</td>
104 [% IF CAN_user_clubs_edit_templates %]
105 <a class="btn btn-xs btn-default" style="white-space:nowrap" href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
106 <i class="fa fa-pencil"></i> Edit
108 <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
109 <i class="fa fa-trash"></i> Delete
118 <div class="dialog message">No club templates defined.</div>
123 [% IF CAN_user_clubs_edit_clubs %]
124 <div class="btn-toolbar">
125 <div class="btn-group">
126 [% IF club_templates.count %]
127 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
129 <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>
131 <ul class="dropdown-menu">
132 [% FOREACH t IN club_templates %]
133 <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
141 [% INCLUDE 'clubs-table.inc' %]
143 [% IF club_templates.count %]
144 <div class="dialog message">No clubs defined.</div>
146 <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
151 </div> <!-- /.col-sm-10.col-sm-push-2 -->
153 <div class="col-sm-2 col-sm-pull-10">
155 [% INCLUDE 'tools-menu.inc' %]
157 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
158 </div> <!-- /.row -->
160 [% MACRO jsinclude BLOCK %]
161 [% INCLUDE 'datatables.inc' %]
162 [% Asset.js("js/tools-menu.js") | $raw %]
164 $(document).ready(function() {
165 tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
166 "sPaginationType": "full",
167 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
169 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
173 cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
174 "sPaginationType": "full",
175 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
177 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
181 $("body").on("click", ".delete_club", function(e){
183 var club_id = $(this).data("id");
184 var club_name = $(this).data("name");
185 ConfirmDeleteClub( club_id, club_name );
188 $("body").on("click", ".delete_template", function(e){
190 var template_id = $(this).data("id");
191 var template_name = $(this).data("name");
192 ConfirmDeleteTemplate( template_id, template_name );
195 $("body").on("click", ".club_hold_search", function(e){
197 var club_id = $(this).data("id");
198 SearchToHold( club_id );
202 function ConfirmDeleteTemplate( id, name ) {
203 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) ) ) {
206 url: '/cgi-bin/koha/svc/club/template/delete',
208 success: function( data ) {
209 if ( data.success ) {
212 alert(_("Unable to delete template!"));
220 function ConfirmDeleteClub( id, name ) {
221 if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
224 url: '/cgi-bin/koha/svc/club/delete',
226 success: function( data ) {
227 if ( data.success ) {
230 alert(_("Unable to delete club!"));
238 function SearchToHold(club_id) {
239 var date = new Date();
240 date.setTime(date.getTime() + (10 * 60 * 1000));
241 Cookies.set("holdforclub", club_id, { path: "/", expires: date, sameSite: 'Lax' });
242 location.href="/cgi-bin/koha/catalogue/search.pl";
247 [% INCLUDE 'intranet-bottom.inc' %]