Skip to content

Commit

Permalink
issue-124, group management UI created
Browse files Browse the repository at this point in the history
  • Loading branch information
GrandShow authored and GrandShow committed Jun 20, 2020
1 parent c1a4538 commit cbde205
Show file tree
Hide file tree
Showing 12 changed files with 742 additions and 20 deletions.
12 changes: 6 additions & 6 deletions ui/src/app/admin/admin.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<mat-tab-group mat-align-tabs="center" color="accent" backgroundColor="primary">
<mat-tab label="Groups">
<ng-template matTabContent>
<app-groups-management></app-groups-management>
</ng-template>
</mat-tab>

<mat-tab label="Users">
<ng-template matTabContent>
<app-users-management></app-users-management>
Expand All @@ -13,12 +19,6 @@
<mat-tab label="Roles">
<ng-template matTabContent> <app-roles class="roles"></app-roles> </ng-template
></mat-tab>

<mat-tab label="Groups">
<ng-template matTabContent>
<app-groups-management></app-groups-management>
</ng-template>
</mat-tab>
</mat-tab-group>
<button
mat-fab
Expand Down
10 changes: 9 additions & 1 deletion ui/src/app/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import {InMemoryDataService} from '../timetable/in-memory-data.service';
import {AdminComponent} from './admin.component';
import {RolesComponent, AddRoleDialogComponent, SelectFeatureDialogComponent} from './roles/roles.component';
import {UsersManagementComponent} from './users-management/users-management.component';
import {GroupsManagementComponent} from './groups-management/groups-management.component';
import {
GroupsManagementComponent,
SelectUserDialogComponent,
GroupUpdateDialogComponent,
} from './groups-management/groups-management.component';
import {
ResourcesManagementComponent,
MessageDialogComponent,
Expand Down Expand Up @@ -43,6 +47,8 @@ import {MatSelectModule} from '@angular/material/select';
GroupsManagementComponent,
ResourcesManagementComponent,
MessageDialogComponent,
SelectUserDialogComponent,
GroupUpdateDialogComponent,
],
imports: [
CommonModule,
Expand Down Expand Up @@ -82,6 +88,8 @@ import {MatSelectModule} from '@angular/material/select';
GroupsManagementComponent,
ResourcesManagementComponent,
MessageDialogComponent,
SelectUserDialogComponent,
GroupUpdateDialogComponent,

MatTabsModule,
MatIconModule,
Expand Down
54 changes: 54 additions & 0 deletions ui/src/app/admin/groups-management/group-update.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<mat-form-field appearance="fill">
<mat-label>Specialisation:</mat-label>
<mat-select #spec>
<mat-option [value]="spec" *ngFor="let spec of specialisations">{{ spec }} </mat-option>
</mat-select>
</mat-form-field>

<mat-form-field appearance="fill">
<mat-label>Year of education:</mat-label>
<mat-select #year>
<mat-option [value]="year" *ngFor="let year of yearsOfEducation">{{ year }} </mat-option>
</mat-select>
</mat-form-field>

<mat-form-field appearance="fill">
<mat-label>Group number:</mat-label>
<mat-select #groupNum>
<mat-option [value]="num" *ngFor="let num of groupNums">{{ num }} </mat-option>
</mat-select>
</mat-form-field>

<mat-form-field appearance="fill">
<mat-label>Curator:</mat-label>
<mat-select #curator>
<mat-option [value]="lecturer" *ngFor="let lecturer of lecturers"
>{{ lecturer.firstName }} {{ lecturer.lastName }} {{ lecturer.surname }}
</mat-option>
</mat-select>
</mat-form-field>

<div mat-dialog-actions style="float: right;">
<button mat-button (click)="onNoClick()">Cancel</button>
<button
*ngIf="!data.isAddNewGroup"
mat-raised-button
color="primary"
[disabled]="!curator.value && !spec.value && !year.value && !groupNum.value"
[mat-dialog-close]="[spec.value, year.value, groupNum.value, curator.value]"
cdkFocusInitial
>
Ok
</button>

<button
*ngIf="data.isAddNewGroup"
mat-raised-button
color="primary"
[disabled]="!curator.value || !spec.value || !year.value || !groupNum.value"
[mat-dialog-close]="[spec.value, year.value, groupNum.value, curator.value]"
cdkFocusInitial
>
Ok
</button>
</div>
Original file line number Diff line number Diff line change
@@ -1 +1,92 @@
<p>groups-management works!</p>
<mat-card class="group-container">
<mat-toolbar>
<div class="groupTitle">Group:</div>
<div class="addGroup">
<button mat-raised-button color="primary" style="float: right;" (click)="addNewGroup()">
Add Group<mat-icon>add</mat-icon>
</button>
</div>
</mat-toolbar>

<mat-accordion>
<mat-expansion-panel *ngFor="let group of groups; let id = index">
<mat-expansion-panel-header>
<mat-panel-title style="width: 5%;">
<b> {{ group.specialisation }}-{{ group.yearOfEducation }}{{ group.groupNumber }} </b>
</mat-panel-title>

<mat-panel-title style="width: 10%;">
<b>Students in group: {{ group.students.length }}</b>
</mat-panel-title>

<mat-panel-title style="width: 70%;">
<b>Curator: </b> {{ group.curator.firstName }} {{ group.curator.lastName }} {{ group.curator.surname }}
</mat-panel-title>

<mat-panel-description style="width: 5%;">
<a class="upd" style="float: right;" (click)="changeGroupInfo(group, id)">Update</a>
<a class="del" style="float: right;" (click)="deleteGroup(group, id)">DELETE</a>
</mat-panel-description>
</mat-expansion-panel-header>

<ng-template matExpansionPanelContent class="fullInfo">
<mat-toolbar>
<mat-form-field class="userFilter">
<mat-label>Filter</mat-label>
<input matInput (keyup)="applyFilter($event, id)" placeholder="Search filter" />
</mat-form-field>

<div class="groupUserBtns">
<button mat-raised-button color="primary" class="insertedBth" (click)="addStudentsToGroup(group, id)">
Add students to group
</button>
</div>
</mat-toolbar>

<mat-card>
<mat-paginator [pageSizeOptions]="[10, 20]" showFirstLastButtons></mat-paginator>
<table mat-table [dataSource]="dataSource[id]" style="width: 100%;">
<ng-container matColumnDef="Name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let element">{{ element.firstName }}</td>
</ng-container>

<ng-container matColumnDef="LastName">
<th mat-header-cell *matHeaderCellDef>Last name</th>
<td mat-cell *matCellDef="let element">{{ element.lastName }}</td>
</ng-container>

<ng-container matColumnDef="Surname">
<th mat-header-cell *matHeaderCellDef>Surname</th>
<td mat-cell *matCellDef="let element">{{ element.surname }}</td>
</ng-container>

<ng-container matColumnDef="Details">
<th mat-header-cell *matHeaderCellDef>
<button mat-button>Full info:</button>
</th>

<td mat-cell *matCellDef="let element">
<button mat-button color="primary" style="text-decoration: underline;">
View full info
</button>
</td>
</ng-container>

<ng-container matColumnDef="RemoveStudent">
<th mat-header-cell *matHeaderCellDef>Remove student</th>
<td mat-cell *matCellDef="let element">
<button mat-raised-button color="warn" (click)="delStudentsFromGroup(group, element, id)">
Remove
</button>
</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
</table>
</mat-card>
</ng-template>
</mat-expansion-panel>
</mat-accordion>
</mat-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.group-container
width: 100%
.groupTitle
width: 20%
.addGroup
width: 80%
.upd, .del
margin-right: 8px
margin-left: 8px
.upd
color: #3f51b5
.del
color: #f44336
.insertedBth
float: right
margin-left: 8px
.userFilter
width: 20%
.groupUserBtns
width: 80%
Loading

0 comments on commit cbde205

Please sign in to comment.