Skip to content

Commit

Permalink
Déplace le nom de la structure dans la déclaration (#574)
Browse files Browse the repository at this point in the history
* remove auditor org from first step

* add auditor organisation field on statement edit page

* display auditor organisation in a11y statement

* remove auditor org from create-audit dto

* fix typing error

* pr feedbacks

* update changelog
  • Loading branch information
bellangerq authored Dec 6, 2023
1 parent 80057da commit b5f7af1
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 54 deletions.
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 "[email protected]"
*/
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
6 changes: 6 additions & 0 deletions confiture-web-app/src/assets/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

Tous les changements notables de Ara sont documentés ici avec leur date, leur catégorie (nouvelle fonctionnalité, correction de bug ou autre changement) et leur pull request (PR) associée.

## 06/12/2023

### Autres changements ⚙️

- Déplace le champ du nom de la structure qui audite le site dans la page de déclaration ([#574](https://github.com/DISIC/Ara/pull/574))

## 01/12/2023

### Autres changements ⚙️
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 ||= "[email protected]";
procedureAuditorOrganisation.value ||= "Example Organisation";
procedureAuditorName.value = "Etienne Dupont";
procedureAuditorEmail.value = "[email protected]";
}
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 [email protected] si le problème persiste."
"Un problème empêche la sauvegarde de vos données. Contactez-nous à l'adresse [email protected] 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 = "[email protected]";
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

0 comments on commit b5f7af1

Please sign in to comment.