Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/clubs/clubs-tab.tt
Hammat Wele d39115e5fd
Bug 32341: (follow-up) Making the remains OPAC tables responsive
Apply the patch and check for the responsivity of the following tables
1- Go to the OPAC
2- Open mobile mode
3- The following tables are not responsive
- Summary - Clubs
- Summary - Recalls
- Summary - Article requests
- Charges - (relative's)
- Search history - Authority
- Checkout history - All
- Checkout history - Checkouts
- Checkout history - On-site
- Recalls history
- Messaging
- Subscription (serial)
- Course reserves - Courses
- Course reserves - Reserves
- Authority search results
4- Apply the patch
5- Execute 'yarn build --view opac'
6- Clean your cache or open your navigator on private mode (to load updated css files)
7- Perform previous step (1-3)
8- Confirm that the tables are now displayed correctly and is now responsive.

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 6caeb1f627)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
2023-07-12 07:56:39 +01:00

120 lines
3.9 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>
<th></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>
<td></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>
<th></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>
<td></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;
}
var Tables = $("#clubs-table-enrolled,#clubs-table-unenrolled");
Tables.each(function(){
$(this).dataTable($.extend(true, {}, dataTablesDefaults, {
"searching": false,
"paging": false,
"info": false,
"autoWidth": false,
"responsive": {
"details": { "type": 'column',"target": -1 }
},
"columnDefs": [
{ "className": 'dtr-control', "orderable": false, "targets": -1 }
],
}));
});
</script>