aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-edit
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-ui/src/app/components/need-edit')
-rw-r--r--ufund-ui/src/app/components/need-edit/need-edit.component.css9
-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.ts19
3 files changed, 18 insertions, 24 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..211ee17 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
@@ -11,8 +11,8 @@
padding: 10px;
border-style: solid;
border-width: 1px;
- border-color: #6c6c6c;
- background-color: #2e2e2e;
+ border-color: var(--secondary-color);
+ background-color: var(--tertiary-color);
border-radius: 5px;
position: relative;
width: 500px;
@@ -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 abfa543..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
@@ -53,15 +53,10 @@ export class NeedEditComponent implements OnChanges {
}
updateNeed(need: Need) {
+ 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(
@@ -82,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(