From 0d69bbfe75d9555be6962c69e617be36e148af11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20G=C3=B3reczny?= Date: Sat, 16 Jan 2021 20:33:34 +0100 Subject: [PATCH] SES-151 Added shopkeepers table --- .../ClientApp/src/app/app.module.ts | 3 ++ .../game-master-dashboard.component.ts | 10 ++++ ...ame-master-shopkeepers-table.component.css | 44 ++++++++++++++++ ...me-master-shopkeepers-table.component.html | 46 ++++++++++++++++ ...game-master-shopkeepers-table.component.ts | 52 +++++++++++++++++++ 5 files changed, 155 insertions(+) create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.css create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.html create mode 100644 SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.ts diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts index 15363fb..92cb57a 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/app.module.ts @@ -47,6 +47,7 @@ import { OtherEquipmentService } from '../services/other-equipment.service'; import { GameMasterMonstersTableComponent } from './components/game-master-monsters-table/game-master-monsters-table.component'; import { MonsterService } from '../services/monster.service'; import { SpellDetailsDialogComponent } from './components/spell-details-dialog/spell-details-dialog.component'; +import { GameMasterShopkeepersTableComponent } from './components/game-master-shopkeepers-table/game-master-shopkeepers-table.component'; @NgModule({ declarations: [ @@ -65,6 +66,7 @@ import { SpellDetailsDialogComponent } from './components/spell-details-dialog/s GameMasterCharacterActionsDialogComponent, GameMasterMonstersTableComponent, SpellDetailsDialogComponent, + GameMasterShopkeepersTableComponent, ], imports: [ BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }), @@ -111,6 +113,7 @@ import { SpellDetailsDialogComponent } from './components/spell-details-dialog/s AbilitiesComponent, GameMasterCharacterActionsDialogComponent, SpellDetailsDialogComponent, + GameMasterShopkeepersTableComponent, ], }) export class AppModule {} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts index 4367adb..3db8ef0 100644 --- a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-dashboard/game-master-dashboard.component.ts @@ -21,6 +21,7 @@ import { Store } from '@ngrx/store'; import { AppState } from '../../store/models/app-state.model'; import { Router } from '@angular/router'; import { GameMasterMonstersTableComponent } from '../game-master-monsters-table/game-master-monsters-table.component'; +import { GameMasterShopkeepersTableComponent } from '../game-master-shopkeepers-table/game-master-shopkeepers-table.component'; @Component({ selector: 'app-game-master-dashboard', @@ -65,6 +66,12 @@ export class GameMasterDashboardComponent implements OnInit, OnDestroy { componentToDisplay: 'GameMasterMonstersTableComponent', expanded: false, }, + { + displayName: 'Shopkeepers', + iconName: 'ra ra-wooden-sign', + componentToDisplay: 'GameMasterShopkeepersTableComponent', + expanded: false, + }, ]; rightSidenavExpanded = false; @@ -142,6 +149,9 @@ export class GameMasterDashboardComponent implements OnInit, OnDestroy { case 'GameMasterMonstersTableComponent': this.middleComponentName = GameMasterMonstersTableComponent; break; + case 'GameMasterShopkeepersTableComponent': + this.middleComponentName = GameMasterShopkeepersTableComponent; + break; } } diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.css b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.css new file mode 100644 index 0000000..07509b6 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.css @@ -0,0 +1,44 @@ +table { + background-color: initial; +} + +mat-paginator { + background-color: initial; + color: white; +} + +::ng-deep .mat-select-arrow { + color: whitesmoke; +} + +::ng-deep .mat-select-value { + color: white; +} + +.mat-sort-header-container { + color: whitesmoke !important; +} + +.mat-form-field { + font-size: 14px; + width: 100%; +} + +td, +th { + color: whitesmoke; +} + +.mat-green { + background-color: green; + color: #fff; +} + +button { + margin: 10px; + width: 100px; +} + +.mat-column-actions { + text-align: center; +} diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.html b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.html new file mode 100644 index 0000000..2d8e425 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.html @@ -0,0 +1,46 @@ + + Filter + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Name {{row.name}} Items Count {{row.itemsCount}} Actions + + + + +
No data matching the filter "{{input.value}}"
+ + +
diff --git a/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.ts b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.ts new file mode 100644 index 0000000..25c48b1 --- /dev/null +++ b/SessionCompanion/SessionCompanion/ClientApp/src/app/components/game-master-shopkeepers-table/game-master-shopkeepers-table.component.ts @@ -0,0 +1,52 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { MatPaginator } from '@angular/material/paginator'; +import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; +import { MonsterViewModel } from '../../../types/viewmodels/monster-viewmodels/MonsterViewModel'; + +@Component({ + selector: 'app-game-master-shopkeepers-table', + templateUrl: './game-master-shopkeepers-table.component.html', + styleUrls: ['./game-master-shopkeepers-table.component.css'], +}) +export class GameMasterShopkeepersTableComponent implements OnInit { + displayedColumns: string[] = ['name', 'itemsCount', 'actions']; + dataSource: MatTableDataSource<{ + name: string; + itemsCount: number; + isAvailable: boolean; + }>; //TODO zmienić na skopkeeper view model + + @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; + @ViewChild(MatSort, { static: true }) sort: MatSort; + + constructor() {} + + ngOnInit() { + this.dataSource = new MatTableDataSource<{ + name: string; + itemsCount: number; + isAvailable: boolean; + }>([ + { + name: 'Test', + itemsCount: 12, + isAvailable: true, + }, + { + name: 'Test2', + itemsCount: 12, + isAvailable: false, + }, + ]); + } + + applyFilter(event: Event) { + const filterValue = (event.target as HTMLInputElement).value; + this.dataSource.filter = filterValue.trim().toLowerCase(); + + if (this.dataSource.paginator) { + this.dataSource.paginator.firstPage(); + } + } +} -- 2.20.1