place-card.component.ts 1.24 KB
Newer Older
1
2
import { Component, OnInit, Input } from '@angular/core';
import { Place } from '../../../place';
mdsecurity's avatar
mdsecurity committed
3
import { DataProviderService } from '../../../data-provider.service';
mdsecurity's avatar
mdsecurity committed
4
5
import { MdDialog } from '@angular/material';
import { FeedbackDialogComponent } from './feedback-dialog/feedback-dialog.component';
6
7
import {DomSanitizer} from '@angular/platform-browser';

mdsecurity's avatar
mdsecurity committed
8
@Component({
mdsecurity's avatar
mdsecurity committed
9
10
11
	selector: 'app-place-card',
	templateUrl: './place-card.component.html',
	styleUrls: ['./place-card.component.scss']
mdsecurity's avatar
mdsecurity committed
12
})
mdsecurity's avatar
mdsecurity committed
13

mdsecurity's avatar
mdsecurity committed
14
export class PlaceCardComponent implements OnInit {
mdsecurity's avatar
mdsecurity committed
15
16
17
	@Input() private place: Place;
	private status: string;
	private week: string[] = ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"];
mdsecurity's avatar
mdsecurity committed
18
	private url; 
19
	constructor(private dataProvider: DataProviderService, public dialog: MdDialog,private sanitizer: DomSanitizer) { }
mdsecurity's avatar
mdsecurity committed
20
	ngOnInit() {
21
		this.url = this.sanitizer.bypassSecurityTrustUrl('https://unsplash.it/200/300?image='+Math.floor((Math.random()*999+1)));
mdsecurity's avatar
mdsecurity committed
22
23
			
		
mdsecurity's avatar
mdsecurity committed
24
25
26
	}
	openInContext() {
		this.dataProvider.setContext(this.place);
mdsecurity's avatar
mdsecurity committed
27
		console.log(this.place.openFor().hour+ " "+ this.place.openFor().minute+ " "+ this.place.openFor().second)
mdsecurity's avatar
mdsecurity committed
28
	}
mdsecurity's avatar
mdsecurity committed
29
30
31
32
33
	openDialog() {
		let dialogRef = this.dialog.open(FeedbackDialogComponent);
		dialogRef.afterClosed().subscribe(result => {
		});
	}
mdsecurity's avatar
mdsecurity committed
34
}