Skip to content

Commit

Permalink
feat(history): create a new history page
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Oct 31, 2023
1 parent b378d2d commit 00ed95b
Show file tree
Hide file tree
Showing 48 changed files with 449 additions and 343 deletions.
Binary file modified _scripts/db/dumps/domifa_test.postgres.custom.gz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<h3>Historique des notes</h3>

<div class="table-responsive">
<table *ngIf="notes.length > 0" class="table table-hover">
<caption class="visually-hidden">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { RouterTestingModule } from "@angular/router/testing";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";

import { USAGER_ACTIF_MOCK } from "../../../../../_common/mocks/USAGER_ACTIF.mock";
import { SharedModule } from "../../../shared/shared.module";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { USAGER_ACTIF_MOCK } from "../../../../../../_common/mocks/USAGER_ACTIF.mock";
import { SharedModule } from "../../../../shared/shared.module";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";

import { ProfilEditPortailUsagerPreferenceComponent } from "./profil-edit-portail-usager-preference.component";
import { StoreModule } from "@ngrx/store";
import { _usagerReducer } from "../../../../shared";
import { _usagerReducer } from "../../../../../shared";

describe("ProfilEditPortailUsagerPreferenceComponent", () => {
let component: ProfilEditPortailUsagerPreferenceComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { CustomToastService } from "src/app/modules/shared/services/custom-toast
import {
StructureDocTypesAvailable,
UserStructure,
} from "../../../../../_common/model";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { DocumentService } from "../../../usager-shared/services/document.service";
import { UsagerProfilService } from "../../services/usager-profil.service";
} from "../../../../../../_common/model";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { DocumentService } from "../../../../usager-shared/services/document.service";
import { UsagerProfilService } from "../../../services/usager-profil.service";

@Component({
selector: "app-profil-edit-portail-usager-preference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { RouterTestingModule } from "@angular/router/testing";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";

import { USAGER_ACTIF_MOCK } from "../../../../../_common/mocks/USAGER_ACTIF.mock";
import { MATOMO_INJECTORS, _usagerReducer } from "../../../../shared";
import { NotFoundComponent } from "../../../general/components/errors/not-found/not-found.component";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { USAGER_ACTIF_MOCK } from "../../../../../../_common/mocks/USAGER_ACTIF.mock";
import { MATOMO_INJECTORS, _usagerReducer } from "../../../../../shared";
import { NotFoundComponent } from "../../../../general/components/errors/not-found/not-found.component";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { UsagersProfilProcurationCourrierComponent } from "./profil-procuration-courrier-component";
import { StoreModule } from "@ngrx/store";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ import { NgbDateCustomParserFormatter } from "src/app/modules/shared/services/da
import {
UserStructure,
DEFAULT_MODAL_OPTIONS,
} from "../../../../../_common/model";
} from "../../../../../../_common/model";
import {
endDateAfterBeginDateValidator,
NoWhiteSpaceValidator,
} from "../../../../shared";
} from "../../../../../shared";
import {
minDateToday,
minDateNaissance,
formatDateToNgb,
} from "../../../../shared/bootstrap-util";
} from "../../../../../shared/bootstrap-util";

import { CustomDatepickerI18n } from "../../../shared/services/date-french.service";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { UsagerProcuration } from "../../../usager-shared/interfaces/UsagerProcuration.interface";
import { UsagerOptionsService } from "../../services/usager-options.service";
import { CustomDatepickerI18n } from "../../../../shared/services/date-french.service";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { UsagerProcuration } from "../../../../usager-shared/interfaces/UsagerProcuration.interface";
import { UsagerOptionsService } from "../../../services/usager-options.service";
import { UsagerOptionsProcuration } from "@domifa/common";
@Component({
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { RouterTestingModule } from "@angular/router/testing";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { USAGER_ACTIF_MOCK } from "../../../../../_common/mocks";
import { MATOMO_INJECTORS, _usagerReducer } from "../../../../shared";
import { USAGER_ACTIF_MOCK } from "../../../../../../_common/mocks";
import { MATOMO_INJECTORS, _usagerReducer } from "../../../../../shared";

import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";

import { UsagersProfilTransfertCourrierComponent } from "./profil-transfert-courrier-component";
import { StoreModule } from "@ngrx/store";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ import { Subscription } from "rxjs";
import {
DEFAULT_MODAL_OPTIONS,
UserStructure,
} from "../../../../../_common/model";
} from "../../../../../../_common/model";
import {
endDateAfterBeginDateValidator,
formatDateToNgb,
minDateToday,
NoWhiteSpaceValidator,
} from "../../../../shared";
} from "../../../../../shared";
import {
NgbDateCustomParserFormatter,
CustomDatepickerI18n,
CustomToastService,
} from "../../../shared/services";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { UsagerOptionsService } from "../../services/usager-options.service";
} from "../../../../shared/services";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { UsagerOptionsService } from "../../../services/usager-options.service";

@Component({
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ReactiveFormsModule, FormsModule } from "@angular/forms";
import { RouterTestingModule } from "@angular/router/testing";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";

import { SharedModule } from "../../../shared/shared.module";
import { SharedModule } from "../../../../shared/shared.module";

describe("ProfilStructureDocsComponent", () => {
let component: ProfilStructureDocsComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { UserStructure } from "./../../../../../_common/model/user-structure/UserStructure.type";
import { UserStructure } from "../../../../../../_common/model/user-structure/UserStructure.type";
import { Component, Input, OnDestroy, OnInit } from "@angular/core";
import { saveAs } from "file-saver";
import {
StructureDoc,
StructureDocTypesAvailable,
STRUCTURE_DOC_EXTENSIONS,
} from "../../../../../_common/model/structure-doc";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { DocumentService } from "../../../usager-shared/services/document.service";
import { CustomToastService } from "../../../shared/services/custom-toast.service";
} from "../../../../../../_common/model/structure-doc";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { DocumentService } from "../../../../usager-shared/services/document.service";
import { CustomToastService } from "../../../../shared/services/custom-toast.service";
import { Subscription } from "rxjs";

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing";
import { NO_ERRORS_SCHEMA } from "@angular/core";

import { DisplayEtatCivilComponent } from "./display-etat-civil.component";
import { SharedModule } from "../../../shared/shared.module";
import { SharedModule } from "../../../../shared/shared.module";

describe("DisplayEtatCivilComponent", () => {
let component: DisplayEtatCivilComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UsagerFormModel } from "./../../../usager-shared/interfaces/UsagerFormModel";
import { UsagerFormModel } from "../../../../usager-shared/interfaces/UsagerFormModel";
import { Component, Input, OnInit } from "@angular/core";
import { languagesAutocomplete } from "../../../../shared";
import { languagesAutocomplete } from "../../../../../shared";
import { LIEN_PARENTE_LABELS } from "@domifa/common";

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>
<div class="d-flex align-items-top">
<div>
<div class="number">
<div class="number d-print-none">
<div class="icon-courrier" [ngClass]="'icon-' + interaction.type"></div>
</div>
<div class="interaction-separator"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { USAGER_ACTIF_MOCK } from "./../../../../../_common/mocks/USAGER_ACTIF.mock";
import { USAGER_ACTIF_MOCK } from "../../../../../../_common/mocks/USAGER_ACTIF.mock";
import { APP_BASE_HREF } from "@angular/common";
import { HttpClientTestingModule } from "@angular/common/http/testing";
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
Expand All @@ -8,9 +8,9 @@ import { RouterTestingModule } from "@angular/router/testing";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";

import { ProfilGeneralHistoriqueCourriersComponent } from "./profil-general-historique-courriers.component";
import { UsagerFormModel } from "../../../usager-shared/interfaces";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { StoreModule } from "@ngrx/store";
import { _usagerReducer } from "../../../../shared";
import { _usagerReducer } from "../../../../../shared";

describe("ProfilGeneralHistoriqueCourriersComponent", () => {
let component: ProfilGeneralHistoriqueCourriersComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component, Input, OnDestroy, OnInit } from "@angular/core";
import { Subscription } from "rxjs";
import { UserStructure } from "../../../../../_common/model";
import { UserStructure } from "../../../../../../_common/model";

import {
UsagerFormModel,
Interaction,
} from "../../../usager-shared/interfaces";
} from "../../../../usager-shared/interfaces";

import { InteractionService } from "../../../usager-shared/services/interaction.service";
import { InteractionService } from "../../../../usager-shared/services/interaction.service";

@Component({
selector: "app-profil-general-historique-courriers",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
<div class="d-flex justify-content-between align-items-center">
<h2>Historique des courriers</h2>

<button
type="button"
class="btn btn-sm btn-primary d-print-none"
(click)="goToPrint()"
>
<fa-icon
[icon]="['fas', 'print']"
class="me-2"
aria-hidden="true"
></fa-icon>
Imprimer les courriers
</button>
</div>

<div *ngIf="interactions" class="table-responsive">
<div class="alert alert-info" *ngIf="interactions.length === 0">
<p>Aucune interaction enregistrée</p>
</div>
<table
id="interactions-table"
class="table table-hover"
*ngIf="interactions.length > 0"
>
<h3>Historique des courriers</h3>
<div *ngIf="interactions.length > 0" class="table-responsive">
<table class="table table-hover">
<caption class="visually-hidden">
Historique des courriers
</caption>
Expand Down Expand Up @@ -117,6 +94,9 @@ <h2>Historique des courriers</h2>
</tbody>
</table>
</div>
<div class="alert alert-info" *ngIf="interactions.length === 0">
<p>Aucune interaction enregistrée</p>
</div>

<ng-template #deleteInteractionModal let-modal>
<div class="modal-header bg-danger">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ export class ProfilHistoriqueCourriersComponent implements OnInit, OnDestroy {
this.modalService.dismissAll();
}

public goToPrint(): void {
window.print();
}
public ngOnDestroy(): void {
this.subscription.unsubscribe();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<h3>Historique des décisions</h3>
<div class="alert alert-info" *ngIf="usager.historique.length === 0">
<p>Aucun historique de décision n'est enregistré</p>
</div>
<div class="table-responsive" *ngIf="usager.historique.length > 0">
<table class="table table-hover">
<caption class="visually-hidden">
Historique des décisions
</caption>
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Type de décision</th>
<th scope="col">Responsable</th>
<th scope="col" class="text-end d-print-none">Actions</th>
</tr>
</thead>
<tbody>
<tr
*ngFor="
let histo of usager.historique | orderByDate : 'desc';
let i = index
"
[attr.aria-rowindex]="i + 1"
>
<td>
{{ histo.dateDecision | date : "dd MMMM yyyy à HH:mm" }}
</td>
<td>
{{ USAGER_DECISION_STATUT_LABELS_PROFIL[histo.statut] }}
<span *ngIf="histo.statut === 'REFUS' || histo.statut === 'RADIE'">
le {{ histo.dateDebut | date : "dd MMMM yyyy" }}
</span>

<span *ngIf="histo.statut === 'VALIDE'">
du
<strong>
{{ histo.dateDebut | date : "dd MMMM yyyy" }}
</strong>
au
<strong>{{ histo.dateFin | date : "dd MMMM yyyy" }}</strong>
</span>
<div *ngIf="histo.statut === 'RADIE'">
{{ histo.motifString }}
</div>
</td>
<td>{{ histo.userName }}</td>
<td class="text-end d-print-none">
<app-delete-usager-menu
*ngIf="i === 0"
[usager]="usager"
context="HISTORY"
[me]="me"
></app-delete-usager-menu>
</td>
</tr>
</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ComponentFixture, TestBed } from "@angular/core/testing";

import { ProfilHistoriqueDecisionsComponent } from "./profil-historique-decisions.component";

describe("ProfilHistoriqueDecisionsComponent", () => {
let component: ProfilHistoriqueDecisionsComponent;
let fixture: ComponentFixture<ProfilHistoriqueDecisionsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ProfilHistoriqueDecisionsComponent],
}).compileComponents();

fixture = TestBed.createComponent(ProfilHistoriqueDecisionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it("should create", () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, Input } from "@angular/core";
import { UsagerFormModel } from "../../../../usager-shared/interfaces";
import { USAGER_DECISION_STATUT_LABELS_PROFIL } from "@domifa/common";
import { UserStructure } from "../../../../../../_common/model";

@Component({
selector: "app-profil-historique-decisions",
templateUrl: "./profil-historique-decisions.component.html",
})
export class ProfilHistoriqueDecisionsComponent {
public readonly USAGER_DECISION_STATUT_LABELS_PROFIL =
USAGER_DECISION_STATUT_LABELS_PROFIL;
@Input() public me!: UserStructure;
@Input() public usager!: UsagerFormModel;
}
Loading

0 comments on commit 00ed95b

Please sign in to comment.