diff options
author | benal01 <bja4245@rit.edu> | 2025-03-24 22:23:36 -0400 |
---|---|---|
committer | benal01 <bja4245@rit.edu> | 2025-03-24 22:23:36 -0400 |
commit | f0ac1eda74367afc375112a7269c085a511ce490 (patch) | |
tree | 6c08eb12fb63f5ea6791b93ec3a7ac200d28f6ac | |
parent | 1c1d3922e7eea35764ebab39b18172ed2c8c82d9 (diff) | |
download | JellySolutions-f0ac1eda74367afc375112a7269c085a511ce490.tar.gz JellySolutions-f0ac1eda74367afc375112a7269c085a511ce490.tar.bz2 JellySolutions-f0ac1eda74367afc375112a7269c085a511ce490.zip |
viewing search results inside cupboard component
-rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.html | 11 | ||||
-rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.ts | 28 |
2 files changed, 28 insertions, 11 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 9b74b2a..3ed06fb 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -9,7 +9,7 @@ <button [ngClass]="selectedForm === 'update' ? 'selected-tab' : 'tab'" (click)="selectForm('update')">Update existing Need</button> </div> <div id="create-form" *ngIf="selectedForm === 'create'"> - <h1> Create a new need </h1> + <h1> Create Need </h1> <form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)"> <label>Name:</label><br> <input type="text" name="name" ngModel><br> @@ -26,15 +26,10 @@ </div> <div id="update-form" *ngIf="selectedForm === 'update'"> - <h1> Update a need </h1> + <h1> Update Need </h1> <label>Needs:</label><br> <form #updateForm="ngForm" (ngSubmit)="update(updateForm.value)"> - <div *ngFor="let need of needs"> - - <input type="radio" name="id" [value]=need.id [(ngModel)]="selectedNeedId" (change)="populateForm(need)"> - <label name="template">{{need.name}}</label><br> - </div> - <label>Name:</label><br> + <label>Currently Editing : need.name</label><br> <input type="text" name="name" [(ngModel)]="selectedNeed.name"><br> <label>Max Goal:</label><br> <input type="number" name="maxGoal" [(ngModel)]="selectedNeed.maxGoal"><br> diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 646c4ff..e38f8c0 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -16,10 +16,9 @@ import { NeedListComponent } from '../need-list/need-list.component'; export class CupboardComponent implements OnInit { protected statusText = new BehaviorSubject("") - selectedForm = "create" + selectedForm = "create"; needs: any; - @ViewChild("needList") needList?: NeedListComponent - + @ViewChild("needList") needList?: NeedListComponent; constructor(private cupboardService: CupboardService, private usersService: UsersService) { } ngOnInit(): void { @@ -38,9 +37,32 @@ export class CupboardComponent implements OnInit { type: '' }; selectedNeedId: number | null = null; + searchResults: any[] = []; selectForm(name: string) { + //get search results from the need list + if (this.needList) { + this.searchResults = this.needList.searchResults; + } + console.log(this.searchResults) this.selectedForm = name; + if (name == 'update') { + if (this.searchResults) { + this.searchResults.forEach((element: any) => { + console.log(element) + }); + } + + } + } + + async updateSearchResults() { + if (this.needList) { + while (this.selectedForm == 'update') { + this.searchResults = this.needList.searchResults + await new Promise(resolve => setTimeout(resolve, 100)); + } + } } populateForm(need: any): void { |