Merge branch 'julius-dev' of Software_Engineering_I/greenvironment-frontend into max_dev
commit
8cc25f0327
@ -0,0 +1,46 @@
|
|||||||
|
<div id="adminpage">
|
||||||
|
<h1>Administration</h1>
|
||||||
|
<div class="grid">
|
||||||
|
<div class="column">
|
||||||
|
<div class="column-header">
|
||||||
|
<h2>Levels</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<div class="column-header">
|
||||||
|
<h2>Activities</h2>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<mat-form-field class="input">
|
||||||
|
<input matInput type="text" placeholder="Activity name">
|
||||||
|
</mat-form-field>
|
||||||
|
<mat-table [dataSource]="activitySource" matSort>
|
||||||
|
<ng-container matColumnDef="points">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> points</th>
|
||||||
|
<td mat-cell *matCellDef="let action"> {{action.points}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Name Column -->
|
||||||
|
<ng-container matColumnDef="name">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> action</th>
|
||||||
|
<td mat-cell *matCellDef="let action"> {{action.name}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- description Column -->
|
||||||
|
<ng-container matColumnDef="description">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> description</th>
|
||||||
|
<td mat-cell *matCellDef="let action"> {{action.description}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedActivityColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedActivityColumns;"></tr>
|
||||||
|
</mat-table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<div class="column-header">
|
||||||
|
<h2>Blacklist</h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,18 @@
|
|||||||
|
@import "../../../styles/mixins.sass"
|
||||||
|
|
||||||
|
#adminpage
|
||||||
|
margin: 1em
|
||||||
|
|
||||||
|
.grid
|
||||||
|
display: grid
|
||||||
|
grid-template: 100% / 33% 33% 33%
|
||||||
|
.column-header
|
||||||
|
text-align: center
|
||||||
|
|
||||||
|
.column
|
||||||
|
&:nth-child(1)
|
||||||
|
@include gridPosition(1, 2, 1, 2)
|
||||||
|
&:nth-child(2)
|
||||||
|
@include gridPosition(1, 2, 2, 3)
|
||||||
|
&:nth-child(3)
|
||||||
|
@include gridPosition(1, 2, 3, 4)
|
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AdminpageComponent } from './adminpage.component';
|
||||||
|
|
||||||
|
describe('AdminpageComponent', () => {
|
||||||
|
let component: AdminpageComponent;
|
||||||
|
let fixture: ComponentFixture<AdminpageComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ AdminpageComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(AdminpageComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,31 @@
|
|||||||
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
|
import {Levellist} from '../../models/levellist';
|
||||||
|
import {ActivityService} from '../../services/activity/activity.service';
|
||||||
|
import {Activitylist} from '../../models/activity';
|
||||||
|
import {MatTableDataSource} from '@angular/material/table';
|
||||||
|
import {MatSort} from '@angular/material/sort';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-adminpage',
|
||||||
|
templateUrl: './adminpage.component.html',
|
||||||
|
styleUrls: ['./adminpage.component.sass']
|
||||||
|
})
|
||||||
|
export class AdminpageComponent implements OnInit {
|
||||||
|
|
||||||
|
public activitySource: MatTableDataSource<any>;
|
||||||
|
public displayedActivityColumns = ['points', 'name', 'description'];
|
||||||
|
|
||||||
|
@ViewChild(MatSort, {static: true}) activitySort: MatSort;
|
||||||
|
|
||||||
|
constructor(private activityService: ActivityService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.activityService.getActivities();
|
||||||
|
this.activityService.activitylist.subscribe(response => {
|
||||||
|
this.activitySource = new MatTableDataSource(response.Actions);
|
||||||
|
this.activitySource.sort = this.activitySort;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue