Compare commits

...

6 Commits

20 changed files with 284 additions and 253 deletions

View File

@ -1,6 +1,6 @@
{
"name": "user-manager-ui",
"version": "0.0.0",
"version": "4.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --ssl -o",

View File

@ -15,5 +15,6 @@
[theme]="theme"
[rowStyle] = "rowStyle"
[rowClass] = "rowClass"
(selectedRows)="onSelectedRows($event)">
(selectedRows)="onSelectedRows($event)"
(click)="click && click(this)">
</gui-grid>

View File

@ -69,6 +69,10 @@ export class BaseTableComponent<TModel, TApiService extends ApiService<TModel>>
private themeSubscription: Subscription = new Subscription();
private static count: number = 0;
public readonly id: number = (BaseTableComponent.count++)
constructor(@Inject(ApiService<TModel>) service: TApiService, columns: Array<GuiColumn>, private cModeService: ColorModeService) {
this.service = service;
if (this.columns.length == 0)
@ -114,7 +118,9 @@ export class BaseTableComponent<TModel, TApiService extends ApiService<TModel>>
@Input() rowStyle: GuiRowStyle = {}
@Input() rowClass: GuiRowClass = {}
@Input() click: ((table: BaseTableComponent<TModel, TApiService>) => void) | undefined;
selected: boolean = false;
safelyUnselectAll() {
this.selected = true

View File

@ -1,8 +1,8 @@
import { Component, Inject } from '@angular/core';
import { Component } from '@angular/core';
import { UserRep } from '../../../models/user-management.api.models';
import { UserRepService } from '../../../services/api/user-representation.service';
import { BaseTableComponent } from '../base-table/base-table.component';
import { GuiGridModule, GuiColumn } from '@generic-ui/ngx-grid';
import { GuiGridModule } from '@generic-ui/ngx-grid';
import { ColorModeService } from '../../../services/button/color-mode.service';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

View File

@ -5,10 +5,10 @@
<div class="col-5">
<mat-tab-group>
<mat-tab label="Benutzer">
<app-user-table #users [onSelectedRows]="userOnSelectedRows"></app-user-table>
<app-user-table #users [click]="userOnClick"></app-user-table>
</mat-tab>
<mat-tab label="Gruppe">
<app-group-table #groups [columns]="groupColumns" [onSelectedRows]="groupOnSelectedRows"></app-group-table>
<app-group-table #groups [columns]="groupColumns" [click]="groupOnClick"></app-group-table>
</mat-tab>
</mat-tab-group>
</div>
@ -16,10 +16,10 @@
<div class="col-4">
<mat-tab-group>
<mat-tab label="Rep. Benutzer">
<app-user-table #repUsers [onSelectedRows]="repUserOnSelectedRows"></app-user-table>
<app-user-table #repUsers [click]="repUserOnClick"></app-user-table>
</mat-tab>
<mat-tab label="Rep. Gruppen">
<app-group-table #repGroups [columns]="groupRepCols" [onSelectedRows]="repGroupOnSelectedRows"></app-group-table>
<app-group-table #repGroups [columns]="groupRepCols" [click]="repGroupOnClick"></app-group-table>
</mat-tab>
</mat-tab-group>
</div>
@ -27,7 +27,7 @@
<div class="col-3">
<mat-tab-group>
<mat-tab label="{{useRepLabel}}">
<app-user-rep-table #userReps [initData]="initWithoutData" [onSelectedRows]="repOnSelectedRows"></app-user-rep-table>
<app-user-rep-table #userReps [initData]="initWithoutData" [rowClass]="rep_row_class" [click]="repOnClick"></app-user-rep-table>
</mat-tab>
</mat-tab-group>
</div>

View File

@ -1,5 +1,5 @@
import { AfterViewInit, Component, ViewChild, inject } from '@angular/core';
import { GuiColumn, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
import { GuiColumn, GuiRowClass, GuiRowStyle, GuiSelectedRow } from '@generic-ui/ngx-grid/gui/grid/src/core/api/gui.grid.public-api';
import { UserTableComponent } from '../../components/tables/user-table/user-table.component';
import { UserRepTableComponent } from '../../components/tables/user-rep-table/user-rep-table.component';
import { GroupTableComponent } from '../../components/tables/group-table/group-table.component';
@ -8,9 +8,12 @@ import Swal from 'sweetalert2';
import { MatTabsModule, MatTabGroup } from '@angular/material/tabs';
import { env } from '../../../environments/environment';
import { BasePageComponent } from '../base-page/base-page.component';
import { UserRep } from '../../models/user-management.api.models';
import { Group, User, UserRep } from '../../models/user-management.api.models';
import { RepCreateFormComponent } from '../../components/forms/rep-create-form/rep-create-form.component';
import { MatDialog } from '@angular/material/dialog';
import { BaseTableComponent } from '../../components/tables/base-table/base-table.component';
import { GroupService } from '../../services/api/group.service';
import { UserService } from '../../services/api/user.service';
@Component({
standalone: true,
@ -32,6 +35,20 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
private readonly dialog: MatDialog = inject(MatDialog);
rep_row_class: GuiRowClass = {
classFunction(source, index) {
const now = new Date()
return (!source.validFrom && !source.validTo)
? "current-period-row"
: (new Date(source.validFrom) > now)
? "future-period-row"
: (new Date(source.validTo) < now)
? "past-period-row"
: "current-period-row";
}
}
initWithoutData = () => { }
constructor(private userRepService: UserRepService) {
@ -64,16 +81,22 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
@ViewChild("repGroups") repGroups!: GroupTableComponent;
@ViewChild("userReps") userReps!: UserRepTableComponent;
// user
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
if (rows.length > 0) {
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
this.users.safelyUnselectAll();
//this.users.safelyUnselectAll();
this.userReps.fetchByUser(rows[0].source?.id);
this.slGroupId = undefined;
this.slUserId = rows[0].source?.id
}
}
userOnClick = (table: BaseTableComponent<User, UserService>) => {
this.userOnSelectedRows(table.selectedRows);
}
// group
groupOnSelectedRows = (rows: GuiSelectedRow[]) => {
if (rows.length > 0) {
this.useRepLabel = `Vertretungen von ${rows[0].source?.name}`
@ -84,6 +107,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
}
}
groupOnClick = (table: BaseTableComponent<Group, GroupService>) => {
this.groupOnSelectedRows(table.selectedRows);
}
//repUser
repUserOnSelectedRows = (rows: GuiSelectedRow[]) => {
if (rows.length == 0 && this.slRepUserId) {
if (!this.slUserId && !this.slGroupId) {
@ -135,6 +163,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
}
}
repUserOnClick = (table: BaseTableComponent<User, UserService>) => {
this.repUserOnSelectedRows(table.selectedRows);
}
// repGroup
repGroupOnSelectedRows = (rows: GuiSelectedRow[]) => {
if (rows.length == 0 && this.slRepGroupId) {
if (!this.slUserId && !this.slGroupId) {
@ -185,6 +218,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
}
}
repGroupOnClick = (table: BaseTableComponent<Group, GroupService>) => {
this.repGroupOnSelectedRows(table.selectedRows);
}
// rep events
repOnSelectedRows = (rows: GuiSelectedRow[]) => {
if (rows.length == 0 && this.slRepId) {
this.userRepService.delete(this.slRepId).subscribe({
@ -212,6 +250,10 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
}
}
repOnClick = (table: BaseTableComponent<UserRep, UserRepService>) => {
this.repOnSelectedRows(table.selectedRows);
}
openCreateSheet(userRep: UserRep, afterCreation: (any: any) => any): void {
this.dialog.open(RepCreateFormComponent, {

View File

@ -104,3 +104,15 @@ code {
width: #{$i * 5 + "%"} !important;
}
}
.future-period-row {
background: rgba(76, 110, 140, .4) !important;
}
.current-period-row {
background: rgba(76, 110, 76, .4) !important;
}
.past-period-row {
background: rgba(110, 76, 76, .4) !important;
}

View File

@ -4,37 +4,19 @@
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.0.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<Version>4.0.0.0</Version>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<FileVersion>4.0.0.0</FileVersion>
</PropertyGroup>
<ItemGroup>
<Content Remove="wwwroot\assets\img\DD_white.svg" />
<Content Remove="wwwroot\assets\img\digital_data.svg" />
<Content Remove="wwwroot\assets\img\digital_data_red_BG.svg" />
<Content Remove="wwwroot\assets\img\group.svg" />
<Content Remove="wwwroot\assets\img\Huhn_andersrum.webp" />
<Content Remove="wwwroot\assets\img\login_logo.svg" />
<Content Remove="wwwroot\assets\img\mode_logo.svg" />
<Content Remove="wwwroot\assets\img\thema_bttn.svg" />
<Content Remove="wwwroot\assets\img\user-plus-svgrepo-com.svg" />
<Content Remove="wwwroot\assets\img\user.svg" />
<Content Remove="wwwroot\chunk-A2L6DXQH.js" />
<Content Remove="wwwroot\chunk-ZC35XWOR.js" />
<Content Remove="wwwroot\favicon.ico" />
<Content Remove="wwwroot\group-table\index.html" />
<Content Remove="wwwroot\index.html" />
<Content Remove="wwwroot\main-QF3MRK45.js" />
<Content Remove="wwwroot\media\bootstrap-icons-OCU552PF.woff" />
<Content Remove="wwwroot\media\bootstrap-icons-X6UQXWUS.woff2" />
<Content Remove="wwwroot\module-table\index.html" />
<Content Remove="wwwroot\polyfills-6EAL64PA.js" />
<Content Remove="wwwroot\scripts-EEEIPNC3.js" />
<Content Remove="wwwroot\styles-ZC4KW2NT.css" />
<Content Remove="wwwroot\user-assignment\index.html" />
<Content Remove="wwwroot\user-representation\index.html" />
<Content Remove="wwwroot\user-table\index.html" />
</ItemGroup>
<ItemGroup>
<Content Include="wwwroot\assets\img\.vscode\settings.json" />
</ItemGroup>
<ItemGroup>
@ -78,24 +60,7 @@
<None Include="wwwroot\assets\img\thema_bttn.svg" />
<None Include="wwwroot\assets\img\user-plus-svgrepo-com.svg" />
<None Include="wwwroot\assets\img\user.svg" />
<None Include="wwwroot\favicon.ico" />
<None Include="wwwroot\group-table\index.html" />
<None Include="wwwroot\index.html" />
<None Include="wwwroot\media\bootstrap-icons-OCU552PF.woff" />
<None Include="wwwroot\media\bootstrap-icons-X6UQXWUS.woff2" />
<None Include="wwwroot\module-table\index.html" />
<None Include="wwwroot\polyfills-6EAL64PA.js" />
<None Include="wwwroot\scripts-EEEIPNC3.js" />
<None Include="wwwroot\styles-ZC4KW2NT.css" />
<None Include="wwwroot\user-assignment\index.html" />
<None Include="wwwroot\user-representation\index.html" />
<None Include="wwwroot\user-table\index.html" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\assets\config.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long