@@ -88,7 +88,9 @@ export class PlanFilterComponent implements OnInit {
8888 filteredPlansByMetalLevel : any ;
8989 filteredPlansByProductTypes : any ;
9090 public availableProducts : any ;
91- get sortFilter ( ) { return this . sortDirection ? 'asc' : 'desc' ; }
91+ get sortFilter ( ) {
92+ return this . sortDirection ? 'asc' : 'desc' ;
93+ }
9294
9395 public planOptions = [
9496 { key : 'single_issuer' , value : 'One Carrier' , view : 'health' } ,
@@ -144,8 +146,8 @@ export class PlanFilterComponent implements OnInit {
144146
145147 employee . dependents . forEach ( function ( dependent ) {
146148 employeeJson . roster_dependents . push ( {
147- dob : new Date ( dependent . dob ) ,
148- relationship : dependent . relationship
149+ dob : new Date ( dependent . dependentDob ) ,
150+ relationship : dependent . dependentRelationship
149151 } ) ;
150152 } ) ;
151153
@@ -259,7 +261,12 @@ export class PlanFilterComponent implements OnInit {
259261
260262 private calculator ( date , contributionModel , isTiredCalculator ?: boolean ) : QuoteCalculator {
261263 if ( isTiredCalculator ) {
262- const calc = new this . clientPreferences . tiered_quote_calculator ( date , contributionModel , this . sponsorRoster , this . planType ) ;
264+ const calc = new this . clientPreferences . tiered_quote_calculator (
265+ date ,
266+ contributionModel ,
267+ this . sponsorRoster ,
268+ this . planType
269+ ) ;
263270
264271 return calc ;
265272 } else {
@@ -278,7 +285,7 @@ export class PlanFilterComponent implements OnInit {
278285 switch ( type ) {
279286 case 'metalLevel' :
280287 if ( event . target . checked ) {
281- this . selectedMetalLevels . push ( { key : 'metal_level' , value : value } ) ;
288+ this . selectedMetalLevels . push ( { key : 'metal_level' , value : value } ) ;
282289 this . filterKeysSelected . push ( type ) ;
283290 } else {
284291 this . selectedMetalLevels = this . selectedMetalLevels . filter ( ( ml ) => ml . value != value ) ;
@@ -288,7 +295,7 @@ export class PlanFilterComponent implements OnInit {
288295 break ;
289296 case 'productType' :
290297 if ( event . target . checked ) {
291- this . selectedProductTypes . push ( { key : 'product_type' , value : value } ) ;
298+ this . selectedProductTypes . push ( { key : 'product_type' , value : value } ) ;
292299 this . filterKeysSelected . push ( type ) ;
293300 } else {
294301 this . selectedProductTypes = this . selectedProductTypes . filter ( ( ml ) => ml . value != value ) ;
@@ -298,7 +305,7 @@ export class PlanFilterComponent implements OnInit {
298305 break ;
299306 case 'insuranceCompany' :
300307 if ( event . target . checked ) {
301- this . selectedInsuranceCompanies . push ( { key : 'provider_name' , value : value } ) ;
308+ this . selectedInsuranceCompanies . push ( { key : 'provider_name' , value : value } ) ;
302309 this . filterKeysSelected . push ( type ) ;
303310 } else {
304311 this . selectedInsuranceCompanies = this . selectedInsuranceCompanies . filter ( ( ml ) => ml . value != value ) ;
@@ -308,7 +315,7 @@ export class PlanFilterComponent implements OnInit {
308315 break ;
309316 case 'hsa' :
310317 if ( event . target . checked ) {
311- this . selectedHSAs . push ( { key : 'hsa_eligible' , value : value } ) ;
318+ this . selectedHSAs . push ( { key : 'hsa_eligible' , value : value } ) ;
312319 this . filterKeysSelected . push ( type ) ;
313320 } else {
314321 this . selectedHSAs = this . selectedHSAs . filter ( ( ml ) => ml . value != value ) ;
@@ -321,8 +328,7 @@ export class PlanFilterComponent implements OnInit {
321328 }
322329
323330 combineArray ( arr ) {
324- return [ ] . concat . apply ( [ ] , arr )
325- . reduce ( ( unique , item ) => ( unique . includes ( item ) ? unique : [ ...unique , item ] ) , [ ] ) ;
331+ return [ ] . concat . apply ( [ ] , arr ) . reduce ( ( unique , item ) => ( unique . includes ( item ) ? unique : [ ...unique , item ] ) , [ ] ) ;
326332 }
327333
328334 filterCarriers ( ) {
@@ -335,71 +341,75 @@ export class PlanFilterComponent implements OnInit {
335341 let filtered ;
336342
337343 if ( this . selectedMetalLevels . length > 0 ) {
338- this . selectedMetalLevels . map ( ml => {
339- mlArray . push ( plans . filter ( plan => plan [ 'product_information' ] [ ml . key ] === ml . value ) ) ;
344+ this . selectedMetalLevels . map ( ( ml ) => {
345+ mlArray . push ( plans . filter ( ( plan ) => plan [ 'product_information' ] [ ml . key ] === ml . value ) ) ;
340346 selected = this . combineArray ( mlArray ) ;
341347 } ) ;
342348 }
343349
344350 if ( this . selectedProductTypes . length > 0 ) {
345- this . selectedProductTypes . map ( pt => {
346- ptArray . push ( plans . filter ( plan => plan [ 'product_information' ] [ pt . key ] === pt . value ) ) ;
351+ this . selectedProductTypes . map ( ( pt ) => {
352+ ptArray . push ( plans . filter ( ( plan ) => plan [ 'product_information' ] [ pt . key ] === pt . value ) ) ;
347353 selected = this . combineArray ( ptArray ) ;
348354 } ) ;
349355 }
350356
351357 if ( this . selectedInsuranceCompanies . length > 0 ) {
352- this . selectedInsuranceCompanies . map ( ic => {
353- icArray . push ( plans . filter ( plan => plan [ 'product_information' ] [ ic . key ] === ic . value ) ) ;
358+ this . selectedInsuranceCompanies . map ( ( ic ) => {
359+ icArray . push ( plans . filter ( ( plan ) => plan [ 'product_information' ] [ ic . key ] === ic . value ) ) ;
354360 selected = this . combineArray ( icArray ) ;
355361 } ) ;
356362 }
357363
358364 if ( this . selectedHSAs . length > 0 ) {
359- this . selectedHSAs . map ( hsa => {
360- hsaArray . push ( plans . filter ( plan => plan [ 'product_information' ] [ hsa . key ] === hsa . value ) ) ;
365+ this . selectedHSAs . map ( ( hsa ) => {
366+ hsaArray . push ( plans . filter ( ( plan ) => plan [ 'product_information' ] [ hsa . key ] === hsa . value ) ) ;
361367 selected = this . combineArray ( hsaArray ) ;
362368 } ) ;
363369 }
364370
365371 if ( this . selectedInsuranceCompanies . length > 0 && this . selectedProductTypes . length > 0 ) {
366372 selected = this . selectedProductTypes . reduce ( ( currentValue , pt ) => {
367- filtered = this . combineArray ( icArray ) . filter ( plan => plan [ 'product_information' ] [ pt . key ] === pt . value ) ;
373+ filtered = this . combineArray ( icArray ) . filter ( ( plan ) => plan [ 'product_information' ] [ pt . key ] === pt . value ) ;
368374 return [ ...currentValue , ...filtered ] ;
369375 } , [ ] ) ;
370376 }
371377
372378 if ( this . selectedInsuranceCompanies . length > 0 && this . selectedHSAs . length > 0 ) {
373379 selected = this . selectedHSAs . reduce ( ( currentValue , hsa ) => {
374- filtered = this . combineArray ( icArray ) . filter ( plan => plan [ 'product_information' ] [ hsa . key ] === hsa . value ) ;
380+ filtered = this . combineArray ( icArray ) . filter ( ( plan ) => plan [ 'product_information' ] [ hsa . key ] === hsa . value ) ;
375381 return [ ...currentValue , ...filtered ] ;
376382 } , [ ] ) ;
377383 }
378384
379385 if ( this . selectedMetalLevels . length > 0 && this . selectedInsuranceCompanies . length > 0 ) {
380386 selected = this . selectedInsuranceCompanies . reduce ( ( currentValue , ic ) => {
381- filtered = this . combineArray ( mlArray ) . filter ( plan => plan [ 'product_information' ] [ ic . key ] === ic . value ) ;
387+ filtered = this . combineArray ( mlArray ) . filter ( ( plan ) => plan [ 'product_information' ] [ ic . key ] === ic . value ) ;
382388 return [ ...currentValue , ...filtered ] ;
383389 } , [ ] ) ;
384390 }
385391
386392 if ( this . selectedMetalLevels . length > 0 && this . selectedProductTypes . length > 0 ) {
387393 selected = this . selectedProductTypes . reduce ( ( currentValue , pt ) => {
388- filtered = this . combineArray ( mlArray ) . filter ( plan => plan [ 'product_information' ] [ pt . key ] === pt . value ) ;
394+ filtered = this . combineArray ( mlArray ) . filter ( ( plan ) => plan [ 'product_information' ] [ pt . key ] === pt . value ) ;
389395 return [ ...currentValue , ...filtered ] ;
390396 } , [ ] ) ;
391397 }
392398
393399 if ( this . selectedMetalLevels . length > 0 && this . selectedHSAs . length > 0 ) {
394400 selected = this . selectedHSAs . reduce ( ( currentValue , hsa ) => {
395- filtered = this . combineArray ( mlArray ) . filter ( plan => plan [ 'product_information' ] [ hsa . key ] === hsa . value ) ;
401+ filtered = this . combineArray ( mlArray ) . filter ( ( plan ) => plan [ 'product_information' ] [ hsa . key ] === hsa . value ) ;
396402 return [ ...currentValue , ...filtered ] ;
397403 } , [ ] ) ;
398404 }
399405
400- if ( this . selectedMetalLevels . length > 0 && this . selectedProductTypes . length > 0 && this . selectedInsuranceCompanies . length > 0 ) {
406+ if (
407+ this . selectedMetalLevels . length > 0 &&
408+ this . selectedProductTypes . length > 0 &&
409+ this . selectedInsuranceCompanies . length > 0
410+ ) {
401411 selected = this . selectedInsuranceCompanies . reduce ( ( currentValue , ic ) => {
402- filtered = selected . filter ( plan => plan [ 'product_information' ] [ ic . key ] === ic . value ) ;
412+ filtered = selected . filter ( ( plan ) => plan [ 'product_information' ] [ ic . key ] === ic . value ) ;
403413 return [ ...currentValue , ...filtered ] ;
404414 } , [ ] ) ;
405415 }
@@ -409,33 +419,43 @@ export class PlanFilterComponent implements OnInit {
409419 }
410420
411421 if ( this . yearlyMedicalDeductibleFrom && ! this . yearlyMedicalDeductibleTo ) {
412- selected = selected . filter ( plan => parseInt ( plan [ 'product_information' ] [ 'deductible' ]
413- . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) >= this . yearlyMedicalDeductibleFrom ) ;
422+ selected = selected . filter (
423+ ( plan ) =>
424+ parseInt ( plan [ 'product_information' ] [ 'deductible' ] . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) >=
425+ this . yearlyMedicalDeductibleFrom
426+ ) ;
414427 }
415428
416429 if ( ! this . yearlyMedicalDeductibleFrom && this . yearlyMedicalDeductibleTo ) {
417- selected = selected . filter ( plan => parseInt ( plan [ 'product_information' ] [ 'deductible' ]
418- . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) <= this . yearlyMedicalDeductibleTo ) ;
430+ selected = selected . filter (
431+ ( plan ) =>
432+ parseInt ( plan [ 'product_information' ] [ 'deductible' ] . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) <=
433+ this . yearlyMedicalDeductibleTo
434+ ) ;
419435 }
420436
421437 if ( this . yearlyMedicalDeductibleFrom && this . yearlyMedicalDeductibleTo ) {
422- selected = selected . filter ( plan => parseInt ( plan [ 'product_information' ] [ 'deductible' ]
423- . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) >= this . yearlyMedicalDeductibleFrom && parseInt ( plan [ 'product_information' ] [ 'deductible' ]
424- . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) <= this . yearlyMedicalDeductibleTo ) ;
438+ selected = selected . filter (
439+ ( plan ) =>
440+ parseInt ( plan [ 'product_information' ] [ 'deductible' ] . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) >=
441+ this . yearlyMedicalDeductibleFrom &&
442+ parseInt ( plan [ 'product_information' ] [ 'deductible' ] . replace ( '$' , '' ) . replace ( ',' , '' ) , 0 ) <=
443+ this . yearlyMedicalDeductibleTo
444+ ) ;
425445 }
426446
427447 if ( this . planPremiumsFrom && ! this . planPremiumsTo ) {
428- selected = selected . filter ( plan => plan [ 'total_cost' ] >= this . planPremiumsFrom ) ;
448+ selected = selected . filter ( ( plan ) => plan [ 'total_cost' ] >= this . planPremiumsFrom ) ;
429449 }
430450
431451 if ( ! this . planPremiumsFrom && this . planPremiumsTo ) {
432- selected = selected . filter ( plan => plan [ 'total_cost' ] <= this . planPremiumsTo ) ;
452+ selected = selected . filter ( ( plan ) => plan [ 'total_cost' ] <= this . planPremiumsTo ) ;
433453 }
434454
435455 if ( this . planPremiumsFrom && this . planPremiumsTo ) {
436- selected = selected . filter ( plan => plan [ 'total_cost' ]
437- > = this . planPremiumsFrom && plan [ 'total_cost' ]
438- <= this . planPremiumsTo ) ;
456+ selected = selected . filter (
457+ ( plan ) => plan [ 'total_cost' ] > = this . planPremiumsFrom && plan [ 'total_cost' ] <= this . planPremiumsTo
458+ ) ;
439459 }
440460
441461 this . filterCarriersResults = selected ;
@@ -549,7 +569,7 @@ export class PlanFilterComponent implements OnInit {
549569 }
550570
551571 validateNumber ( event ) {
552- const charCode = ( event . which ) ? event . which : event . keyCode ;
572+ const charCode = event . which ? event . which : event . keyCode ;
553573 if ( charCode > 31 && ( charCode < 48 || charCode > 57 ) ) {
554574 return false ;
555575 }
0 commit comments