<script type="text/javascript">
//<![CDATA[
-
- function confirm_remove_restriction() {
- return confirm(_("Remove restriction?"));
- }
-
+ $(document).ready(function(e){
+ $("#remove_restriction").on("click",function(){
+ return confirm(_("Remove restriction?"));
+ });
+ var mrform = $("#manual_restriction_form");
+ var mrlink = $("#add_manual_restriction");
+ mrform.hide();
+ mrlink.on("click",function(e){
+ $(this).hide();
+ mrform.show();
+ e.preventDefault();
+ });
+ $("#cancel_manual_restriction").on("click",function(e){
+ mrlink.show();
+ mrform.hide();
+ e.preventDefault();
+ });
+ })
//]]>
</script>
<div id="reldebarments">
- [% UNLESS debarments %]<p>Patron is currently unrestricted.</p>[% END %]
-
- <table>
- <thead>
- <tr>
- <th>Type</th>
- <th>Comment</th>
- <th>Expiration</th>
- [% IF ( CAN_user_borrowers ) %]
- <th> </th>
- [% END %]
- </tr>
- </thead>
-
- <tbody>
- [% FOREACH d IN debarments %]
+ [% IF ( debarments.size < 1 ) %]
+ <p>Patron is currently unrestricted.</p>
+ [% ELSE %]
+ <table>
+ <thead>
<tr>
- <td>[% d.type %]</td>
- <td>[% d.comment %]</td>
- <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
- [% IF ( CAN_user_borrowers )%]
- <td>
- <a href="/cgi-bin/koha/members/mod_debarment.pl?borrowernumber=[% borrowernumber %]&borrower_debarment_id=[% d.borrower_debarment_id %]&action=del" onclick="return confirm_remove_restriction()">
- Remove
- </a>
- </td>
- [% END %]
+ <th>Type</th>
+ <th>Comment</th>
+ <th>Expiration</th>
+ [% IF ( CAN_user_borrowers ) %]
+ <th> </th>
+ [% END %]
</tr>
- [% END %]
- </tbody>
-
- [% IF ( CAN_user_borrowers )%]
- <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl">
- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
- <input type="hidden" name="action" value="add" />
-
- <tfoot>
+ </thead>
+ <tbody>
+ [% FOREACH d IN debarments %]
<tr>
- <td>MANUAL</td>
- <td><input type="text" name="comment" /></td>
- <td>
- <input name="expiration" id="expiration" size="10" readonly="readonly" value="" class="datepicker" />
- <a href='#' onclick="document.getElementById('expiration').value='';">Clear Date</a>
- </td>
- <td>
- <input type="submit" value="Add restriction" />
- </td>
+ <td>[% d.type %]</td>
+ <td>[% d.comment %]</td>
+ <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
+ [% IF ( CAN_user_borrowers )%]
+ <td>
+ <a id="remove_restriction" href="/cgi-bin/koha/members/mod_debarment.pl?borrowernumber=[% borrowernumber %]&borrower_debarment_id=[% d.borrower_debarment_id %]&action=del">
+ Remove
+ </a>
+ </td>
+ [% END %]
</tr>
- </tfoot>
- </form>
- [% END %]
- </table>
+ [% END %]
+ </tbody>
+ </table>
+ [% END %]
+ <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
+ [% IF ( CAN_user_borrowers )%]
+ <form method="post" action="/cgi-bin/koha/members/mod_debarment.pl" class="clearfix">
+ <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
+ <input type="hidden" name="action" value="add" />
+ <fieldset class="rows" id="manual_restriction_form">
+ <legend>Add manual restriction</legend>
+ <ol>
+ <li><label for="rcomment">Comment:</label> <input type="text" id="rcomment" name="comment" /></li>
+ <li><label for="rexpiration">Expiration:</label> <input name="expiration" id="rexpiration" size="10" readonly="readonly" value="" class="datepicker" />
+ <a href='#' onclick="document.getElementById('expiration').value='';">Clear date</a></li>
+ </ol>
+ <fieldset class="action"><input type="submit" value="Add restriction" /> <a href="#" class="cancel" id="cancel_manual_restriction">Cancel</a></fieldset>
+ </fieldset>
+ </form>
+ [% END %]
</div>
form.submit();
}
});
+
+ var mrform = $("#manual_restriction_form");
+ var mrlink = $("#add_manual_restriction");
+ mrform.hide();
+ mrlink.on("click",function(e){
+ $(this).hide();
+ mrform.show();
+ e.preventDefault();
+ });
+ $("#cancel_manual_restriction").on("click",function(e){
+ $('#debarred_expiration').val('');
+ $('#add_debarment').prop('checked', false);
+ $('#debarred_comment').val('');
+ mrlink.show();
+ mrform.hide();
+ e.preventDefault();
+ });
});
function clear_entry(node) {
</ol>
</fieldset>
-
+
<fieldset class="rows">
<legend>Patron restrictions</legend>
- [% UNLESS debarments %]<p>Patron is currently unrestricted.</p>[% END %]
-
- <table>
- <thead>
- <tr>
- <th>Type</th>
- <th>Comment</th>
- <th>Expiration</th>
- <th>Remove?</th>
- </tr>
- </thead>
-
- <tbody>
- [% FOREACH d IN debarments %]
+ [% IF ( debarments.size < 1 ) %]
+ <p>Patron is currently unrestricted.</p>
+ [% ELSE %]
+ <table>
+ <thead>
<tr>
- <td>[% d.type %]</td>
- <td>[% d.comment %]</td>
- <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
- <td>
- <input type="checkbox" id="debarment_[% d.borrower_debarment_id %]" name="remove_debarment" value="[% d.borrower_debarment_id %]" />
- </td>
+ <th>Type</th>
+ <th>Comment</th>
+ <th>Expiration</th>
+ <th>Remove?</th>
</tr>
- [% END %]
- </tbody>
+ </thead>
+
+ <tbody>
+ [% FOREACH d IN debarments %]
+ <tr>
+ <td>[% d.type %]</td>
+ <td>[% d.comment %]</td>
+ <td>[% IF d.expiration %] [% d.expiration | $KohaDates %] [% ELSE %] <i>Indefinite</i> [% END %]</td>
+ <td>
+ <input type="checkbox" id="debarment_[% d.borrower_debarment_id %]" name="remove_debarment" value="[% d.borrower_debarment_id %]" />
+ </td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+ [% END %]
+ <p><a href="#" id="add_manual_restriction">Add manual restriction</a></p>
+ <fieldset id="manual_restriction_form">
+ <input type="hidden" id="add_debarment" name="add_debarment" value="1" />
+ <legend>Add manual restriction</legend>
+ <ol>
+ <li><label for="debarred_comment">Comment: </label><input type="text" id="debarred_comment" name="debarred_comment" onchange="$('#add_debarment').prop('checked', true);" /></li>
+ <li><label for="debarred_expiration">Expiration: </label><input name="debarred_expiration" id="debarred_expiration" size="10" readonly="readonly" value="" class="datepicker" onchange="$('#add_debarment').prop('checked', true);" />
+ <a href='javascript:void(0)' onclick="$('#debarred_expiration').val('');">Clear date</a></li>
- <tfoot>
- <tr>
- <td>
- Add new
- <input type="checkbox" id="add_debarment" name="add_debarment" value="1" />
- </td>
- <td><input type="text" id="debarred_comment" name="debarred_comment" onchange="$('#add_debarment').prop('checked', true);" /></td>
- <td>
- <input name="debarred_expiration" id="debarred_expiration" size="10" readonly="readonly" value="" class="datepicker" onchange="$('#add_debarment').prop('checked', true);" />
- <a href='javascript:void(0)' onclick="$('#debarred_expiration').val('');">Clear date</a>
- </td>
- <td><a class="btn" href='javascript:void(0)' onclick="$('#debarred_expiration').val(''); $('#add_debarment').prop('checked', false); $('#debarred_comment').val('');">Clear new restriction</a></td>
- </tr>
- </tfoot>
- </table>
+ </ol>
+ <p>
+ <a class="cancel" id="cancel_manual_restriction" href="#" onclick="">Cancel</a>
+ </p>
+ </fieldset>
</fieldset>
[% END %]