Skip to content
Snippets Groups Projects
Commit 1568706d authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix(aptic): handling of missing fields for aptic structures

parent 6698cf83
No related branches found
No related tags found
4 merge requests!418V2.1.0,!400V2.0,!374Resolve "L'import des structures APTIC semble KO en V2",!230V2.0
......@@ -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
......
......@@ -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
......
......@@ -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),
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment