Activities + Schedule Services
This commit is contained in:
0
src/app/activities/activities.component.css
Normal file
0
src/app/activities/activities.component.css
Normal file
14
src/app/activities/activities.component.html
Normal file
14
src/app/activities/activities.component.html
Normal file
@ -0,0 +1,14 @@
|
||||
<app-header></app-header>
|
||||
|
||||
<h1> List of Activities</h1>
|
||||
<div *ngFor="let activity of activities">
|
||||
<h3>{{activity.data.name}}</h3>
|
||||
<ul>
|
||||
<li>Country: {{activity.data.country}}</li>
|
||||
<li>City: {{activity.data.city}}</li>
|
||||
<li>Description: {{activity.data.description}}</li>
|
||||
<li>Duration: {{activity.data.duration}} minutes</li>
|
||||
<li>Id: {{activity.id}}</li>
|
||||
<button (click)="addActivitiesIntoSchedule(activity.id)">Add</button>
|
||||
</ul>
|
||||
</div>
|
25
src/app/activities/activities.component.spec.ts
Normal file
25
src/app/activities/activities.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ActivitiesComponent } from './activities.component';
|
||||
|
||||
describe('ActivitiesComponent', () => {
|
||||
let component: ActivitiesComponent;
|
||||
let fixture: ComponentFixture<ActivitiesComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ActivitiesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ActivitiesComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
41
src/app/activities/activities.component.ts
Normal file
41
src/app/activities/activities.component.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {ActivitiesService} from '@app/Services/activities.service';
|
||||
import {ScheduleService} from '@app/Services/schedule.service';
|
||||
import {ScheduleComponent} from '@app/schedule/schedule.component';
|
||||
import {MatDialog} from '@angular/material';
|
||||
import {NewScheduleComponent} from '@app/new-schedule/new-schedule.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-activities',
|
||||
templateUrl: './activities.component.html',
|
||||
styleUrls: ['./activities.component.css']
|
||||
})
|
||||
export class ActivitiesComponent implements OnInit {
|
||||
|
||||
activities: any[];
|
||||
schedule = {
|
||||
activitiesId: '',
|
||||
};
|
||||
|
||||
animal: string;
|
||||
name: string;
|
||||
|
||||
constructor(private activitiesService: ActivitiesService,
|
||||
private scheduleService: ScheduleService,
|
||||
public dialog: MatDialog) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.activitiesService.getActivities().subscribe(data => {
|
||||
this.activities = data.map(e => {
|
||||
return {
|
||||
id: e.payload.doc.id,
|
||||
data: e.payload.doc.data()
|
||||
} as any;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
addActivitiesIntoSchedule(id) {
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user