Revize 37333849
Přidáno uživatelem Václav Jirák před téměř 6 roky(ů)
webapp/src/app/app.component.html | ||
---|---|---|
1 | 1 |
<div class="container-fluid h-100"> |
2 |
<div class="row header"> |
|
3 |
<img class="logo" src="../assets/images/logo.png" /> |
|
4 |
<div class="user-info"> |
|
5 |
<img class="user-icon" src="../assets/images/default-user.png"/> |
|
6 |
<span class="user-name">Václav Jirák</span> |
|
7 |
</div> |
|
8 |
</div> |
|
2 |
<app-header></app-header> |
|
9 | 3 |
<div class="row navigation-and-content"> |
10 | 4 |
<div class="col-lg-2 navigation"> |
11 | 5 |
<app-menu></app-menu> |
webapp/src/app/app.component.sass | ||
---|---|---|
1 |
.header |
|
2 |
height: 50px |
|
3 |
background-color: #3F425D |
|
4 |
padding-left: 10px |
|
5 |
|
|
6 |
.user-info |
|
7 |
height: 100% |
|
8 |
margin-left: auto |
|
9 |
margin-right: 0 |
|
10 |
|
|
11 |
.user-icon |
|
12 |
width: 35px |
|
13 |
height: 35px |
|
14 |
border-radius: 20px |
|
15 |
|
|
16 |
.user-name |
|
17 |
height: 50px |
|
18 |
line-height: 50px |
|
19 |
color: white |
|
20 |
margin-left: 10px |
|
21 |
margin-right: 10px |
|
22 |
|
|
23 | 1 |
.navigation-and-content |
24 | 2 |
height: calc(100% - 50px) |
25 | 3 |
|
webapp/src/app/app.module.ts | ||
---|---|---|
6 | 6 |
import { MenuComponent } from './menu/menu.component'; |
7 | 7 |
import { EmployeesListComponent } from './employees-list/employees-list.component'; |
8 | 8 |
import { DashboardModule } from './dashboard/dashboard.module'; |
9 |
import { HeaderComponent } from './header/header.component'; |
|
10 |
import { MatDialogModule } from '@angular/material'; |
|
11 |
import {ProfileSettingsModule} from './profile-settings/profile-settings.module'; |
|
9 | 12 |
|
10 | 13 |
@NgModule({ |
11 | 14 |
declarations: [ |
12 | 15 |
AppComponent, |
13 | 16 |
MenuComponent, |
14 |
EmployeesListComponent |
|
17 |
EmployeesListComponent, |
|
18 |
HeaderComponent |
|
15 | 19 |
], |
16 | 20 |
imports: [ |
17 | 21 |
BrowserModule, |
18 | 22 |
AppRoutingModule, |
19 |
DashboardModule |
|
23 |
DashboardModule, |
|
24 |
MatDialogModule, |
|
25 |
ProfileSettingsModule |
|
20 | 26 |
], |
21 | 27 |
providers: [], |
22 | 28 |
bootstrap: [AppComponent] |
webapp/src/app/header/header.component.html | ||
---|---|---|
1 |
<div class="row header"> |
|
2 |
<img class="logo" src="../../assets/images/logo.png" /> |
|
3 |
<button class="user-info" (click)="onProfileClick()"> |
|
4 |
<img class="user-icon" src="../../assets/images/default-user.png"/> |
|
5 |
<span class="user-name">{{name}}</span> |
|
6 |
</button> |
|
7 |
</div> |
webapp/src/app/header/header.component.sass | ||
---|---|---|
1 |
.header |
|
2 |
height: 50px |
|
3 |
background-color: #3F425D |
|
4 |
padding-left: 10px |
|
5 |
|
|
6 |
.user-info |
|
7 |
height: 100% |
|
8 |
margin-left: auto |
|
9 |
margin-right: 0 |
|
10 |
border: 0 |
|
11 |
background-color: transparent |
|
12 |
|
|
13 |
&:focus |
|
14 |
outline: none |
|
15 |
|
|
16 |
.user-icon |
|
17 |
width: 35px |
|
18 |
height: 35px |
|
19 |
border-radius: 20px |
|
20 |
|
|
21 |
.user-name |
|
22 |
height: 50px |
|
23 |
line-height: 50px |
|
24 |
color: white |
|
25 |
margin-left: 10px |
|
26 |
margin-right: 10px |
webapp/src/app/header/header.component.ts | ||
---|---|---|
1 |
import { Component, Input } from '@angular/core'; |
|
2 |
import { MatDialog } from '@angular/material'; |
|
3 |
import { ProfileSettingsComponent } from '../profile-settings/profile-settings.component'; |
|
4 |
|
|
5 |
@Component({ |
|
6 |
selector: 'app-header', |
|
7 |
templateUrl: './header.component.html', |
|
8 |
styleUrls: ['./header.component.sass'] |
|
9 |
}) |
|
10 |
export class HeaderComponent { |
|
11 |
@Input() name = 'John Doe'; |
|
12 |
|
|
13 |
constructor(private dialog: MatDialog) { } |
|
14 |
|
|
15 |
onProfileClick(): void { |
|
16 |
this.dialog.open(ProfileSettingsComponent, { |
|
17 |
data: { |
|
18 |
} |
|
19 |
}); |
|
20 |
} |
|
21 |
} |
webapp/src/app/profile-settings/profile-settings.component.html | ||
---|---|---|
1 |
<h1 mat-dialog-title>Nastavení</h1> |
|
2 |
|
|
3 |
<div mat-dialog-content> |
|
4 |
<mat-checkbox [(ngModel)]="data.shouldNotify">Upozorňovat na blížící se vypršění extra dovolené</mat-checkbox> |
|
5 |
<div class="datetime-picker" *ngIf="data.shouldNotify"> |
|
6 |
<mat-form-field> |
|
7 |
<input id="from-datetime-input" matInput [matDatepicker]="startDatePicker" [(ngModel)]="data.notifyDate" placeholder="Datum upozornění"> |
|
8 |
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle> |
|
9 |
<mat-datepicker #startDatePicker></mat-datepicker> |
|
10 |
</mat-form-field> |
|
11 |
<ngb-timepicker [(ngModel)]="data.notifyTime"></ngb-timepicker> |
|
12 |
</div> |
|
13 |
</div> |
|
14 |
|
|
15 |
<div mat-dialog-actions align="end"> |
|
16 |
<button mat-raised-button color="primary" (click)="onConfirmClick()">Potvrdit</button> |
|
17 |
<button mat-raised-button color="basic" (click)="onCloseClick()">Zavřít</button> |
|
18 |
</div> |
webapp/src/app/profile-settings/profile-settings.component.sass | ||
---|---|---|
1 |
.datetime-picker > * |
|
2 |
display: table-cell |
webapp/src/app/profile-settings/profile-settings.component.ts | ||
---|---|---|
1 |
import { Component, Inject } from '@angular/core'; |
|
2 |
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; |
|
3 |
import { FormControl } from '@angular/forms'; |
|
4 |
|
|
5 |
@Component({ |
|
6 |
selector: 'app-profile-settings', |
|
7 |
templateUrl: './profile-settings.component.html', |
|
8 |
styleUrls: ['./profile-settings.component.sass'] |
|
9 |
}) |
|
10 |
export class ProfileSettingsComponent { |
|
11 |
constructor( |
|
12 |
public dialogRef: MatDialogRef<ProfileSettingsComponent>, |
|
13 |
@Inject(MAT_DIALOG_DATA) public data: ProfileSettingsDialogData, |
|
14 |
) { |
|
15 |
if (data.notifyTime == null) { |
|
16 |
data.notifyTime = { hour: 8, minute: 0 }; |
|
17 |
} |
|
18 |
} |
|
19 |
|
|
20 |
onConfirmClick(): void { |
|
21 |
// TODO API CALL |
|
22 |
this.dialogRef.close(); |
|
23 |
} |
|
24 |
|
|
25 |
onCloseClick(): void { |
|
26 |
this.dialogRef.close(); |
|
27 |
} |
|
28 |
} |
|
29 |
|
|
30 |
export interface ProfileSettingsDialogData { |
|
31 |
shouldNotify: boolean; |
|
32 |
notifyDate: FormControl; |
|
33 |
notifyTime: { hour: number, minute: number }; |
|
34 |
} |
webapp/src/app/profile-settings/profile-settings.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { CommonModule } from '@angular/common'; |
|
3 |
import { ProfileSettingsComponent } from './profile-settings.component'; |
|
4 |
import { |
|
5 |
MatButtonModule, |
|
6 |
MatCheckboxModule, |
|
7 |
MatDialogModule, |
|
8 |
MatDatepickerModule, |
|
9 |
MatFormFieldModule, MatInputModule |
|
10 |
} from '@angular/material'; |
|
11 |
import {FormsModule} from '@angular/forms'; |
|
12 |
import {NgbModule} from '@ng-bootstrap/ng-bootstrap'; |
|
13 |
|
|
14 |
|
|
15 |
@NgModule({ |
|
16 |
declarations: [ProfileSettingsComponent], |
|
17 |
imports: [ |
|
18 |
CommonModule, |
|
19 |
MatButtonModule, |
|
20 |
MatDialogModule, |
|
21 |
MatCheckboxModule, |
|
22 |
FormsModule, |
|
23 |
MatDatepickerModule, |
|
24 |
MatFormFieldModule, |
|
25 |
MatInputModule, |
|
26 |
NgbModule |
|
27 |
], |
|
28 |
entryComponents: [ |
|
29 |
ProfileSettingsComponent |
|
30 |
], |
|
31 |
exports: [ |
|
32 |
ProfileSettingsComponent |
|
33 |
] |
|
34 |
}) |
|
35 |
export class ProfileSettingsModule { } |
Také k dispozici: Unified diff
Re #7457 Basic features of profile settings component implemented