diff options
| author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-04 16:13:25 -0400 | 
|---|---|---|
| committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-04 16:13:25 -0400 | 
| commit | 0a876b31609144c62f312ea59f074f5f79b67ae7 (patch) | |
| tree | a4cf70a927d72bd31c8033a286222c8e057c6dd7 /ufund-ui/src/app | |
| parent | 24ab92f79ccbb1a109ed1186b7b8030cae768eab (diff) | |
| download | JellySolutions-0a876b31609144c62f312ea59f074f5f79b67ae7.tar.gz JellySolutions-0a876b31609144c62f312ea59f074f5f79b67ae7.tar.bz2 JellySolutions-0a876b31609144c62f312ea59f074f5f79b67ae7.zip  | |
Made every invalid need input in basket turn red when invalid
Diffstat (limited to '')
| -rw-r--r-- | ufund-ui/src/app/components/funding-basket/funding-basket.component.ts | 12 | 
1 files changed, 10 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 5d94124..a39b4f3 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 @@ -36,16 +36,21 @@ export class FundingBasketComponent implements OnInit {      async checkout() {          let order: { needID: number, quantity: number }[] = [] +        let isNotValid = false          for (let contribution of document.querySelectorAll<HTMLInputElement>('.contribution')!) {              if (contribution.value == '' || contribution.valueAsNumber <= 0) { +                isNotValid = true                  contribution.setAttribute("style", "border-color: #ff0000"); -                this.toastService.sendToast(ToastType.ERROR, "Invalid input in funding basket!") -                return;              }              order.push({needID: +contribution.id, quantity: contribution.valueAsNumber});          } +        if (isNotValid) { +            this.toastService.sendToast(ToastType.ERROR, "Invalid input in funding basket!") +            return; +        } +          try {              await firstValueFrom(this.cupboardService.checkoutNeed(order))          } catch (ex:any) { @@ -58,6 +63,9 @@ export class FundingBasketComponent implements OnInit {      }      resetColor(ev: any) { +        for (let contribution of document.querySelectorAll<HTMLInputElement>('.contribution')!) { + +        }          (ev.target as HTMLInputElement).setAttribute("style", "border-color: unset")      }  }  | 
