-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #340 from Cafnanc/release-2.6.0
Release 2.6.0
- Loading branch information
Showing
28 changed files
with
598 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<ion-header *ngIf="filterData"> | ||
<div class="ion-padding-start wrapper-class ion-padding-bottom"> | ||
<ion-label class="header">{{"FILTER"|translate}}</ion-label> | ||
<ion-label class="underline" (click)="clearAll()">{{"CLEAR_ALL"|translate}}</ion-label> | ||
</div> | ||
</ion-header> | ||
<ion-content *ngIf="filterData"> | ||
<div class="ion-padding-start ion-padding-top" *ngFor="let filter of filterData"> | ||
<ion-label class="sub-header">{{filter?.title}}</ion-label> | ||
<div class="ion-padding-top d-flex flex-align-items-center" *ngFor="let data of filter.options"> | ||
<ion-checkbox slot="start" [(ngModel)]="data.selected" (ionChange)="onFilterChange()"></ion-checkbox> | ||
<ion-label class="ion-padding-start">{{data?.name || data?.label}}</ion-label> | ||
</div> | ||
</div> | ||
</ion-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.header { | ||
font-weight: bold; | ||
font-size: 17px; | ||
letter-spacing: 1px; | ||
} | ||
.wrapper-class { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
.underline { | ||
border-bottom: 1px solid black; | ||
} | ||
.sub-header { | ||
font-weight: bold; | ||
font-size: 16px; | ||
padding-bottom: 16px; | ||
// letter-spacing: 1px; | ||
} | ||
ion-checkbox { | ||
--border-color: var(--ion-color-primary) | ||
} |
24 changes: 24 additions & 0 deletions
24
src/app/shared/components/filters/filters.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; | ||
import { IonicModule } from '@ionic/angular'; | ||
|
||
import { FiltersComponent } from './filters.component'; | ||
|
||
describe('FiltersComponent', () => { | ||
let component: FiltersComponent; | ||
let fixture: ComponentFixture<FiltersComponent>; | ||
|
||
beforeEach(waitForAsync(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ FiltersComponent ], | ||
imports: [IonicModule.forRoot()] | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(FiltersComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import * as _ from 'lodash'; | ||
|
||
@Component({ | ||
selector: 'app-filters', | ||
templateUrl: './filters.component.html', | ||
styleUrls: ['./filters.component.scss'], | ||
}) | ||
export class FiltersComponent implements OnInit { | ||
@Input() filterData: any; | ||
@Output() filtersChanged = new EventEmitter<any>(); | ||
|
||
ogArrObj: any; | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
console.log(this.filterData) | ||
this.ogArrObj = _.cloneDeep(this.filterData); | ||
} | ||
|
||
|
||
clearAll() { | ||
this.filterData = _.cloneDeep(this.ogArrObj) | ||
this.filtersChanged.emit([]) | ||
} | ||
|
||
onFilterChange() { | ||
const selectedOptionsByCategory = {}; | ||
this.filterData.forEach(category => { | ||
const selectedOptions = category.options.filter(option => option.selected); | ||
if (selectedOptions.length > 0) { | ||
const optionsWithCategory = selectedOptions.map(option => ({ ...option, categoryName: category.name })); | ||
selectedOptionsByCategory[category.name] = selectedOptionsByCategory[category.name] || []; | ||
selectedOptionsByCategory[category.name].push(...optionsWithCategory); | ||
} | ||
}); | ||
this.filtersChanged.emit(selectedOptionsByCategory); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.