Commit 4687e473 authored by mechtelm's avatar mechtelm
Browse files

Restyle main data read only view

parent af6fb875
<div fxLayout="column" *ngIf="mainData">
<div>{{mainData.fullName}}</div>
<div>{{mainData.contractData}}</div>
<div>{{mainData.sex}}</div>
<button mat-button *ngIf="appService.authData.isPersonalAdmin" (click)="editMainData()"><mat-icon>edit</mat-icon></button>
<div fxLayout="column" class="main-data-body" *ngIf="mainData">
<div fxLayout="row" fxLayoutAlign="space-between center">
<h2>{{mainData.fullName}}</h2>
<button mat-raised-button *ngIf="appService.authData.isPersonalAdmin"
(click)="editMainData()"><mat-icon>edit</mat-icon></button>
</div>
<table>
<tr><td>Personalnummer</td><td>{{mainData.payrollId ? mainData.payrollId : 'keine'}}</td></tr>
<tr><td>IDM-Kennung</td><td>{{mainData.idmId ? mainData.idmId : 'keine'}}</td></tr>
<tr><td>Adresse</td><td>{{mainData.address ? mainData.address.replace('\n', '; ') : '-'}}</td></tr>
<tr><td>Tag der Geburt</td><td>{{mainData.dateOfBirthString}}</td></tr>
<tr><td>Vertrag</td><td>{{mainData.contractData}}</td></tr>
</table>
</div>
.main-data-body {
padding: 20px;
}
table td{
padding: 10px 5px;
}
table tr:nth-child(odd) td {
background-color: lightgray;
}
......@@ -51,22 +51,32 @@ export class StaffMember {
dateOfBirth?: string;
get fullName(): string {
return `${this.name}${this.firstName ? ', ' + this.firstName : ''}`
const returnText = `${this.name}${this.firstName ? ', ' + this.firstName : ''}`;
return `${returnText}${this.title ? (' (' + this.title + ')') : ''}`
}
get contractData(): string {
let returnText = `${this.contractType ? (ContractTypeLabels as {[key: string]: string})[this.contractType] : '<kein Vertragstyp>'} `;
if (this.contractStart) {
returnText += 'vom ' + _moment(this.contractStart).format('DD.MM.YYYY') + ' ';
if (this.contractType) {
let returnText = (ContractTypeLabels as {[key: string]: string})[this.contractType];
if (this.contractStart) {
returnText += ' vom ' + _moment(this.contractStart).format('DD.MM.YYYY') + ' ';
} else {
returnText += ' (kein Start-Datum) '
}
if (this.contractEnd) {
returnText += 'bis ' + _moment(this.contractEnd).format('DD.MM.YYYY');
} else {
returnText += ' (unbefristet)'
}
return returnText + '; Wochentage: ' + this.weekDays
} else {
returnText += '<kein Start-Datum> '
return 'Vertrag nicht bekannt'
}
if (this.contractEnd) {
returnText += 'bis ' + _moment(this.contractEnd).format('DD.MM.YYYY');
} else {
returnText += ' (unbefristet)'
}
return returnText
}
get dateOfBirthString(): string {
if (this.dateOfBirth) return _moment(this.contractStart).format('DD.MM.YYYY');
return 'keine Angabe'
}
get weekDayMonday(): boolean {
......@@ -90,6 +100,19 @@ export class StaffMember {
return true
}
get weekDays(): string {
if (this.contractWeekDays && this.contractWeekDays !== 'xxxxx') {
let weekDaysArray = [];
if (this.contractWeekDays.substring(0,1) === 'x') weekDaysArray.push('Montag');
if (this.contractWeekDays.substring(1,2) === 'x') weekDaysArray.push('Dienstag');
if (this.contractWeekDays.substring(2,3) === 'x') weekDaysArray.push('Mittwoch');
if (this.contractWeekDays.substring(3,4) === 'x') weekDaysArray.push('Donnerstag');
if (this.contractWeekDays.substring(4) === 'x') weekDaysArray.push('Freitag');
return weekDaysArray.join(', ');
}
return 'alle'
}
constructor (staffData: StaffMemberMainDto) {
this.id = staffData.id;
this.name = staffData.name;
......
......@@ -120,6 +120,7 @@ export class StaffListComponent implements OnInit{
};
this.backendService.addStaffMember(staffMemberData).subscribe(
newId => {
this.appService.dataLoading = false;
this.updateStaffList(newId);
}
);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment