4 [% PROCESS 'restriction-types.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>[% FILTER collapse %]
8 [% IF op == 'add_form' %]
9 [% IF ( restriction ) %]
10 [% t("Modify restriction type") | html %] '[% PROCESS restriction_type_description restriction_type=restriction %]' ›
12 [% t("New restriction type") | html %] ›
15 [% IF op == 'delete_confirm' %]
16 [% t("Confirm deletion of restriction type") | html %] '[% PROCESS restriction_type_description restriction_type=restriction %]' ›
18 [% t("Patron restriction types") | html %] ›
19 [% t("Administration") | html %] ›
20 [% t("Koha") | html %]
22 [% INCLUDE 'doc-head-close.inc' %]
25 <body id="admin_restrictions" class="admin">
26 [% WRAPPER 'header.inc' %]
27 [% INCLUDE 'prefs-admin-search.inc' %]
30 [% WRAPPER 'sub-header.inc' %]
31 [% WRAPPER breadcrumbs %]
32 [% WRAPPER breadcrumb_item %]
33 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
37 [% WRAPPER breadcrumb_item bc_active= 1 %]
38 <span>Patron restriction types</span>
41 [% WRAPPER breadcrumb_item %]
42 <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restriction types</a>
46 [% IF op == 'add_form' %]
48 [% WRAPPER breadcrumb_item bc_active= 1 %]
49 <span>Modify restriction type '[% PROCESS restriction_type_description %]'</span>
52 [% WRAPPER breadcrumb_item bc_active= 1 %]
53 <span>New restriction type</span>
58 [% IF op == 'delete_confirm' %]
59 [% WRAPPER breadcrumb_item bc_active= 1 %]
60 <span>Delete restriction type '[% PROCESS restriction_type_description %]'</span>
63 [% END #/ WRAPPER breadcrumbs %]
64 [% END #/ WRAPPER sub-header.inc %]
66 <div class="main container-fluid">
68 <div class="col-sm-10 col-sm-push-2">
71 [% FOR m IN messages %]
72 <div class="dialog message [% m.code | html %]">
74 [% CASE 'add_success' %]
75 Restriction type added.
76 [% CASE 'update_success' %]
77 Restriction type updated.
78 [% CASE 'duplicate_display_text' %]
79 Another restriction type already has this label.
80 [% CASE 'duplicate_code' %]
81 Another restriction type already has this code.
82 [% CASE 'delete_success' %]
83 Restriction type deleted.
84 [% CASE 'delete_default' %]
85 Cannot delete the default restriction type.
86 [% CASE 'delete_system' %]
87 Cannot delete a system restriction type.
94 [% IF op == 'add_form' %]
95 <form id="restriction_form" action="/cgi-bin/koha/admin/restrictions.pl" method="post">
96 <input type="hidden" name="op" value="add_validate" />
97 <input type="hidden" name="checked" value="0" />
99 <h1>Modify restriction type '[% PROCESS restriction_type_description restriction_type=restriction %]'</h1>
100 <input type="hidden" name="is_a_modif" value="1" />
102 <h1>New restriction type</h1>
104 <fieldset class="rows">
108 <span class="label">Code: </span>[% restriction.code | html %]
109 <input type="hidden" name="code" value="[% restriction.code | html %]" />
112 <label for="display_text" class="required">Label: </label>
113 <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
114 <span class="required">Required</span>
117 <label for="lift_after_payment" class="required">Lift after payment: </label>
118 <select type="text" name="lift_after_payment" id="lift_after_payment"/>
119 [% IF restriction.lift_after_payment %]
120 <option value="0">No</option>
121 <option value="1" selected="selected">Yes</option>
123 <option value="0" selected="selected">No</option>
124 <option value="1">Yes</option>
129 <label for="fee_limit">Fee limit: </label>
130 <input type="text" value="[% restriction.fee_limit | html %]" inputmode="decimal" pattern="^\d+(\.\d{2})?$" min="0" name="fee_limit" id="fee_limit" />
134 <label for="code" class="required">Code: </label>
135 <input type="text" name="code" id="code" size="50" maxlength="50" class="focus required type_input " required="required" />
136 <span class="required">Required</span>
139 <label for="display_text" class="required">Label: </label>
140 <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
141 <span class="required">Required</span>
144 <label for="lift_after_payment">Lift after payment: </label>
145 <select type="text" name="lift_after_payment" id="lift_after_payment" />
146 <option value="0" selected="selected">No</option>
147 <option value="1">Yes</option>
151 <label for="fee_limit">Fee limit: </label>
152 <input type="text" inputmode="decimal" pattern="^\d+(\.\d{2})?$" min="0" name="fee_limit" id="fee_limit" />
158 <fieldset class="action">
159 <input type="submit" class="btn btn-primary" value="Save" />
160 <a href="/cgi-bin/koha/admin/restrictions.pl" class="cancel">Cancel</a>
165 [% IF op == 'delete_confirm' %]
166 <div class="dialog alert">
167 <h1>Confirm restriction type deletion</h1>
168 <p>Are you sure you want to delete '[% PROCESS restriction_type_description restriction_type=restriction %]'?</p>
169 <form action="/cgi-bin/koha/admin/restrictions.pl" method="post">
170 <input type="hidden" name="op" value="delete_confirmed" />
171 <input type="hidden" name="code" value="[% restriction.code | html %]" />
172 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
174 <form action="/cgi-bin/koha/admin/restrictions.pl" method="get">
175 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
180 [% IF op == 'list' %]
182 <div id="toolbar" class="btn-toolbar">
183 <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>
186 <h1>Patron restriction types</h1>
188 [% IF restrictions %]
189 <div class="page-section">
190 <table id="restriction_types">
193 <th scope="col">Code</th>
194 <th scope="col">Label</th>
195 <th scope="col">Default</th>
196 <th scope="col">Lift after payment?</th>
197 <th scope="col">Fee limit</th>
198 <th scope="col">Actions</th>
202 [% FOREACH restriction IN restrictions %]
205 [% restriction.code | html %]
208 [% PROCESS restriction_type_description restriction_type=restriction %]
211 [% IF restriction.is_default %]Yes[% END %]
214 [% IF restriction.lift_after_payment %]Yes[% END %]
217 [% IF restriction.fee_limit %][% restriction.fee_limit | html %][% END %]
220 <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>
221 [% IF !restriction.is_system && !restriction.is_default %]
222 <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>
224 [% IF !restriction.is_system && !restriction.is_default %]
225 <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>
232 </div><!-- /.page-section -->
234 <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>
239 </div> <!-- /.col-sm-10.col-sm-push-2 -->
241 <div class="col-sm-2 col-sm-pull-10">
243 [% INCLUDE 'admin-menu.inc' %]
245 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
246 </div> <!-- /.row -->
248 [% MACRO jsinclude BLOCK %]
249 [% Asset.js("js/admin-menu.js") | $raw %]
250 [% INCLUDE 'datatables.inc' %]
251 [% INCLUDE 'columns_settings.inc' %]
253 var MSG_DUPLICATE_CODE = _("Restriction type code is already in use");
254 var MSG_DUPLICATE_DISPLAY_TEXT = _("Restriction type label is already in use");
256 [% FOREACH ex IN existing %]
257 [% NEXT IF ex.code == restriction.code %]
258 [% ex.code | $raw %]: '[% ex.display_text | $raw %]',
262 //Require fee limit if "Lift after payment" is set true
263 $("#lift_after_payment").on("change", function(){
264 if($(this).val() == 1){
265 $("#fee_limit").prop("required",true).after('<span class="required">Required</span>');
267 $("#fee_limit").prop("required",false).nextAll().remove();
271 [% Asset.js("js/restrictiontypes.js") | $raw %]
273 [% INCLUDE 'intranet-bottom.inc' %]