Skip to content
Snippets Groups Projects
Commit 60dddc44 authored by Pierre Ecarlat's avatar Pierre Ecarlat
Browse files

fix(orientation): Refactored orientation to fix broken baseSkills' previous button

parent e625176a
No related branches found
No related tags found
2 merge requests!907V3.2.0,!888fix(orientation): Refactored orientation to fix broken baseSkills' previous button
Showing
with 181 additions and 233 deletions
<div class="orientationForm">
<h2>Quel est le besoin numérique de la personne&nbsp;?</h2>
<div class="tagList">
<app-tag-item
*ngFor="let module of baseSkills"
[label]="module.name"
[disabled]="module.disabled"
[color]="isSelectedModule(module.id) ? 'green' : 'white'"
[iconName]="isSelectedModule(module.id) ? 'tag-checked' : 'tag-unchecked'"
[clickable]="true"
(action)="handleClick(module)"
/>
</div>
</div>
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { OrientationService } from '../../../../services/orientation.service';
import { PersonalOfferService } from '../../../../services/personal-offer.service';
import { CategoryEnum } from '../../../../shared/enum/category.enum';
import { Category } from '../../../../structure-list/models/category.model';
import { Module } from '../../../../structure-list/models/module.model';
import { SearchService } from '../../../../structure-list/services/search.service';
import { OrientationUtils } from '../../../../utils/orientationUtils';
import { SelectComponent } from '../../global-components/select/select.component';
import { FiltersForm } from '../../interfaces/filtersForm.interface';
@Component({
selector: 'app-base-skills-choice',
templateUrl: './base-skills-choice.component.html',
})
export class BaseSkillsChoiceComponent extends SelectComponent implements OnInit {
@Input() form: FormGroup<FiltersForm>;
public orientationUtils = new OrientationUtils();
public baseSkills: Module[] = [];
constructor(
private searchService: SearchService,
public orientationService: OrientationService,
public personalOfferService: PersonalOfferService,
) {
super();
}
ngOnInit(): void {
this.selectedModules = this.form.get('filters').value;
this.searchService.getCategories().subscribe(async (categories: Category[]) => {
this.baseSkills = categories.find((el) => el.id === CategoryEnum.baseSkills).modules;
// For rdv from structure or annuaire, disable items which are not offered
if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
await this.orientationUtils.rdvDisableItemsNotOffered(this.baseSkills, this.orientationService, 'baseSkills');
}
});
this.checkValidation.emit();
}
}
<app-base-skills-choice
*ngIf="currentType === GenericOrientationSteps.common"
[form]="form"
(checkValidation)="checkValidation()"
/>
<div class="orientationForm">
<h2>Quel est le besoin numérique de la personne&nbsp;?</h2>
<div class="tagList">
<app-tag-item
*ngFor="let module of baseSkills"
[label]="module.name"
[disabled]="module.disabled"
[color]="isSelectedModule(module.id) ? 'green' : 'white'"
[iconName]="isSelectedModule(module.id) ? 'tag-checked' : 'tag-unchecked'"
[clickable]="!module.disabled"
(action)="handleClick(module)"
/>
</div>
</div>
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { OrientationService } from '../../../services/orientation.service';
import { CategoryEnum } from '../../../shared/enum/category.enum';
import { Category } from '../../../structure-list/models/category.model';
import { Module } from '../../../structure-list/models/module.model';
import { SearchService } from '../../../structure-list/services/search.service';
import { OrientationUtils } from '../../../utils/orientationUtils';
import { FiltersSteps, GenericOrientationSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
import { SelectComponent } from '../global-components/select/select.component';
import { FiltersForm } from '../interfaces/filtersForm.interface';
import { MediationStepType, MediationType } from '../types/orientation.types';
@Component({
selector: 'app-base-skills',
templateUrl: './base-skills.component.html',
})
export class BaseSkillsComponent {
@Input() currentStep: FiltersSteps | MediationStepType;
@Input() currentType: GenericOrientationSteps | MediationType;
@Input() form: FormGroup<FiltersForm>;
@Output() validatePage = new EventEmitter<any>();
export class BaseSkillsComponent extends SelectComponent implements OnInit {
@Input() filtersForm: FormGroup<FiltersForm>;
public orientationUtils = new OrientationUtils();
public pagesValidation: any[] = [];
public baseSkills: Module[] = [];
// Enums
public StructuresListSteps = StructuresListSteps;
public FiltersSteps = FiltersSteps;
public RecapsType = RecapsType;
public GenericOrientationSteps = GenericOrientationSteps;
constructor(
private searchService: SearchService,
public orientationService: OrientationService,
) {
super();
}
ngOnInit(): void {
this.selectedModules = this.filtersForm.get('filters').value;
this.searchService.getCategories().subscribe(async (categories: Category[]) => {
this.baseSkills = categories.find((el) => el.id === CategoryEnum.baseSkills).modules;
// For rdv from structure or annuaire, disable items which are not offered
if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
await this.orientationUtils.rdvDisableItemsNotOffered(this.baseSkills, this.orientationService, 'baseSkills');
}
});
public checkValidation(): void {
switch (this.currentType) {
case GenericOrientationSteps.common:
this.orientationUtils.setValidationsEquipmentForm(
this.pagesValidation,
this.form,
(isValid) => this.validatePage.emit(isValid),
this.currentStep as FiltersSteps,
);
break;
default:
throw new Error('Not implemented tunnel type in BaseSkillsComponent');
}
this.checkValidation.emit();
}
}
/**
* Names of needs, leading to one of the three orientations
*/
export enum NeedsTypes {
equipmentAccess = 'selfServiceMaterial',
equipmentBuy = 'solidarityMaterial',
onlineDemarch = 'onlineProcedures',
baseSkills = 'baseSkills',
}
/**
* Names of different orientations
*/
export enum AccompanimentTypes {
structuresList = 'Trouver une structure',
appointment = 'RDV Conseiller Numérique',
onlineMediation = 'Médiation Numérique à distance',
}
/**
* We are either in the common first steps (filtersChoice, accompanimentChoice),
* or in the accompaniment tunnel (either a structuresList, an appointment, or
* an online Mediation)
*/
export enum GenericOrientationSteps {
common,
accompanimentTunnel,
}
/**
* To prepare each need, a set of filters must be chosen. In Online procedures
* (onlineDemarch or baseSkills), there is also a choice of the accompaniment
* type.
*/
export enum CommonSteps {
filtersChoice,
accompanimentType,
}
/**
* Steps of different orientations
*/
export enum StructuresListSteps {
pmrAccess,
address,
structureChoice,
mediationBeneficiaryInfo,
comments,
structureOrientator,
orientationRecap,
}
export enum AppointmentSteps {
infoScreen,
pmrAccess,
......@@ -10,17 +61,7 @@ export enum AppointmentSteps {
rdvEnd,
orientationPrint,
}
export enum FiltersSteps {
filterChoice,
}
export enum GenericOrientationSteps {
common = 'Common',
structureList = 'Trouver une structure',
}
export enum HotlineMediationSteps {
export enum OnlineMediationSteps {
infoScreen,
mediationBeneficiaryInfo,
mediationHoursSelection,
......@@ -31,42 +72,3 @@ export enum HotlineMediationSteps {
rdvEnd,
orientationPrint,
}
export enum OnlineDemarche {
structureList = 'Trouver une structure',
appointment = 'RDV Conseiller Numérique',
onlineMediation = 'Médiation Numérique à distance',
common = 'Common',
}
export enum OnlineDemarchesCommonSteps {
onlineDemarche,
accompanimentType,
}
export enum NeedsType {
equipmentAccess = 'equipmentAccess',
equipmentBuy = 'equipmentBuy',
onlineDemarch = 'onlineDemarch',
learnSkills = 'learnSkills',
}
export enum PreferredLanguages {
french = 'Français',
english = 'Anglais',
arabic = 'Arabe',
}
export enum RecapsType {
appointment,
onlineMediation,
structure,
}
export enum StructuresListSteps {
pmrAccess,
address,
structureChoice,
mediationBeneficiaryInfo,
comments,
structureOrientator,
orientationRecap,
}
import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { CategoryEnum } from '../../../../shared/enum/category.enum';
import { Category } from '../../../../structure-list/models/category.model';
import { Module } from '../../../../structure-list/models/module.model';
......@@ -13,7 +12,7 @@ import { FiltersForm } from '../../interfaces/filtersForm.interface';
templateUrl: './equipment-access-choice.component.html',
})
export class EquipmentAccessChoiceComponent extends SelectComponent implements OnInit {
@Input() form: FormGroup<FiltersForm>;
@Input() filtersForm: FormGroup<FiltersForm>;
public equipmentType: Module[] = [];
constructor(private searchService: SearchService) {
......@@ -21,7 +20,7 @@ export class EquipmentAccessChoiceComponent extends SelectComponent implements O
}
ngOnInit(): void {
this.selectedModules = this.form.get('filters').value;
this.selectedModules = this.filtersForm.get('filters').value;
this.searchService.getCategories().subscribe((categories: Category[]) => {
this.equipmentType = categories.find((el) => el.id === CategoryEnum.selfServiceMaterial).modules;
});
......
<app-equipment-access-choice
*ngIf="currentType === GenericOrientationSteps.common"
[form]="form"
*ngIf="genericStep === GenericOrientationSteps.common"
[filtersForm]="filtersForm"
(checkValidation)="checkValidation()"
/>
<app-orientation-structure-list
*ngIf="currentType === GenericOrientationSteps.structureList"
[form]="orientationForm"
*ngIf="genericStep === GenericOrientationSteps.accompanimentTunnel"
[currentStep]="currentStep"
[form]="orientationForm"
[filters]="filters"
[profile]="profile"
(validatePage)="checkValidation()"
......
......@@ -3,19 +3,19 @@ import { FormGroup } from '@angular/forms';
import { User } from '../../../models/user.model';
import { Filter } from '../../../structure-list/models/filter.model';
import { OrientationUtils } from '../../../utils/orientationUtils';
import { FiltersSteps, GenericOrientationSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
import { FiltersForm } from '../interfaces/filtersForm.interface';
import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
import { MediationStepType, MediationType } from '../types/orientation.types';
import { AllOrientationSteps } from '../types/orientation.types';
@Component({
selector: 'app-equipment-access',
templateUrl: './equipment-access.component.html',
})
export class EquipmentAccessComponent {
@Input() currentStep: FiltersSteps | StructuresListSteps | MediationStepType;
@Input() currentType: GenericOrientationSteps | MediationType;
@Input() form: FormGroup<FiltersForm>;
@Input() currentStep: AllOrientationSteps;
@Input() genericStep: GenericOrientationSteps;
@Input() filtersForm: FormGroup<FiltersForm>;
@Input() orientationForm: FormGroup<StructureOrientationForm>;
@Input() filters: Filter[] = [];
@Input() profile: User;
......@@ -25,21 +25,19 @@ export class EquipmentAccessComponent {
public pagesValidation: any[] = [];
// Enums
public FiltersSteps = FiltersSteps;
public RecapsType = RecapsType;
public GenericOrientationSteps = GenericOrientationSteps;
public checkValidation(): void {
switch (this.currentType) {
switch (this.genericStep) {
case GenericOrientationSteps.common:
this.orientationUtils.setValidationsEquipmentForm(
this.pagesValidation,
this.form,
this.filtersForm,
(isValid) => this.validatePage.emit(isValid),
this.currentStep as FiltersSteps,
this.currentStep as CommonSteps,
);
break;
case GenericOrientationSteps.structureList:
case GenericOrientationSteps.accompanimentTunnel:
this.orientationUtils.setValidationsStructuresForm(
this.pagesValidation,
this.orientationForm,
......
......@@ -12,14 +12,14 @@ import { FiltersForm } from '../../interfaces/filtersForm.interface';
templateUrl: './equipment-buy-type.component.html',
})
export class EquipmentBuyTypeComponent extends SelectComponent implements OnInit {
@Input() form: FormGroup<FiltersForm>;
@Input() filtersForm: FormGroup<FiltersForm>;
public equipmentType: Module[] = [];
constructor(private searchService: SearchService) {
super();
}
ngOnInit(): void {
this.selectedModules = this.form.get('filters').value;
this.selectedModules = this.filtersForm.get('filters').value;
this.searchService.getCategories().subscribe((categories: Category[]) => {
this.equipmentType = categories.find((el) => el.id === CategoryEnum.solidarityMaterial).modules;
});
......
<app-equipment-buy-type
*ngIf="currentType === GenericOrientationSteps.common"
[form]="form"
*ngIf="genericStep === GenericOrientationSteps.common"
[filtersForm]="filtersForm"
(checkValidation)="checkValidation()"
/>
<app-orientation-structure-list
*ngIf="currentType === GenericOrientationSteps.structureList"
*ngIf="genericStep === GenericOrientationSteps.accompanimentTunnel"
[form]="orientationForm"
[currentStep]="currentStep"
[filters]="filters"
......
......@@ -3,19 +3,19 @@ import { FormGroup } from '@angular/forms';
import { User } from '../../../models/user.model';
import { Filter } from '../../../structure-list/models/filter.model';
import { OrientationUtils } from '../../../utils/orientationUtils';
import { FiltersSteps, GenericOrientationSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
import { FiltersForm } from '../interfaces/filtersForm.interface';
import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
import { MediationStepType, MediationType } from '../types/orientation.types';
import { AllOrientationSteps } from '../types/orientation.types';
@Component({
selector: 'app-equipment-buy',
templateUrl: './equipment-buy.component.html',
})
export class EquipmentBuyComponent {
@Input() currentStep: FiltersSteps | StructuresListSteps | MediationStepType;
@Input() currentType: GenericOrientationSteps | MediationType;
@Input() form: FormGroup<FiltersForm>;
@Input() currentStep: AllOrientationSteps;
@Input() genericStep: GenericOrientationSteps;
@Input() filtersForm: FormGroup<FiltersForm>;
@Input() orientationForm: FormGroup<StructureOrientationForm>;
@Input() filters: Filter[] = [];
@Input() profile: User;
......@@ -25,21 +25,19 @@ export class EquipmentBuyComponent {
public pagesValidation: any[] = [];
// Enums
public FiltersSteps = FiltersSteps;
public RecapsType = RecapsType;
public GenericOrientationSteps = GenericOrientationSteps;
public checkValidation(): void {
switch (this.currentType) {
switch (this.genericStep) {
case GenericOrientationSteps.common:
this.orientationUtils.setValidationsEquipmentForm(
this.pagesValidation,
this.form,
this.filtersForm,
(isValid) => this.validatePage.emit(isValid),
this.currentStep as FiltersSteps,
this.currentStep as CommonSteps,
);
break;
case GenericOrientationSteps.structureList:
case GenericOrientationSteps.accompanimentTunnel:
this.orientationUtils.setValidationsStructuresForm(
this.pagesValidation,
this.orientationForm,
......
<div class="container">
<img src="../../../../../assets/img/orientationBeginning.svg" alt="" />
<ng-container *ngIf="currentType === currentTypeEnum.appointment">
<ng-container *ngIf="accompanimentType === AccompanimentTypes.appointment">
<h2>Vous vous apprêtez à demander un rendez-vous auprès d'un·e accompagnant·e numérique</h2>
<p>
Ces professionnel·les peuvent aider à la prise en main des services administratifs en ligne, mais ne sont pas
......@@ -8,7 +8,7 @@
de l’orienter vers un lieu du type “Maison France Service”.
</p>
</ng-container>
<ng-container *ngIf="currentType === currentTypeEnum.onlineMediation">
<ng-container *ngIf="accompanimentType === AccompanimentTypes.onlineMediation">
<h2>Vous vous apprêtez à choisir un créneau de médiation numérique à distance</h2>
<p>
Ce service d’accompagnement permettra à la personne d'être assistée depuis son domicile dans ses usages
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { OnlineDemarche } from '../../enums/orientation.enums';
import { AccompanimentTypes } from '../../enums/orientation.enums';
@Component({
selector: 'app-information-screen',
......@@ -7,10 +7,10 @@ import { OnlineDemarche } from '../../enums/orientation.enums';
styleUrls: ['./information-screen.component.scss'],
})
export class InformationScreenComponent implements OnInit {
@Input() currentType: OnlineDemarche;
@Input() accompanimentType: AccompanimentTypes;
@Output() checkValidation = new EventEmitter<boolean>();
public currentTypeEnum = OnlineDemarche;
public AccompanimentTypes = AccompanimentTypes;
ngOnInit(): void {
this.checkValidation.emit();
......
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { ButtonComponent } from '../../../../shared/components';
import { NeedsType, OnlineDemarche } from '../../enums/orientation.enums';
import { MediationStepType, MediationType } from '../../types/orientation.types';
import { NeedsTypes } from '../../enums/orientation.enums';
import { AllOrientationSteps } from '../../types/orientation.types';
@Component({
selector: 'app-navigation',
......@@ -10,13 +10,12 @@ import { MediationStepType, MediationType } from '../../types/orientation.types'
styleUrls: ['./navigation.component.scss'],
})
export class NavigationComponent {
@Input() currentStep: MediationStepType;
@Input() currentType: OnlineDemarche | MediationType;
@Input() currentStep: AllOrientationSteps;
@Input() isPageValid: boolean;
@Input() needType: NeedsType;
@Input() needType: NeedsTypes;
@Input() isPrevHidden = false;
@Input() isNextHidden = false;
@Input() isLastStep = false;
@Input() hideNavButtons = false;
@Input() failedOrientation = false;
@Output() goNext = new EventEmitter<boolean>();
......@@ -26,7 +25,7 @@ export class NavigationComponent {
@ViewChild('prevButton', { read: ButtonComponent }) prevButton: ButtonComponent;
@ViewChild('nextButton', { read: ButtonComponent }) nextButton: ButtonComponent;
public NeedsTypeEnum = NeedsType;
public NeedsTypeEnum = NeedsTypes;
constructor(private router: Router) {}
......@@ -34,7 +33,7 @@ export class NavigationComponent {
return this.currentStep !== null && !(this.isPrevHidden || this.isLastStep);
}
public showNextButton(): boolean {
return !this.hideNavButtons;
return !this.isNextHidden;
}
public nextPage(isPrint?: boolean): void {
......
......@@ -10,7 +10,7 @@
[label]="option.title"
[description]="option.hint"
[iconName]="option.icon"
[selected]="currentNeed === option.key"
[selected]="needType === option.key"
(click)="selectNeed(option.key)"
/>
</div>
......
......@@ -4,40 +4,40 @@ import { PersonalOffer } from '../../../../models/personalOffer.model';
import { OrientationService } from '../../../../services/orientation.service';
import { PersonalOfferService } from '../../../../services/personal-offer.service';
import { INeedItem } from '../../../../utils/orientationUtils';
import { NeedsType } from '../../enums/orientation.enums';
import { NeedsTypes } from '../../enums/orientation.enums';
@Component({
selector: 'app-needs-selection',
templateUrl: './needs-selection.component.html',
})
export class NeedsSelectionComponent implements OnInit {
@Input() currentNeed: NeedsType;
@Output() setNeedType = new EventEmitter<any>();
@Input() needType: NeedsTypes;
@Output() needTypeChange = new EventEmitter<NeedsTypes>();
@Output() validate = new EventEmitter<any>();
public needsList: INeedItem[] = [
{
title: 'Accéder à du matériel numérique en libre service',
hint: '(Wifi, ordinateur, imprimante, scanner…)',
key: NeedsType.equipmentAccess,
key: NeedsTypes.equipmentAccess,
icon: 'orientationIndex0',
},
{
title: 'Acheter du matériel numérique à tarif solidaire',
hint: '(Ordinateur, smartphone, clé 4G, forfait internet…)',
key: NeedsType.equipmentBuy,
key: NeedsTypes.equipmentBuy,
icon: 'orientationIndex1',
},
{
title: 'Réaliser une démarche en ligne',
hint: '(Démarche Caf, CPAM, France Travail…)',
key: NeedsType.onlineDemarch,
key: NeedsTypes.onlineDemarch,
icon: 'orientationIndex2',
},
{
title: 'Acquérir les compétences numériques de base',
hint: '(Ordinateur et smartphone, mails, réseaux sociaux et bureautique...)',
key: NeedsType.learnSkills,
key: NeedsTypes.baseSkills,
icon: 'orientationIndex3',
},
];
......@@ -50,7 +50,7 @@ export class NeedsSelectionComponent implements OnInit {
ngOnInit(): void {
if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
this.needsList = this.needsList.filter(
(item) => item.key === NeedsType.onlineDemarch || item.key === NeedsType.learnSkills,
(item) => item.key === NeedsTypes.onlineDemarch || item.key === NeedsTypes.baseSkills,
);
}
......@@ -73,7 +73,7 @@ export class NeedsSelectionComponent implements OnInit {
}
public selectNeed(event: string): void {
this.setNeedType.emit(event);
this.needTypeChange.emit(event as NeedsTypes);
this.validate.emit();
}
}
......@@ -5,7 +5,7 @@ import { Owner } from '../../../../models/owner.model';
import { Structure } from '../../../../models/structure.model';
import { Module } from '../../../../structure-list/models/module.model';
import { Utils } from '../../../../utils/utils';
import { RecapsType } from '../../enums/orientation.enums';
import { AccompanimentTypes } from '../../enums/orientation.enums';
@Component({
selector: 'app-orientation-recap',
......@@ -14,7 +14,7 @@ import { RecapsType } from '../../enums/orientation.enums';
})
export class OrientationRecapComponent implements OnInit {
@Input() form: UntypedFormGroup;
@Input() recapType: RecapsType;
@Input() accompanimentType: AccompanimentTypes;
@Input() socialWorker?: Owner;
@Input() structureRDV?: Structure;
@Input() isToPrint = true;
......@@ -34,7 +34,7 @@ export class OrientationRecapComponent implements OnInit {
this.checkValidation.emit();
// When requesting for an appointments, we save Filters within the form 'onlineDemarcheType',
// instead of Modules within the form 'filters'. This harmonizes it.
if (this.recapType === RecapsType.appointment) {
if (this.accompanimentType === AccompanimentTypes.appointment) {
this.needs = this.utils.convertFiltersToModule(this.form.get('onlineDemarcheType').value);
} else {
this.needs = this.form.get('filters').value;
......@@ -43,28 +43,23 @@ export class OrientationRecapComponent implements OnInit {
name: this.form.get('name').value,
surname: this.form.get('surname').value,
};
switch (this.recapType) {
case RecapsType.onlineMediation:
this.handleOnlineOrientationRecap();
switch (this.accompanimentType) {
case AccompanimentTypes.structuresList:
this.handleStructureRecap();
break;
case RecapsType.appointment:
case AccompanimentTypes.appointment:
this.handleAppointmentRecap();
break;
case RecapsType.structure:
this.handleStructureRecap();
case AccompanimentTypes.onlineMediation:
this.handleOnlineOrientationRecap();
break;
default:
throw new Error(`Not implemented recap type ${this.recapType}`);
throw new Error(`Not implemented recap type ${this.accompanimentType}`);
}
}
public shouldDisplayAppointmentRecap(): boolean {
return this.recapType === RecapsType.appointment;
}
public handleAppointmentRecap(): void {
this.comment = this.form.get('details').value;
this.orientator = this.form.get('structureOrientator').value;
return this.accompanimentType === AccompanimentTypes.appointment;
}
public handleStructureRecap(): void {
......@@ -72,11 +67,10 @@ export class OrientationRecapComponent implements OnInit {
this.structuresToPrint = this.form.get('structureChoice').value;
this.orientator = this.form.get('structureOrientator').value;
}
public isOrientator(): boolean {
return Boolean(this.orientator?.structureName);
public handleAppointmentRecap(): void {
this.comment = this.form.get('details').value;
this.orientator = this.form.get('structureOrientator').value;
}
public handleOnlineOrientationRecap(): void {
this.comment = this.form.get('comments').value;
this.orientator = this.form.get('structureOrientator').value;
......@@ -91,29 +85,33 @@ export class OrientationRecapComponent implements OnInit {
};
}
public isOrientator(): boolean {
return Boolean(this.orientator?.structureName);
}
public getRecapTitle(): string {
switch (this.recapType) {
case RecapsType.structure:
switch (this.accompanimentType) {
case AccompanimentTypes.structuresList:
return 'Orientation vers un lieu de médiation numérique';
case RecapsType.appointment:
case AccompanimentTypes.appointment:
return 'Demande de rendez-vous d’aide numérique';
case RecapsType.onlineMediation:
case AccompanimentTypes.onlineMediation:
return 'Rappel téléphonique';
default:
throw new Error(`Not implemented recap type ${this.recapType}`);
throw new Error(`Not implemented recap type ${this.accompanimentType}`);
}
}
public getRecapInfo(): string | null {
switch (this.recapType) {
case RecapsType.structure:
switch (this.accompanimentType) {
case AccompanimentTypes.structuresList:
return null;
case RecapsType.appointment:
case AccompanimentTypes.appointment:
return 'Votre demande de rendez-vous d’aide numérique a bien été envoyée.<br>Un·e professionnel·le vous rappellera pour fixer une date.';
case RecapsType.onlineMediation:
case AccompanimentTypes.onlineMediation:
return 'Vous avez effectué une demande de rappel téléphonique.<br>Vous serez contacté(e) par un·e professionnel·le pour le créneau sélectionné.';
default:
throw new Error(`Not implemented recap type ${this.recapType}`);
throw new Error(`Not implemented recap type ${this.accompanimentType}`);
}
}
......
......@@ -4,8 +4,8 @@ import { Module } from '../../../../structure-list/models/module.model';
@Component({ template: `` })
export class SelectComponent {
@Input() form: FormGroup;
@Output() checkValidation = new EventEmitter<any>();
@Input() filtersForm: FormGroup;
@Output() checkValidation = new EventEmitter<void>();
public equipmentType: Module[] = [];
public selectedModules: Module[] = [];
......@@ -16,7 +16,7 @@ export class SelectComponent {
} else {
this.selectedModules.push(module);
}
this.form.get('filters').patchValue(this.selectedModules);
this.filtersForm.get('filters').patchValue(this.selectedModules);
this.checkValidation.emit();
}
......
......@@ -37,6 +37,7 @@ export class StructureOrientatorComponent implements OnInit {
} else {
this.hasStructures = false;
}
this.validatePage.emit(this.form.valid);
}
public select(structure: Structure): void {
......
......@@ -8,7 +8,7 @@
</div>
<!-- If need to select a social worker -->
<section *ngIf="owners?.length > 0">
<section *ngIf="!comingFromRegistry">
<div class="header-card">
<app-card [structure]="structureRDV" [redirectToStructure]="false" />
</div>
......@@ -31,7 +31,7 @@
</section>
<!-- If need to select a structure -->
<section *ngIf="structures?.length > 0">
<section *ngIf="comingFromRegistry">
<div class="header-card">
<app-member-card
[member]="orientationService.rdvUser"
......@@ -50,7 +50,7 @@
[structure]="structure"
[redirectToStructure]="false"
[showRadioButton]="true"
[isChecked]="selectedOption === structure._id"
[isChecked]="this.form.get('structureRDV')?.value === structure._id"
(selectedStructure)="onStructureRadioChange(structure)"
/>
</div>
......
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