aboutsummaryrefslogtreecommitdiff
path: root/ufund-ui/src/app/components/need-list/need-list.component.html
blob: 84f80dc6c7814cdd8f6c9c14c6afd2f83802f4de (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<div id="header">
    <div id="searchArea">
        <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>
    </div>
    <div id="sortArea">
        <label for="sort">Sort by: </label>
        <select id='sort' [(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)">
            <span class="icon">{{sortMode === 'Ascending' ? 'arrow_upward': 'arrow_downward'}}</span>
        </button>
        <label>Needs per page: </label>
        <input type ="number" [(ngModel)]="itemsPerPage" (change)="editNeedsPerPage()" min="1" max="{{searchResults.length}}">
    </div>
    <!--<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>
<div id="needList">
    <div *ngFor="let need of visibleNeeds" class="needEntry">
        <div [routerLink]="'/need/' + need.id" class="clickable">
            <div class="split">
                <div class="left">
                    <span class="needName">{{need.name}}</span>
                    <span class="needType">{{need.type}}</span>
                </div>

                <div class="right">
                    <span *ngIf="need.urgent" class="urgent">URGENT</span>
                    <span *ngIf="need.location"><span class="icon">location_on</span>{{need.location}}</span>
                </div>
            </div>

            <div class="prog">
                <span id="hover-status-label-{{need.id}}"> </span>

                <span>{{need.type.toString() == 'MONETARY' ? '$' : ''}}{{need.current}}/{{need.type.toString() == 'MONETARY' ? '$' : ''}}{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%)</span>
                <progress [value]="need.current" [max]="need.maxGoal"></progress>
            </div>

        </div>

        <div class="actionArea">
            <button *ngIf="isHelper()" (click)="add(need)">
                <span class="icon">add</span>Add To Basket
            </button>
            <button *ngIf="isManager()" (click)="select(need)">
                <span class="icon">edit</span>Edit Need
            </button>
            <button *ngIf="isManager()" (click)="delete(need.id)" >
                <span class="icon">delete</span>Delete Need
            </button>
        </div>
    </div>
</div>

<div id="page-selector">
    <button [disabled]="!(currentPage !== 0)" (click)="firstPage()"><span class="icon">first_page</span></button>
    <button [disabled]="!(currentPage > 0)" (click)="decrementPage()"><span class="icon">arrow_back_ios_new</span></button>
    <span>Page {{currentPage + 1}} of {{totalPages}}</span>
    <button [disabled]="!(currentPage < totalPages - 1)" (click)="incrementPage()"><span class="icon">arrow_forward_ios</span></button>
    <button [disabled]="!(currentPage !== totalPages - 1)" (click)="lastPage()"><span class="icon">last_page</span></button>
</div>