Add headline to tables

urls
Max Ehrlicher-Schmidt 4 years ago
parent 5b2ae731c4
commit f18da19bcc

@ -1,4 +1,7 @@
<div class="table-page-wrapper"> <div class="table-page-wrapper">
<h1 class="headline">
{{ headline }}
</h1>
<div class="table-control"> <div class="table-control">
<button <button
mat-raised-button mat-raised-button
@ -121,11 +124,14 @@
></app-cell> ></app-cell>
<ng-template #stringValue> <ng-template #stringValue>
<span *ngIf="!column.link">{{ element[column.name] }}</span> <span *ngIf="!column.link">{{ element[column.name] }}</span>
<a mat-button color="primary" *ngIf="column.link" [routerLink]="column.link(element)">{{ <a
element[column.name] mat-button
}}</a> color="primary"
*ngIf="column.link"
[routerLink]="column.link(element)"
>{{ element[column.name] }}</a
>
</ng-template> </ng-template>
</td> </td>
</ng-container> </ng-container>
@ -198,7 +204,12 @@
<div <div
class="button-wrapper" class="button-wrapper"
*ngIf="element.newObject" *ngIf="element.newObject"
[matTooltip]="(countUnvalidFields(element) > 0) ? ('Nicht ausgefüllte Pflichtfelder (rot): ' + countUnvalidFields(element)) : 'Erstellen'" [matTooltip]="
countUnvalidFields(element) > 0
? 'Nicht ausgefüllte Pflichtfelder (rot): ' +
countUnvalidFields(element)
: 'Erstellen'
"
> >
<button <button
mat-icon-button mat-icon-button
@ -231,4 +242,3 @@
</mat-card> </mat-card>
</div> </div>
</div> </div>

@ -2,6 +2,9 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
.headline {
margin: 0 0.5em;
}
.table-control { .table-control {
margin: 0.5em; margin: 0.5em;
flex: none; flex: none;

@ -23,6 +23,8 @@ import { MatDialog, MatDialogRef } from '@angular/material/dialog';
styleUrls: ['./table.component.scss'], styleUrls: ['./table.component.scss'],
}) })
export class TableComponent { export class TableComponent {
@Input()
headline: string = "Keine Überschrift";
/** this array defines the columns and translations of the table and the order they are displayed */ /** this array defines the columns and translations of the table and the order they are displayed */
@Input() @Input()
columnInfo: { columnInfo: {

@ -1,4 +1,5 @@
<app-table <app-table
[headline]="headline"
[columnInfo]="columnInfo" [columnInfo]="columnInfo"
[dataService]="dataService" [dataService]="dataService"
[tableDataGQLType]="tableDataGQLType" [tableDataGQLType]="tableDataGQLType"

@ -109,16 +109,16 @@ export class BikesComponent implements OnInit {
tableDataGQLCreateInputType: string = 'CargoBikeCreateInput'; tableDataGQLCreateInputType: string = 'CargoBikeCreateInput';
tableDataGQLUpdateInputType: string = 'CargoBikeUpdateInput'; tableDataGQLUpdateInputType: string = 'CargoBikeUpdateInput';
headline = 'Lastenräder';
loadingRowIds: string[] = []; loadingRowIds: string[] = [];
constructor( constructor(private bikesService: BikesService) {}
private bikesService: BikesService
) {}
ngOnInit() { ngOnInit() {
this.dataService = this.bikesService; this.dataService = this.bikesService;
} }
create(object: {currentId: string, row: any}) { create(object: { currentId: string; row: any }) {
this.bikesService.createBike(object.currentId, { bike: object.row }); this.bikesService.createBike(object.currentId, { bike: object.row });
} }

@ -1,4 +1,5 @@
<app-table <app-table
[headline]="headline"
[columnInfo]="columnInfo" [columnInfo]="columnInfo"
[dataService]="dataService" [dataService]="dataService"
[tableDataGQLType]="tableDataGQLType" [tableDataGQLType]="tableDataGQLType"

@ -7,6 +7,8 @@ import {EquipmentTypeService} from 'src/app/services/equipmentType.service'
styleUrls: ['./equipment-types.component.scss'] styleUrls: ['./equipment-types.component.scss']
}) })
export class EquipmentTypesComponent implements OnInit { export class EquipmentTypesComponent implements OnInit {
headline = 'Ausstattungstypen';
columnInfo = [ columnInfo = [
{ name: 'id', translation: 'ID', readonly: true }, { name: 'id', translation: 'ID', readonly: true },
{ name: 'name', translation: 'Name', requiredForCreation: true }, { name: 'name', translation: 'Name', requiredForCreation: true },

Loading…
Cancel
Save