Marcel de Rooy
ad29aae5c3
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
273 lines
12 KiB
Text
273 lines
12 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% PROCESS 'restriction-types.inc' %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>[% FILTER collapse %]
|
|
[% IF op == 'add_form' %]
|
|
[% IF ( restriction ) %]
|
|
[% t("Modify restriction type") | html %] '[% PROCESS restriction_type_description restriction_type=restriction %]' ›
|
|
[% ELSE %]
|
|
[% t("New restriction type") | html %] ›
|
|
[% END %]
|
|
[% END %]
|
|
[% IF op == 'delete_confirm' %]
|
|
[% t("Confirm deletion of restriction type") | html %] '[% PROCESS restriction_type_description restriction_type=restriction %]' ›
|
|
[% END %]
|
|
[% t("Patron restriction types") | html %] ›
|
|
[% t("Administration") | html %] ›
|
|
[% t("Koha") | html %]
|
|
[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="admin_restrictions" class="admin">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'prefs-admin-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
|
|
[% END %]
|
|
|
|
[% IF op == 'list' %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Patron restriction types</span>
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/admin/restrictions.pl">Patron restriction types</a>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
[% IF restriction %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Modify restriction type '[% PROCESS restriction_type_description %]'</span>
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>New restriction type</span>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF op == 'delete_confirm' %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Delete restriction type '[% PROCESS restriction_type_description %]'</span>
|
|
[% END %]
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% FOR m IN messages %]
|
|
<div class="dialog message [% m.code | html %]">
|
|
[% SWITCH m.code %]
|
|
[% CASE 'add_success' %]
|
|
Restriction type added
|
|
[% CASE 'update_success' %]
|
|
Restriction type updated
|
|
[% CASE 'duplicate_display_text' %]
|
|
Another restriction type already has this label
|
|
[% CASE 'duplicate_code' %]
|
|
Another restriction type already has this code
|
|
[% CASE 'delete_success' %]
|
|
Restriction type deleted
|
|
[% CASE 'delete_default' %]
|
|
Cannot delete the default restriction type
|
|
[% CASE 'delete_system' %]
|
|
Cannot delete a system restriction type
|
|
[% CASE %]
|
|
[% m.code | html %]
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'add_form' %]
|
|
<form id="restriction_form" action="/cgi-bin/koha/admin/restrictions.pl" method="post">
|
|
<input type="hidden" name="op" value="add_validate" />
|
|
<input type="hidden" name="checked" value="0" />
|
|
[% IF restriction %]
|
|
<h1>Modify restriction type '[% PROCESS restriction_type_description restriction_type=restriction %]'</h1>
|
|
<input type="hidden" name="is_a_modif" value="1" />
|
|
[% ELSE %]
|
|
<h1>New restriction type</h1>
|
|
[% END %]
|
|
<fieldset class="rows">
|
|
<ol>
|
|
[% IF restriction %]
|
|
<li>
|
|
<span class="label">Code: </span>[% restriction.code | html %]
|
|
<input type="hidden" name="code" value="[% restriction.code | html %]" />
|
|
</li>
|
|
<li>
|
|
<label for="display_text" class="required">Label: </label>
|
|
<input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="lift_after_payment" class="required">Lift after payment: </label>
|
|
<select type="text" name="lift_after_payment" id="lift_after_payment"/>
|
|
[% IF restriction.lift_after_payment %]
|
|
<option value="0">No</option>
|
|
<option value="1" selected="selected">Yes</option>
|
|
[% ELSE %]
|
|
<option value="0" selected="selected">No</option>
|
|
<option value="1">Yes</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="fee_limit">Fee limit: </label>
|
|
<input type="text" value="[% restriction.fee_limit | html %]" inputmode="decimal" pattern="^\d+(\.\d{2})?$" min="0" name="fee_limit" id="fee_limit" />
|
|
</li>
|
|
[% ELSE %]
|
|
<li>
|
|
<label for="code" class="required">Code: </label>
|
|
<input type="text" name="code" id="code" size="50" maxlength="50" class="focus required type_input " required="required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="display_text" class="required">Label: </label>
|
|
<input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="lift_after_payment">Lift after payment: </label>
|
|
<select type="text" name="lift_after_payment" id="lift_after_payment" />
|
|
<option value="0" selected="selected">No</option>
|
|
<option value="1">Yes</option>
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="fee_limit">Fee limit: </label>
|
|
<input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" min="0" name="fee_limit" id="fee_limit" />
|
|
</li>
|
|
[% END %]
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<fieldset class="action">
|
|
<input type="submit" class="btn btn-primary" value="Save" />
|
|
<a href="/cgi-bin/koha/admin/restrictions.pl" class="cancel">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
[% IF op == 'delete_confirm' %]
|
|
<div class="dialog alert">
|
|
<h1>Confirm restriction type deletion</h1>
|
|
<p>Are you sure you want to delete '[% PROCESS restriction_type_description restriction_type=restriction %]'?</p>
|
|
<form action="/cgi-bin/koha/admin/restrictions.pl" method="post">
|
|
<input type="hidden" name="op" value="delete_confirmed" />
|
|
<input type="hidden" name="code" value="[% restriction.code | html %]" />
|
|
<button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
|
|
</form>
|
|
<form action="/cgi-bin/koha/admin/restrictions.pl" method="get">
|
|
<button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
|
|
</form>
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF op == 'list' %]
|
|
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a class="btn btn-default" id="newrestriction" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form"><i class="fa fa-plus"></i> New restriction type</a>
|
|
</div>
|
|
|
|
<h1>Patron restriction types</h1>
|
|
|
|
[% IF restrictions %]
|
|
<div class="page-section">
|
|
<table id="restriction_types">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Code</th>
|
|
<th scope="col">Label</th>
|
|
<th scope="col">Default</th>
|
|
<th scope="col">Lift after payment?</th>
|
|
<th scope="col">Fee limit</th>
|
|
<th scope="col">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
[% FOREACH restriction IN restrictions %]
|
|
<tr>
|
|
<td>
|
|
[% restriction.code | html %]
|
|
</td>
|
|
<td>
|
|
[% PROCESS restriction_type_description restriction_type=restriction %]
|
|
</td>
|
|
<td>
|
|
[% IF restriction.is_default %]Yes[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF restriction.lift_after_payment %]Yes[% END %]
|
|
</td>
|
|
<td>
|
|
[% IF restriction.fee_limit %][% restriction.fee_limit | html %][% END %]
|
|
</td>
|
|
<td class="actions">
|
|
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form&code=[% restriction.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
|
[% IF !restriction.is_system && !restriction.is_default %]
|
|
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=delete_confirm&code=[% restriction.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
|
|
[% END %]
|
|
[% IF !restriction.is_system && !restriction.is_default %]
|
|
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=make_default&code=[% restriction.code | uri %]"><i class="fa fa-archive"></i> Make default</a>
|
|
[% END %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div><!-- /.page-section -->
|
|
[% ELSE %]
|
|
<div class="dialog alert">No restriction types have been defined. <a href="/cgi-bin/koha/admin/restrictions.pl?op=add_form">Create a new restriction type</a>.</div>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/admin-menu.js") | $raw %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% INCLUDE 'columns_settings.inc' %]
|
|
<script>
|
|
var MSG_DUPLICATE_CODE = _("Restriction type code is already in use");
|
|
var MSG_DUPLICATE_DISPLAY_TEXT = _("Restriction type label is already in use");
|
|
var existing = {
|
|
[% FOREACH ex IN existing %]
|
|
[% NEXT IF ex.code == restriction.code %]
|
|
[% ex.code | $raw %]: '[% ex.display_text | $raw %]',
|
|
[% END %]
|
|
};
|
|
|
|
//Require fee limit if "Lift after payment" is set true
|
|
$("#lift_after_payment").on("change", function(){
|
|
if($(this).val() == 1){
|
|
$("#fee_limit").prop("required",true).after('<span class="required">Required</span>');
|
|
} else {
|
|
$("#fee_limit").prop("required",false).nextAll().remove();
|
|
}
|
|
});
|
|
</script>
|
|
[% Asset.js("js/restrictiontypes.js") | $raw %]
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|