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' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
26 <a href="#" aria-current="page">
33 <div class="main container-fluid">
35 <div class="col-sm-10 col-sm-push-2">
40 [% IF club_template %]
41 <div class="dialog message">
42 [% IF stored == 'updated' %]
43 <p>Club template <em>[% club_template.name | html %]</em> was updated.</p>
45 <p>Club template <em>[% club_template.name | html %]</em> was saved.</p>
49 <div class="dialog message">
50 [% IF stored == 'updated' %]
51 <p>Club <em>[% club.name | html %]</em> was updated.</p>
53 <p>Club <em>[% club.name | html %]</em> was saved.</p>
58 <h3>Club templates</h3>
60 [% IF CAN_user_clubs_edit_templates %]
61 <div class="btn-toolbar">
62 <div class="btn-group">
63 <a class="btn btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
68 [% IF club_templates %]
69 <table id="club-templates-table">
74 <th>Public enrollment</th>
75 <th>Email required</th>
77 <th class="noExport">Actions</th>
81 [% FOREACH t IN club_templates %]
83 <td>[% t.name | html %]</td>
84 <td>[% t.description | html %]</td>
86 [% IF t.is_enrollable_from_opac %]
93 [% IF t.is_email_required %]
99 <td>[% Branches.GetName( t.branchcode ) | html %]</td>
101 [% IF CAN_user_clubs_edit_templates %]
102 <a class="btn btn-xs btn-default" style="white-space:nowrap" href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
103 <i class="fa fa-pencil"></i> Edit
105 <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
106 <i class="fa fa-trash"></i> Delete
115 <div class="dialog message">No club templates defined.</div>
120 [% IF CAN_user_clubs_edit_clubs %]
121 <div class="btn-toolbar">
122 <div class="btn-group">
123 [% IF club_templates %]
124 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
126 <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>
128 <ul class="dropdown-menu">
129 [% FOREACH t IN club_templates %]
130 <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
138 [% INCLUDE 'clubs-table.inc' %]
140 [% IF club_templates %]
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 $.cookie("holdforclub", club_id, { path: "/", expires: date });
239 location.href="/cgi-bin/koha/catalogue/search.pl";
244 [% INCLUDE 'intranet-bottom.inc' %]