Skip to content

Commit

Permalink
fix(frontend): fix head of columns
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Dec 12, 2024
1 parent 69bdb3a commit 79408fc
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
DOMIFA_MAIL_SMTP_TIPIMAIL_USER: >-
AgBwRj3Ov5/EEjSftwT8Do2OckqU7bgsEuKAJjd0kyQcFM9Z7bm/XZWtFS7AOOvcdFtOI52pP4bdTNys3lct8izsqh9zKtyBeIKzqw9v+9YKbsa7TXCdL301WkFF0lMO50Y3cxCvHS8k4dNeXnCoh5ramAf/xvCQt3L+6z2aQpQNanfhjKb5ogbXKj1cvvi91VRuzruGlOPs2EZsvwDAFAYwr5VNSBVIxwL8tmmuGtBKAEff+dDjBUuBoE64VVJ66Cg7yGF/S7xmZ2mQGVBfJ22uOYckE6Bd/u1vgn/PjinCI0E8ckxvkol1VpdGRcuWndutwB3g9Ed0CnoQykaufKg6L2seKBfH+ES0DxQunnd3WHev1EAUSRv90u1QnXH53TAqonmTM+blxPfWjzDwxZG2sHSWql/M5E9FtCP0Fz09JJeDzDnIpSQaPfv09nlF27gNDufVxGv6zG7MpKjG5lGz3F2z1L4dXbH2VECbjScfcIPlopq+Nr9JISTOwSDkRBo/kUEFYSFsxkAX+fpg34GWoyOVrY20WyNz7inJvzR29WxNV13HafeuJYoATpbYX/h176pjscWf6zDhDZyzrMu2SxEa/eQb3h4gQt31IQEvEpN/8UIh0FDD0WBi9cF5lF6eckie2UfXyUV2C1ShWYs2OXWho4wYXxTdctyuD9kllE9kCVsdUO19CeZ5iNfz4hStG4Y0249pGILEg3GIAsWX6mE7+lZvU9AusBYTcJNMxA==
DOMIFA_MAIL_SMTP_TIPIMAIL_PASSWORD: >-
AgAm/c7nOXUnuTNr2UZp1GDwF1eXMgFKrFe1VWPJYHLQ8NctuAT19B55Qw0VHwYmOVD8wW4OHo+SK9pZPNw4TN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5wOWrZgXq2bJbU3MPy8ND2hoVHXTJZCRCNAgE+S4obwKfZ8Fl0AI7qclSKfYfA==
DOMIFA_TIPIMAIL_FROM_EMAIL: >-
Expand Down
26 changes: 14 additions & 12 deletions packages/backend/src/usagers/controllers/usagers.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,36 @@ export class UsagersController {
@Body() search: SearchUsagerDto,
@CurrentUser() user: UserStructureAuthenticated
) {
console.log({ x: normalizeString(search.searchString) });
const query = usagerRepository
.createQueryBuilder("usager")
.select(joinSelectFields(USAGER_LIGHT_ATTRIBUTES))
.where(`"structureId" = :structureId and statut = 'RADIE'`, {
structureId: user.structureId,
});

if (search.searchString && search.searchStringField === "DEFAULT") {
const searchString = normalizeString(search?.searchString).trim();

if (searchString && search.searchStringField === "DEFAULT") {
query.andWhere("nom_prenom_surnom_ref ILIKE :str", {
str: `%${normalizeString(search.searchString)}%`,
str: `%${searchString}%`,
});
}
} else if (searchString && search.searchStringField === "DATE_NAISSANCE") {
const parsedDate = parse(
searchString.replace(/\D/g, ""),
"ddMMyyyy",
new Date()
);

if (search.searchString && search.searchStringField === "DATE_NAISSANCE") {
const parsedDate = parse(search.searchString, "dd MM yyyy", new Date());
if (!isValid(parsedDate)) {
console.log({ searchString });

throw new BadRequestException(
'Format de date invalide. Utilisez le format "dd MM yyyy"'
);
}

query.andWhere(`DATE("dateNaissance") = DATE(:date)`, {
date: new Date(search.searchString),
date: parsedDate,
});
}

Expand Down Expand Up @@ -220,11 +226,7 @@ export class UsagersController {
}
}

if (
!search?.searchString &&
!search?.echeance &&
!search?.lastInteractionDate
) {
if (!searchString && !search?.echeance && !search?.lastInteractionDate) {
query.take(100);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ <h1 class="col-md-2 col-6 title text-start order-1 order-md-1">
[usagers]="usagers"
[selectAllCheckboxes]="selectAllCheckboxes"
[filters]="filters"
[filters$]="filters$"
(updateFilters)="updateFilters($event)"
(goToPrint)="goToPrint()"
></app-manage-manage-usagers-table>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Subscription } from "rxjs";
import { Subject, Subscription, takeUntil } from "rxjs";
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
TemplateRef,
ViewChild,
Expand Down Expand Up @@ -36,12 +38,14 @@ import {
styleUrls: ["./manage-usagers-table.scss"],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ManageUsagersTableComponent implements OnDestroy {
export class ManageUsagersTableComponent implements OnInit, OnDestroy {
@Input({ required: true })
public usagers!: UsagerFormModel[];
private destroy$ = new Subject<void>();

@Input({ required: true })
public filters!: UsagersFilterCriteria;
@Input({ required: true }) filters$!: Subject<UsagersFilterCriteria>;

@Input({ required: true })
public selectAllCheckboxes = false;
Expand All @@ -64,6 +68,9 @@ export class ManageUsagersTableComponent implements OnDestroy {

public me!: UserStructure | null;
private subscription = new Subscription();
public showCheckboxes = false;
public currentFilters!: UsagersFilterCriteria;

public loading = false;
public readonly ETAPES_DEMANDE_URL = ETAPES_DEMANDE_URL;

Expand All @@ -79,13 +86,42 @@ export class ManageUsagersTableComponent implements OnDestroy {
constructor(
private readonly modalService: NgbModal,
private readonly router: Router,
private readonly authService: AuthService
private readonly authService: AuthService,
private readonly cd: ChangeDetectorRef
) {
this.me = this.authService.currentUserValue;
this.usagers = [];
this.selectedRefs.clear();
}

ngOnInit() {
this.filters$.pipe(takeUntil(this.destroy$)).subscribe((filters) => {
this.currentFilters = filters;
this.computeCheckboxVisibility();
this.cd.markForCheck();
});
}

private computeCheckboxVisibility() {
if (this.me.role === "admin" || this.me.role === "responsable") {
this.showCheckboxes = true;
return;
}

if (this.me.role === "facteur") {
this.showCheckboxes = false;
return;
}

if (this.me.role === "simple") {
this.showCheckboxes = this.currentFilters.statut === "VALIDE";
return;
}

this.showCheckboxes = false;

this.cd.markForCheck();
}
public toggleSelection(id: number) {
if (!this.selectedRefs.size) {
this.selectAllCheckboxes = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@
peuvent disposent de boutons pour trier les colonnes
</caption>
<thead>
<th
scope="col"
role="columnheader"
*ngIf='!(me?.role === "facteur" || (me?.role === "simple" && filters.statut === "VALIDE"))'
>
<th scope="col" role="columnheader" *ngIf="showCheckboxes">
<span class="visually-hidden"
>Colonne de sélection des dossiers les supprimer ou les radier</span
>
Expand All @@ -96,6 +92,7 @@
<th scope="col" role="columnheader">
<button
type="button"
[ngClass]="filters.sortKey === 'ID' ? 'fw-bold text-primary' : ''"
[attr.aria-sort]="filters.sortKey ==='ID' ? ARIA_SORT[filters.sortValue] : 'none'"
(click)="updateFilters.emit({ element: 'sortKey', value: 'ID'})"
>
Expand All @@ -112,6 +109,7 @@
<th scope="col">
<button
type="button"
[ngClass]="filters.sortKey === 'NOM' ? 'fw-bold text-primary' : ''"
[attr.aria-sort]="filters.sortKey ==='NOM' ? ARIA_SORT[filters.sortValue] : 'none'"
(click)="updateFilters.emit({ element: 'sortKey', value: 'NOM' })"
>
Expand Down Expand Up @@ -147,7 +145,6 @@
>
<span class="visually-hidden">Trier par</span>
<span>PASSAGE</span>

<app-table-head-sort-icon
[sortKey]="filters.sortKey"
[sortValue]="filters.sortValue"
Expand All @@ -170,14 +167,18 @@
(click)="updateFilters.emit({element: 'sortKey', value: 'ECHEANCE'})"
>
<span class="visually-hidden">Trier par</span>
<ng-container
*ngIf="filters.statut !== 'REFUS' && filters.statut !== 'RADIE'"
>ÉCHÉANCE</ng-container
>
<ng-container *ngIf="filters.statut === 'REFUS'"
>REFUSÉ LE</ng-container
>
<ng-container *ngIf="filters.statut === 'RADIE'">RADIÉ LE</ng-container>
<span>
<ng-container
*ngIf="filters.statut !== 'REFUS' && filters.statut !== 'RADIE'"
>ÉCHÉANCE</ng-container
>
<ng-container *ngIf="filters.statut === 'REFUS'"
>REFUSÉ LE</ng-container
>
<ng-container *ngIf="filters.statut === 'RADIE'"
>RADIÉ LE</ng-container
>
</span>
<app-table-head-sort-icon
[sortKey]="filters.sortKey"
[sortValue]="filters.sortValue"
Expand All @@ -193,10 +194,7 @@
</thead>
<tbody>
<tr *ngFor="let usager of usagers; let i = index; trackBy: refTrackBy">
<td
class="text-start p-0 m-0"
*ngIf='!( me?.role === "facteur" || (me?.role === "simple" && filters.statut !== "VALIDE"))'
>
<td class="text-start p-0 m-0" *ngIf="showCheckboxes">
<label
for="select-{{ usager.ref }}"
(change)="toggleSelection(usager.ref)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,26 @@
padding: 0 0.2rem;
height: 62px;
font-size: 0.95rem;
}

tbody td span {
vertical-align: middle;
}

tbody td a {
width: 100%;
height: 100%;
text-decoration: none;
display: flex;
align-items: center;
color: black;
label {
height: 100%;
width: 100%;
padding: 1.3rem 0.5rem;
margin: 0;
text-align: center;
background-color: transparent;
}
span {
vertical-align: middle;
}
a {
width: 100%;
height: 100%;
text-decoration: none;
display: flex;
align-items: center;
color: black;
}
}

tbody td a:hover,
Expand Down Expand Up @@ -57,6 +64,7 @@
tbody td:first-child {
border-radius: 2px 0 0 2px;
padding: 0 0.5rem;
text-align: center;
}

tbody td:last-child {
Expand All @@ -80,31 +88,35 @@
box-shadow: 2px 1px 4px rgba(179, 179, 179, 0.5);
}

thead th .btn {
padding: 0.25rem 0.5rem;
}

thead th button:not(.btn) {
font-size: 0.95rem;
padding: 0;
color: #3150c0;
text-transform: uppercase;
border: none;
font-weight: 600;
vertical-align: middle;
background-color: transparent !important;
}

thead th {
font-style: normal;
font-weight: 600;
font-size: 0.95rem;
font-size: 1rem;
color: #3150c0;
padding: 0.2rem;
padding: 0.7rem 0;
text-transform: uppercase;
border: none;
transition: all 0.2s ease;
vertical-align: middle;
vertical-align: bottom;
label {
padding: 0;
text-align: center;
width: 100%;
vertical-align: bottom;
margin: 0;
background-color: transparent;
}
button {
padding: 0;
color: #3150c0;
text-transform: uppercase;
border: none;
background-color: transparent !important;

* {
vertical-align: bottom;
}
}
}

.table-name img {
Expand Down Expand Up @@ -152,15 +164,6 @@
font-weight: bold;
}

label {
height: 100%;
width: 100%;
padding: 1.3rem 0.5rem;
margin: 0;
text-align: center;
background-color: transparent;
}

.is-sticky {
position: fixed;
top: 0;
Expand Down

0 comments on commit 79408fc

Please sign in to comment.