Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt
Martin Renvoize f733910f26
Bug 33223: Replace 'first_valid' with 'notice' for email addresses
This patch replaces the uses of first_valid_email_address with
notice_email_address in waiting_holds, transferstoreceive, clubs and
sendbasket so that we take EmailFieldPrimary into account for these
notices too.

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-05-16 15:17:35 -03:00

101 lines
3.3 KiB
Text

[% USE KohaDates %]
[% IF enrollments %]
<h2>Clubs currently enrolled in</h2>
<table id="clubs-table-enrolled" class="table table-bordered table-striped">
<caption class="sr-only">Clubs</caption>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Date enrolled</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH e IN enrollments %]
<tr>
<td>[% e.club.name | html %]</td>
<td>[% e.club.description | html %]</td>
<td>[% e.date_enrolled | $KohaDates %]</td>
<td>
[% IF e.club.club_template.is_enrollable_from_opac %]
<button class="btn btn-xs btn-default" onclick="cancelEnrollment( [% e.id | html %] )">
<i class="fa fa-remove" aria-hidden="true"></i> Cancel enrollment
</button>
[% ELSE %]
Contact your library to be disenrolled from this club.
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
[% IF clubs %]
<h2>Clubs you can enroll in</h2>
<table id="clubs-table-unenrolled" class="table table-bordered table-striped">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
[% FOREACH c IN clubs %]
<tr>
<td>[% c.name | html %]</td>
<td>[% c.description | html %]</td>
<td>
[% IF !c.club_template.is_email_required || ( c.club_template.is_email_required && borrower.notice_email_address ) %]
<button class="btn btn-xs btn-default" onclick="loadEnrollmentForm([% c.id | html%])">
<i class="fa fa-plus" aria-hidden="true"></i> Enroll
</button>
[% ELSE %]
<span class="hint">You must have an email address to enroll</span>
[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
<script>
function loadEnrollmentForm( id ) {
$("body").css("cursor", "progress");
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/enroll.pl?borrowernumber=[% borrower.borrowernumber | html %]&id=' + id, function() {
$("body").css("cursor", "default");
});
return false;
}
function cancelEnrollment( id ) {
$("body").css("cursor", "progress");
$.ajax({
type: "POST",
url: '/cgi-bin/koha/svc/club/cancel_enrollment',
data: { id: id },
success: function( data ) {
if ( data.success ) {
$('#opac-user-clubs').load('/cgi-bin/koha/clubs/clubs-tab.pl?borrowernumber=[% borrower.borrowernumber | html %]', function() {
$("body").css("cursor", "default");
});
} else {
alert(_("Unable to cancel enrollment!"));
}
},
dataType: 'json'
});
return false;
}
</script>