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 <div id="breadcrumbs">
18 <nav aria-label="Breadcrumb" class="breadcrumb">
21 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
24 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
27 <a href="#" aria-current="page">
34 <div class="main container-fluid">
36 <div class="col-sm-10 col-sm-push-2">
41 [% IF club_template %]
42 <div class="dialog message">
43 [% IF stored == 'updated' %]
44 <p>Club template <em>[% club_template.name | html %]</em> was updated.</p>
46 <p>Club template <em>[% club_template.name | html %]</em> was saved.</p>
50 <div class="dialog message">
51 [% IF stored == 'updated' %]
52 <p>Club <em>[% club.name | html %]</em> was updated.</p>
54 <p>Club <em>[% club.name | html %]</em> was saved.</p>
59 <h3>Club templates</h3>
61 [% IF CAN_user_clubs_edit_templates %]
62 <div class="btn-toolbar">
63 <div class="btn-group">
64 <a class="btn btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
69 [% IF club_templates %]
70 <table id="club-templates-table">
75 <th>Public enrollment</th>
76 <th>Email required</th>
78 <th class="noExport">Actions</th>
82 [% FOREACH t IN club_templates %]
84 <td>[% t.name | html %]</td>
85 <td>[% t.description | html %]</td>
87 [% IF t.is_enrollable_from_opac %]
94 [% IF t.is_email_required %]
100 <td>[% Branches.GetName( t.branchcode ) | html %]</td>
102 [% IF CAN_user_clubs_edit_templates %]
103 <a class="btn btn-xs btn-default" style="white-space:nowrap" href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
104 <i class="fa fa-pencil"></i> Edit
106 <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
107 <i class="fa fa-trash"></i> Delete
116 <div class="dialog message">No club templates defined.</div>
121 [% IF CAN_user_clubs_edit_clubs %]
122 <div class="btn-toolbar">
123 <div class="btn-group">
124 [% IF club_templates %]
125 <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
127 <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>
129 <ul class="dropdown-menu">
130 [% FOREACH t IN club_templates %]
131 <li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id | uri %]">[% t.name | html %]</a></li>
139 [% INCLUDE 'clubs-table.inc' %]
141 [% IF club_templates %]
142 <div class="dialog message">No clubs defined.</div>
144 <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
149 </div> <!-- /.col-sm-10.col-sm-push-2 -->
151 <div class="col-sm-2 col-sm-pull-10">
153 [% INCLUDE 'tools-menu.inc' %]
155 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
156 </div> <!-- /.row -->
158 [% MACRO jsinclude BLOCK %]
159 [% INCLUDE 'datatables.inc' %]
160 [% Asset.js("js/tools-menu.js") | $raw %]
162 $(document).ready(function() {
163 tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
164 "sPaginationType": "full",
165 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
167 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
171 cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
172 "sPaginationType": "full",
173 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
175 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
179 $("body").on("click", ".delete_club", function(e){
181 var club_id = $(this).data("id");
182 var club_name = $(this).data("name");
183 ConfirmDeleteClub( club_id, club_name );
186 $("body").on("click", ".delete_template", function(e){
188 var template_id = $(this).data("id");
189 var template_name = $(this).data("name");
190 ConfirmDeleteTemplate( template_id, template_name );
193 $("body").on("click", ".club_hold_search", function(e){
195 var club_id = $(this).data("id");
196 SearchToHold( club_id );
200 function ConfirmDeleteTemplate( id, name ) {
201 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) ) ) {
204 url: '/cgi-bin/koha/svc/club/template/delete',
206 success: function( data ) {
207 if ( data.success ) {
210 alert(_("Unable to delete template!"));
218 function ConfirmDeleteClub( id, name ) {
219 if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
222 url: '/cgi-bin/koha/svc/club/delete',
224 success: function( data ) {
225 if ( data.success ) {
228 alert(_("Unable to delete club!"));
236 function SearchToHold(club_id) {
237 var date = new Date();
238 date.setTime(date.getTime() + (10 * 60 * 1000));
239 $.cookie("holdforclub", club_id, { path: "/", expires: date });
240 location.href="/cgi-bin/koha/catalogue/search.pl";
245 [% INCLUDE 'intranet-bottom.inc' %]