- Teilnehmer zu Ausbildung zuordnen!
+
+ Teilnehmer zu Ausbildung zuordnen
diff --git a/src/app/list-lehrlinge/list-lehrlinge.component.css b/src/app/list-lehrlinge/list-lehrlinge.component.css
index 9071202..a54bdc2 100644
--- a/src/app/list-lehrlinge/list-lehrlinge.component.css
+++ b/src/app/list-lehrlinge/list-lehrlinge.component.css
@@ -1,4 +1,18 @@
.table {
width: 100%;
}
+.aktzeile {
+ color: red;
+ background: #472ddb;
+ font-weight: bold;
+}
+.mat-row .mat-cell {
+ border-bottom: 1px solid transparent;
+ border-top: 1px solid transparent;
+ cursor: pointer;
+}
+
+.mat-row:hover .mat-cell {
+ border-color: currentColor;
+}
\ No newline at end of file
diff --git a/src/app/list-lehrlinge/list-lehrlinge.component.html b/src/app/list-lehrlinge/list-lehrlinge.component.html
index 574d608..0f5fa07 100644
--- a/src/app/list-lehrlinge/list-lehrlinge.component.html
+++ b/src/app/list-lehrlinge/list-lehrlinge.component.html
@@ -1,33 +1,109 @@
-
Lehrlinge
-
-
- Neu
-
+
+ Lehrlinge
+
+
+
+ Filter
+
+
-
-
- Name
- Gruppe
- Geschlecht
- Geboren
- Eintritt
- Austritt
- Aktion
-
-
-
- {{aktlehrling.firstname}} {{aktlehrling.lastname}}
- {{aktlehrling.groupname}}
- {{aktlehrling.sex}}
- {{aktlehrling.date_of_birth}}
- {{aktlehrling.date_joined}}
- {{aktlehrling.date_leave}}
-
-
-
+
+
+
+
+ ID
+ {{user.apprenticeid}}
+
+
+ Vorname
+ {{user.firstname}}
+
+
+ Name
+ {{user.lastname}}
+
+
+ Gruppe
+ {{user.groupname}}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/list-lehrlinge/list-lehrlinge.component.ts b/src/app/list-lehrlinge/list-lehrlinge.component.ts
index b436651..b2f4dcd 100644
--- a/src/app/list-lehrlinge/list-lehrlinge.component.ts
+++ b/src/app/list-lehrlinge/list-lehrlinge.component.ts
@@ -1,7 +1,14 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, ViewChild } from '@angular/core';
import { LehrlingService } from '../services/lehrling.service';
import { Observable } from 'rxjs';
import { Lehrling } from '../lehrling';
+import { MatTableDataSource } from '@angular/material/table';
+import { SelectionModel } from '@angular/cdk/collections';
+import { Router } from '@angular/router';
+import { UntypedFormBuilder, Validators } from '@angular/forms';
+import { LiveAnnouncer } from '@angular/cdk/a11y';
+import { MatSort, Sort } from '@angular/material/sort';
+import { MatPaginator } from '@angular/material/paginator';
@Component({
selector: 'app-list-lehrlinge',
@@ -10,16 +17,90 @@ import { Lehrling } from '../lehrling';
})
export class ListLehrlingeComponent implements OnInit {
+ public dsLehrlinge?: MatTableDataSource
;
+ selection = new SelectionModel(true, []);
public lehrlinge: any;
+ public displayedColumns: any;
+ public editForm: any;
+ public aktlehrling: any;
- constructor(private Lehrlinge: LehrlingService) { }
+ constructor(private Lehrlinge: LehrlingService,
+ private router: Router,
+ private formbuilder: UntypedFormBuilder,
+ private _liveAnnouncer: LiveAnnouncer,)
+ {
+ this.editForm = this.formbuilder.group({
+ apprenticeid: [],
+ firstname: ['', Validators.required],
+ lastname: ['', Validators.required],
+ groupid: [''],
+ sex: [''],
+ date_of_birth: [''],
+ date_joined: [''],
+ date_leave: ['']
+ })
+ }
ngOnInit(): void {
+ this.displayedColumns = ["apprenticeid", "firstname", "lastname", "groupname"];
this.Lehrlinge.getLehrlinge().subscribe(
(
data: any) => {
console.log(data);
this.lehrlinge = data.apprentice;
+ this.dsLehrlinge = this.lehrlinge;
})
}
+
+ @ViewChild('paginator') paginator: MatPaginator;
+ @ViewChild(MatSort) sort: MatSort;
+
+ ngAfterViewInit() {
+ if(this.dsLehrlinge != undefined) {
+ this.dsLehrlinge.paginator = this.paginator;
+ this.dsLehrlinge.sort = this.sort;
+ // console.log(this.dsLehrlinge);
+ }
+ else
+ console.log("DataSource undefined in AfterViewInit");
+ }
+
+ onclick(aktlehrling: any) {
+ this.aktlehrling = aktlehrling;
+ console.log("ausgewählt: " + aktlehrling.lastname)
+ }
+ /** Selects all rows if they are not all selected; otherwise clear selection. */
+ masterToggle() {
+ this.isAllSelected() ?
+ this.selection.clear() :
+ this.dsLehrlinge.data.forEach(row => this.selection.select(row));
+ }
+
+ /** Whether the number of selected elements matches the total number of rows. */
+ isAllSelected() {
+ console.log(this.selection);
+ const numSelected = this.selection.selected.length;
+ const numRows = this.dsLehrlinge.data.length;
+ return numSelected === numRows;
+ }
+ applyFilter(event: Event) {
+ const filterValue = (event.target as HTMLInputElement).value;
+ this.dsLehrlinge.filter = filterValue.trim().toLowerCase();
+ // console.log("Filter: " + this.dsLehrlinge.filter);
+ }
+
+ /** Announce the change in sort state for assistive technology. */
+ announceSortChange(sortState: Sort) {
+ if (sortState.direction) {
+ this._liveAnnouncer.announce(`Sorted ${sortState.direction}ending`);
+ } else {
+ this._liveAnnouncer.announce('Sorting cleared');
+ }
+ }
+ onEdit(): void {
+
+ }
+ onCancel(): void {
+ this.router.navigate(['/list-lehrling']);
+ }
}
diff --git a/src/app/modul/modul.component.html b/src/app/modul/modul.component.html
index bf8790c..e3925df 100644
--- a/src/app/modul/modul.component.html
+++ b/src/app/modul/modul.component.html
@@ -1,8 +1,7 @@
+
+ Module
+