Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
"deepl": "^1.0.13",
|
"deepl": "^1.0.13",
|
||||||
"geolib": "^3.3.3",
|
"geolib": "^3.3.3",
|
||||||
"html-to-image": "^1.11.11",
|
"html-to-image": "^1.11.11",
|
||||||
|
"ngx-cookie-service": "^15.0.0",
|
||||||
"nodemon": "^2.0.22",
|
"nodemon": "^2.0.22",
|
||||||
"os-browserify": "^0.3.0",
|
"os-browserify": "^0.3.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {HomeComponent} from './home/home.component';
|
|||||||
import {DetailComponent} from "./component/detail/detail.component";
|
import {DetailComponent} from "./component/detail/detail.component";
|
||||||
import {ListComponent} from "./component/list/list.component";
|
import {ListComponent} from "./component/list/list.component";
|
||||||
import {ManagementComponent} from "./component/management/management.component";
|
import {ManagementComponent} from "./component/management/management.component";
|
||||||
|
import {LoginComponent} from "./component/login/login.component";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot([
|
imports: [RouterModule.forRoot([
|
||||||
@@ -12,7 +12,8 @@ import {ManagementComponent} from "./component/management/management.component";
|
|||||||
{path: 'management', component: ManagementComponent},
|
{path: 'management', component: ManagementComponent},
|
||||||
{path: 'location/:location', component: ListComponent},
|
{path: 'location/:location', component: ListComponent},
|
||||||
{path: 'location/:location/:id', component: DetailComponent},
|
{path: 'location/:location/:id', component: DetailComponent},
|
||||||
{path: '**', redirectTo: 'home'}
|
{path: 'login', component: LoginComponent},
|
||||||
|
{path: '**', redirectTo: 'home'},
|
||||||
])],
|
])],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule],
|
||||||
providers: []
|
providers: []
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import {FormsModule} from "@angular/forms";
|
|||||||
import { HttpClientModule} from "@angular/common/http";
|
import { HttpClientModule} from "@angular/common/http";
|
||||||
import { SafePipe } from './pipes/safe.pipe';
|
import { SafePipe } from './pipes/safe.pipe';
|
||||||
import { ManagementComponent } from './component/management/management.component';
|
import { ManagementComponent } from './component/management/management.component';
|
||||||
|
import { LoginComponent } from './component/login/login.component';
|
||||||
|
import {CookieService} from "ngx-cookie-service";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
@@ -18,6 +21,7 @@ import { ManagementComponent } from './component/management/management.component
|
|||||||
DetailComponent,
|
DetailComponent,
|
||||||
ManagementComponent,
|
ManagementComponent,
|
||||||
SafePipe,
|
SafePipe,
|
||||||
|
LoginComponent,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@@ -25,7 +29,7 @@ import { ManagementComponent } from './component/management/management.component
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [CookieService],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {LocationService} from "../../service/http/location.service";
|
|||||||
import {LocationEntity} from "../../interface/LocationEntity";
|
import {LocationEntity} from "../../interface/LocationEntity";
|
||||||
import {WaypointsEntity} from "../../interface/WaypointsEntity";
|
import {WaypointsEntity} from "../../interface/WaypointsEntity";
|
||||||
import {WaypointService} from "../../service/http/waypoint.service"
|
import {WaypointService} from "../../service/http/waypoint.service"
|
||||||
|
import {cookieService} from "../../service/cookie.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-list',
|
selector: 'app-list',
|
||||||
@@ -15,6 +16,7 @@ import {WaypointService} from "../../service/http/waypoint.service"
|
|||||||
styleUrls: ['./list.component.css']
|
styleUrls: ['./list.component.css']
|
||||||
})
|
})
|
||||||
export class ListComponent implements OnInit, OnChanges {
|
export class ListComponent implements OnInit, OnChanges {
|
||||||
|
username: string = '';
|
||||||
locationParams: string | undefined
|
locationParams: string | undefined
|
||||||
locations: LocationEntity[] | undefined;
|
locations: LocationEntity[] | undefined;
|
||||||
location: LocationEntity | undefined;
|
location: LocationEntity | undefined;
|
||||||
@@ -37,11 +39,13 @@ export class ListComponent implements OnInit, OnChanges {
|
|||||||
private readTranslationJsonService: ReadTranslateJsonService,
|
private readTranslationJsonService: ReadTranslateJsonService,
|
||||||
private locationService: LocationService,
|
private locationService: LocationService,
|
||||||
private waypointService: WaypointService,
|
private waypointService: WaypointService,
|
||||||
|
private cookieService: cookieService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
this.translations = this.readTranslationJsonService.getListTransaltions();
|
this.translations = this.readTranslationJsonService.getListTransaltions();
|
||||||
|
this.username = this.cookieService.getUsername();
|
||||||
this.route.params.subscribe(params => {
|
this.route.params.subscribe(params => {
|
||||||
this.locationParams = params['location'];
|
this.locationParams = params['location'];
|
||||||
});
|
});
|
||||||
|
|||||||
0
src/app/component/login/login.component.css
Normal file
0
src/app/component/login/login.component.css
Normal file
31
src/app/component/login/login.component.html
Normal file
31
src/app/component/login/login.component.html
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<div class="h-screen w-screen flex items-center justify-center">
|
||||||
|
<div class="max-w-md py-12">
|
||||||
|
|
||||||
|
<div class="bg-white px-6 py-8 rounded-lg shadow-md w-[400px]">
|
||||||
|
|
||||||
|
<h2 class="text-center text-2xl font-bold mb-8">Accedi</h2>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="email" class="block text-gray-700 font-bold mb-2">Email:</label>
|
||||||
|
<input type="email" id="email" name="email" placeholder="Inserisci la tua email"
|
||||||
|
class="w-full px-4 py-2 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="password" class="block text-gray-700 font-bold mb-2">Password:</label>
|
||||||
|
<input type="password" id="password" name="password" placeholder="Inserisci la tua password"
|
||||||
|
class="w-full px-4 py-2 rounded-lg shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-600 focus:border-transparent">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<button type="submit" class="btn gap-2 border-primary bg-primary text-secondary hover:bg-secondary hover:text-primary hover:border-primary py-2 w-full">Accedi</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
10
src/app/component/login/login.component.ts
Normal file
10
src/app/component/login/login.component.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-login',
|
||||||
|
templateUrl: './login.component.html',
|
||||||
|
styleUrls: ['./login.component.css']
|
||||||
|
})
|
||||||
|
export class LoginComponent {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,3 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Management</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="dropdown dropdown-hover" id="translate">
|
<div class="dropdown dropdown-hover" id="translate">
|
||||||
<label tabindex="0" class="btn m-1 bg-black border-neutral text-base-100"
|
<label tabindex="0" class="btn m-1 bg-black border-neutral text-base-100"
|
||||||
id="translateLabel">{{translations.translate}}</label>
|
id="translateLabel">{{translations.translate}}</label>
|
||||||
@@ -192,5 +184,4 @@
|
|||||||
<button (click)="closeWaypointForm()">{{translations.close}}</button>
|
<button (click)="closeWaypointForm()">{{translations.close}}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import {ActivatedRoute} from "@angular/router";
|
|||||||
import {LocationService} from "../../service/http/location.service";
|
import {LocationService} from "../../service/http/location.service";
|
||||||
import {UserService} from "../../service/http/user.service";
|
import {UserService} from "../../service/http/user.service";
|
||||||
import {WaypointService} from "../../service/http/waypoint.service";
|
import {WaypointService} from "../../service/http/waypoint.service";
|
||||||
import {toNumbers} from "@angular/compiler-cli/src/version_helpers";
|
|
||||||
import {managementTranslations} from "../../interface/translations";
|
import {managementTranslations} from "../../interface/translations";
|
||||||
import {TranslateService} from "../../service/language/translate.service";
|
import {TranslateService} from "../../service/language/translate.service";
|
||||||
import {ReadTranslateJsonService} from "../../service/language/readTranslateJson.service";
|
import {ReadTranslateJsonService} from "../../service/language/readTranslateJson.service";
|
||||||
|
import {cookieService} from "../../service/cookie.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-home',
|
selector: 'app-home',
|
||||||
@@ -18,6 +18,8 @@ import {ReadTranslateJsonService} from "../../service/language/readTranslateJson
|
|||||||
})
|
})
|
||||||
|
|
||||||
export class ManagementComponent implements OnInit {
|
export class ManagementComponent implements OnInit {
|
||||||
|
|
||||||
|
username: string = '';
|
||||||
showUserForm: boolean = false;
|
showUserForm: boolean = false;
|
||||||
showLocationForm: boolean = false;
|
showLocationForm: boolean = false;
|
||||||
showWaypointForm: boolean = false;
|
showWaypointForm: boolean = false;
|
||||||
@@ -39,11 +41,13 @@ export class ManagementComponent implements OnInit {
|
|||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private readTranslationJsonService: ReadTranslateJsonService,
|
private readTranslationJsonService: ReadTranslateJsonService,
|
||||||
|
private cookieService: cookieService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.translations = this.readTranslationJsonService.getManagementTranslations();
|
this.translations = this.readTranslationJsonService.getManagementTranslations();
|
||||||
|
this.username = this.cookieService.getUsername();
|
||||||
this.locationService.getLocations().subscribe(locations => {
|
this.locationService.getLocations().subscribe(locations => {
|
||||||
this.locations = locations;
|
this.locations = locations;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ input {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.bg-image {
|
.bg-image {
|
||||||
padding-top: 25%;
|
padding-top: 15%;
|
||||||
background-image: url('src/assets/img/mountains.png');
|
background-image: url('src/assets/img/mountains.png');
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
import {AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||||
import {BehaviorSubject, distinctUntilChanged, fromEvent, Observable, Subject, Subscription} from "rxjs";
|
import {distinctUntilChanged, fromEvent, Subject, Subscription} from "rxjs";
|
||||||
import {ReadjsonService} from "../service/readjson.service";
|
import {ReadjsonService} from "../service/readjson.service";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {TranslateService} from '../service/language/translate.service';
|
import {TranslateService} from '../service/language/translate.service';
|
||||||
@@ -7,6 +7,7 @@ import {ReadTranslateJsonService} from "../service/language/readTranslateJson.se
|
|||||||
import {homeTranslations} from "../interface/translations";
|
import {homeTranslations} from "../interface/translations";
|
||||||
import {LocationService} from "../service/http/location.service";
|
import {LocationService} from "../service/http/location.service";
|
||||||
import {LocationEntity} from "../interface/LocationEntity";
|
import {LocationEntity} from "../interface/LocationEntity";
|
||||||
|
import {cookieService} from "../service/cookie.service";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -16,11 +17,9 @@ import {LocationEntity} from "../interface/LocationEntity";
|
|||||||
})
|
})
|
||||||
|
|
||||||
export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
|
|
||||||
@ViewChild('myInput') myInput?: ElementRef;
|
@ViewChild('myInput') myInput?: ElementRef;
|
||||||
|
|
||||||
public locationsPopup: Subject<LocationEntity[]> = new Subject<LocationEntity[]>()
|
username: string = '';
|
||||||
|
|
||||||
subs: Subscription[] = [];
|
subs: Subscription[] = [];
|
||||||
backgroundColor: string | undefined;
|
backgroundColor: string | undefined;
|
||||||
locations: LocationEntity[] = [];
|
locations: LocationEntity[] = [];
|
||||||
@@ -31,6 +30,7 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
suggerimento: string = '';
|
suggerimento: string = '';
|
||||||
completamento: string = '';
|
completamento: string = '';
|
||||||
translations: homeTranslations = {} as homeTranslations;
|
translations: homeTranslations = {} as homeTranslations;
|
||||||
|
public locationsPopup: Subject<LocationEntity[]> = new Subject<LocationEntity[]>()
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -38,14 +38,16 @@ export class HomeComponent implements OnInit, AfterViewInit, OnDestroy {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private readTranslationJsonService: ReadTranslateJsonService,
|
private readTranslationJsonService: ReadTranslateJsonService,
|
||||||
private locationService: LocationService
|
private locationService: LocationService,
|
||||||
|
private cookieService: cookieService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes the component and loads translations and locations
|
// Initializes the component and loads translations and locations
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.translations = this.readTranslationJsonService.getHomeTranslations();
|
this.translations = this.readTranslationJsonService.getHomeTranslations();
|
||||||
console.log("translations loaded", this.translations)
|
console.log("translations loaded", this.translations);
|
||||||
|
this.username= this.cookieService.getUsername();
|
||||||
this.locationService.getLocations()
|
this.locationService.getLocations()
|
||||||
.subscribe(locations => {
|
.subscribe(locations => {
|
||||||
this.locations = locations;
|
this.locations = locations;
|
||||||
|
|||||||
34
src/app/service/cookie.service.ts
Normal file
34
src/app/service/cookie.service.ts
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import {Injectable} from '@angular/core';
|
||||||
|
import {CookieService} from 'ngx-cookie-service';
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class cookieService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private coockieService: CookieService,
|
||||||
|
private router: Router,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
setUsername(username: string): void {
|
||||||
|
this.coockieService.set('username', username);
|
||||||
|
}
|
||||||
|
|
||||||
|
getUsername(): string {
|
||||||
|
let username = this.coockieService.get('username');
|
||||||
|
if (username == null) {
|
||||||
|
this.router.navigate(['/login']);
|
||||||
|
return '';
|
||||||
|
} else {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteUsername(): void {
|
||||||
|
this.coockieService.delete('username');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user