Skip to content

Commit

Permalink
przycisk w group-summary.component.html
Browse files Browse the repository at this point in the history
DEPLOY
  • Loading branch information
JanisBe committed Mar 11, 2024
1 parent 1fb3840 commit 3588636
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "../resources/frontend",
"allowedCommonJsDependencies": [
"ts-md5"
],
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<button (click)="addExpense()" color="primary" mat-raised-button>Dodaj nowy wydatek</button>
<div *ngFor="let expense of expenses | keyvalue: reverseKeyOrder">
<div>
<table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {ActivatedRoute} from "@angular/router";
import {ExpenseService} from "../../../service/expense.service";
import {Expense} from "../../../model/expense";
import {KeyValue} from "@angular/common";
import {MatDialog} from "@angular/material/dialog";
import {AddExpenseComponent} from "../../expense/add-expense/add-expense.component";

@Component({
selector: 'group-summary',
Expand All @@ -14,7 +16,8 @@ export class GroupSummaryComponent implements OnInit {
expenses: Map<string, Expense[]> = new Map<string, Expense[]>();

constructor(private expenseService: ExpenseService,
private route: ActivatedRoute
private route: ActivatedRoute,
private dialog: MatDialog
) {
}

Expand Down Expand Up @@ -48,4 +51,8 @@ export class GroupSummaryComponent implements OnInit {
reverseKeyOrder = (a: KeyValue<string, Expense[]>, b: KeyValue<string, Expense[]>): number => {
return a.key > b.key ? -1 : (b.key > a.key ? 1 : 0);
}

addExpense() {
this.dialog.open(AddExpenseComponent, {data: {groupId: this.groupId}, width: '600px'});
}
}

0 comments on commit 3588636

Please sign in to comment.