Skip to content

Commit

Permalink
fix(frontend): fix usager-docs download
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Aug 28, 2024
1 parent 158ea3d commit 9e459ff
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@domifa/backend",
"private": true,
"version": "2.157.0",
"version": "2.173.26",
"description": "",
"author": "",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { format } from "date-fns";
import { renderStructureUsagersExcel } from "../services/xlsx-structure-usagers-renderer";
import { AppLogsService } from "../../modules/app-logs/app-logs.service";
import { domifaConfig } from "../../config";
import { captureMessage } from "@sentry/node";

@UseGuards(AuthGuard("jwt"), AppUserGuard)
@ApiTags("export")
Expand All @@ -40,11 +39,12 @@ export class ExportStructureUsagersController {
const usagers = await this.usagersService.export(user.structureId);
const workbook = renderStructureUsagersExcel(usagers, user.structure);

const message = `[EXPORT] [${domifaConfig().envId}] start at ${format(
new Date(),
"dd/MM/yyyy - HH:mm"
)}`;
captureMessage(message);
appLogger.info(
`[EXPORT] [${domifaConfig().envId}] start at ${format(
new Date(),
"dd/MM/yyyy - HH:mm"
)}`
);

try {
res.setHeader(
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@domifa/frontend",
"version": "2.148.1",
"version": "2.173.26",
"main": "index.js",
"author": "Incubateur des Ministères Sociaux <[email protected]> (https://incubateur.social.gouv.fr)",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export class BaseUsagerDossierPageComponent implements OnInit, OnDestroy {
this.subscription.add(
this.store.select(selectUsagerById(id)).subscribe({
next: (usager: UsagerLight) => {
this.usager = new UsagerFormModel(usager);
if (usager) {
this.usager = new UsagerFormModel(usager);
}
},
error: (error) => {
console.error("Erreur lors de la récupération du dossier:", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ <h3>Pièces jointes</h3>
</div>
<div class="mb-5">
<app-display-usager-docs
[editPJ]="editPJ"
[me]="me"
[editPJ]="true"
[usager]="usager"
></app-display-usager-docs>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ <h2 class="form-title">Pièces justificatives complétant le dossier</h2>

<div class="py-3">
<app-display-usager-docs
[usager]="usager"
[me]="me"
[editPJ]="true"
[usager]="usager"
></app-display-usager-docs>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,28 @@ export class BaseUsagerNotesComponent implements OnInit, OnDestroy {
.pipe(select(selectUsagerById(this.usager.ref)), take(1))
.subscribe((usager: UsagerLight) => {
if (usager) {
this.subscription.add(
this.usagerNotesService
.getNotes(usager, this.params, this.getArchivedNotes)
.subscribe({
next: (notes: PageResults<UsagerNote>) => {
this.notes = notes.data;
this.loading = false;
},
error: () => {
this.toastService.error("Impossible d'afficher les notes");
this.loading = false;
},
})
);
this.getNotes(usager);
}
});
}

private getNotes(usager: UsagerLight) {
this.subscription.add(
this.usagerNotesService
.getNotes(usager, this.params, this.getArchivedNotes)
.subscribe({
next: (notes: PageResults<UsagerNote>) => {
this.notes = notes.data;
this.loading = false;
},
error: () => {
this.toastService.error("Impossible d'afficher les notes");
this.loading = false;
},
})
);
}

public closeModals() {
this.modalService.dismissAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<th scope="col">Ajouté le</th>
<th scope="col" class="d-print-none text-end">Actions</th>
</tr>

<tr
*ngFor="let document of docs; let indexDocs = index"
[attr.aria-rowindex]="indexDocs + 1"
Expand Down

0 comments on commit 9e459ff

Please sign in to comment.