diff --git a/src/app/profile/profile-structure/profile-structure.component.ts b/src/app/profile/profile-structure/profile-structure.component.ts index d8e4ab9328407a67e1137357da19abb7960bdd4e..f771ef6bc857b5bcd5c22955144456e9fbc30a5d 100644 --- a/src/app/profile/profile-structure/profile-structure.component.ts +++ b/src/app/profile/profile-structure/profile-structure.component.ts @@ -66,7 +66,16 @@ export class ProfileStructureComponent implements OnInit { public async getSharedPersonalOffer(): Promise<PersonalOffer> { // Check if user has personal offers - if (!this.userProfile.job.hasPersonalOffer || this.userProfile.personalOffers.length === 0) return null; + + if ( + !this.userProfile || + !this.userProfile.job || + !this.userProfile.personalOffers || + !this.userProfile.job.hasPersonalOffer || + this.userProfile.personalOffers.length === 0 + ) + return null; + // Check if structure has personal offers if (this.structure.personalOffers.length === 0) return null; // Return personnal offer if the user has one in this structure diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html index 0217e060a8542ebc84b275684319e5e635190ed9..039edaef5e9ba26094104cee90e0e14bd2bb67ad 100644 --- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html +++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html @@ -294,6 +294,11 @@ <p>{{ public }}</p> </div> </ng-container> + + <ng-container *ngIf="!isFieldValid('age', 'categories') && structure.categoriesDisplay.age"> + <app-no-information *ngIf="!structure.otherDescription"></app-no-information> + <app-missing-information></app-missing-information> + </ng-container> </div> <div class="content"> <ng-container diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts index f139e3bb1a5b8a8f15746bde0b0c6894014f76cd..8ce4f2a2c05f0885f408ccbc82cca69adf3bddab 100644 --- a/src/app/utils/formUtils.ts +++ b/src/app/utils/formUtils.ts @@ -3,6 +3,7 @@ import { structureFormStep } from '../form/form-view/structure-form/structureFor import { Day } from '../models/day.model'; import { Structure } from '../models/structure.model'; import { Time } from '../models/time.model'; +import { Week } from '../models/week.model'; import { CustomRegExp } from './CustomRegExp'; export interface IStructureSummary { @@ -114,17 +115,17 @@ export class formUtils { exceptionalClosures: new UntypedFormControl(structure.exceptionalClosures), categories: new UntypedFormGroup({ labelsQualifications: this.loadArrayForCheckbox(structure.categories?.labelsQualifications, false), - accessModality: this.loadArrayForCheckbox(structure.categories.accessModality, true), - publicsAccompaniment: this.loadArrayForCheckbox(structure.categories.age, false), - onlineProcedures: this.loadArrayForCheckbox(structure.categories.onlineProcedures, false), - handicaps: this.loadArrayForCheckbox(structure.categories.handicaps, false), - age: this.loadArrayForCheckbox(structure.categories.age, true), - languageAndIlliteracy: this.loadArrayForCheckbox(structure.categories.languageAndIlliteracy, false), - selfServiceMaterial: this.loadArrayForCheckbox(structure.categories.selfServiceMaterial, false), - publicOthers: this.loadArrayForCheckbox(structure.categories.publicOthers, false), - baseSkills: new UntypedFormControl(structure.categories.baseSkills), - advancedSkills: new UntypedFormControl(structure.categories.advancedSkills), - solidarityMaterial: this.loadArrayForCheckbox(structure.categories.solidarityMaterial, false), + accessModality: this.loadArrayForCheckbox(structure.categories?.accessModality, true), + publicsAccompaniment: this.loadArrayForCheckbox(structure.categories?.age, false), + onlineProcedures: this.loadArrayForCheckbox(structure.categories?.onlineProcedures, false), + handicaps: this.loadArrayForCheckbox(structure.categories?.handicaps, false), + age: this.loadArrayForCheckbox(structure.categories?.age, true), + languageAndIlliteracy: this.loadArrayForCheckbox(structure.categories?.languageAndIlliteracy, false), + selfServiceMaterial: this.loadArrayForCheckbox(structure.categories?.selfServiceMaterial, false), + publicOthers: this.loadArrayForCheckbox(structure.categories?.publicOthers, false), + baseSkills: new UntypedFormControl(structure.categories?.baseSkills), + advancedSkills: new UntypedFormControl(structure.categories?.advancedSkills), + solidarityMaterial: this.loadArrayForCheckbox(structure.categories?.solidarityMaterial, false), }), //TODO: remettre ou migrer les données de accompagnements à distance remoteAccompaniment: new UntypedFormControl(false), @@ -182,14 +183,17 @@ export class formUtils { }); } public createHoursForm(structure: Structure): UntypedFormGroup { + if (!structure.hours) { + structure.hours = new Week(); + } return new UntypedFormGroup({ - monday: this.createDay(structure.hours.monday), - tuesday: this.createDay(structure.hours.tuesday), - wednesday: this.createDay(structure.hours.wednesday), - thursday: this.createDay(structure.hours.thursday), - friday: this.createDay(structure.hours.friday), - saturday: this.createDay(structure.hours.saturday), - sunday: this.createDay(structure.hours.sunday), + monday: this.createDay(structure.hours?.monday), + tuesday: this.createDay(structure.hours?.tuesday), + wednesday: this.createDay(structure.hours?.wednesday), + thursday: this.createDay(structure.hours?.thursday), + friday: this.createDay(structure.hours?.friday), + saturday: this.createDay(structure.hours?.saturday), + sunday: this.createDay(structure.hours?.sunday), }); }