diff options
Diffstat (limited to 'ufund-ui/src/app/components/cupboard/cupboard.component.html')
| -rw-r--r-- | ufund-ui/src/app/components/cupboard/cupboard.component.html | 88 | 
1 files changed, 58 insertions, 30 deletions
diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.html b/ufund-ui/src/app/components/cupboard/cupboard.component.html index 37954bb..bdc8a0e 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.html +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.html @@ -3,36 +3,64 @@          <h1> Cupboard </h1>          <button *ngIf="isManager()" class="button2" (click)="this.selectForm('create')"><span class="icon">add</span>Create Need</button>      </div> -    <app-need-list (currentNeed) = populateForm($event) #needList></app-need-list> -</div> -<ng-template [ngIf]="isManager()" > -<div> -    <app-need-edit *ngIf="selectedForm === 'update'" [selectedNeed]="selectedNeed" (refreshNeedList)="needList.refresh()"></app-need-edit> -    <div> -    <div id="create-form" *ngIf="selectedForm === 'create'"> -        <h1> Create Need </h1> -        <form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)"> -            <label>Name:</label><br> -            <input type="text" name="name" ngModel><br> -            <label>Image:</label><br> -            <input type="text" name="image" ngModel><br> -            <label>Location:</label><br> -            <input type="text" name="location" ngModel><br> -            <label>Max Goal:</label><br> -            <input type="number" name="maxGoal" ngModel><br> -            <label>Type</label><br> -            <input type="radio" name="type" value="MONETARY" ngModel> -            <label>Monetary</label><br> -            <input type="radio" name="type" value="PHYSICAL" ngModel> -            <label>Physical</label><br> -            <input type="checkbox" name="urgent" value="false" ngModel> -            <label>Urgent</label><br> -            <label>Description</label><br> -            <textarea name="description"></textarea><br> -            <input type="submit" value="Submit"> -        </form> -    </div> +    <div id="header2"> +        <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)] = "currentSortAlgo" class="wide-input" (change)="search(searchForm.value)" [value]="currentSortAlgo"> +                <option *ngFor="let algorithm of Object.values(SortingAlgoArrays)" value="{{algorithm}}"> +                    {{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" min="1" max="{{searchResults.length}}">--> +        </div> +        <!--<button (click)="close()">Close</button>-->      </div> +    <h2 *ngIf="(searchResults | async)?.length < needs.length && (searchResults | async)?.length != 0"> Search Results({{needs.length - (searchResults | async)?.length}} needs filtered): </h2> +    <h2 *ngIf="(searchResults | async)?.length == needs.length"> All Needs </h2> +    <h2 *ngIf="(searchResults | async)?.length == 0"> No Results Found </h2> + +    <app-need-list [needs]="searchResults" #needList></app-need-list>  </div> -</ng-template> + +<!--<ng-template [ngIf]="isManager()" >--> +<!--<div>--> +<!--    <app-need-edit *ngIf="selectedForm === 'update'" [selectedNeed]="selectedNeed" (refreshNeedList)="needList.refresh()"></app-need-edit>--> +<!--    <div>--> +<!--        <div id="create-form" *ngIf="selectedForm === 'create'">--> +<!--            <h1> Create Need </h1>--> +<!--            <form #cupboardForm="ngForm" (ngSubmit)="submit(cupboardForm.value)">--> +<!--                <label>Name:</label><br>--> +<!--                <input type="text" name="name" ngModel><br>--> +<!--                <label>Image:</label><br>--> +<!--                <input type="text" name="image" ngModel><br>--> +<!--                <label>Location:</label><br>--> +<!--                <input type="text" name="location" ngModel><br>--> +<!--                <label>Max Goal:</label><br>--> +<!--                <input type="number" name="maxGoal" ngModel><br>--> +<!--                <label>Type</label><br>--> +<!--                <input type="radio" name="type" value="MONETARY" ngModel>--> +<!--                <label>Monetary</label><br>--> +<!--                <input type="radio" name="type" value="PHYSICAL" ngModel>--> +<!--                <label>Physical</label><br>--> +<!--                <input type="checkbox" name="urgent" value="false" ngModel>--> +<!--                <label>Urgent</label><br>--> +<!--                <label>Description</label><br>--> +<!--                <textarea name="description"></textarea><br>--> +<!--                <input type="submit" value="Submit">--> + +<!--            </form>--> +<!--        </div>--> +<!--    </div>--> +<!--</div>--> +<!--</ng-template>-->  | 
