feat: RefreshService zu UserRepresentationComponent hinzugefügt und integriert
This commit is contained in:
parent
277472636a
commit
fe6d8618ce
@ -1,4 +1,4 @@
|
||||
import { Component, Inject, ViewChild } from '@angular/core';
|
||||
import { AfterViewInit, Component, Inject, ViewChild } from '@angular/core';
|
||||
import { GuiColumn, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
|
||||
import { UserTableComponent } from '../tables/user-table/user-table.component';
|
||||
import { UserRepTableComponent } from '../tables/user-rep-table/user-rep-table.component';
|
||||
@ -7,6 +7,7 @@ import { UserRepService } from '../../services/user-representation.service';
|
||||
import Swal from 'sweetalert2';
|
||||
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
|
||||
import { env } from '../../../environments/environment';
|
||||
import { RefreshService } from '../../services/refresh.service';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@ -15,7 +16,7 @@ import { env } from '../../../environments/environment';
|
||||
templateUrl: './user-representation.component.html',
|
||||
styleUrl: './user-representation.component.css'
|
||||
})
|
||||
export class UserRepresentationComponent {
|
||||
export class UserRepresentationComponent implements AfterViewInit {
|
||||
|
||||
useRepLabel: string = "";
|
||||
groupRepCols: Array<GuiColumn>;
|
||||
@ -25,16 +26,25 @@ export class UserRepresentationComponent {
|
||||
slRepGroupId: null | number = null;
|
||||
slRightGroupId: null | number = null;
|
||||
slUserRepId: null | number = null;
|
||||
userRepService: UserRepService
|
||||
|
||||
initWithoutData = () => { }
|
||||
|
||||
constructor(userRepService: UserRepService) {
|
||||
constructor(private userRepService: UserRepService, private refreshService: RefreshService) {
|
||||
this.groupRepCols = env.columnNames.group.representative;
|
||||
this.groupRightColumns = env.columnNames.group.right;
|
||||
this.userRepService = userRepService;
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.refreshService.removeAll();
|
||||
this.refreshService.add(() => {
|
||||
this.users.fetchData();
|
||||
this.repUsers.fetchData();
|
||||
this.repGroups.fetchData();
|
||||
this.rightGroups.fetchData();
|
||||
})
|
||||
}
|
||||
|
||||
@ViewChild("users") users!: UserTableComponent;
|
||||
@ViewChild("repUsers") repUsers!: UserTableComponent;
|
||||
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
||||
@ -96,11 +106,10 @@ export class UserRepresentationComponent {
|
||||
this.userReps.fetchData(this.slUserId)
|
||||
},
|
||||
error: (error) => {
|
||||
const errorMessage = error?.error || "Es ist ein unerwarteter Fehler aufgetreten.";
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "Oops...",
|
||||
text: `${errorMessage}\nBitte versuchen Sie es später noch einmal.`,
|
||||
text: `Bitte versuchen Sie es später noch einmal.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user