Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
Resin
Client
Commits
f7a1cb27
Commit
f7a1cb27
authored
1 year ago
by
Bastien DUMONT
Browse files
Options
Downloads
Plain Diff
Merge branch '226-annuaire-filters' into 'dev'
fix(annuaire): filters See merge request
!500
parents
e3dc13d4
53a5cde6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!525
V2.3.0
,
!500
fix(annuaire): filters
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/annuaire/filter-modal/filter-modal.component.ts
+20
-25
20 additions, 25 deletions
src/app/annuaire/filter-modal/filter-modal.component.ts
src/app/annuaire/search-bar/search-bar.component.html
+3
-1
3 additions, 1 deletion
src/app/annuaire/search-bar/search-bar.component.html
with
23 additions
and
26 deletions
src/app/annuaire/filter-modal/filter-modal.component.ts
+
20
−
25
View file @
f7a1cb27
...
@@ -11,48 +11,37 @@ export class FilterModalComponent implements OnInit, OnChanges {
...
@@ -11,48 +11,37 @@ export class FilterModalComponent implements OnInit, OnChanges {
@
Input
()
public
modalType
:
TypeModal
;
@
Input
()
public
modalType
:
TypeModal
;
@
Input
()
public
filtersTypes
:
string
[];
@
Input
()
public
filtersTypes
:
string
[];
@
Input
()
public
checkedFilters
:
string
[];
@
Input
()
public
checkedFilters
:
string
[];
@
Output
()
searchEvent
=
new
EventEmitter
();
@
Input
()
public
jobFilterChecked
:
string
[];
@
Output
()
closeEvent
=
new
EventEmitter
();
@
Input
()
public
employerFilterChecked
:
string
[];
@
Output
()
fetchResults
=
new
EventEmitter
<
string
[]
>
();
public
buttonTypeEnum
=
ButtonType
;
public
buttonTypeEnum
=
ButtonType
;
public
toggledCategories
:
string
[]
=
[];
public
toggledCategories
:
string
[]
=
[];
public
currentCheckedFilters
:
string
[]
=
[];
public
currentCheckedFilters
:
string
[]
=
[];
ngOnInit
():
void
{
ngOnInit
():
void
{
this
.
currentCheckedFilters
=
[...
this
.
checkedFilters
]
;
this
.
currentCheckedFilters
=
this
.
checkedFilters
.
slice
()
;
}
}
ngOnChanges
(
changes
:
SimpleChanges
):
void
{
ngOnChanges
(
changes
:
SimpleChanges
):
void
{
if
(
changes
.
modalType
)
this
.
currentCheckedFilters
=
[]
;
if
(
changes
.
modalType
)
this
.
currentCheckedFilters
=
this
.
checkedFilters
.
slice
()
;
}
}
public
isFilterChecked
(
filter
:
string
):
boolean
{
public
isFilterChecked
(
filter
:
string
):
boolean
{
return
this
.
currentCheckedFilters
.
f
in
dIndex
((
_filter
)
=>
_filter
===
filter
)
>
-
1
;
return
this
.
currentCheckedFilters
.
in
cludes
(
filter
)
;
}
}
public
toggleCheckbox
(
filter
:
string
):
void
{
public
toggleCheckbox
(
filter
:
string
):
void
{
const
filterExists
=
this
.
currentCheckedFilters
.
f
in
dIndex
((
_filterChecked
)
=>
_filterChecked
===
filter
)
!==
-
1
;
const
filterExists
=
this
.
currentCheckedFilters
.
in
cludes
(
filter
)
;
if
(
!
filterExists
)
{
if
(
!
filterExists
)
{
const
index
=
this
.
filtersTypes
.
findIndex
((
_filter
)
=>
_filter
===
filter
);
const
index
=
this
.
filtersTypes
.
indexOf
(
filter
);
this
.
currentCheckedFilters
.
push
(
this
.
filtersTypes
[
index
]);
this
.
currentCheckedFilters
.
push
(
this
.
filtersTypes
[
index
]);
}
else
{
}
else
{
const
filterToRemove
=
this
.
currentCheckedFilters
.
f
ind
Index
((
_filterChecked
)
=>
_filterChecked
===
filter
);
const
filterToRemove
=
this
.
currentCheckedFilters
.
ind
exOf
(
filter
);
this
.
currentCheckedFilters
.
splice
(
filterToRemove
);
this
.
currentCheckedFilters
.
splice
(
filterToRemove
,
1
);
}
}
}
}
// Clear only filters in the current modal
public
clearFilters
():
void
{
this
.
checkedFilters
=
[];
this
.
currentCheckedFilters
=
[];
this
.
emitModules
(
this
.
checkedFilters
);
}
// Sends an array containing all modules
public
emitModules
(
filters
:
string
[]):
void
{
this
.
searchEvent
.
emit
(
filters
);
}
public
getModalType
():
string
{
public
getModalType
():
string
{
switch
(
this
.
modalType
)
{
switch
(
this
.
modalType
)
{
case
TypeModal
.
employers
:
case
TypeModal
.
employers
:
...
@@ -64,12 +53,18 @@ export class FilterModalComponent implements OnInit, OnChanges {
...
@@ -64,12 +53,18 @@ export class FilterModalComponent implements OnInit, OnChanges {
}
}
}
}
public
closeModal
():
void
{
/** Clear only filters in the current modal */
this
.
closeEvent
.
emit
();
public
clearFilters
():
void
{
if
(
this
.
modalType
===
TypeModal
.
jobs
)
{
this
.
currentCheckedFilters
=
this
.
employerFilterChecked
;
}
else
if
(
this
.
modalType
===
TypeModal
.
employers
)
{
this
.
currentCheckedFilters
=
this
.
jobFilterChecked
;
}
this
.
fetchResults
.
emit
(
this
.
currentCheckedFilters
);
}
}
public
onSubmitFilters
():
void
{
public
onSubmitFilters
():
void
{
this
.
checkedFilters
=
this
.
currentCheckedFilters
;
this
.
fetchResults
.
emit
(
this
.
currentCheckedFilters
);
this
.
emitModules
(
this
.
currentCheckedFilters
);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/app/annuaire/search-bar/search-bar.component.html
+
3
−
1
View file @
f7a1cb27
...
@@ -57,8 +57,10 @@
...
@@ -57,8 +57,10 @@
<app-filter-modal
<app-filter-modal
[modalType]=
"modalTypeOpened"
[modalType]=
"modalTypeOpened"
[checkedFilters]=
"searchService.checkedFilterList"
[checkedFilters]=
"searchService.checkedFilterList"
[employerFilterChecked]=
"employerFilterChecked"
[jobFilterChecked]=
"jobFilterChecked"
[filtersTypes]=
"getModalCategory()"
[filtersTypes]=
"getModalCategory()"
(
searchEvent
)=
"fetchResults($event)"
(
fetchResults
)=
"fetchResults($event)"
(closeEvent)=
"closeModal()"
(closeEvent)=
"closeModal()"
/>
/>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment