From 8ec987f46b4ef3ff1ce23d9942662a74e162689d Mon Sep 17 00:00:00 2001 From: benal01 Date: Thu, 20 Mar 2025 09:58:32 -0400 Subject: need-list search embedded in normal display with better feedback --- .../components/need-list/need-list.component.css | 2 +- .../components/need-list/need-list.component.html | 23 ++++----- .../components/need-list/need-list.component.ts | 60 +++++++++++----------- 3 files changed, 41 insertions(+), 44 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index bbc3f2c..88bdfbe 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -15,7 +15,7 @@ li, div { } -#search-form { +#search-container { background-color: #d9d9d9; padding: 10px 20px 20px 20px; border: 2px solid #000; diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 36c12d0..504deb9 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -1,25 +1,20 @@

Needs List

-
-
+
+
-
+
-
-

Search Results:

-
- - {{need.name}} - - - -
-
-
  • + +

    Search Results({{needs.length - searchResults.length}} needs filtered):

    +

    All Needs

    +

    No Results Found

    + +
  • {{need.name}} diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 25f05d6..f5d7855 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { NgForm } from '@angular/forms'; import {Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; import { UsersService } from '../../services/users.service'; @@ -19,12 +20,16 @@ export class NeedListComponent { ) {} refresh() { - this.cupboardService.getNeeds().subscribe(n => this.needs = n) + this.cupboardService.getNeeds().subscribe(n => { + this.needs = n; + this.searchResults = this.needs; + }); + + console.log(this.searchResults); } ngOnInit(): void { this.refresh() - this.close(); } @@ -42,20 +47,13 @@ export class NeedListComponent { } } - private updateSearchStatus(text: string) { - let element = document.getElementById('search-status'); - if (element) { - element.innerHTML = text; - } - } - open() { this.hideElement(document.getElementById('search-button')); - this.showElement(document.getElementById('search-form')); + this.showElement(document.getElementById('search-container')); } close() { - this.hideElement(document.getElementById('search-form')); + this.hideElement(document.getElementById('search-container')); this.showElement(document.getElementById('search-button')); this.hideElement(document.getElementById('search-status')); } @@ -69,24 +67,28 @@ export class NeedListComponent { if (this.searchDelay) { clearTimeout(this.searchDelay); } + if (form) { + this.searchDelay = setTimeout(() => { + + if (form) { + const currentSearchValue = form.search; //latest value of the search + this.cupboardService.searchNeeds(currentSearchValue).subscribe((n) => { + this.searchResults = n; + console.log(currentSearchValue, this.searchResults); + this.showElement(document.getElementById('search-results')); + this.showElement(document.getElementById('search-status')); + }); + } + }, 250); + } else { + //user has cleared the search bar, we can skip the timeout for a 1/4 second faster response + //clear timeout to stop pending search + clearTimeout(this.searchDelay); + this.searchResults = this.needs; + } + - this.searchDelay = setTimeout(() => { - const currentSearchValue = form.search; //latest value of the search - this.cupboardService.searchNeeds(currentSearchValue).subscribe((n) => { - this.searchResults = n; - console.log(currentSearchValue, this.searchResults); - this.showElement(document.getElementById('search-results')); - this.showElement(document.getElementById('search-status')); - if (this.searchResults.length === this.needs.length) { - this.updateSearchStatus("Please refine your search"); - this.searchResults = []; - } else if (this.searchResults.length === 0) { - this.updateSearchStatus("No results found"); - } else { - this.updateSearchStatus("Search results:"); - } - }); - }, 250); + } delete(id : number) { @@ -127,6 +129,6 @@ export class NeedListComponent { } back() { - this.searchResults = []; + this.searchResults = this.needs; } } -- cgit v1.2.3 From 237b9197c08c46a11fe45347e2d41428a558f75b Mon Sep 17 00:00:00 2001 From: benal01 Date: Thu, 20 Mar 2025 10:18:43 -0400 Subject: component style refactor for simpler display --- .../app/components/cupboard/cupboard.component.css | 20 +++- .../components/cupboard/cupboard.component.html | 101 +++++++++++---------- .../app/components/cupboard/cupboard.component.ts | 2 - 3 files changed, 69 insertions(+), 54 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.css b/ufund-ui/src/app/components/cupboard/cupboard.component.css index fe4971a..4c6ac4b 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.css +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.css @@ -1,18 +1,30 @@ :host { - display: block; + display: flex; + justify-content: left; border: 2px solid #000; border-radius: 5px; padding: 10px 20px; } +#menu { + display: flex; + justify-content: space-between; + margin: 10px; + * { + border: 3px solid #000; + + border-top-left-radius: 5px; + border-top-right-radius: 5px; + margin-right: 5px; + border-bottom: 0px; + } +} -#menu, #create-form, #delete-form, #update-form { +#create-form, #delete-form, #update-form { background-color: #d9d9d9; padding: 10px 20px 20px 20px; border: 2px solid #000; border-radius: 5px; - width: 20%; visibility: visible; - } #create-button { diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 0d64475..4577844 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -1,50 +1,55 @@ -

    Cupboard

    -

    Admin View

    -
  • -- cgit v1.2.3 From 2b67bd14828c8c0bffe461a66542a2dba6c19f93 Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 22 Mar 2025 11:21:30 -0400 Subject: API creation bug fix- the max goal would not be casted properly --- ufund-ui/src/app/components/cupboard/cupboard.component.css | 9 ++++++--- ufund-ui/src/app/components/need-list/need-list.component.css | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.css b/ufund-ui/src/app/components/cupboard/cupboard.component.css index 4c6ac4b..434b136 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.css +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.css @@ -1,17 +1,21 @@ :host { display: flex; - justify-content: left; + justify-content: space-evenly; border: 2px solid #000; border-radius: 5px; padding: 10px 20px; + > div { + width: 40%; + } } + + #menu { display: flex; justify-content: space-between; margin: 10px; * { border: 3px solid #000; - border-top-left-radius: 5px; border-top-right-radius: 5px; margin-right: 5px; @@ -29,5 +33,4 @@ #create-button { padding: 10px 20px; - } \ No newline at end of file diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index f8948ee..bf7b982 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -4,7 +4,6 @@ display: block; border-radius: 5px; } - li, div { border: 2px solid #000; border-radius: 5px; -- cgit v1.2.3 From 2abd4b4ba9171821ac545f8dcb67be1e7d722e01 Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 22 Mar 2025 11:58:39 -0400 Subject: replaced unneccicary methods for form selection with ngIf --- ufund-ui/src/app/components/cupboard/cupboard.component.css | 2 +- ufund-ui/src/app/components/cupboard/cupboard.component.html | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.css b/ufund-ui/src/app/components/cupboard/cupboard.component.css index 434b136..6c2e5c6 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.css +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.css @@ -12,7 +12,7 @@ #menu { display: flex; - justify-content: space-between; + margin: 10px; * { border: 3px solid #000; diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 4577844..41bb4a7 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -5,10 +5,10 @@

    Admin View

    -
    +

    Create a new need


    @@ -22,11 +22,10 @@
    - - ‼️{{statusText | async}} + {{statusText | async}}
    -
    +

    Update a need


    @@ -46,7 +45,6 @@
    - {{statusText | async}}
    -- cgit v1.2.3 From e9564ba2514f32c63d2ce4ecfc9eeb9f3269f3dd Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 22 Mar 2025 12:14:00 -0400 Subject: [ngClass] tab styling --- .../app/components/cupboard/cupboard.component.css | 21 ++++++---- .../components/cupboard/cupboard.component.html | 4 +- .../app/components/cupboard/cupboard.component.ts | 46 ++-------------------- 3 files changed, 20 insertions(+), 51 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.css b/ufund-ui/src/app/components/cupboard/cupboard.component.css index 6c2e5c6..6e70951 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.css +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.css @@ -14,13 +14,20 @@ display: flex; margin: 10px; - * { - border: 3px solid #000; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - margin-right: 5px; - border-bottom: 0px; - } + +} + +.tab, .selected-tab { + background-color: lightgray; + border: 3px solid #000; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + margin-right: 5px; + border-bottom: 0px; +} + +.selected-tab { + background-color: white; } #create-form, #delete-form, #update-form { diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 41bb4a7..9b74b2a 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -5,8 +5,8 @@

    Admin View

    Create a new need

    diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index f8023c3..646c4ff 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -16,7 +16,7 @@ import { NeedListComponent } from '../need-list/need-list.component'; export class CupboardComponent implements OnInit { protected statusText = new BehaviorSubject("") - + selectedForm = "create" needs: any; @ViewChild("needList") needList?: NeedListComponent @@ -24,9 +24,6 @@ export class CupboardComponent implements OnInit { ngOnInit(): void { this.cupboardService.getNeeds().subscribe(n => this.needs = n); - this.close(); - this.openmenu(); - if (this.isManager()) { console.log("Admin view of Cupboard"); } else { @@ -41,44 +38,9 @@ export class CupboardComponent implements OnInit { type: '' }; selectedNeedId: number | null = null; - - private hideElement(element: any) { - if (element) { - element.style.visibility = 'hidden'; - element.style.position = 'absolute'; - } - } - - private showElement(element: any) { - if (element) { - element.style.visibility = 'visible'; - element.style.position = 'relative'; - } - } - openmenu() { - const menuElement = document.getElementById('menu'); - this.showElement(menuElement); - } - - opencreate() { - this.close(); - this.showElement(document.getElementById('create-form')); - } - - openupdate() { - this.close(); - this.showElement(document.getElementById('update-form')); - } - - back() { - this.close(); - this.openmenu(); - } - - close() { - this.hideElement(document.getElementById('create-form')); - this.hideElement(document.getElementById('destroy-form')); - this.hideElement(document.getElementById('update-form')); + + selectForm(name: string) { + this.selectedForm = name; } populateForm(need: any): void { -- cgit v1.2.3 From d8b9c0da32383630f0831fdf6a7f13c96174ee4c Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 22 Mar 2025 12:17:50 -0400 Subject: removing unneccicary functions for element visiblity in need list --- .../components/need-list/need-list.component.css | 3 +-- .../components/need-list/need-list.component.ts | 29 ---------------------- 2 files changed, 1 insertion(+), 31 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index bf7b982..29a9626 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -26,6 +26,5 @@ li { background-color: #d9d9d9; padding: 10px 20px 20px 20px; border: 2px solid #000; - border-radius: 5px; - visibility: visible; + border-radius: 5px; } \ No newline at end of file diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index f5d7855..3f77df4 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -24,38 +24,11 @@ export class NeedListComponent { this.needs = n; this.searchResults = this.needs; }); - console.log(this.searchResults); } ngOnInit(): void { this.refresh() - this.close(); - } - - private showElement(element: any) { - if (element){ - element.style.visibility = 'visible'; - element.style.position = 'relative'; - } - } - - private hideElement(element: any) { - if (element){ - element.style.visibility = 'hidden'; - element.style.position = 'absolute'; - } - } - - open() { - this.hideElement(document.getElementById('search-button')); - this.showElement(document.getElementById('search-container')); - } - - close() { - this.hideElement(document.getElementById('search-container')); - this.showElement(document.getElementById('search-button')); - this.hideElement(document.getElementById('search-status')); } private searchDelay: any; @@ -75,8 +48,6 @@ export class NeedListComponent { this.cupboardService.searchNeeds(currentSearchValue).subscribe((n) => { this.searchResults = n; console.log(currentSearchValue, this.searchResults); - this.showElement(document.getElementById('search-results')); - this.showElement(document.getElementById('search-status')); }); } }, 250); -- cgit v1.2.3 From 2ae7c1036b7ce398e2b18928215f74d57bb3cec6 Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 22 Mar 2025 12:28:36 -0400 Subject: search reformatting --- ufund-ui/src/app/components/need-list/need-list.component.css | 1 - ufund-ui/src/app/components/need-list/need-list.component.html | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 29a9626..2e4a31b 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -24,7 +24,6 @@ li { #search-container { background-color: #d9d9d9; - padding: 10px 20px 20px 20px; border: 2px solid #000; border-radius: 5px; } \ No newline at end of file diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 9f22633..0345519 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -1,8 +1,7 @@

    Needs List

    -
    - +
    -- cgit v1.2.3 From b725948521e81965a18991e7dd59a2bc84dbd460 Mon Sep 17 00:00:00 2001 From: benal01 Date: Sat, 22 Mar 2025 12:56:28 -0400 Subject: need list uses button instead of link --- .../app/components/need-list/need-list.component.css | 15 ++++++++++++--- .../components/need-list/need-list.component.html | 20 +++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 2e4a31b..8f017cd 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -1,17 +1,26 @@ :host { - list-style-type:circle; + list-style-type: none; border: 2px solid #000; display: block; border-radius: 5px; } -li, div { + +div, li > button { border: 2px solid #000; border-radius: 5px; padding: 5px; margin: 5px; } -li { +ul { + list-style-type: none; + padding-inline-start: 0px; +} + +li > button { + width: 98%; + padding: 1%; + margin: 1%; display: flex; justify-content: space-between; align-items: center; diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 0345519..fef22d7 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -12,12 +12,14 @@

    All Needs

    No Results Found

    -
  • - - {{need.name}} - - - -
  • +
      +
    • + + + +
    • +
    \ No newline at end of file -- cgit v1.2.3 From a05f6f0ab8dead76f937a2d7196fa005af0367fe Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 24 Mar 2025 10:27:31 -0400 Subject: hover feedback for need list's button --- ufund-ui/src/app/components/need-list/need-list.component.css | 6 ++++++ ufund-ui/src/app/components/need-list/need-list.component.html | 4 ++-- ufund-ui/src/app/components/need-list/need-list.component.ts | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 8f017cd..c2b8b90 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -24,8 +24,14 @@ li > button { display: flex; justify-content: space-between; align-items: center; + transition: all 0.3s ease; } +li > button:hover p { + font-weight: bold; +} + + .icon { width: 15px; margin: 3px -3px -1px -3px; diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index fef22d7..fc2daa5 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -13,9 +13,9 @@

    No Results Found

      -
    • +
    • diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 3f77df4..8ae7370 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -78,6 +78,13 @@ export class NeedListComponent { return type === ("HELPER" as unknown as userType); } + changeText(id : number, text : string) { + const label = document.getElementById('need-label-' + id); + if (label) { + label.innerHTML = text; + } + } + add(need: Need) { const currentUser = this.usersService.getCurrentUser(); //console.log("get current user in angular:", currentUser) -- cgit v1.2.3 From 1c1d3922e7eea35764ebab39b18172ed2c8c82d9 Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 24 Mar 2025 10:38:40 -0400 Subject: better feedback using a --- ufund-ui/src/app/components/need-list/need-list.component.css | 8 +++++++- ufund-ui/src/app/components/need-list/need-list.component.html | 4 ++-- ufund-ui/src/app/components/need-list/need-list.component.ts | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index c2b8b90..c42dfda 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -25,10 +25,16 @@ li > button { justify-content: space-between; align-items: center; transition: all 0.3s ease; + font-weight: bold; +} + +li > button span { + font-style: italic; + font-weight: normal; } li > button:hover p { - font-weight: bold; + text-decoration: underline; } diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index fc2daa5..741b899 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -13,9 +13,9 @@

      No Results Found

        -
      • +
      • diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 8ae7370..0f86921 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -79,10 +79,10 @@ export class NeedListComponent { } changeText(id : number, text : string) { - const label = document.getElementById('need-label-' + id); - if (label) { - label.innerHTML = text; - } + const span = document.getElementById('hover-status-label-' + id); + if (span) { + span.innerHTML = ' ' + text; + } } add(need: Need) { -- cgit v1.2.3 From f0ac1eda74367afc375112a7269c085a511ce490 Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 24 Mar 2025 22:23:36 -0400 Subject: viewing search results inside cupboard component --- .../components/cupboard/cupboard.component.html | 11 +++------ .../app/components/cupboard/cupboard.component.ts | 28 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 11 deletions(-) (limited to 'ufund-ui/src') 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 @@
    -

    Create a new need

    +

    Create Need



    @@ -26,15 +26,10 @@
    -

    Update a need

    +

    Update Need


    -
    - - -
    -
    -
    +



    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 { -- cgit v1.2.3 From 20458b2ae22466d0b75a2ae60f318e514c0d905f Mon Sep 17 00:00:00 2001 From: benal01 Date: Tue, 25 Mar 2025 08:46:45 -0400 Subject: need list reformatting- button does not span whole list element --- .../app/components/need-list/need-list.component.css | 19 ++++++++++++++----- .../app/components/need-list/need-list.component.html | 14 ++++++++++---- .../app/components/need-list/need-list.component.ts | 7 ++++++- 3 files changed, 30 insertions(+), 10 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index c42dfda..74dbc34 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -5,7 +5,7 @@ border-radius: 5px; } -div, li > button { +div { border: 2px solid #000; border-radius: 5px; padding: 5px; @@ -17,17 +17,26 @@ ul { padding-inline-start: 0px; } -li > button { - width: 98%; - padding: 1%; - margin: 1%; +li { display: flex; justify-content: space-between; align-items: center; transition: all 0.3s ease; font-weight: bold; + border: 2px solid #000; + border-radius: 5px; + margin: 5px; + + > button { + width: 90%; + float: left; + transition: all 0.3s ease; + font-weight: bold; + display: flex; + } } + li > button span { font-style: italic; font-weight: normal; diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 741b899..b31ccf0 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -13,13 +13,19 @@

    No Results Found

      -
    • - + + +
      + - - +
    \ No newline at end of file diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 0f86921..e47929b 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -11,6 +11,7 @@ import { userType } from '../../models/User'; styleUrl: './need-list.component.css' }) export class NeedListComponent { + selectedNeed: Need | undefined; needs: Need[] = []; searchResults: Need[] = []; @@ -109,4 +110,8 @@ export class NeedListComponent { back() { this.searchResults = this.needs; } -} + + select(need : Need) { + this.selectedNeed = need; + } +} \ No newline at end of file -- cgit v1.2.3 From f7cd2d90191c1d81526ed549514d82864c1aebb2 Mon Sep 17 00:00:00 2001 From: benal01 Date: Tue, 25 Mar 2025 09:08:26 -0400 Subject: restyling of need list results --- .../app/components/need-list/need-list.component.css | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 74dbc34..c763105 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -1,4 +1,5 @@ :host { + --list-background-color: lightgray; list-style-type: none; border: 2px solid #000; display: block; @@ -18,6 +19,7 @@ ul { } li { + background-color: var(--list-background-color); display: flex; justify-content: space-between; align-items: center; @@ -25,17 +27,26 @@ li { font-weight: bold; border: 2px solid #000; border-radius: 5px; - margin: 5px; - + margin: 5px; > button { - width: 90%; + background-color: var(--list-background-color); + width: 88%; float: left; transition: all 0.3s ease; font-weight: bold; display: flex; + border: none; + border-radius: 5px; + } + + > section { + width: 12%; } } +section button{ + margin: 4%; +} li > button span { font-style: italic; @@ -48,7 +59,7 @@ li > button:hover p { .icon { - width: 15px; + width: 18px; margin: 3px -3px -1px -3px; } -- cgit v1.2.3 From d9eb78521f29ead3a9f70b09e18a6d9560cc849c Mon Sep 17 00:00:00 2001 From: benal01 Date: Tue, 25 Mar 2025 10:43:52 -0400 Subject: fancy selection animation for need list --- .../components/need-list/need-list.component.css | 2 +- .../components/need-list/need-list.component.html | 4 ++-- .../components/need-list/need-list.component.ts | 28 +++++++++++++++++++++- 3 files changed, 30 insertions(+), 4 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index c763105..2eb6a8d 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -29,7 +29,7 @@ li { border-radius: 5px; margin: 5px; > button { - background-color: var(--list-background-color); + background-color: transparent; width: 88%; float: left; transition: all 0.3s ease; diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index b31ccf0..eaa8a6f 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -13,14 +13,14 @@

    No Results Found

      -
    • +
    • -
    diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index e38f8c0..cf9b95e 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import {Component, Input, OnInit, ViewChild} from '@angular/core'; import { CupboardService } from '../../services/cupboard.service'; import { UsersService } from '../../services/users.service'; import { Need, GoalType } from '../../models/Need'; @@ -38,9 +38,9 @@ export class CupboardComponent implements OnInit { }; selectedNeedId: number | null = null; searchResults: any[] = []; - + selectForm(name: string) { - //get search results from the need list + //get search results from the need list if (this.needList) { this.searchResults = this.needList.searchResults; } diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 9ef191a..bf78d99 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import {Component, Input} from '@angular/core'; import { NgForm } from '@angular/forms'; import {Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; @@ -15,6 +15,8 @@ export class NeedListComponent { needs: Need[] = []; searchResults: Need[] = []; + @Input() editF?: Function + constructor( private cupboardService: CupboardService, private usersService: UsersService @@ -43,7 +45,7 @@ export class NeedListComponent { } if (form) { this.searchDelay = setTimeout(() => { - + if (form) { const currentSearchValue = form.search; //latest value of the search this.cupboardService.searchNeeds(currentSearchValue).subscribe((n) => { @@ -58,9 +60,9 @@ export class NeedListComponent { clearTimeout(this.searchDelay); this.searchResults = this.needs; } - - + + } delete(id : number) { @@ -80,10 +82,10 @@ export class NeedListComponent { } changeText(id : number, text : string) { - const span = document.getElementById('hover-status-label-' + id); + const span = document.getElementById('hover-status-label-' + id); if (span) { span.innerHTML = ' ' + text; - } + } } add(need: Need) { @@ -101,7 +103,7 @@ export class NeedListComponent { } else { window.alert("This need is already in your basket!") } - + } @@ -140,4 +142,4 @@ export class NeedListComponent { button.style.visibility = 'hidden'; } } -} \ No newline at end of file +} -- cgit v1.2.3 From 0549991d0b32de4de544d16478ce5b2782c1809d Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 26 Mar 2025 18:59:55 -0400 Subject: use (output) for need edit selection --- ufund-ui/src/app/components/cupboard/cupboard.component.html | 2 +- ufund-ui/src/app/components/need-list/need-list.component.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index c2d146b..4b76f25 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -1,6 +1,6 @@

    Cupboard

    - +

    Admin View

    diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index bf78d99..2eed87d 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,4 +1,4 @@ -import {Component, Input} from '@angular/core'; +import {Component, Output, EventEmitter} from '@angular/core'; import { NgForm } from '@angular/forms'; import {Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; @@ -11,11 +11,11 @@ import { userType } from '../../models/User'; styleUrl: './need-list.component.css' }) export class NeedListComponent { - selectedNeed: Need | undefined; + selectedNeed: Need | null = null; needs: Need[] = []; searchResults: Need[] = []; - @Input() editF?: Function + @Output() currentNeed = new EventEmitter(); constructor( private cupboardService: CupboardService, @@ -114,6 +114,8 @@ export class NeedListComponent { } select(need : Need) { + //emit value + this.currentNeed.emit(need); if (this.selectedNeed) { //revert already selected need to previous style console.log(need.id); -- cgit v1.2.3 From 959aa5101fbba55f20eda46d02addd27a74cf950 Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 26 Mar 2025 19:03:16 -0400 Subject: snap form open on edit event --- ufund-ui/src/app/components/cupboard/cupboard.component.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index cf9b95e..0d2c1f5 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -66,6 +66,7 @@ export class CupboardComponent implements OnInit { } populateForm(need: any): void { + this.selectForm('update'); this.selectedNeed = { ...need }; } -- cgit v1.2.3 From d5ae670dbce9e5cabbd594759df490176fd8cecd Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 26 Mar 2025 19:12:52 -0400 Subject: use selected id for the update form --- ufund-ui/src/app/components/cupboard/cupboard.component.html | 1 - ufund-ui/src/app/components/cupboard/cupboard.component.ts | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'ufund-ui/src') diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 4b76f25..d54eed9 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -29,7 +29,6 @@

    Update Need


    -



    diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 0d2c1f5..a8b9c14 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -79,14 +79,13 @@ export class CupboardComponent implements OnInit { console.log(form); const need: Need = { name: form.name, - id: form.id, //system will control this + id: this.selectedNeed.id, //system will control this maxGoal: form.maxGoal, type: GoalType[form.type as keyof typeof GoalType], filterAttributes: [], current: 0 }; - console.log("need:", need); - console.log(need.id, need, "need updated"); + this.cupboardService.updateNeed(need.id, need) .pipe(catchError((ex, r) => { if (ex.status == 500) { -- cgit v1.2.3