Skip to content
Snippets Groups Projects
Commit f7e39ada authored by Marlène SIMONDANT's avatar Marlène SIMONDANT
Browse files
parents 10d805a5 10e23605
No related branches found
No related tags found
2 merge requests!635V2.5.0,!622V2.5.0
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ColDef, CsvExportParams, GridApi, GridReadyEvent } from 'ag-grid-community'; import { ColDef, CsvExportParams, GridApi, GridReadyEvent, ProcessCellForExportParams } from 'ag-grid-community';
import { Employer } from '../../../models/employer.model'; import { Employer } from '../../../models/employer.model';
import { Job } from '../../../models/job.model'; import { Job } from '../../../models/job.model';
import { Structure } from '../../../models/structure.model';
import { User } from '../../../models/user.model'; import { User } from '../../../models/user.model';
import { NotificationService } from '../../../services/notification.service'; import { NotificationService } from '../../../services/notification.service';
import { ButtonType } from '../../../shared/components/button/buttonType.enum'; import { ButtonType } from '../../../shared/components/button/buttonType.enum';
...@@ -85,6 +86,7 @@ export class ManageUsersComponent { ...@@ -85,6 +86,7 @@ export class ManageUsersComponent {
structures: 'structures', structures: 'structures',
}, },
minWidth: 350, minWidth: 350,
field: 'structures',
}, },
{ {
headerName: 'Fonction', headerName: 'Fonction',
...@@ -338,19 +340,51 @@ export class ManageUsersComponent { ...@@ -338,19 +340,51 @@ export class ManageUsersComponent {
} }
public exportUsers(status: UsersStatus): void { public exportUsers(status: UsersStatus): void {
const gridApi = status === 'attached' ? this.gridApiAttached : this.gridApiUnattached;
if (!gridApi) {
throw new Error('Grid API not found for the selected status.');
}
const exportParams: CsvExportParams = { const exportParams: CsvExportParams = {
columnKeys: ['name', 'surname', 'email'], columnKeys: ['name', 'surname', 'email', 'job', 'structures'],
processCellCallback: (params) => this.formatCells(params),
fileName: `RESIN - export utilisateurs ${status === 'attached' ? 'rattachés' : 'non rattachés'}`,
}; };
if (status === 'attached') {
this.gridApiAttached.exportDataAsCsv({ gridApi.exportDataAsCsv(exportParams);
...exportParams, }
fileName: 'RESIN - export utilisateurs rattachés',
}); private formatCells(params: ProcessCellForExportParams): string {
} else if (status === 'unattached') { const cellRenderer = params.column.getColDef().cellRenderer;
this.gridApiUnattached.exportDataAsCsv({
...exportParams, if (!cellRenderer) {
fileName: 'RESIN - export utilisateurs non rattachés', return this.formatRegularCell(params);
}); }
switch (cellRenderer) {
case 'jobRenderer':
return this.formatJobCell(params.value);
case 'administredStructuresComponent':
return this.formatStructureCell(params.value);
default:
return params.value;
}
}
private formatRegularCell(params: any): string {
return params?.value;
}
private formatJobCell(params: any): string {
return params?.name || '';
}
private formatStructureCell(params: any[]): string {
if (params?.length > 0) {
const structureNames = params.map((structure: Structure) => structure.structureName);
return structureNames.join(', ');
} }
return '';
} }
} }
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
</svg> </svg>
</div> </div>
<div *ngIf="authFailed" class="incorrectId">Identifiant ou mot de passe invalide</div> <div *ngIf="authFailed" class="incorrectId">Identifiant ou mot de passe invalide</div>
<div *ngIf="isUnverifiedEmail" class="incorrectId"> <div *ngIf="isUnverifiedEmail">
Votre email n'a jamais été validé. <div class="incorrectId">Votre adresse email n’a jamais été validée</div>
<a tabindex="0" (click)="resendConfirmationEmail()" (keyup.enter)="resendConfirmationEmail()" <p class="resendEmail">
>Renvoyer l'email de confirmation</a <a tabindex="0" (click)="resendConfirmationEmail()" (keyup.enter)="resendConfirmationEmail()"
> >Renvoyer l'email de confirmation</a
>
</p>
</div> </div>
</div> </div>
<div class="form-group password" fxLayout="column"> <div class="form-group password" fxLayout="column">
......
...@@ -50,6 +50,13 @@ ...@@ -50,6 +50,13 @@
@include lato-regular-14; @include lato-regular-14;
color: $orange-warning; color: $orange-warning;
} }
.resendEmail {
margin: 0;
a {
@include lato-bold-14;
text-decoration: underline;
}
}
.form-group { .form-group {
margin: 1.5rem 0; margin: 1.5rem 0;
......
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