Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #291 from mistergone/master
Browse files Browse the repository at this point in the history
Refactored ARM warning code to fix some alert scenarios
  • Loading branch information
ascott1 committed Jan 8, 2015
2 parents 4848336 + 4578843 commit ae76d01
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/static/js/modules/check-rates.js
Original file line number Diff line number Diff line change
Expand Up @@ -766,28 +766,24 @@ function checkARM() {
// reset warning and info
$('#arm-warning').addClass('hidden');
$('.arm-info').addClass('hidden');
var disallowedTypes = [ 'fha', 'va'],
var disallowedTypes = [ 'fha', 'va', 'va-hb', 'fha-hb'],
disallowedTerms = [ '15' ];

if ( params['rate-structure'] === 'arm' ) {
// ARMs must be 30 years
if ( params['loan-term'] !== '30' ) {
// Reset and highlight if the loan term is disallowed
if ( disallowedTerms.indexOf( params['loan-term']) !== -1 ) {
dropdown('loan-term').reset();
dropdown('loan-term').showHighlight();
$('#arm-warning').removeClass('hidden');
}
// ARMs cannot be VA-HB or FHA-HB
if ( params['loan-type'] === 'va-hb' || params['loan-type'] === 'fha-hb' ) {
// Reset and highlight if the loan type is disallowed
if ( disallowedTypes.indexOf( params['loan-type']) !== -1 ) {
dropdown('loan-type').reset();
dropdown('loan-type').showHighlight();
$('#arm-warning').removeClass('hidden');
}
dropdown('loan-term').disable('15');
dropdown('loan-type').disable(['fha', 'va']);
if ( disallowedTerms.indexOf( params['loan-term']) !== -1 ) {
dropdown('loan-term').reset();
}
if ( disallowedTypes.indexOf( params['loan-type']) !== -1 ) {
dropdown('loan-type').reset();
}
dropdown('arm-type').show();
$('.no-arm').addClass('hidden');
$('.arm-info').removeClass('hidden');
Expand Down

0 comments on commit ae76d01

Please sign in to comment.