aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-list/need-list.component.html
blob: 72bc9c54cbee2339969748b926ddcc46357133bd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<div id="search-container">
    <section>
        <label for="sort">Sort by: </label>
        <select [(ngModel)] = "sortSelection" class="wide-input" (change)="search(searchForm.value)" [value]="sortSelection">
            <option *ngFor="let algorithm of SortingAlgoArrays" value="{{algorithm.name}}">
                {{algorithm.display[sortMode === 'Ascending' ? 0 : 1]}}
            </option>
        </select>
        <button (click)="changeSortMode(searchForm.value)">
            {{sortMode}}
        </button>
    </section>
    <section>
        <form id="search-form" #searchForm="ngForm">
            <input type="text" name="search" class="wide-input" placeholder="Search in {{needs.length}} needs..." (input)="search(searchForm.value)" ngModel>
            <input type="reset" value="Clear" (click)="search(null)"> <br>
        </form>
    </section>
    <!--<button (click)="close()">Close</button>-->
</div>

<!-- display for when results are present and filtered-->
<h2 *ngIf="searchResults.length < needs.length && searchResults.length != 0"> Search Results({{needs.length - searchResults.length}} needs filtered): </h2>
<h2 *ngIf="searchResults.length == needs.length"> All Needs </h2>
<h2 *ngIf="searchResults.length == 0"> No Results Found </h2>

<ul>
    <li *ngFor="let need of searchResults" id="need-button-{{need.id}}">
        <button [routerLink]="'/need/' + need.id" (mouseenter) ="changeText(need.id, '(details)')" (mouseleave)="changeText(need.id, '')">
            <section> <p> {{need.name}} | {{need.location}} <span> {{need.urgent ? "URGENT" : ""}} </span> <span id="hover-status-label-{{need.id}}"> </span> </section>
            <section>
                <progress value="need.current" max="need.maxGoal"></progress>
                <progress value="need.current" max="need.maxGoal"></progress>
                <progress value="need.current" max="need.maxGoal"></progress>
                <progress value="need.current" max="need.maxGoal"></progress>
            </section>
            <section>{{need.current}}/{{need.maxGoal}} {{(need.current / need.maxGoal) * 100}}% <span>{{need.type}}</span></section>
        </button>

        <button (click)="add(need)" *ngIf="isHelper()">Add To Basket</button>
        <section *ngIf="isManager()">
            <button (click)="select(need)" id="need-edit-button-{{need.id}}">
                <img class="icon" src="/edit.png" alt="Select">
            </button>
            <button (click)="delete(need.id)" *ngIf="isManager()">
                <img class="icon" src="/delete.png" alt="Delete">
            </button>
        </section>
    </li>
</ul>