aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui')
-rw-r--r--ufund-ui/src/app/components/need-edit/need-edit.component.css5
-rw-r--r--ufund-ui/src/app/components/need-edit/need-edit.component.html14
-rw-r--r--ufund-ui/src/app/components/need-edit/need-edit.component.ts18
3 files changed, 15 insertions, 22 deletions
diff --git a/ufund-ui/src/app/components/need-edit/need-edit.component.css b/ufund-ui/src/app/components/need-edit/need-edit.component.css
index b06e061..9ef9292 100644
--- a/ufund-ui/src/app/components/need-edit/need-edit.component.css
+++ b/ufund-ui/src/app/components/need-edit/need-edit.component.css
@@ -49,3 +49,8 @@ textarea {
label {
padding: 3px;
}
+
+
+.red {
+ color: red;
+}
diff --git a/ufund-ui/src/app/components/need-edit/need-edit.component.html b/ufund-ui/src/app/components/need-edit/need-edit.component.html
index ed4bfb3..f7eec63 100644
--- a/ufund-ui/src/app/components/need-edit/need-edit.component.html
+++ b/ufund-ui/src/app/components/need-edit/need-edit.component.html
@@ -3,23 +3,23 @@
<h2>{{this.mode}} Need</h2>
<form #updateForm="ngForm" id="update-form" (ngSubmit)="submit(updateForm.value)">
<div>
- <span>Name:</span>
+ <span>Name <span class="red">*Required</span></span>
<input type="text" name="name" [(ngModel)]="needCopy.name">
</div>
<div>
- <span>Image:</span>
+ <span>Image</span>
<input type="text" name="image" [(ngModel)]="needCopy.image">
</div>
<div>
- <span>Location:</span>
+ <span>Location</span>
<input type="text" name="location" [(ngModel)]="needCopy.location">
</div>
<div>
- <span>Max Goal:</span>
+ <span>Max Goal <span class="red">*Required</span></span>
<input type="number" name="maxGoal" [(ngModel)]="needCopy.maxGoal">
</div>
<div>
- <span>Type:</span>
+ <span>Type <span class="red">*Required</span></span>
<label>
<input type="radio" name="type" value="MONETARY" [(ngModel)]="needCopy.type">
Monetary
@@ -30,14 +30,14 @@
</label>
</div>
<div>
- <span>Urgency:</span>
+ <span>Urgency</span>
<label>
<input type="checkbox" name="urgent" [(ngModel)]="needCopy.urgent">
Urgent
</label>
</div>
<div>
- <span>Description:</span>
+ <span>Description</span>
<textarea name="description" [(ngModel)]="needCopy.description"></textarea>
</div>
<input type="submit" value="Submit">
diff --git a/ufund-ui/src/app/components/need-edit/need-edit.component.ts b/ufund-ui/src/app/components/need-edit/need-edit.component.ts
index b63d9c1..3c42c34 100644
--- a/ufund-ui/src/app/components/need-edit/need-edit.component.ts
+++ b/ufund-ui/src/app/components/need-edit/need-edit.component.ts
@@ -39,7 +39,7 @@ export class NeedEditComponent implements OnChanges {
id: this.needCopy.id, //system will control this
maxGoal: form.maxGoal,
type: GoalType[form.type as keyof typeof GoalType],
- urgent: form.urgent,
+ urgent: form.urgent ?? false,
filterAttributes: [],
current: 0,
description: form.description
@@ -56,13 +56,7 @@ export class NeedEditComponent implements OnChanges {
need.current = this.need?.current ?? 0
this.cupboardService.updateNeed(need.id, need)
.pipe(catchError((ex, _) => {
- if (ex.status == 500) {
- this.toastService.sendToast(ToastType.ERROR, 'Fields cannot be blank');
- } else if (ex.status == 400) {
- this.toastService.sendToast(ToastType.ERROR, ex.error);
- } else {
- this.toastService.sendToast(ToastType.ERROR, "Error on creating need");
- }
+ this.toastService.sendToast(ToastType.ERROR, ex.error);
return of()
}))
.subscribe(
@@ -83,13 +77,7 @@ export class NeedEditComponent implements OnChanges {
createNeed(need: Need) {
this.cupboardService.createNeed(need)
.pipe(catchError((ex, _) => {
- if (ex.status == 500) {
- this.toastService.sendToast(ToastType.ERROR, "Fields cannot be blank");
- } else if (ex.status == 400) {
- this.toastService.sendToast(ToastType.ERROR, ex.error);
- } else {
- this.toastService.sendToast(ToastType.ERROR, "Error on creating need");
- }
+ this.toastService.sendToast(ToastType.ERROR, ex.error);
return of()
}))
.subscribe(