6 [% PROCESS 'i18n.inc' %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>[% FILTER collapse %]
10 [% t("Patron clubs") | html %] ›
11 [% t("Tools") | html %] ›
12 [% t("Koha") | html %]
14 [% INCLUDE 'doc-head-close.inc' %]
18 <body id="clubs_clubs" class="clubs">
19 [% WRAPPER 'header.inc' %]
20 [% INCLUDE 'cat-search.inc' %]
23 [% WRAPPER 'sub-header.inc' %]
24 [% WRAPPER breadcrumbs %]
25 [% WRAPPER breadcrumb_item %]
26 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
28 [% WRAPPER breadcrumb_item bc_active= 1 %]
29 <span>Patron clubs</span>
31 [% END #/ WRAPPER breadcrumbs %]
32 [% END #/ WRAPPER sub-header.inc %]
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.count %]
70 <div class="page-section">
71 <table id="club-templates-table">
76 <th>Public enrollment</th>
77 <th>Email required</th>
79 <th class="noExport">Actions</th>
83 [% FOREACH t IN club_templates %]
85 <td>[% t.name | html %]</td>
86 <td>[% t.description | html %]</td>
88 [% IF t.is_enrollable_from_opac %]
95 [% IF t.is_email_required %]
101 <td>[% Branches.GetName( t.branchcode ) | html %]</td>
103 [% IF CAN_user_clubs_edit_templates %]
104 <a class="btn btn-xs btn-default" style="white-space:nowrap" href="/cgi-bin/koha/clubs/templates-add-modify.pl?id=[% t.id | html %]">
105 <i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit
107 <a class="btn btn-xs btn-default delete_template" href="#" data-id="[% t.id | html %]" data-name="[% t.name | html %]">
108 <i class="fa fa-trash-can"></i> Delete
116 </div> <!-- /.page-section -->
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 <div class="page-section">
142 [% INCLUDE 'clubs-table.inc' %]
143 </div> <!-- /.page-section -->
145 [% IF club_templates.count %]
146 <div class="dialog message">No clubs defined.</div>
148 <div class="dialog message">No clubs defined. A club template must be defined before a club can be defined.</div>
153 </div> <!-- /.col-sm-10.col-sm-push-2 -->
155 <div class="col-sm-2 col-sm-pull-10">
157 [% INCLUDE 'tools-menu.inc' %]
159 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
160 </div> <!-- /.row -->
162 [% MACRO jsinclude BLOCK %]
163 [% INCLUDE 'datatables.inc' %]
164 [% Asset.js("js/tools-menu.js") | $raw %]
166 $(document).ready(function() {
167 tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
168 "sPaginationType": "full",
169 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
171 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
175 cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
176 "sPaginationType": "full",
177 "sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
179 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
183 $("body").on("click", ".delete_club", function(e){
185 var club_id = $(this).data("id");
186 var club_name = $(this).data("name");
187 ConfirmDeleteClub( club_id, club_name );
190 $("body").on("click", ".delete_template", function(e){
192 var template_id = $(this).data("id");
193 var template_name = $(this).data("name");
194 ConfirmDeleteTemplate( template_id, template_name );
197 $("body").on("click", ".club_hold_search", function(e){
199 var club_id = $(this).data("id");
200 SearchToHold( club_id );
204 function ConfirmDeleteTemplate( id, name ) {
205 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) ) ) {
208 url: '/cgi-bin/koha/svc/club/template/delete',
210 success: function( data ) {
211 if ( data.success ) {
214 alert(_("Unable to delete template!"));
222 function ConfirmDeleteClub( id, name ) {
223 if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
226 url: '/cgi-bin/koha/svc/club/delete',
228 success: function( data ) {
229 if ( data.success ) {
232 alert(_("Unable to delete club!"));
240 function SearchToHold(club_id) {
241 var date = new Date();
242 date.setTime(date.getTime() + (10 * 60 * 1000));
243 Cookies.set("holdforclub", club_id, { path: "/", expires: date, sameSite: 'Lax' });
244 location.href="/cgi-bin/koha/catalogue/search.pl";
249 [% INCLUDE 'intranet-bottom.inc' %]