@@ -2,6 +2,7 @@ import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
22import { Shelter } from '../shelter' ;
33import { SheltersService } from 'src/app/_services/shelters.service' ;
44import { AlertService } from 'src/app/_services/alert.service' ;
5+ import * as $ from 'jquery' ;
56
67@Component ( {
78 selector : 'app-shelter-card' ,
@@ -11,8 +12,10 @@ import { AlertService } from 'src/app/_services/alert.service';
1112export class ShelterCardComponent implements OnInit {
1213 @Input ( ) shelter : Shelter ;
1314 @Input ( ) user : any ;
15+ @Input ( ) zipcodeStatus : any ;
1416 @Output ( ) updateUserDetails = new EventEmitter < any > ( ) ;
1517 bingMapUrl = '' ;
18+ shelterStatus = 2 ;
1619
1720 joinShelter ( ) {
1821 this . shelterService . joinShelter ( this . shelter [ '_id' ] )
@@ -35,16 +38,19 @@ export class ShelterCardComponent implements OnInit {
3538 ( err ) => this . alertService . error ( err )
3639 ) ;
3740 }
41+
3842 constructor (
3943 private shelterService : SheltersService ,
4044 private alertService : AlertService
4145 ) { }
4246
43- ngOnInit ( ) {
44- // this.shelterService.getHospitalDetails(this.shelter.lngLat, 10)
45- // .subscribe(
46- // (res) => console.log(res)
47- // )
47+ ngOnInit ( ) {
48+ if ( $ . inArray ( + this . shelter . zipcode , this . zipcodeStatus . dangerous ) !== - 1 ) {
49+ this . shelterStatus = 0 ;
50+ } else if ( $ . inArray ( + this . shelter . zipcode , this . zipcodeStatus . warning ) !== - 1 ) {
51+ this . shelterStatus = 1 ;
52+ }
53+
4854 this . bingMapUrl = `http://bing.com/maps/default.aspx?cp=${ this . shelter . lngLat . split ( ',' ) . reverse ( ) . join ( '~' ) } &sp=point.${ this . shelter . lngLat . split ( ',' ) . reverse ( ) . join ( '_' ) } _${ this . shelter . name } _Shelter&lvl=15`
4955 }
5056
0 commit comments