improved css (at least tried to) and fixed bugs in management page

This commit is contained in:
grata
2023-05-01 14:36:36 +02:00
parent a68d48e065
commit 2a3aec6c95
6 changed files with 21 additions and 39 deletions

View File

@@ -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);
}

View File

@@ -142,7 +142,7 @@
<div class="form-container">
<h2>Add Location</h2>
<form
(submit)="addWaypoint(newWaypoint.name, newWaypoint.lat, newWaypoint.lon, newWaypoint.description, newWaypoint.image, newWaypoint.locationName)">
(submit)="addWaypoint(newWaypoint.name, newWaypoint.lat, newWaypoint.lon, newWaypoint.description, newWaypoint.img, newWaypoint.locationName)">
<div>
<label for="waypointName">Waypoint:</label>
<input type="text" id="waypointName" name="waypointName" [(ngModel)]="newWaypoint.name">

View File

@@ -6,6 +6,7 @@ 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";
@Component({
selector: 'app-home',
@@ -18,9 +19,9 @@ 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;
@@ -56,15 +57,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 +95,6 @@ export class ManagementComponent implements OnInit {
closeWaypointForm() {
this.showWaypointForm = false;
}
protected readonly String = String;
}