diff --git a/src/app/component/list/list.component.ts b/src/app/component/list/list.component.ts index f5df874..4086238 100644 --- a/src/app/component/list/list.component.ts +++ b/src/app/component/list/list.component.ts @@ -73,21 +73,6 @@ export class ListComponent implements OnInit, OnChanges { setTimeout(() => { if (!this.positionCord) { this.positionNotFound = true; - } else { - if (this.waypoints) { - if (!this.waypoints[0].distance) { - this.positionNotFound = true; - } else { - this.positionNotFound = false; - } - } - if (this.locations) { - if (!this.locations[0].distance) { - this.positionNotFound = true; - } else { - this.positionNotFound = false; - } - } } }, 5000); } diff --git a/src/app/component/management/management.component.html b/src/app/component/management/management.component.html index 78d93c2..ee45ca6 100644 --- a/src/app/component/management/management.component.html +++ b/src/app/component/management/management.component.html @@ -5,13 +5,25 @@ Management -

Users

+ + + +

{{translations.users}}

- - - + + + @@ -26,40 +38,40 @@
-

Add User

+

{{translations.addUserButton}}

- +
- +
- +
- + - +
-

Locations

+

{{translations.locations}}

NameUsernamePassword{{ translations.name }}{{translations.username}}{{translations.password}}
- - - - + + + + @@ -75,49 +87,49 @@
-

Add Location

+

{{translations.addLocationButton}}

- +
- +
- +
- +
- + - +
-

Waypoints

+

{{translations.waypoints}}

LocationRegionLatitudeLongitude{{translations.location}}{{translations.region}}{{translations.lat}}{{translations.lon}}
- - - - - + + + + + @@ -134,50 +146,50 @@
-

Add Location

+

{{translations.addWaypointButton}}

+ (submit)="addWaypoint(newWaypoint.name, newWaypoint.lat, newWaypoint.lon, newWaypoint.description, newWaypoint.img, newWaypoint.locationName)">
- +
- +
- +
- +
- +
- +
- + - +
diff --git a/src/app/component/management/management.component.ts b/src/app/component/management/management.component.ts index b62ba1b..fde46d0 100644 --- a/src/app/component/management/management.component.ts +++ b/src/app/component/management/management.component.ts @@ -6,6 +6,10 @@ import {ActivatedRoute} from "@angular/router"; import {LocationService} from "../../service/http/location.service"; import {UserService} from "../../service/http/user.service"; import {WaypointService} from "../../service/http/waypoint.service"; +import {toNumbers} from "@angular/compiler-cli/src/version_helpers"; +import {managementTranslations} from "../../interface/translations"; +import {TranslateService} from "../../service/language/translate.service"; +import {ReadTranslateJsonService} from "../../service/language/readTranslateJson.service"; @Component({ selector: 'app-home', @@ -18,24 +22,29 @@ export class ManagementComponent implements OnInit { showLocationForm: boolean = false; showWaypointForm: boolean = false; - newUser: UserEntity; - newLocation: LocationEntity; - newWaypoint: WaypointsEntity; + newUser: UserEntity = {name: "", password: "", username: ""}; + newLocation: LocationEntity = {lat: 0, location: "", lon: 0, region: ""}; + newWaypoint: WaypointsEntity = {description: "", img: "", lat: 0, locationName: "", lon: 0, name: ""}; locations: LocationEntity[] | undefined; waypoints: WaypointsEntity[] | undefined; users: UserEntity[] | undefined; + translations: managementTranslations = {} as managementTranslations + constructor( private route: ActivatedRoute, private locationService: LocationService, private waypointService: WaypointService, private userService: UserService, + private translateService: TranslateService, + private readTranslationJsonService: ReadTranslateJsonService, ) { } ngOnInit(): void { + this.translations = this.readTranslationJsonService.getManagementTranslations(); this.locationService.getLocations().subscribe(locations => { this.locations = locations; }); @@ -56,15 +65,15 @@ export class ManagementComponent implements OnInit { } addLocation(name: string, region: string, lat: number, lon: number) { - this.newLocation = {name: name, region: region, lat: lat, lon: lon}; + this.newLocation = {location: name, region: region, lat: lat, lon: lon}; this.locationService.createLocation(this.newLocation).subscribe(location => { this.locations?.push(location); }); this.showLocationForm = false; } - addWaypoint(name: string, lat: string, lon: string, description: string, image: string, locationName: string) { - this.newWaypoint = {name: name, lat: lat, lon: lon, description: description, img: image, locationName: locationName}; + addWaypoint(name: string, lat: number, lon: number, description: string, image: string, locationName: string) { + this.newWaypoint = {description: description, img: image, lat: lat, locationName: locationName, lon: lon, name: name} this.waypointService.createWaypoint(this.newWaypoint).subscribe(waypoint => { this.waypoints?.push(waypoint); }); @@ -94,4 +103,28 @@ export class ManagementComponent implements OnInit { closeWaypointForm() { this.showWaypointForm = false; } + + async switchLanguage(lang: string) { + this.translations.users = await this.translateService.getData(this.translations.users, lang); + this.translations.locations = await this.translateService.getData(this.translations.locations, lang); + this.translations.waypoints = await this.translateService.getData(this.translations.waypoints, lang); + this.translations.name = await this.translateService.getData(this.translations.name, lang); + this.translations.username = await this.translateService.getData(this.translations.username, lang); + this.translations.password = await this.translateService.getData(this.translations.password, lang); + this.translations.location = await this.translateService.getData(this.translations.location, lang); + this.translations.region = await this.translateService.getData(this.translations.region, lang); + this.translations.lat = await this.translateService.getData(this.translations.lat, lang); + this.translations.lon = await this.translateService.getData(this.translations.lon, lang); + this.translations.description = await this.translateService.getData(this.translations.description, lang); + this.translations.locationName = await this.translateService.getData(this.translations.locationName, lang); + this.translations.image = await this.translateService.getData(this.translations.image, lang); + this.translations.translate = await this.translateService.getData(this.translations.translate, lang); + this.translations.addLocationButton = await this.translateService.getData(this.translations.addLocationButton, lang); + this.translations.addUserButton = await this.translateService.getData(this.translations.addUserButton, lang); + this.translations.addWaypointButton = await this.translateService.getData(this.translations.addWaypointButton, lang); + this.translations.add = await this.translateService.getData(this.translations.add, lang); + this.translations.close = await this.translateService.getData(this.translations.close, lang); + } + + protected readonly String = String; } diff --git a/src/app/home/home.component.css b/src/app/home/home.component.css index bc6241b..c48ebfd 100644 --- a/src/app/home/home.component.css +++ b/src/app/home/home.component.css @@ -1,12 +1,7 @@ .search { - display: flex; align-items: center; justify-content: center; flex-direction: column; - position: absolute; - top: 35%; - left: 50%; - transform: translate(-50%, -50%); } input { @@ -16,10 +11,8 @@ input { } #list { - position: absolute; - top: 46%; - left: 44%; - transform: translate(-50%, -50%); + align-self: center; + height: auto; justify-content: center; align-items: center; align-content: center; @@ -40,13 +33,13 @@ input { } .bg-image { + padding-top: 25%; background-image: url('src/assets/img/mountains.png'); background-size: cover; background-repeat: no-repeat; background-position: center center; - height: 100vh; + height: 94vh; + display: flex; + flex-direction: column; } -#translate{ - margin: 100px 10px 10px 10px; -} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 2545413..4a02806 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -1,6 +1,6 @@
-
+
@@ -11,7 +11,7 @@
-
+
NameLatitudeLongitudeDescriptionLocation Name{{translations.name}}{{translations.lat}}{{translations.lon}}{{translations.description}}{{translations.locationName}}