Skip to content
Snippets Groups Projects
Commit 5ae89245 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

feat(pin-structures): pin already selected structures in search

parent ce2cd3ea
No related branches found
No related tags found
4 merge requests!418V2.1.0,!400V2.0,!276sort structures,!230V2.0
This diff is collapsed.
...@@ -72,15 +72,19 @@ export class ProfileStructureChoiceComponent implements OnInit { ...@@ -72,15 +72,19 @@ export class ProfileStructureChoiceComponent implements OnInit {
structure.alreadySelected = true; structure.alreadySelected = true;
} }
}); });
if (this.searchString === '') {
structures.sort((a, b) => a.structureName.localeCompare(b.structureName)); this.structures = this.sortStructures(structures);
}
this.structures = structures;
this.isAlreadySearching = false; this.isAlreadySearching = false;
}); });
} }
} }
private sortStructures(structures: Structure[]) {
if (this.searchString === '') structures.sort((a, b) => a.structureName.localeCompare(b.structureName));
structures.sort((a, b) => Number(b.alreadySelected) - Number(a.alreadySelected));
return structures;
}
public addStructure(): void { public addStructure(): void {
this.createStructure.emit(this.searchString); this.createStructure.emit(this.searchString);
} }
......
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