feat: Added file formatting

This commit is contained in:
2025-06-11 11:56:39 +02:00
parent 772fc52cf6
commit a25a90c0d7
164 changed files with 4163 additions and 3242 deletions

View File

@@ -1,21 +1,24 @@
import { Component, OnInit } from '@angular/core';
import { AdminCommService } from '../admin-comm.service';
import { Group } from 'src/app/types/group';
import { Status } from 'src/app/types/status';
import { MatDialog } from '@angular/material/dialog';
import { RemoveConfirmComponent } from './remove-confirm/remove-confirm.component';
import { Component, OnInit } from '@angular/core'
import { AdminCommService } from '../admin-comm.service'
import { Group } from 'src/app/types/group'
import { Status } from 'src/app/types/status'
import { MatDialog } from '@angular/material/dialog'
import { RemoveConfirmComponent } from './remove-confirm/remove-confirm.component'
@Component({
selector: 'app-groups',
templateUrl: './groups.component.html',
styleUrls: ['./groups.component.scss'],
standalone: false
selector: 'app-groups',
templateUrl: './groups.component.html',
styleUrls: ['./groups.component.scss'],
standalone: false,
})
export class GroupsComponent implements OnInit {
groups?: Group[]
constructor (protected readonly acs: AdminCommService, private readonly dialog: MatDialog) {}
constructor(
protected readonly acs: AdminCommService,
private readonly dialog: MatDialog
) {}
ngOnInit(): void {
this.acs.groups.getGroups().subscribe((v) => {
this.acs.groups.getGroups().subscribe(v => {
this.groups = v
})
}
@@ -26,36 +29,41 @@ export class GroupsComponent implements OnInit {
}
}
get groupOptions(): {id: string, text: string}[] {
return this.groups!.map((v)=> {return {id: v._id as string, text: v.name as string}})
get groupOptions(): { id: string; text: string }[] {
return this.groups!.map(v => {
return { id: v._id as string, text: v.name as string }
})
}
protected getId(g: Group[] | undefined) {
if (!g) return undefined
return g.map((v)=>v._id)
return g.map(v => v._id)
}
groupNames(groups: Group[]) {
return groups.flatMap((g) => g.name)
return groups.flatMap(g => g.name)
}
protected nameEdit(id: string, name: string | string[]) {
name = name as string
this.acs.groups.editName(id, name).subscribe((s) => this.refreshIfGood(s))
this.acs.groups.editName(id, name).subscribe(s => this.refreshIfGood(s))
}
protected newGroup() {
let name = prompt("Nazwa grupy")
let name = prompt('Nazwa grupy')
if (name) {
this.acs.groups.newGroup(name).subscribe((s) => this.refreshIfGood(s))
this.acs.groups.newGroup(name).subscribe(s => this.refreshIfGood(s))
}
}
protected remove(id: string) {
this.dialog.open(RemoveConfirmComponent).afterClosed().subscribe((v) => {
if (v) {
this.acs.groups.remove(id).subscribe((s) => this.refreshIfGood(s))
}
})
this.dialog
.open(RemoveConfirmComponent)
.afterClosed()
.subscribe(v => {
if (v) {
this.acs.groups.remove(id).subscribe(s => this.refreshIfGood(s))
}
})
}
}