Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(admin): fix export in admin #3616

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading