Skip to content

Commit

Permalink
fix(admin): fix export in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Jan 9, 2025
1 parent 14da8a2 commit f181905
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function renderWorksheet({
{ key: "importDate" },
{ key: "usersCount" },
{ key: "usagersAllCount" },
{ key: "actifs" },
{ key: "lastLogin" },
{ key: "codePostal" },
{ key: "ville" },
Expand Down Expand Up @@ -69,6 +70,7 @@ function buildRows(structures: StructureAdminForList[]): XlRowModel[] {
importDate: xlFormater.toLocalTimezone(structure.importDate),
usersCount: structure.users,
usagersAllCount: structure.usagers ?? 0,
actifs: structure.actifs ?? 0,
lastLogin: xlFormater.toLocalTimezone(structure.lastLogin),
codePostal: structure.codePostal,
ville: structure.ville.toUpperCase().trim(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import { StructureAdmin } from "./StructureAdmin.type";
export type StructureAdminForList = StructureAdmin & {
users: number;
usagers: number;
actifs: number;
};
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export class AdminStructuresListComponent
);

this.setupIntersectionObserver();
this.filters$.next(this.filters);
this.searchInput.nativeElement.value = this.filters.searchString;
}

private setupIntersectionObserver(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ function sortBy(
return structures;
}

if (["id", "users", "actifs", "usagers"].includes(sortKey)) {
return structures.sort((a, b) => {
const valueA = a[sortKey as keyof StructureAdmin] as number;
const valueB = b[sortKey as keyof StructureAdmin] as number;
return sortNumeric(valueA, valueB, asc);
});
}

return sortMultiple(structures, asc, (structure) => {
const sortAttributes: SortableValue[] = [];

Expand All @@ -32,11 +40,13 @@ function sortBy(
) {
value = normalizeString(value as string);
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
sortAttributes.push(value as any);
sortAttributes.push(normalizeString(structure.nom));

sortAttributes.push(structure.nom);
return sortAttributes;
});
}

export const sortNumeric = (a: number, b: number, asc: boolean): number => {
return asc ? a - b : b - a;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ <h2 class="section-title">Votre domiciliation</h2>
<div class="py-2">
<div
class="alert alert-info"
*ngIf="usager.decision.statut === 'INSTRUCTION' && rdvInfo.display"
*ngIf="usager.decision.statut === 'INSTRUCTION' && rdvInfo.content"
>
<div aria-hidden="true" class="svg-icon icon-calendar"></div>
<p>
Expand Down

0 comments on commit f181905

Please sign in to comment.