From c4e931730a3243381e44071858fe79721c7381ca Mon Sep 17 00:00:00 2001 From: lsagona Date: Tue, 27 Oct 2020 16:57:22 +0100 Subject: [PATCH] add vessel list --- src/app/component/app.component.html | 1 + .../import-vessels/import-vessels.component.ts | 1 + .../list-vessel/list-vessel.component.html | 10 +++++++++ .../list-vessel/list-vessel.component.scss | 23 ++++++++++++++++++++ .../component/list-vessel/list-vessel.component.ts | 14 +++++++++--- 5 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/app/component/app.component.html b/src/app/component/app.component.html index 435cdfd..e781435 100644 --- a/src/app/component/app.component.html +++ b/src/app/component/app.component.html @@ -1,2 +1,3 @@ + diff --git a/src/app/component/import-vessels/import-vessels.component.ts b/src/app/component/import-vessels/import-vessels.component.ts index 88cdcd9..dcefb9f 100644 --- a/src/app/component/import-vessels/import-vessels.component.ts +++ b/src/app/component/import-vessels/import-vessels.component.ts @@ -59,6 +59,7 @@ export class ImportVesselsComponent implements OnInit { const newVessel = new Vessel(splitLine); this.vessels.set(Number(newVessel.mmsi), newVessel); } + this.vesselsService.changeVesselsSet(this.vessels); }; fileReader.onprogress = (e ) => { diff --git a/src/app/component/list-vessel/list-vessel.component.html b/src/app/component/list-vessel/list-vessel.component.html index e69de29..bae30cf 100644 --- a/src/app/component/list-vessel/list-vessel.component.html +++ b/src/app/component/list-vessel/list-vessel.component.html @@ -0,0 +1,10 @@ + +
+

Vessel

+ + {{vessel.value.mmsi}} - {{vessel.value.vesselName}} + +
+ + diff --git a/src/app/component/list-vessel/list-vessel.component.scss b/src/app/component/list-vessel/list-vessel.component.scss index e69de29..15299da 100644 --- a/src/app/component/list-vessel/list-vessel.component.scss +++ b/src/app/component/list-vessel/list-vessel.component.scss @@ -0,0 +1,23 @@ +h2.side-title { + margin-right: 0; + margin-bottom: 10px; + padding: 10px; + font-size: 20px; + color: #333; + text-transform: uppercase; +} + +h2.side-title:after { + content: ''; + width: 60px; + height: 1px; + background: #ff173c; + display: block; + margin-top: 6px; +} + +.list-group { + margin-right: 80%; + height: 94.7vh; +} + diff --git a/src/app/component/list-vessel/list-vessel.component.ts b/src/app/component/list-vessel/list-vessel.component.ts index 42235c0..3b24893 100644 --- a/src/app/component/list-vessel/list-vessel.component.ts +++ b/src/app/component/list-vessel/list-vessel.component.ts @@ -1,4 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; +import {Vessel} from '../../model/vessel'; +import {VesselsService} from '../../service/vessels.service'; @Component({ selector: 'app-list-vessel', @@ -6,10 +8,16 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./list-vessel.component.scss'] }) export class ListVesselComponent implements OnInit { + vessels: Map; - constructor() { } - ngOnInit(): void { + constructor(private vesselsService: VesselsService) { } + ngOnInit(): void { + this.vesselsService.currentVessels.subscribe(vessels => { + this.vessels = vessels; + console.log(this.vessels); + }); + } } -- 1.7.10.4