Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Audit" ALTER COLUMN "auditorOrganisation" DROP NOT NULL;
2 changes: 1 addition & 1 deletion confiture-rest-api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ model Audit {
auditorName String?
auditorEmail String?
showAuditorEmailInReport Boolean @default(false)
auditorOrganisation String

// A11y declaration edition step
initiator String?
auditorOrganisation String?
procedureUrl String?
contactName String?
contactEmail String?
Expand Down
4 changes: 4 additions & 0 deletions confiture-rest-api/src/audits/audit-report.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ class ReportContext {
* @example "john-doe@example.com"
*/
auditorEmail: string | null;
/**
* @example "Web Audit Services Corp."
*/
auditorOrganisation: string;

technologies: string[];

Expand Down
2 changes: 1 addition & 1 deletion confiture-rest-api/src/audits/audit.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export class AuditService {

auditorEmail: data.auditorEmail,
auditorName: data.auditorName,
auditorOrganisation: data.auditorOrganisation,

pages: {
createMany: {
Expand Down Expand Up @@ -765,6 +764,7 @@ export class AuditService {
context: {
auditorName: audit.auditorName,
auditorEmail: null,
auditorOrganisation: audit.auditorOrganisation,
desktopEnvironments: audit.environments
.filter((e) => e.platform === 'desktop')
.map((e) => ({
Expand Down
6 changes: 0 additions & 6 deletions confiture-rest-api/src/audits/create-audit.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,4 @@ export class CreateAuditDto {
@IsEmail()
@IsOptional()
auditorEmail?: string;

/**
* @example "WEB AUDIT SARL"
*/
@IsString()
auditorOrganisation: string;
}
7 changes: 7 additions & 0 deletions confiture-rest-api/src/audits/update-audit.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ export class UpdateAuditDto extends CreateAuditDto {
@IsOptional()
initiator?: string;

/**
* @example "WEB AUDIT SARL"
*/
@IsString()
@IsOptional()
auditorOrganisation?: string;

/**
* @example "John Referent"
*/
Expand Down
21 changes: 3 additions & 18 deletions confiture-web-app/src/components/AuditGeneralInformationsForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ const procedureAuditorName = ref(
const procedureAuditorEmail = ref(
props.defaultValues?.auditorEmail ?? accountStore.account?.email ?? ""
);
const procedureAuditorOrganisation = ref(
props.defaultValues?.auditorOrganisation ??
accountStore.account?.orgName ??
""
);

const pageNameFieldRefs = ref<InstanceType<typeof DsfrField>[]>([]);

/**
Expand Down Expand Up @@ -102,9 +98,8 @@ function fillFields() {
{ name: "Accueil", url: "https://example.com" },
{ name: "Contact", url: "https://example.com/contact" },
];
procedureAuditorName.value ||= "Etienne Dupont";
procedureAuditorEmail.value ||= "etienne-dupont@example.com";
procedureAuditorOrganisation.value ||= "Example Organisation";
procedureAuditorName.value = "Etienne Dupont";
procedureAuditorEmail.value = "etienne-dupont@example.com";
}

function onSubmit() {
Expand All @@ -115,7 +110,6 @@ function onSubmit() {
pages: pages.value.map((p) => ({ ...p, url: p.url.trim() })),
auditorName: procedureAuditorName.value,
auditorEmail: formatEmail(procedureAuditorEmail.value),
auditorOrganisation: procedureAuditorOrganisation.value,
});
}

Expand Down Expand Up @@ -233,15 +227,6 @@ const route = useRoute();
hint="Sera affiché dans le rappport de l’audit pour aider le demandeur de l’audit à vous identifier s’il a des questions ou besoin d’aide."
/>

<DsfrField
v-if="!accountStore.account?.orgName"
id="procedure-auditor-organisation"
v-model="procedureAuditorOrganisation"
label="Nom de la structure"
hint="Sera affiché dans la déclaration d’accessibilité, cette mention est une obligation. "
required
/>

<DsfrField
v-if="!accountStore.account"
id="procedure-auditor-email"
Expand Down
13 changes: 4 additions & 9 deletions confiture-web-app/src/components/ReportA11yStatement.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, computed } from "vue";
import { ref } from "vue";
import { useRoute } from "vue-router";

import { useWrappedFetch } from "../composables/useWrappedFetch";
Expand Down Expand Up @@ -28,11 +28,6 @@ function getA11yLevel() {
const statementRef = ref<HTMLDivElement>();
const showCopyAlert = ref(false);

const auditIsInProgress = computed(() => {
// The `initiator` field is requied on the a11y declaration form so we can check that it's not null
return !report.data?.procedureInitiator;
});

async function copyA11yStatementHTML() {
const tagsWithSpacesRegex = /<(?<tagName>\S+)(\s+)>/g; // "<XX >"
const whitespaceFollowedTags = /<(?<tagName>p)>\s{1}/g; // "<p> "
Expand Down Expand Up @@ -241,9 +236,9 @@ function hideCopyAlert() {
<h4 class="fr-h2">Résultats des tests</h4>
<p class="fr-mb-9v fr-mb-md-6w">
L’audit de conformité réalisé par
<strong>{{ report.data.procedureInitiator }}</strong> révèle que
<strong>{{ report.data.accessibilityRate }}%</strong> des critères du
RGAA version 4 sont respectés.
<strong>{{ report.data.context.auditorOrganisation }}</strong> révèle
que <strong>{{ report.data.accessibilityRate }}%</strong> des critères
du RGAA version 4 sont respectés.
</p>
<!--ul class="fr-mb-9v fr-mb-md-6w">
<li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { ref, computed, watch } from "vue";
import { ref, computed, watch, onMounted } from "vue";

import { useAccountStore } from "../../../store/account";
import { useNotifications } from "../../../composables/useNotifications";
Expand All @@ -11,6 +11,11 @@ const notify = useNotifications();
const name = ref("");
const orgName = ref("");

onMounted(() => {
name.value = accountStore.account?.name || "";
orgName.value = accountStore.account?.orgName || "";
});

watch(accountStore, () => {
if (!accountStore.account) {
return;
Expand Down
17 changes: 15 additions & 2 deletions confiture-web-app/src/pages/edit/EditAuditDeclarationPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ const environments = ref<Omit<AuditEnvironment, "id">[]>([]);
// Other data

const auditInitiator = ref("");
const auditorOrganisation = ref("");
const procedureUrl = ref("");
const contactName = ref("");
const contactEmail = ref("");
Expand All @@ -134,6 +135,7 @@ watch(
return;
}
auditInitiator.value = audit.initiator ?? "";
auditorOrganisation.value = audit.auditorOrganisation ?? "";
procedureUrl.value = audit.procedureUrl ?? "";
contactName.value = audit.contactName ?? "";
contactEmail.value = audit.contactEmail ?? "";
Expand All @@ -159,7 +161,7 @@ watch(
},
{
immediate: true,
}
},
);

const notify = useNotifications();
Expand All @@ -184,6 +186,7 @@ function handleSubmit() {
...auditStore.currentAudit!,

initiator: auditInitiator.value,
auditorOrganisation: auditorOrganisation.value,
procedureUrl: procedureUrl.value.trim(),

contactEmail: formatEmail(contactEmail.value) || null,
Expand All @@ -210,7 +213,7 @@ function handleSubmit() {
notify(
"error",
"Une erreur est survenue",
"Un problème empêche la sauvegarde de vos données. Contactez-nous à l'adresse contact@design.numerique.gouv.fr si le problème persiste."
"Un problème empêche la sauvegarde de vos données. Contactez-nous à l'adresse contact@design.numerique.gouv.fr si le problème persiste.",
);
throw err;
});
Expand All @@ -221,6 +224,7 @@ function handleSubmit() {
*/
function DEBUG_fillFields() {
auditInitiator.value = "Mairie de Tours";
auditorOrganisation.value = "Web Audit Services Corp.";
procedureUrl.value = "https://example.com";
contactEmail.value = "philipinne-jolivet@example.com";
contactFormUrl.value = "https://example.com/contact";
Expand Down Expand Up @@ -286,6 +290,15 @@ const isDevMode = useDevMode();
required
/>

<DsfrField
id="auditorOrganisation"
v-model="auditorOrganisation"
label="Entité qui a réalisé l’audit"
hint="L’entité qui a demandé et réalisé l’audit peut être identique dans le cas d’un audit réalisé en interne."
type="text"
required
/>

<DsfrField
id="procedure-url"
v-model="procedureUrl"
Expand Down
11 changes: 2 additions & 9 deletions confiture-web-app/src/pages/edit/NewAuditStepOnePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,10 @@ async function submitStepOne(data: CreateAuditRequestData) {
isSubmitting.value = true;

// Update user profile when their name/org is not known.
if (
accountStore.account &&
((data.auditorName && !accountStore.account?.name) ||
(data.auditorOrganisation && !accountStore.account?.orgName))
) {
if (accountStore.account && data.auditorName && !accountStore.account?.name) {
// Since this update is not necessary for the audit to be created, we ignore eventual errors.
accountStore
.updateProfile({
name: data.auditorName,
orgName: data.auditorOrganisation,
})
.updateProfile({ name: data.auditorName })
.catch(captureWithPayloads);
}

Expand Down
2 changes: 1 addition & 1 deletion confiture-web-app/src/types/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface UpdateProfileRequestData {
/** John Doe */
name: string | null;
/** ACME */
orgName: string | null;
orgName?: string | null;
}

export interface AccountDeletionResponse {
Expand Down
1 change: 1 addition & 0 deletions confiture-web-app/src/types/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ interface AuditReportContext {

auditorName: string;
auditorEmail: string | null;
auditorOrganisation: string;

technologies: string[];

Expand Down
8 changes: 2 additions & 6 deletions confiture-web-app/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ export interface Audit {
pages: AuditPage[];
auditorEmail: string;
auditorName: string | null;
auditorOrganisation: string;

// A11y declaration edition
technologies: string[];
procedureUrl: string | null;
initiator: string | null;
auditorOrganisation: string;
tools: string[];
environments: AuditEnvironment[];
contactName: string | null;
Expand All @@ -69,11 +69,7 @@ export interface Audit {
/** Audit type but without the generated IDs and step 2 fields */
export type CreateAuditRequestData = Pick<
Audit,
| "auditType"
| "procedureName"
| "auditorEmail"
| "auditorName"
| "auditorOrganisation"
"auditType" | "procedureName" | "auditorEmail" | "auditorName"
> & { pages: Omit<AuditPage, "id">[] };

/** Creation data type plus step 2 fields. */
Expand Down