This repository has been archived by the owner on Oct 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...src/app/widgets/expense-split-widget/expense-entry-card/expense-entry-card.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<mat-card> | ||
<mat-card-header> | ||
<mat-card-title>{{ entry.description }}</mat-card-title> | ||
<button mat-icon-button class="menu-button"> | ||
<mat-icon>more_horiz</mat-icon> | ||
</button> | ||
</mat-card-header> | ||
|
||
<mat-card-content> | ||
<div class="content-container"> | ||
<div class="involved-users"> | ||
<mat-icon>call_split</mat-icon> | ||
@if (isEveryoneInvolved) { | ||
jeder | ||
} @else { | ||
{{ getInvolvedUserNames.join(", ") }} | ||
} | ||
</div> | ||
|
||
<div class="distribution"> | ||
|
||
</div> | ||
|
||
<div class="creator"> | ||
@if (creator) { | ||
<img [ngSrc]="creator.profilePictureUrl" width="32" height="32" alt="" class="user-profile-picture"> | ||
{{ creator.firstName }} {{ creator.lastName }} | ||
} @else { | ||
<p>Zahlungsempfänger konnte nicht ermittelt werden.</p> | ||
} | ||
</div> | ||
</div> | ||
</mat-card-content> | ||
</mat-card> |
17 changes: 17 additions & 0 deletions
17
...src/app/widgets/expense-split-widget/expense-entry-card/expense-entry-card.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.menu-button { | ||
margin-left: auto; | ||
} | ||
|
||
.content-container { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
justify-content: space-between; | ||
gap: var(--size-12); | ||
} | ||
|
||
.user-profile-picture { | ||
border-radius: 50%; | ||
vertical-align: middle; | ||
margin-right: 5px; | ||
} |
23 changes: 23 additions & 0 deletions
23
.../app/widgets/expense-split-widget/expense-entry-card/expense-entry-card.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ExpenseEntryCardComponent } from './expense-entry-card.component'; | ||
|
||
describe('ExpenseEntryCardComponent', () => { | ||
let component: ExpenseEntryCardComponent; | ||
let fixture: ComponentFixture<ExpenseEntryCardComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ExpenseEntryCardComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ExpenseEntryCardComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
...d/src/app/widgets/expense-split-widget/expense-entry-card/expense-entry-card.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {Component, Input} from '@angular/core'; | ||
import {ExpenseEntry} from "../../../../model/expense-split-widget"; | ||
import {SimpleUser} from "../../../../model/user"; | ||
import {Event} from "../../../../model/event"; | ||
|
||
@Component({ | ||
selector: 'app-expense-entry-card', | ||
templateUrl: './expense-entry-card.component.html', | ||
styleUrl: './expense-entry-card.component.scss' | ||
}) | ||
export class ExpenseEntryCardComponent { | ||
|
||
@Input() | ||
entry!: ExpenseEntry; | ||
|
||
@Input() | ||
eventData!: Event; | ||
|
||
get getInvolvedUserNames(): string[] { | ||
return this.entry.involvedUsers.map(u => [u.user.firstName, u.user.firstName].join(" ")); | ||
} | ||
|
||
get isEveryoneInvolved(): boolean { | ||
const eventParticipantIds = this.eventData.participants.map(p => p.id); | ||
const involvedUserIds = this.entry.involvedUsers.map(u => u.user.id); | ||
return eventParticipantIds.length === involvedUserIds.length && | ||
eventParticipantIds.every(id => involvedUserIds.includes(id)); | ||
} | ||
|
||
get creator(): SimpleUser | undefined { | ||
return this.eventData.participants.find(p => p.id === this.entry.creatorId); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
frontend/src/app/widgets/expense-split-widget/expense-split-widget.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters