Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_client
1 result
Show changes
import { FormControl, FormGroup, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
import {
FormControl,
FormGroup,
UntypedFormArray,
UntypedFormControl,
UntypedFormGroup,
Validators,
} from '@angular/forms';
import { structureFormStep } from '../form/form-view/structure-form/structureFormStep.enum';
import { FiltersSteps } from '../form/orientation-form-view/enums/filtersSteps.enum';
import { HotlineMediationSteps } from '../form/orientation-form-view/enums/hotlineMediationSteps.enum';
import { MeetingRDVSSteps } from '../form/orientation-form-view/enums/MeetingRDVSSteps.enum';
import { NeedsType } from '../form/orientation-form-view/enums/needs.enum';
import { OnlineDemarchesCommonSteps } from '../form/orientation-form-view/enums/onlineDemarchesCommonSteps.enum';
import { OnlineDemarchesMeetingSteps } from '../form/orientation-form-view/enums/onlineDemarchesMeetingSteps.enum';
import { PreferredLanguages } from '../form/orientation-form-view/enums/preferredLanguages.enum';
import { StructuresListSteps } from '../form/orientation-form-view/enums/structuresListSteps.enum';
import { FiltersForm } from '../form/orientation-form-view/interfaces/filtersForm.interface';
import { MeetingRDVSForm } from '../form/orientation-form-view/interfaces/meetingRDVSForm.interface';
import { OnlineDemarchesForm } from '../form/orientation-form-view/interfaces/onlineDemarchesForm.interface';
import { StructureOrientationForm } from '../form/orientation-form-view/interfaces/structureOrientationForm.interface';
import { StructureOrientator } from '../form/orientation-form-view/interfaces/structureOrientator.interface';
......@@ -73,7 +81,10 @@ export class OrientationUtils {
});
}
public createStructureOrientationForm(filters: Module[] = []): FormGroup<StructureOrientationForm> {
public createStructureOrientationForm(
filters: Module[] = [],
orientatorForm?: FormGroup<StructureOrientator>
): FormGroup<StructureOrientationForm> {
return new FormGroup<StructureOrientationForm>({
filters: new FormControl<Module[]>(filters, Validators.required),
pmrAccess: new FormControl(null, Validators.required),
......@@ -82,18 +93,42 @@ export class OrientationUtils {
name: new FormControl('', [Validators.required, Validators.pattern(CustomRegExp.TEXT_WITHOUT_NUMBER)]),
surname: new FormControl('', [Validators.required, Validators.pattern(CustomRegExp.TEXT_WITHOUT_NUMBER)]),
comments: new FormControl('', [Validators.required]),
structureOrientator: this.createStructureOrientatorForm(),
structureOrientator: orientatorForm || this.createStructureOrientatorForm(),
});
}
public createStructureOrientatorForm(): FormGroup<StructureOrientator> {
public createStructureOrientatorForm(orientator?: {
structureName: string;
structureMail: string;
structurePhone: string;
}): FormGroup<StructureOrientator> {
return new FormGroup<StructureOrientator>({
structureName: new FormControl('', Validators.required),
structureMail: new FormControl(''),
structurePhone: new FormControl('', [Validators.pattern(CustomRegExp.PHONE)]),
structureName: new FormControl(orientator?.structureName || '', Validators.required),
structureMail: new FormControl(orientator?.structureMail || ''),
structurePhone: new FormControl(orientator?.structurePhone || '', [Validators.pattern(CustomRegExp.PHONE)]),
});
}
public createMeetingRDVSForm(
onlineDemarcheType,
orientatorForm?: FormGroup<StructureOrientator>
): FormGroup<MeetingRDVSForm> {
return new FormGroup<MeetingRDVSForm>({
structureOrientator: orientatorForm || this.createStructureOrientatorForm(),
categories: new UntypedFormGroup(
{
age: new UntypedFormArray([], Validators.required),
languageAndIlliteracy: new UntypedFormArray([]),
publicOthers: new UntypedFormArray([]),
handicaps: new UntypedFormArray([]),
},
Validators.required
),
pmrAccess: new FormControl(null, Validators.required),
digitalPass: new FormControl(null, Validators.required),
address: new FormControl(''),
onlineDemarcheType: new FormControl(onlineDemarcheType),
});
}
/**
*
* @param pagesValidation
......@@ -184,13 +219,29 @@ export class OrientationUtils {
*/
public setValidationsOnlineMeetingForm(
pagesValidation: any[],
form: UntypedFormGroup,
form: FormGroup<MeetingRDVSForm>,
updatePageValid: (isValid: boolean) => void,
step: OnlineDemarchesMeetingSteps
step: MeetingRDVSSteps
): void {
pagesValidation[OnlineDemarchesMeetingSteps.structureOrientator] = {
pagesValidation[MeetingRDVSSteps.structureOrientator] = {
valid: form.get('structureOrientator').valid,
};
pagesValidation[MeetingRDVSSteps.publicTypeMandatory] = {
valid: form.get('categories').valid && form.get('categories').get('age').valid,
};
pagesValidation[MeetingRDVSSteps.publicTypeOptional] = {
valid: true,
};
pagesValidation[MeetingRDVSSteps.pmrAccess] = {
valid: form.get('pmrAccess').valid,
};
pagesValidation[MeetingRDVSSteps.digitalPass] = {
valid: true,
};
pagesValidation[MeetingRDVSSteps.location] = {
valid: true,
};
updatePageValid(pagesValidation[step].valid);
}
......
This diff is collapsed.
This diff is collapsed.
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.46967 12.1367C9.17678 12.4296 9.17678 12.9044 9.46967 13.1973C9.76256 13.4902 10.2374 13.4902 10.5303 13.1973L9.46967 12.1367ZM16.8943 6.83336C17.1872 6.54047 17.1872 6.0656 16.8943 5.7727C16.6014 5.47981 16.1265 5.47981 15.8336 5.7727L16.8943 6.83336ZM10.5303 13.1973L16.8943 6.83336L15.8336 5.7727L9.46967 12.1367L10.5303 13.1973Z" fill="#FF7100"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.8887 3.82812L19.192 3.47457L18.8384 8.77787L13.8887 3.82812Z" fill="#FF7100"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 6.75C5.86193 6.75 5.75 6.86193 5.75 7V16C5.75 16.1381 5.86193 16.25 6 16.25H16C16.1381 16.25 16.25 16.1381 16.25 16V11.5L17.75 10.2308V16C17.75 16.9665 16.9665 17.75 16 17.75H6C5.0335 17.75 4.25 16.9665 4.25 16V7C4.25 6.0335 5.0335 5.25 6 5.25H12.7143L11 6.75H6Z" fill="#FF7100"/>
</svg>
This diff is collapsed.
......@@ -25,6 +25,7 @@ $orange-warning: #da6c2e;
/* OTHERS */
$blue: #348899;
$blue-light: #c9ecf3;
$blueRdvs: #1f2952;
/* APP COLORS */
$primary-color: $red;
$primary-color-dark: $red-dark;
......