Merge remote-tracking branch 'origin/master'
commit
7c156010a8
@ -0,0 +1,30 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import {
|
||||
Router,
|
||||
CanActivate,
|
||||
ActivatedRouteSnapshot,
|
||||
RouterStateSnapshot
|
||||
} from "@angular/router";
|
||||
import { AuthUser } from '../models/user';
|
||||
|
||||
import { AuthService } from "../services/auth.service";
|
||||
|
||||
@Injectable({ providedIn: "root" })
|
||||
export class AuthGuard implements CanActivate {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private authService: AuthService
|
||||
) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||
const currentUser = this.authService.getCurrentUserValue;
|
||||
if (Object.keys(currentUser).length != 0) {
|
||||
// authorised so return true
|
||||
return true;
|
||||
}
|
||||
|
||||
// not logged in so redirect to login page with the return url
|
||||
this.router.navigate(["/login"], { queryParams: { returnUrl: state.url } });
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<app-table
|
||||
[headline]="headline"
|
||||
[columnInfo]="columnInfo"
|
||||
[dataService]="dataService"
|
||||
[tableDataGQLType]="tableDataGQLType"
|
||||
[tableDataGQLCreateInputType]="tableDataGQLCreateInputType"
|
||||
[tableDataGQLUpdateInputType]="tableDataGQLUpdateInputType"
|
||||
(createEvent)="create($event)"
|
||||
(lockEvent)="lock($event)"
|
||||
(saveEvent)="save($event)"
|
||||
(cancelEvent)="cancel($event)"
|
||||
(deleteEvent)="delete($event)"
|
||||
></app-table>
|
@ -0,0 +1,155 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { BikesService } from '../../services/bikes.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-profile',
|
||||
templateUrl: './profile.component.html',
|
||||
styleUrls: ['./profile.component.scss'],
|
||||
})
|
||||
export class ProfileComponent implements OnInit {
|
||||
columnInfo = [
|
||||
{
|
||||
dataPath: 'name',
|
||||
translation: 'Name',
|
||||
sticky: true,
|
||||
link: (row: any) => {
|
||||
return '/bike/' + row.id;
|
||||
},
|
||||
},
|
||||
{ dataPath: 'id', translation: 'ID', readonly: true },
|
||||
{ dataPath: 'group', translation: 'Gruppe' },
|
||||
{ dataPath: 'modelName', translation: 'Modell' },
|
||||
{
|
||||
dataPath: 'insuranceData.billing',
|
||||
translation: 'Versicherung Abrechnung',
|
||||
},
|
||||
{ dataPath: 'insuranceData.hasFixedRate', translation: 'Pauschale j/n' },
|
||||
{ dataPath: 'insuranceData.fixedRate', translation: 'Pauschale Betrag' },
|
||||
{ dataPath: 'insuranceData.name', translation: 'Versicherer' },
|
||||
{ dataPath: 'insuranceData.benefactor', translation: 'Kostenträger' },
|
||||
{ dataPath: 'insuranceData.noPnP', translation: 'Nr. P&P' },
|
||||
{
|
||||
dataPath: 'insuranceData.maintenanceResponsible',
|
||||
translation: 'Wartung zuständig',
|
||||
},
|
||||
{
|
||||
dataPath: 'insuranceData.maintenanceBenefactor',
|
||||
translation: 'Wartung Kostenträger',
|
||||
},
|
||||
{
|
||||
dataPath: 'insuranceData.maintenanceAgreement',
|
||||
translation: 'Wartungsvereinbarung',
|
||||
},
|
||||
{
|
||||
dataPath: 'insuranceData.projectAllowance',
|
||||
translation: 'Projektzuschuss',
|
||||
},
|
||||
{ dataPath: 'insuranceData.notes', translation: 'Sonstiges' },
|
||||
{ dataPath: 'dimensionsAndLoad.bikeLength', translation: 'Länge' },
|
||||
{ dataPath: 'dimensionsAndLoad.bikeWeight', translation: 'Gewicht' },
|
||||
{ dataPath: 'dimensionsAndLoad.bikeHeight', translation: 'Höhe' },
|
||||
{ dataPath: 'dimensionsAndLoad.bikeWidth', translation: 'Breite' },
|
||||
{ dataPath: 'dimensionsAndLoad.boxHeightRange', translation: 'Boxhöhe' },
|
||||
{ dataPath: 'dimensionsAndLoad.boxLengthRange', translation: 'Boxlänge' },
|
||||
{ dataPath: 'dimensionsAndLoad.boxWidthRange', translation: 'Boxbreite' },
|
||||
{
|
||||
dataPath: 'dimensionsAndLoad.hasCoverBox',
|
||||
translation: 'Boxabdeckung j/n',
|
||||
},
|
||||
{ dataPath: 'dimensionsAndLoad.lockable', translation: 'Box abschließbar' },
|
||||
{
|
||||
dataPath: 'dimensionsAndLoad.maxWeightBox',
|
||||
translation: 'max Zuladung Box',
|
||||
},
|
||||
{
|
||||
dataPath: 'dimensionsAndLoad.maxWeightLuggageRack',
|
||||
translation: 'max Zuladung Gepäckträger',
|
||||
},
|
||||
{
|
||||
dataPath: 'dimensionsAndLoad.maxWeightTotal',
|
||||
translation: 'max Gesamtgewicht',
|
||||
},
|
||||
{ dataPath: 'numberOfChildren', translation: 'Anzahl Kinder' },
|
||||
{ dataPath: 'numberOfWheels', translation: 'Anzahl Räder' },
|
||||
{ dataPath: 'forCargo', translation: 'für Lasten j/n' },
|
||||
{ dataPath: 'forChildren', translation: 'für Kinder j/n' },
|
||||
{ dataPath: 'security.frameNumber', translation: 'Rahmennummer' },
|
||||
{ dataPath: 'security.adfcCoding', translation: 'ADFC Codierung' },
|
||||
{
|
||||
dataPath: 'security.keyNumberAXAChain',
|
||||
translation: 'Schlüsselnrummer Rahmenschloss',
|
||||
},
|
||||
{
|
||||
dataPath: 'security.keyNumberFrameLock',
|
||||
translation: 'Schlüsselnrummer AXA-Kette',
|
||||
},
|
||||
{ dataPath: 'security.policeCoding', translation: 'Polizei Codierung' },
|
||||
{ dataPath: 'technicalEquipment.bicycleShift', translation: 'Schaltung' },
|
||||
{ dataPath: 'technicalEquipment.isEBike', translation: 'E-Bike j/n' },
|
||||
{
|
||||
dataPath: 'technicalEquipment.hasLightSystem',
|
||||
translation: 'Lichtanlage j/n',
|
||||
},
|
||||
{
|
||||
dataPath: 'technicalEquipment.specialFeatures',
|
||||
translation: 'Besonderheiten',
|
||||
},
|
||||
{ dataPath: 'stickerBikeNameState', translation: 'Aufkleber Status' },
|
||||
{ dataPath: 'note', translation: 'Aufkleber Kommentar' },
|
||||
{ dataPath: 'taxes.costCenter', translation: 'Steuern Kostenstelle' },
|
||||
{
|
||||
dataPath: 'taxes.organisationArea',
|
||||
translation: 'Steuern Vereinsbereich',
|
||||
},
|
||||
{ dataPath: 'provider.id', translation: '' },
|
||||
{ dataPath: 'provider.formName', translation: '' },
|
||||
{ dataPath: 'provider.privatePerson.id', translation: '' },
|
||||
{ dataPath: 'provider.privatePerson.person.id', translation: '' },
|
||||
{ dataPath: 'provider.privatePerson.person.name', translation: '' },
|
||||
{ dataPath: 'provider.privatePerson.person.firstName', translation: '' },
|
||||
{
|
||||
dataPath: 'provider.privatePerson.person.contactInformation.email',
|
||||
translation: '',
|
||||
},
|
||||
{ dataPath: 'lendingStation.id', translation: '' },
|
||||
{ dataPath: 'lendingStation.name', translation: '' },
|
||||
{ dataPath: 'lendingStation.address.number', translation: '' },
|
||||
{ dataPath: 'lendingStation.address.street', translation: '' },
|
||||
{ dataPath: 'lendingStation.address.zip', translation: '' },
|
||||
];
|
||||
|
||||
dataService: any;
|
||||
|
||||
tableDataGQLType: string = 'CargoBike';
|
||||
tableDataGQLCreateInputType: string = 'CargoBikeCreateInput';
|
||||
tableDataGQLUpdateInputType: string = 'CargoBikeUpdateInput';
|
||||
|
||||
headline = 'Lastenräder';
|
||||
|
||||
loadingRowIds: string[] = [];
|
||||
constructor(private bikesService: BikesService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.dataService = this.bikesService;
|
||||
}
|
||||
|
||||
create(object: { currentId: string; row: any }) {
|
||||
this.bikesService.createBike(object.currentId, { bike: object.row });
|
||||
}
|
||||
|
||||
lock(row: any) {
|
||||
this.bikesService.lockBike({ id: row.id });
|
||||
}
|
||||
|
||||
save(row: any) {
|
||||
this.bikesService.updateBike({ bike: row });
|
||||
}
|
||||
|
||||
cancel(row: any) {
|
||||
this.bikesService.unlockBike({ id: row.id });
|
||||
}
|
||||
|
||||
delete(row: any) {
|
||||
this.bikesService.deleteBike({ id: row.id });
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { catchError, finalize, map, tap } from 'rxjs/operators';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { Observable, BehaviorSubject, of } from 'rxjs';
|
||||
import { User } from "../models/user";
|
||||
import { AuthService} from "./auth.service";
|
||||
import { ObserveOnSubscriber } from 'rxjs/internal/operators/observeOn';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RoleService {
|
||||
|
||||
constructor(private http: HttpClient, private authService: AuthService) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public getAllUsers(): Observable<User[]> {
|
||||
return this.http.get<User[]>(`${environment.authUrl}/users`);
|
||||
}
|
||||
|
||||
public getUser(email: string): Observable<User> {
|
||||
return this.http.get<User>(`${environment.authUrl}/users/${email}`);
|
||||
}
|
||||
|
||||
public getUserPermissions(email: string): Observable<any> {
|
||||
return this.http.get<any>(`${environment.authUrl}/users/${email}/permissions`)
|
||||
}
|
||||
|
||||
public updateUser(user: User): Observable<User> {
|
||||
return this.http.post<User>(`${environment.authUrl}/users/${user.email}/update`, user);
|
||||
}
|
||||
|
||||
public deleteUser(email: string): Observable<any> {
|
||||
return this.http.delete<any>(`${environment.authUrl}/users/` + email + "/delete");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { catchError, finalize, map, tap } from 'rxjs/operators';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { Observable, BehaviorSubject, of } from 'rxjs';
|
||||
import { User } from "../models/user";
|
||||
import { AuthService} from "./auth.service";
|
||||
import { ObserveOnSubscriber } from 'rxjs/internal/operators/observeOn';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UserService {
|
||||
|
||||
constructor(private http: HttpClient, private authService: AuthService) {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public getAllUsers(): Observable<User[]> {
|
||||
return this.http.get<User[]>(`${environment.authUrl}/users`);
|
||||
}
|
||||
|
||||
public getUser(email: string): Observable<User> {
|
||||
return this.http.get<User>(`${environment.authUrl}/users/${email}`);
|
||||
}
|
||||
|
||||
public getUserPermissions(email: string): Observable<any> {
|
||||
return this.http.get<any>(`${environment.authUrl}/users/${email}/permissions`)
|
||||
}
|
||||
|
||||
public updateUser(user: User): Observable<User> {
|
||||
return this.http.post<User>(`${environment.authUrl}/users/${user.email}/update`, user);
|
||||
}
|
||||
|
||||
public deleteUser(email: string): Observable<any> {
|
||||
return this.http.delete<any>(`${environment.authUrl}/users/` + email + "/delete");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue