(function($) {
// Document has loaded
$(document).ready(function() {
//last nr to 2
var compNameF = $('[data-field="fld_6752835"]');
var regNrF = $('[data-field="fld_5065799"]');
$( '#fld_5065799Label' ).append('
');
$('#fld_6564705_1_opt1108604, #fld_6564705_2_opt1108604').parent().parent().append('')
//if contains pty, auto-select trust/trustee no
compNameF.change(function () {
//clear error if no pty in new company name
$('.lei-trustee-warning').html("");
if (/ pty /i.test(compNameF.val())) {
$('#fld_6564705_1_opt1750124, #fld_6564705_2_opt1750124').click();
}
});
//if contains pty and yes selected, show extra warning
$('#fld_6564705_1_opt1108604, #fld_6564705_2_opt1108604').click(function () {
if (/ pty /i.test(compNameF.val())) {
$('.lei-trustee-warning').html('If you need an LEI for a proprietary limited company please answer “NO”.'+
"
If you need an LEI for a trust/trustee, please recheck the legal entity name and the entity ID. If the LEI is for a trust/trustee insert the ABN number.")
}else{
$('.lei-trustee-warning').html("");
}
});
//remove warning if selects no
$('#fld_6564705_1_opt1750124, #fld_6564705_2_opt1750124').click(function () {
$('.lei-trustee-warning').html("");
});
//If typed and focused out
regNrF.keyup(function(){
$('.lei-acn-warning').text("");
if (compNameF.val()){
if (regNrF.val().length >= 9) {
if (/ pty /i.test(compNameF.val())) {
if (regNrF.val().replace(/[^0-9]/g, "").length == 9) {
$('.lei-acn-warning').text("");
regNrF.css("border-color", "#78b978");
} else {
regNrF.css("border-color", "red");
$('.lei-acn-warning').html('The entity ID does not match the ACN format.'+
''+
'If you need an LEI for a proprietary limited company please provide the ACN (NNN NNN NNN). You can check your ACN from ASIC:'+
'
Click here' +
'
If the LEI is for a Trustee/Trust, please insert the ABN number (NN NNN NNN NNN). You can check your ABN from ABR:
Click here ');
}
}
}
}
});
});
})(jQuery);