Skip to content

Commit

Permalink
fix(profil): add link to check user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Oct 26, 2023
1 parent 68ef6f3 commit 3c3ea15
Show file tree
Hide file tree
Showing 19 changed files with 148 additions and 175 deletions.
1 change: 0 additions & 1 deletion packages/frontend/src/_common/model/usager/Usager.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@ export type Usager = AppEntity & {
// Variables de front
echeanceInfos?: UsagerEcheanceInfos;
rdvInfos?: UsagerRdvInfos;
usagerProfilUrl?: string;
nbNotes?: number;
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export type UsagerLight = AppEntity &
| "langue"
| "contactByPhone"
| "import"
| "usagerProfilUrl"
| "echeanceInfos"
| "rdvInfos"
| "pinnedNote"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { NgbModal, NgbModalRef } from "@ng-bootstrap/ng-bootstrap";

import {
DEFAULT_MODAL_OPTIONS,
ETAPES_DEMANDE_URL,
UserStructure,
} from "../../../../../_common/model";
import { fadeInOut } from "../../../../shared";
Expand All @@ -24,6 +25,7 @@ import {
} from "../usager-filter";
import { Router } from "@angular/router";
import { AuthService } from "../../../shared/services";
import { getUrlUsagerProfil } from "../../../usager-shared/utils";

@Component({
animations: [fadeInOut],
Expand Down Expand Up @@ -59,6 +61,7 @@ export class ManageUsagersTableComponent implements OnDestroy {
}>();
public me!: UserStructure | null;
private subscription = new Subscription();
public readonly ETAPES_DEMANDE_URL = ETAPES_DEMANDE_URL;

constructor(
private readonly modalService: NgbModal,
Expand All @@ -85,7 +88,7 @@ export class ManageUsagersTableComponent implements OnDestroy {
}

public goToProfil(usager: UsagerFormModel): void {
this.router.navigate([usager.usagerProfilUrl]);
this.router.navigate([getUrlUsagerProfil(usager)]);
}

public refTrackBy(_index: number, item: UsagerFormModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,13 @@
>
</td>
<td class="clickable table-name td-name">
<a [routerLink]="usager.usagerProfilUrl" ariaCurrentWhenActive="page">
<a
[routerLink]="
usager.decision.statut === 'INSTRUCTION' || usager.decision.statut === 'ATTENTE_DECISION'
? '/usager/'+usager.ref+'/edit/'+ETAPES_DEMANDE_URL[usager.etapeDemande]
: '/profil/general/'+usager.ref"
ariaCurrentWhenActive="page"
>
<span class="visually-hidden">Consulter la fiche de </span>
<span>{{ usager.nom | uppercase }} {{ usager.prenom }}</span>
<span *ngIf="usager.surnom && usager.surnom !== null">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ export class StepDecisionComponent
public setDecisionAttente() {
this.subscription.add(
this.usagerDecisionService
.setDecision(this.usager.ref, { statut: "ATTENTE_DECISION" })
.setDecision(this.usager.ref, { statut: "ATTENTE_DECISION" }, true)
.subscribe({
next: () => {
this.toastService.success("Décision enregistrée avec succès ! ");
this.toastService.success("Décision enregistrée avec succès !");
},
error: () => {
this.toastService.error("La décision n'a pas pu être enregistrée");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,5 @@ <h2 class="form-title">Pièces justificatives complétant le dossier</h2>
</div>

<app-step-footer [usager]="usager"></app-step-footer>

<app-delete-usager-menu
context="PROFIL"
[me]="me"
[usager]="usager"
></app-delete-usager-menu>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,4 @@
</div>

<app-step-footer [usager]="usager"></app-step-footer>

<app-delete-usager-menu
context="PROFIL"
[me]="me"
[usager]="usager"
></app-delete-usager-menu>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -729,11 +729,4 @@ <h2 class="form-title">État civil du demandeur</h2>
</div>

<app-step-footer *ngIf="usager" [usager]="usager"></app-step-footer>

<app-delete-usager-menu
*ngIf="usager"
[me]="me"
[usager]="usager"
class="my-4"
></app-delete-usager-menu>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ <h2 class="form-title">Commentaires privés</h2>
<app-profil-general-notes [usager]="usager"></app-profil-general-notes>
</div>
</div>

<app-delete-usager-menu
*ngIf="usager"
class="my-4"
[usager]="usager"
[context]="'INSTRUCTION_FORM'"
></app-delete-usager-menu>
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,30 @@ <h1 class="m-0">
</h1>
</div>

<a
aria-label="Naviguer vers les commentaires privés"
ariaCurrentWhenActive="page"
[routerLink]="currentUrl"
class="btn btn-white-primary my-2 my-md-0 mx-auto mx-md-0 d-flex align-items-center"
*ngIf="usager.uuid"
fragment="notes"
>
<div class="icon-note me-2"></div>
Commentaires privés
<div class="notif-notes ms-2">
{{ nbNotes }}
</div>
</a>
<div class="px-0 mx-0 d-block d-md-flex align-items-center">
<a
ariaCurrentWhenActive="page"
[routerLink]="['/profil/general', usager.ref]"
class="btn btn-white-primary my-2 my-md-0 mx-auto mx-md-1"
*ngIf="usager.uuid"
>
Voir le dossier complet
</a>
<a
aria-label="Naviguer vers les commentaires privés"
ariaCurrentWhenActive="page"
[routerLink]="currentUrl"
class="btn btn-white-primary my-2 my-md-0 mx-auto mx-md-1 d-flex align-items-center"
*ngIf="usager.uuid"
fragment="notes"
>
<div class="icon-note me-2"></div>
Commentaires privés
<div class="notif-notes ms-2">
{{ nbNotes }}
</div>
</a>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,5 @@ <h2 class="form-title">
</form>

<app-step-footer [usager]="usager"></app-step-footer>

<app-delete-usager-menu
[usager]="usager"
context="PROFIL"
[me]="me"
></app-delete-usager-menu>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,98 +1,77 @@
<ng-container *ngIf="me && usager && isAdmin">
<div class="container py-5" *ngIf="context === 'PROFIL'">
<div class="d-print-none col-md-12 text-center text-danger">
<ng-container
*ngIf="usager.decision.statut === 'INSTRUCTION' && usager.ref"
>
<!-- Si c'est une première demande, on supprime le dossier -->
<button
class="btn btn-danger"
type="button"
*ngIf="!isFirstInstruction"
(click)="open(deleteDecisionConfirmation)"
>
<fa-icon
[icon]="['fas', 'trash']"
aria-hidden="true"
class="me-2"
></fa-icon>
Supprimer cette demande
</button>

<!-- Si ce n'est pas une première demande, on supprime simplement la demande -->
<button
type="button"
class="btn btn-danger"
*ngIf="isFirstInstruction"
(click)="open(deleteConfirmation)"
>
<fa-icon
[icon]="['fas', 'trash']"
aria-hidden="true"
class="me-2"
></fa-icon>
Supprimer cette demande
</button>
</ng-container>

<ng-container
*ngIf="
usager.decision.statut !== 'INSTRUCTION' &&
usager.decision.statut !== 'ATTENTE_DECISION'
"
>
<button
type="button"
class="btn btn-danger"
(click)="open(deleteConfirmation)"
>
<fa-icon
[icon]="['fas', 'trash']"
aria-hidden="true"
class="me-2"
></fa-icon>
Supprimer ce domicilié
</button>
</ng-container>
</div>
<div
class="container py-5"
*ngIf="context === 'PROFIL' || context === 'INSTRUCTION_FORM'"
>
<div
class="d-print-none col-md-12 text-center text-danger"
*ngIf="context === 'PROFIL'"
>
<button
type="button"
class="btn btn-danger"
(click)="open(deleteConfirmation)"
>
<fa-icon
[icon]="['fas', 'trash']"
aria-hidden="true"
class="me-2"
></fa-icon>
Supprimer ce dossier
</button>
</div>

<ng-container *ngIf="context === 'HISTORY' && usager.historique.length > 1">
<div
class="d-print-none col-md-12 text-center text-danger"
*ngIf="context === 'INSTRUCTION_FORM'"
>
<button
class="btn btn-danger"
type="button"
aria-label="Supprimer la dernière décision"
(click)="open(deleteDecisionConfirmation)"
(click)="
usager.historique.length > 1
? open(deleteDecisionConfirmation)
: open(deleteConfirmation)
"
>
<fa-icon [icon]="['fas', 'trash']" aria-hidden="true"></fa-icon>
<fa-icon
[icon]="['fas', 'trash']"
aria-hidden="true"
class="me-2"
></fa-icon>
Supprimer cette demande
</button>
</ng-container>
</div>
</div>

<ng-container *ngIf="context === 'HISTORY' && usager.historique.length > 1">
<button
class="btn btn-danger"
type="button"
aria-label="Supprimer la dernière décision"
(click)="open(deleteDecisionConfirmation)"
>
<fa-icon [icon]="['fas', 'trash']" aria-hidden="true"></fa-icon>
</button>
</ng-container>

<ng-template #deleteDecisionConfirmation let-modal>
<div class="modal-header bg-danger">
<span *ngIf="context === 'HISTORY'" class="text-white" id="modal-title"
<span class="text-white" id="modal-title"
>Êtes-vous sûr de vouloir supprimer cette décision ?</span
>
<span *ngIf="context === 'PROFIL'" class="text-white" id="modal-title"
>Attention !</span
>
</div>
<p class="modal-body py-3 text-center" *ngIf="context === 'HISTORY'">
Les statistiques seront mises à jour, une note sera ajoutée au dossier et
l'usager retournera à son statut précédent :
<strong>{{ previousStatus }}</strong>
</p>
<p class="modal-body py-3 text-center" *ngIf="context === 'PROFIL'">
Une demande de domiciliation a été créée le <br />
<strong
>{{ usager.decision.dateDecision | date : "d MMMM y à HH:mm" }} par
<p class="modal-body py-3 text-center">
Vous êtes sur le point de supprimer la décision suivante:<br />

<strong>
{{ DECISION_LABELS[usager.decision.statut] }} le
{{ usager.decision.dateDecision | date : "d MMMM y à HH:mm" }} par
{{ usager.decision.userName }}.</strong
>
<br />
<br />
Si vous confirmer la suppression de cette demande, l'usager retrouvera son
précédent statut :
Les statistiques seront mises à jour, une note sera ajoutée au dossier et
l'usager retournera à son statut précédent:
<strong>{{ previousStatus }}</strong>
<br />
</p>
Expand Down Expand Up @@ -128,6 +107,6 @@
<ng-template #deleteConfirmation let-modal>
<app-delete-usager
[selectedRefs]="[usager.ref]"
[me]="me"
[context]="'PROFIL'"
></app-delete-usager>
</ng-template>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { USER_STRUCTURE_MOCK } from "./../../../../../_common/mocks/USER_STRUCTURE.mock";
import { USAGER_ACTIF_MOCK } from "./../../../../../_common/mocks/USAGER_ACTIF.mock";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { NO_ERRORS_SCHEMA } from "@angular/core";
Expand Down Expand Up @@ -34,7 +33,6 @@ describe("DeleteUsagerMenuComponent", () => {
fixture = TestBed.createComponent(DeleteUsagerMenuComponent);
component = fixture.debugElement.componentInstance;
component.usager = new UsagerFormModel(USAGER_ACTIF_MOCK);
component.me = USER_STRUCTURE_MOCK;
component.ngOnInit();
});

Expand Down
Loading

0 comments on commit 3c3ea15

Please sign in to comment.