aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-04-07 16:49:21 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-04-07 16:49:21 -0400
commit8b64b8bd43f987b924d74d0ea597b7b606ca9357 (patch)
treec8c3229c54955a4a037b0ce0a016221e8784af42 /ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
parentbb4e0e55fee7ec8f34c36e6299301d612a0de2ce (diff)
parent7635188ed6182a72facd8ab3299f13c7217a8abd (diff)
downloadJellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.tar.gz
JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.tar.bz2
JellySolutions-8b64b8bd43f987b924d74d0ea597b7b606ca9357.zip
Merge branch 'main' into light-mode
# Conflicts: # ufund-ui/src/styles.css
Diffstat (limited to 'ufund-ui/src/app/components/funding-basket/funding-basket.component.ts')
-rw-r--r--ufund-ui/src/app/components/funding-basket/funding-basket.component.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
index 78ce958..920a7ef 100644
--- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
+++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts
@@ -24,7 +24,8 @@ export class FundingBasketComponent implements OnInit {
private toastService: ToastsService
) {}
- public runningTotal = new BehaviorSubject(0)
+ protected runningTotal = new BehaviorSubject(0)
+ protected physicalTotal: string[] = []
@ViewChild("contribution") contribution?: Input;
ngOnInit(): void {
@@ -36,6 +37,9 @@ export class FundingBasketComponent implements OnInit {
let order: { needID: number, quantity: number }[] = []
let isNotValid = false
+ this.runningTotal.next(0);
+ this.physicalTotal = []
+
for (let contribution of document.querySelectorAll<HTMLInputElement>('.contribution')!) {
if (contribution.value == '' || contribution.valueAsNumber <= 0) {
isNotValid = true
@@ -60,21 +64,28 @@ export class FundingBasketComponent implements OnInit {
this.toastService.sendToast(ToastType.INFO, "Checkout successful");
}
- resetColor(ev: any) {
+ onInput(ev: any) {
let total = 0
this.runningTotal.next(total);
+ this.physicalTotal = []
for (let contribution of document.querySelectorAll<HTMLInputElement>('.contribution')!) {
this.cupboardService.getNeed(+contribution.id).subscribe(need => {
if (contribution.value != '' && need.type != GoalType.PHYSICAL) {
total += contribution.valueAsNumber
+ } else if (contribution.value != '' && need.type == GoalType.PHYSICAL) {
+ this.physicalTotal.push(need.name + ": " + contribution.value)
}
this.runningTotal.next(total);
+
})
}
+ this.physicalTotal.sort((a, b) => a < b ? -1 : 1);
+
(ev.target as HTMLInputElement).setAttribute("style", "border-color: unset")
}
protected readonly of = of;
protected readonly userType = userType;
+ protected readonly Infinity = Infinity;
}