Skip to content
Snippets Groups Projects
Commit 7fc68258 authored by Jérémie BRISON's avatar Jérémie BRISON
Browse files

refacto(structure) : change model of structure

parent c500eb4d
No related branches found
No related tags found
3 merge requests!68Recette,!67Dev,!37Fix model structure and fix equipments in details
......@@ -30,14 +30,13 @@ export class Structure {
public accompagnementDesDemarches: string[];
public modalitesDacces: string[];
public labelsEtQualifications: string[];
public wifi: boolean;
public ordinateurs: boolean;
public nombre: number;
public ordinateurs: number;
public hours: Week;
public isOpen: boolean;
public openedOn: OpeningDay;
public lesCompetencesDeBase: string[];
public accesAuxDroits: string[];
public equipementsEtServicesProposes: string[];
public distance?: number;
public address?: string;
public coord?: number[];
......@@ -83,7 +82,7 @@ export class Structure {
* Check if a structure has equipments
*/
public hasEquipments(): boolean {
if (this.wifi || this.ordinateurs) {
if (this.equipementsEtServicesProposes) {
return true;
}
return false;
......
......@@ -15,17 +15,9 @@
<label>
<input
type="checkbox"
[checked]="
c.name !== 'Équipements et services proposés'
? searchService.getIndex(checkedModules, module.id, c.name) > -1
: searchService.getIndex(checkedModules, 'True', module.id) > -1
"
[checked]="searchService.getIndex(checkedModules, module.id, c.name) > -1"
[value]="module.id"
(change)="
c.name !== 'Équipements et services proposés'
? onCheckboxChange($event, c.name, false)
: onCheckboxChange($event, module.id, true)
"
(change)="onCheckboxChange($event, c.name)"
/>
<span class="customCheck"></span>
<div class="label">{{ module.text }}</div>
......
......@@ -31,8 +31,8 @@ export class ModalFilterComponent implements OnInit {
}
// Management of the checkbox event (Check / Uncheck)
public onCheckboxChange(event, categ: string, isSpecial: boolean): void {
const checkValue: string = isSpecial ? 'True' : event.target.value;
public onCheckboxChange(event, categ: string): void {
const checkValue: string = event.target.value;
if (event.target.checked) {
this.checkedModules.push(new Module(checkValue, categ));
} else {
......
......@@ -68,7 +68,7 @@ export class SearchComponent implements OnInit {
}
// Add checked box filter
this.checkedModulesFilter.forEach((cm) => {
filters.push(new Filter(this.fromStringToIdExcel(cm.text), this.mockApiNumber(cm.id)));
filters.push(new Filter(this.fromStringToId(cm.text), this.mockApiNumber(cm.id)));
});
// Send filters
this.searchEvent.emit(filters);
......@@ -139,7 +139,7 @@ export class SearchComponent implements OnInit {
this.modalTypeOpened = undefined;
}
private fromStringToIdExcel(categ: string): string {
private fromStringToId(categ: string): string {
const splitStr = categ.toLowerCase().split(' ');
for (let i = 1; i < splitStr.length; i++) {
splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment