Owen Leonard
693dde521d
This patch addresses template issues with the newly-added patron clubs pages. - Move Clubs tab out of second position in Circulation page tabs. - Link patron name in enrollments list to the patron record - Make page titles on some pages more specific - Correct label "for" attributes so that it matches input id - Correst style of buttons: Buttons in tables must be "btn-xs," all Bootstrap buttons must have "btn-default." - Correct "Edit" icons: Should be "fa-pencil" This patch also revises the club template editing form to make it more consistent with similar interfaces in Koha and (hopefully) make it more clear. To test, apply the patch and test adding clubs and club templates and enrolling patrons in clubs via the staff client and OPAC. Confirm that everything looks and work okay. Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
283 lines
13 KiB
Text
283 lines
13 KiB
Text
[% USE KohaDates %]
|
|
[% USE Branches %]
|
|
[% USE Koha %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Patron clubs</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
|
|
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
|
|
[% INCLUDE 'datatables.inc' %]
|
|
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
$(document).ready(function() {
|
|
tTable = $('#club-templates-table').dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"sPaginationType": "four_button",
|
|
"sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false },
|
|
]
|
|
} ));
|
|
|
|
cTable = $('#clubs-table').dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"sPaginationType": "four_button",
|
|
"sDom": 'C<"top pager"ilpf><"#filter_c">tr<"bottom pager"ip>',
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false },
|
|
]
|
|
} ));
|
|
});
|
|
|
|
function ConfirmDeleteTemplate( id, name, a ) {
|
|
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) ) ) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/cgi-bin/koha/svc/club/template/delete',
|
|
data: { id: id },
|
|
success: function( data ) {
|
|
if ( data.success ) {
|
|
tTable.fnDeleteRow(a.closest("tr")[0]);
|
|
} else {
|
|
alert(_("Unable to delete template!"));
|
|
}
|
|
},
|
|
dataType: 'json'
|
|
});
|
|
}
|
|
}
|
|
|
|
function ConfirmDeleteClub( id, name, a ) {
|
|
if ( confirm( _("Are you sure you want to delete the club %s? This will cancel all patron enrollments in this club." ).format(name) ) ) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/cgi-bin/koha/svc/club/delete',
|
|
data: { id: id },
|
|
success: function( data ) {
|
|
if ( data.success ) {
|
|
cTable.fnDeleteRow(a.closest("tr")[0]);
|
|
} else {
|
|
alert(_("Unable to delete club!"));
|
|
}
|
|
},
|
|
dataType: 'json'
|
|
});
|
|
}
|
|
}
|
|
//]]>
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body id="clubs_clubs" class="clubs">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Patron clubs</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
<h1>Patron clubs</h1>
|
|
|
|
[% IF club_template %]
|
|
<div class="dialog message">
|
|
[% IF stored == 'updated' %]
|
|
<p>Club template <i>[% club_template.name %]</i> was updated.</p>
|
|
[% ELSE %]
|
|
<p>Club template <i>[% club_template.name %]</i> was saved.</p>
|
|
[% END %]
|
|
</div>
|
|
[% ELSIF club %]
|
|
<div class="dialog message">
|
|
[% IF stored == 'updated' %]
|
|
<p>Club <i>[% club.name %]</i> was updated.</p>
|
|
[% ELSE %]
|
|
<p>Club <i>[% club.name %]</i> was saved.</p>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
<h3>Club templates</h3>
|
|
|
|
[% IF CAN_user_clubs_edit_templates %]
|
|
<div class="btn-toolbar">
|
|
<div class="btn-group">
|
|
<a class="btn btn-sm btn-default" href="templates-add-modify.pl"><i class="fa fa-plus"></i> New club template</a>
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
|
|
<table id="club-templates-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Description</th>
|
|
<th>Public enrollment</th>
|
|
<th>Email required</th>
|
|
<th>Library</th>
|
|
<th> </th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% IF club_templates %]
|
|
[% FOREACH t IN club_templates %]
|
|
<tr>
|
|
<td>[% t.name %]</td>
|
|
<td>[% t.description %]</td>
|
|
<td>
|
|
[% IF t.is_enrollable_from_opac %]
|
|
Yes
|
|
[% ELSE %]
|
|
No
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF t.is_email_required %]
|
|
Yes
|
|
[% ELSE %]
|
|
No
|
|
[% END %]
|
|
</td>
|
|
<td>[% Branches.GetName( t.branchcode ) %]</td>
|
|
<td>
|
|
[% IF CAN_user_clubs_edit_templates %]
|
|
<a class="btn btn-xs btn-default" style="white-space:nowrap" href="templates-add-modify.pl?id=[% t.id %]">
|
|
<i class="fa fa-pencil"></i> Edit
|
|
</a>
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF CAN_user_clubs_edit_templates %]
|
|
<a class="btn btn-xs btn-default" href="#" onclick='ConfirmDeleteTemplate([% t.id %], "[% t.name | html %]", $(this) ); return false;'>
|
|
<i class="fa fa-trash"></i> Delete
|
|
</a>
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<tr>
|
|
<td colspan="7">
|
|
No club templates defined.
|
|
</td>
|
|
</td>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
|
|
<h3>Clubs</h3>
|
|
|
|
[% IF CAN_user_clubs_edit_clubs %]
|
|
<div class="btn-toolbar">
|
|
<div class="btn-group">
|
|
[% IF club_templates %]
|
|
<button class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
|
|
[% ELSE %]
|
|
<button disabled="disabled" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New club <span class="caret"></span></button>
|
|
[% END %]
|
|
<ul class="dropdown-menu">
|
|
[% FOREACH t IN club_templates %]
|
|
<li><a href="/cgi-bin/koha/clubs/clubs-add-modify.pl?club_template_id=[% t.id %]">[% t.name %]</a></li>
|
|
[% END %]
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
|
|
<table id="clubs-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Template</th>
|
|
<th>Description</th>
|
|
<th>Public enrollment</th>
|
|
<th>Email required</th>
|
|
<th>Library</th>
|
|
<th>Start date</th>
|
|
<th>End date</th>
|
|
<th>Enrolled patrons</th>
|
|
<th> </th>
|
|
<th> </th>
|
|
<th> </th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% IF clubs %]
|
|
[% FOREACH c IN clubs %]
|
|
<tr>
|
|
<td>[% c.name %]</td>
|
|
<td>[% c.club_template.name %]</td>
|
|
<td>[% c.description %]</td>
|
|
<td>
|
|
[% IF c.club_template.is_enrollable_from_opac %]
|
|
Yes
|
|
[% ELSE %]
|
|
No
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF c.club_template.is_email_required %]
|
|
Yes
|
|
[% ELSE %]
|
|
No
|
|
[% END %]
|
|
</td>
|
|
<td>[% Branches.GetName( c.branchcode ) %]</td>
|
|
<td>
|
|
[% IF c.date_start %]
|
|
[% c.date_start | $KohaDates %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF c.date_end %]
|
|
[% c.date_end | $KohaDates %]
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% c.club_enrollments.count %]
|
|
</td>
|
|
<td class="actions">
|
|
[% IF ( c.club_enrollments.count ) %]
|
|
<a class="btn btn-xs btn-default" href="club-enrollments.pl?id=[% c.id %]">
|
|
[% ELSE %]
|
|
<a class="btn btn-xs btn-default disabled" href="club-enrollments.pl?id=[% c.id %]">
|
|
[% END %]
|
|
<i class="fa fa-list-ul"></i> Enrollments
|
|
</a>
|
|
</td>
|
|
<td class="actions">
|
|
[% IF CAN_user_clubs_edit_clubs %]
|
|
<a class="btn btn-xs btn-default" href="clubs-add-modify.pl?id=[% c.id %]">
|
|
<i class="fa fa-pencil"></i> Edit
|
|
</a>
|
|
[% END %]
|
|
</td>
|
|
<td class="actions">
|
|
[% IF CAN_user_clubs_edit_clubs %]
|
|
<a class="btn btn-xs btn-default" href="#" onclick='ConfirmDeleteClub([% c.id %], "[% c.name | html %]", $(this) ); return false;'>
|
|
<i class="fa fa-trash"></i> Delete
|
|
</a>
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<tr>
|
|
<td colspan="11">
|
|
No clubs defined.
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table> <!-- /.clubs-table -->
|
|
</div> <!-- /.yui-b -->
|
|
</div> <!-- /.yui-main -->
|
|
<div class="yui-b noprint">
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</div>
|
|
</div> <!-- /#bd -->
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|