|
|
@ -61,16 +61,26 @@ $(function () { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Add name button adds new input field for adding other name
|
|
|
// Add name button adds new input field for adding other name
|
|
|
// Maximum of two other name fields allowed
|
|
|
|
|
|
|
|
|
// Maximum of two other name fields allowed
|
|
|
$("#btn_add_other_names").on('click', function () { |
|
|
$("#btn_add_other_names").on('click', function () { |
|
|
if ($('#other_names_fields input[type=text]').length < 2) { |
|
|
if ($('#other_names_fields input[type=text]').length < 2) { |
|
|
$('#other_names_fields').append($('#other_names_group').children().clone(true)); |
|
|
$('#other_names_fields').append($('#other_names_group').children().clone(true)); |
|
|
} |
|
|
} |
|
|
else { |
|
|
|
|
|
$('#btn_add_other_names').prop("disabled",true).prop("value","Max 2 other names"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showWarningOtherName(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Show warning text when there are 2 other name fields
|
|
|
|
|
|
var showWarningOtherName = function() { |
|
|
|
|
|
if ($('#other_names_fields input[type=text]').length >= 2) { |
|
|
|
|
|
$('#btn_add_other_names').hide(); |
|
|
|
|
|
$('#other_name_warning_message').html("<p>Max 2 other names, please enter only the name variations to be shown on the order from the court</p>"); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// show warning message if other name field is already at its maximum number when the page rendered
|
|
|
|
|
|
showWarningOtherName(); |
|
|
|
|
|
|
|
|
$("#btn_add_reconciliation_periods").on('click', function () { |
|
|
$("#btn_add_reconciliation_periods").on('click', function () { |
|
|
$('#reconciliation_period_fields').append($('#reconciliation_period_group').children().clone()); |
|
|
$('#reconciliation_period_fields').append($('#reconciliation_period_group').children().clone()); |
|
|
// add event lister for newly added from_date field, to_date field, delete button, and date picker
|
|
|
// add event lister for newly added from_date field, to_date field, delete button, and date picker
|
|
|
@ -164,7 +174,8 @@ var deleteAddedField = function(e){ |
|
|
|
|
|
|
|
|
//enable btn_add_other_names button
|
|
|
//enable btn_add_other_names button
|
|
|
if (button.prop('id') == "btn_add_other_names"){ |
|
|
if (button.prop('id') == "btn_add_other_names"){ |
|
|
button.prop('disabled',false).prop('value','Add name'); |
|
|
|
|
|
|
|
|
button.show(); |
|
|
|
|
|
$('#other_name_warning_message').html(""); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// when there is only one field left, clear it instead of delete it
|
|
|
// when there is only one field left, clear it instead of delete it
|
|
|
|