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
Showing
with 354 additions and 369 deletions
......@@ -34,6 +34,7 @@ export class StructurePrintHeaderComponent implements OnInit {
minute: 'numeric',
});
//TODO: refactor after merging with new orientation
this.filters.forEach((elem) => {
switch (elem.name) {
case 'proceduresAccompaniment':
......
......@@ -7,7 +7,6 @@ import { Structure } from '../../models/structure.model';
import { GeojsonService } from '../../services/geojson.service';
import { RouterListenerService } from '../../services/routerListener.service';
import { StructureService } from '../../services/structure.service';
import { CategoryEnum } from '../../shared/enum/category.enum';
import { Category } from '../../structure-list/models/category.model';
import { Filter } from '../../structure-list/models/filter.model';
import { Module } from '../../structure-list/models/module.model';
......@@ -59,11 +58,6 @@ export class OrientationFormComponent implements OnInit {
public assistance: Module[] = [];
public formation: Module[] = [];
public selectedFormations: Category[] = [];
public baseSkillssReferentiel: Category;
public accessRightsReferentiel: Category;
public digitalCultureSecuritysReferentiel: Category;
public socialAndProfessionalsReferentiel: Category;
public parentingHelpsReferentiel: Category;
public assistanceReferentiel: Category;
public equipmentReferentiel: Category;
......@@ -98,54 +92,53 @@ export class OrientationFormComponent implements OnInit {
});
}
//TODO: refactor
private async setCategories(): Promise<void> {
this.searchService.getCategoriesAccompaniment().subscribe((categories: Category[]) => {
this.assistanceReferentiel = categories[0];
this.assistance = categories[0].modules;
});
const categs = await this.searchService.getCategoriesTraining().toPromise();
categs.forEach((categ) => {
this.selectedFormations.push(categ);
categ.modules.forEach((module) => {
this.formation.push(module);
});
});
this.searchService.getCategoriesTraining().subscribe((referentiels) => {
referentiels.forEach((referentiel) => {
if (referentiel.isBaseSkills()) {
this.baseSkillssReferentiel = referentiel;
} else if (referentiel.isRigthtsAccess()) {
this.accessRightsReferentiel = referentiel;
} else if (referentiel.isDigitalCultureSecurity()) {
this.digitalCultureSecuritysReferentiel = referentiel;
} else if (referentiel.isParentingHelp()) {
this.parentingHelpsReferentiel = referentiel;
} else if (referentiel.isSocialAndProfessional()) {
this.socialAndProfessionalsReferentiel = referentiel;
}
});
});
const equipmentsCategs = await this.searchService.getCategoriesOthers().toPromise();
equipmentsCategs.forEach((categ) => {
if (categ.id == CategoryEnum.equipmentsAndServices) {
categ.modules = this.filterOnlyEquipments(categ.modules);
this.equipmentReferentiel = categ;
categ.modules.forEach((c) => {
this.equipments.push(c);
});
}
});
const specificProfileCategs = await this.searchService.getCategoriesOthers().toPromise();
specificProfileCategs.forEach((categ) => {
switch (categ.id) {
case CategoryEnum.publicsAccompaniment: {
this.specificProfile = categ;
break;
}
}
});
// this.searchService.getCategoriesAccompaniment().subscribe((categories: Category[]) => {
// this.assistanceReferentiel = categories[0];
// this.assistance = categories[0].modules;
// });
// const categs = await this.searchService.getCategoriesTraining().toPromise();
// categs.forEach((categ) => {
// this.selectedFormations.push(categ);
// categ.modules.forEach((module) => {
// this.formation.push(module);
// });
// });
// this.searchService.getCategoriesTraining().subscribe((referentiels) => {
// referentiels.forEach((referentiel) => {
// if (referentiel.isBaseSkills()) {
// this.baseSkillssReferentiel = referentiel;
// } else if (referentiel.isRigthtsAccess()) {
// this.accessRightsReferentiel = referentiel;
// } else if (referentiel.isDigitalCultureSecurity()) {
// this.digitalCultureSecuritysReferentiel = referentiel;
// } else if (referentiel.isParentingHelp()) {
// this.parentingHelpsReferentiel = referentiel;
// } else if (referentiel.isSocialAndProfessional()) {
// this.socialAndProfessionalsReferentiel = referentiel;
// }
// });
// });
// const equipmentsCategs = await this.searchService.getCategoriesOthers().toPromise();
// equipmentsCategs.forEach((categ) => {
// if (categ.id == CategoryEnum.equipmentsAndServices) {
// categ.modules = this.filterOnlyEquipments(categ.modules);
// this.equipmentReferentiel = categ;
// categ.modules.forEach((c) => {
// this.equipments.push(c);
// });
// }
// });
// const specificProfileCategs = await this.searchService.getCategoriesOthers().toPromise();
// specificProfileCategs.forEach((categ) => {
// switch (categ.id) {
// case CategoryEnum.publicsAccompaniment: {
// this.specificProfile = categ;
// break;
// }
// }
// });
}
private createOrientationForm(orientationFormFilters: OrientationFormFilters): UntypedFormGroup {
......@@ -161,7 +154,10 @@ export class OrientationFormComponent implements OnInit {
commune: new UntypedFormControl('', Validators.required),
postcode: new UntypedFormControl(''),
}),
structureAccompaniment: new UntypedFormControl(orientationFormFilters.structureAccompaniment, Validators.required),
structureAccompaniment: new UntypedFormControl(
orientationFormFilters.structureAccompaniment,
Validators.required
),
contactAccompanimentPhone: new UntypedFormControl(
orientationFormFilters.contactAccompanimentPhone,
Validators.pattern(CustomRegExp.PHONE)
......@@ -409,7 +405,7 @@ export class OrientationFormComponent implements OnInit {
let name;
this.equipmentReferentiel.modules.forEach((elem) => {
if (elem.id === equipment) {
name = elem.text;
name = elem.name;
}
});
return name;
......@@ -419,7 +415,7 @@ export class OrientationFormComponent implements OnInit {
let name;
this.assistanceReferentiel.modules.forEach((elem) => {
if (elem.id === skill) {
name = elem.text;
name = elem.name;
}
});
......
......@@ -171,7 +171,7 @@ export class MapComponent implements OnChanges {
* @returns {MarkerType}
*/
private getMarkerType(structure: Structure): MarkerType {
return structure?.labelsQualifications?.includes('conseillerNumFranceServices')
return structure?.categories?.labelsQualifications?.includes('conseillerNumFranceServices')
? MarkerType.conseillerFrance
: MarkerType.structure;
}
......
import { Category } from '../structure-list/models/category.model';
export class CategoriesToggle {
category: Category;
openned: boolean;
}
export class PersonalOffer {
public publicsAccompaniment: string[] = [];
public proceduresAccompaniment: string[] = [];
public baseSkills: string[] = [];
public accessRight: string[] = [];
public digitalCultureSecurity: string[] = [];
public socialAndProfessional: string[] = [];
public parentingHelp: string[] = [];
public categories: { [key: string]: string[] };
constructor(obj?: any) {
Object.assign(this, obj, {
categories: {
accessModality: obj?.categories?.accessModality || [],
advancedSkills: obj?.categories?.advancedSkills || [],
age: obj?.categories?.age || [],
baseSkills: obj?.categories?.baseSkills || [],
handicaps: obj?.categories?.handicaps || [],
labelsQualifications: obj?.categories?.labelsQualifications || [],
languageAndIlliteracy: obj?.categories?.languageAndIlliteracy || [],
onlineProcedures: obj?.categories?.onlineProcedures || [],
publicOthers: obj?.categories?.publicOthers || [],
},
});
}
}
......@@ -34,30 +34,19 @@ export class Structure {
public contactPersonFirstName: string = null;
public contactPersonLastName: string = null;
public contactPersonEmail: string = null;
public publicsAccompaniment: string[] = [];
public proceduresAccompaniment: string[] = [];
public categories: { [key: string]: string[] };
public categoriesDisplay: { [key: string]: string[] };
public remoteAccompaniment: boolean = null;
public accessModality: string[] = [];
public labelsQualifications: string[] = [];
public publics: string[] = [];
public nbComputers: number = null;
public nbPrinters: number = null;
public nbTablets: number = null;
public nbNumericTerminal: number = null;
public nbScanners: number = null;
public exceptionalClosures: string = null;
public equipmentsAndServices: string[] = [];
public hours: Week;
public freeWorkShop: boolean = null;
public otherDescription: string = null;
public isOpen: boolean = false;
public openedOn: OpeningDay = new OpeningDay();
public baseSkills: string[] = [];
public accessRight: string[] = [];
public parentingHelp: string[] = [];
public socialAndProfessional: string[] = [];
public digitalCultureSecurity: string[] = [];
public distance?: number;
public coord?: number[] = [];
......@@ -74,6 +63,19 @@ export class Structure {
constructor(obj?: any) {
Object.assign(this, obj, {
hours: obj && obj.hours ? new Week(obj.hours) : new Week(),
categories: {
accessModality: obj?.categories?.accessModality || [],
advancedSkills: obj?.categories?.advancedSkills || [],
age: obj?.categories?.age || [],
baseSkills: obj?.categories?.baseSkills || [],
handicaps: obj?.categories?.handicaps || [],
labelsQualifications: obj?.categories?.labelsQualifications || [],
languageAndIlliteracy: obj?.categories?.languageAndIlliteracy || [],
onlineProcedures: obj?.categories?.onlineProcedures || [],
publicOthers: obj?.categories?.publicOthers || [],
selfServiceMaterial: obj?.categories?.selfServiceMaterial || [],
equipmentsServices: obj?.categories?.equipmentsServices || [],
},
});
}
......@@ -102,7 +104,7 @@ export class Structure {
* Check if a structure has equipments
*/
public hasEquipments(): boolean {
if (this.equipmentsAndServices.length && this.hasNotOnlyEmptyEquipments()) {
if (this.categories.selfServiceMaterial.length && this.hasNotOnlyEmptyEquipments()) {
return true;
}
return false;
......@@ -113,7 +115,7 @@ export class Structure {
* @returns {Boolean} validation
*/
public hasNotOnlyEmptyEquipments(): boolean {
if (this.nbComputers + this.nbPrinters + this.nbTablets + this.nbNumericTerminal + this.nbScanners > 0) return true;
if (this.nbComputers + this.nbPrinters + this.nbScanners > 0) return true;
return false;
}
......@@ -121,7 +123,7 @@ export class Structure {
* Check if a structure has pass Numeric label
*/
public hasPassNumeric(): boolean {
return this.labelsQualifications.includes('passNumerique');
return this.categories.labelsQualifications.includes('passNumerique');
}
/**
......@@ -157,13 +159,9 @@ export class Structure {
public getEquipmentsIcon(equipment: Equipment): string {
switch (equipment) {
case Equipment.wifi:
return 'wifi';
case Equipment.bornes:
return 'borne';
return 'wifiEnAccesLibre';
case Equipment.printer:
return 'print';
case Equipment.tablet:
return 'tablet';
case Equipment.computer:
return 'computer';
case Equipment.scanner:
......@@ -177,12 +175,8 @@ export class Structure {
switch (equipment) {
case Equipment.wifi:
return 'Wifi en accès libre';
case Equipment.bornes:
return this.nbNumericTerminal > 1 ? 'Bornes numériques' : 'Borne numérique';
case Equipment.printer:
return this.nbPrinters > 1 ? 'Imprimantes' : 'Imprimante';
case Equipment.tablet:
return this.nbTablets > 1 ? 'Tablettes' : 'Tablette';
case Equipment.computer:
return this.nbComputers > 1 ? 'Ordinateurs' : 'Ordinateur';
case Equipment.scanner:
......
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { User } from '../../models/user.model';
import decode from 'jwt-decode';
import { UserRole } from '../../shared/enum/userRole.enum';
import { AuthService } from '../../services/auth.service';
import { Structure } from '../../models/structure.model';
import { Observable } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { Employer } from '../../models/employer.model';
import { Job } from '../../models/job.model';
import { catchError, map } from 'rxjs/operators';
import { Structure } from '../../models/structure.model';
import { User } from '../../models/user.model';
import { AuthService } from '../../services/auth.service';
import { NotificationService } from '../../services/notification.service';
import { UserRole } from '../../shared/enum/userRole.enum';
@Injectable({
providedIn: 'root',
......@@ -116,7 +116,6 @@ export class ProfileService {
}
public updateDetails(newDetails: { name: string; surname: string; phone: string }): Observable<User | Error> {
console.log('profile service updates details');
return this.http.post<User>(`${this.baseUrl}/details`, newDetails).pipe(
map((user) => user),
catchError(() => {
......
......@@ -86,11 +86,11 @@
></app-button>
</div>
<div class="content">
<app-missing-information *ngIf="!isFieldValid('accessModality')"></app-missing-information>
<ng-container *ngIf="isFieldValid('accessModality')">
<div class="list" *ngFor="let accessModality of structure.accessModality">
<app-missing-information *ngIf="!isFieldValid('accessModality', 'categories')"></app-missing-information>
<ng-container *ngIf="isFieldValid('accessModality', 'categories')">
<div class="list" *ngFor="let accessModality of structure.categoriesDisplay.accessModality">
<p class="accessModilty">
{{ getAccessLabel(accessModality) }}
{{ accessModality }}
</p>
</div>
</ng-container>
......@@ -241,10 +241,48 @@
></app-button>
</div>
<div class="content">
<app-missing-information *ngIf="!isFieldValid('publics')"></app-missing-information>
<ng-container *ngIf="isFieldValid('publics')">
<div *ngFor="let public of structure.publics" class="list">
<p>{{ getPublicLabel(public) }}</p>
<ng-container *ngIf="isFieldValid('age', 'categories') && structure.categoriesDisplay.age">
<div *ngFor="let public of structure.categoriesDisplay.age" class="list">
<p>{{ public }}</p>
</div>
</ng-container>
</div>
<div class="content">
<ng-container
*ngIf="
isFieldValid('languageAndIlliteracy', 'categories') &&
structure.categoriesDisplay &&
structure.categoriesDisplay.languageAndIlliteracy
"
>
<div *ngFor="let public of structure.categoriesDisplay.languageAndIlliteracy" class="list">
<p>{{ public }}</p>
</div>
</ng-container>
</div>
<div class="content">
<ng-container
*ngIf="
isFieldValid('handicaps', 'categories') &&
structure.categoriesDisplay &&
structure.categoriesDisplay.handicaps
"
>
<div *ngFor="let public of structure.categoriesDisplay.handicaps" class="list">
<p>{{ public }}</p>
</div>
</ng-container>
</div>
<div class="content">
<ng-container
*ngIf="
isFieldValid('publicOthers', 'categories') &&
structure.categoriesDisplay &&
structure.categoriesDisplay.publicOthers
"
>
<div *ngFor="let public of structure.categoriesDisplay.publicOthers" class="list">
<p>{{ public }}</p>
</div>
</ng-container>
</div>
......@@ -252,7 +290,7 @@
<div class="section proceduresAccompaniment">
<div class="sectionHeader">
<p>Aides au numérique proposés</p>
<p>Aide au numérique</p>
<app-button
[type]="'button'"
[text]="'Modifier'"
......@@ -264,13 +302,32 @@
<div class="content">
<app-no-information *ngIf="!containsDigitalHelp()"></app-no-information>
<ng-container *ngIf="containsDigitalHelp()">
<div *ngFor="let digitalHelp of structure.proceduresAccompaniment" class="list">
<p>{{ getDigitalHelpLabel(digitalHelp) }}</p>
<div *ngFor="let digitalHelp of structure.categoriesDisplay.onlineProcedures" class="list">
<p>{{ digitalHelp }}</p>
</div>
</ng-container>
</div>
</div>
<div class="section proceduresAccompaniment">
<div class="sectionHeader">
<p>Autres démarches proposées</p>
<app-button
[type]="'button'"
[text]="'Modifier'"
[style]="buttonTypeEnum.Secondary"
[extraClass]="'editButton'"
(action)="goToEdit(structureFormStep.structureDigitalHelpingAccompanimentOther)"
></app-button>
</div>
<div class="content">
<app-no-information *ngIf="!structure.otherDescription"></app-no-information>
<ng-container *ngIf="structure.otherDescription">
<p>{{ structure.otherDescription }}</p>
</ng-container>
</div>
</div>
<div class="section learning">
<div class="sectionHeader">
<p>Formation au numérique proposés</p>
......@@ -299,40 +356,16 @@
</div>
</div>
<div class="detailsContainer" [@show]="showBaseSkills">
<div class="details" *ngFor="let skill of baseSkills">
{{ skill.text }}
</div>
</div>
</div>
</div>
<div *ngIf="isParentingHelp()" class="collapse" [ngClass]="{ notCollapsed: !showParentingHelp }">
<div>
<div class="collapseHeader" (click)="toggleParentingHelp()">
<div class="titleCollapse">Aide à la parentalité</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#unfold'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#fold'"></use>
</svg>
</div>
</div>
<div class="detailsContainer" [@show]="showParentingHelp">
<div class="details" *ngFor="let help of parentingHelp">
{{ help.text }}
<div class="details" *ngFor="let skill of structure.categoriesDisplay.baseSkills">
{{ skill }}
</div>
</div>
</div>
</div>
<div
*ngIf="isSocialAndProfessional()"
class="collapse"
[ngClass]="{ notCollapsed: !showSocialAndProfessional }"
>
<div *ngIf="isAdvancedSkills()" class="collapse" [ngClass]="{ notCollapsed: !showAdvancedSkills }">
<div>
<div class="collapseHeader" (click)="toggleSocialAndProfessional()">
<div class="titleCollapse">Insertion sociale et professionnelle</div>
<div class="collapseHeader" (click)="toogleAdvancedSkills()">
<div class="titleCollapse">Culture numérique</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#unfold'"></use>
......@@ -342,49 +375,9 @@
</svg>
</div>
</div>
<div class="detailsContainer" [@show]="showSocialAndProfessional">
<div class="details" *ngFor="let skill of socialAndProfessional">
{{ skill.text }}
</div>
</div>
</div>
</div>
<div *ngIf="isAccessRights()" class="collapse" [ngClass]="{ notCollapsed: !showAccessRights }">
<div>
<div class="collapseHeader" (click)="toggleAccessRights()">
<div class="titleCollapse">Accès aux droits</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#unfold'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#fold'"></use>
</svg>
</div>
</div>
<div class="detailsContainer" [@show]="showAccessRights">
<div class="details" *ngFor="let rights of accessRights">
{{ rights.text }}
</div>
</div>
</div>
</div>
<div *ngIf="isDigitalSecurity()" class="collapse" [ngClass]="{ notCollapsed: !showDigitalSecurity }">
<div>
<div class="collapseHeader" (click)="toggleDigitalSecurity()">
<div class="titleCollapse">Culture et sécurité numérique</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#unfold'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#fold'"></use>
</svg>
</div>
</div>
<div class="detailsContainer" [@show]="showDigitalSecurity">
<div class="details" *ngFor="let skill of digitalCultureSecurity">
{{ skill.text }}
<div class="detailsContainer" [@show]="showAdvancedSkills">
<div class="details" *ngFor="let help of structure.categoriesDisplay.advancedSkills">
{{ help }}
</div>
</div>
</div>
......@@ -423,7 +416,7 @@
</div>
<div class="content">
<p>
{{ hasWifi(structure.equipmentsAndServices) ? 'Oui' : 'Non' }}
{{ hasWifi(structure.categories.selfServiceMaterial) ? 'Oui' : 'Non' }}
</p>
</div>
</div>
......@@ -441,16 +434,11 @@
</div>
<div class="content">
<app-no-information *ngIf="!hasEquipments(structure)"></app-no-information>
<div *ngIf="!!filterOnlyEquipments(structure.equipmentsAndServices)">
<!-- TODO: refactor -->
<div *ngIf="!!filterOnlyEquipments(structure.categories.selfServiceMaterial)">
<p *ngIf="structure.nbComputers">
{{ getEquipmentsLabelAndValue(equipmentEnum.computer, structure.nbComputers) }}
</p>
<p *ngIf="structure.nbTablets">
{{ getEquipmentsLabelAndValue(equipmentEnum.tablet, structure.nbTablets) }}
</p>
<p *ngIf="structure.nbNumericTerminal">
{{ getEquipmentsLabelAndValue(equipmentEnum.bornes, structure.nbNumericTerminal) }}
</p>
<p *ngIf="structure.nbPrinters">
{{ getEquipmentsLabelAndValue(equipmentEnum.printer, structure.nbPrinters) }}
</p>
......@@ -473,8 +461,8 @@
></app-button>
</div>
<div class="content">
<app-no-information *ngIf="structure.labelsQualifications.length === 0"></app-no-information>
<div *ngFor="let labels of structure.labelsQualifications">
<app-no-information *ngIf="structure.categories.labelsQualifications.length === 0"></app-no-information>
<div *ngFor="let labels of structure.categories.labelsQualifications">
<app-logo-card [name]="labels"></app-logo-card>
</div>
</div>
......@@ -493,10 +481,13 @@
</div>
<div class="content">
<app-no-information
*ngIf="filterOtherServices(structure.equipmentsAndServices).length === 0"
*ngIf="
structure.categoriesDisplay.equipmentsServices &&
structure.categoriesDisplay.equipmentsServices.length === 0
"
></app-no-information>
<div *ngFor="let equipement of filterOtherServices(structure.equipmentsAndServices)" class="list">
<p>{{ getOtherServicesLabel(equipement) }}</p>
<div *ngFor="let equipement of structure.categoriesDisplay.equipmentsServices" class="list">
<p>{{ equipement }}</p>
</div>
</div>
</div>
......
......@@ -163,7 +163,7 @@
border-top: 1px solid $grey-4;
p.warning {
color: $orange-warning;
margin: 1rem 0 0 0;
margin: 1rem;
}
.buttons {
display: flex;
......
......@@ -2,7 +2,6 @@ import { animate, AUTO_STYLE, state, style, transition, trigger } from '@angular
import { Component, OnInit } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import * as lodash from 'lodash';
import { DateTime } from 'luxon';
import { structureFormStep } from '../../form/form-view/structure-form/structureFormStep.enum';
import { Structure } from '../../models/structure.model';
......@@ -11,12 +10,9 @@ import { StructureService } from '../../services/structure.service';
import { ButtonType } from '../../shared/components/button/buttonType.enum';
import { Demarches } from '../../shared/enum/demarches.enum';
import { FreeWorkshop } from '../../shared/enum/freeWorkshop.enum';
import { OtherServices } from '../../shared/enum/otherServices.enum';
import { AccessModality } from '../../structure-list/enum/access-modality.enum';
import { Equipment } from '../../structure-list/enum/equipment.enum';
import { PublicCategorie } from '../../structure-list/enum/public.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 { formUtils, IStructureSummary } from '../../utils/formUtils';
import { Utils } from '../../utils/utils';
......@@ -43,22 +39,9 @@ export class StructureEditionSummaryComponent implements OnInit {
public equipmentEnum = Equipment;
//Digital learning
public baseSkillssReferentiel: Category;
public accessRightsReferentiel: Category;
public digitalCultureSecuritysReferentiel: Category;
public socialAndProfessionalsReferentiel: Category;
public parentingHelpsReferentiel: Category;
public baseSkills: Module[];
public accessRights: Module[];
public parentingHelp: Module[];
public socialAndProfessional: Module[];
public digitalCultureSecurity: Module[];
public categories: Category[] = [];
public showBaseSkills = false;
public showAccessRights = false;
public showParentingHelp = false;
public showSocialAndProfessional = false;
public showDigitalSecurity = false;
public showAdvancedSkills = false;
public mailHref: string;
// set to true when last updated date of a structure is > 6 months
public isUpdateStructure = false;
......@@ -85,13 +68,13 @@ export class StructureEditionSummaryComponent implements OnInit {
const sixMonthsAgo = DateTime.local().minus({ month: 6 });
if (updatedAt < sixMonthsAgo) this.isUpdateStructure = true;
}
this.initForm();
});
}
public goBack(): void {
history.back();
}
public goToEdit(step: structureFormStep): void {
this.router.navigate(['/form/structure', this.structure._id, structureFormStep[step]]);
}
......@@ -127,14 +110,16 @@ export class StructureEditionSummaryComponent implements OnInit {
}
public containsHours(): boolean {
let contains = false;
for (const day in this.structure.hours) {
if (this.structure.hours[day].time.length) contains = true;
if (this.structure.hours[day].time.length) return true;
}
return contains;
return false;
}
public isFieldValid(field: string): boolean {
public isFieldValid(field: string, theme?: string): boolean {
if (theme) {
return this.structureForm.get(theme).get([field]).valid;
}
return this.structureForm.get([field]).valid;
}
......@@ -146,97 +131,35 @@ export class StructureEditionSummaryComponent implements OnInit {
return this.utils.hasWebsite(this.structure);
}
public getPublicLabel(tagetPublic: PublicCategorie): string {
return this.utils.getPublicLabel(tagetPublic);
}
public containsDigitalHelp(): boolean {
return !!this.structure.proceduresAccompaniment.length;
return (
this.structure.categoriesDisplay.onlineProcedures?.length > 0
);
}
public getDigitalHelpLabel(digitalHelp: Demarches): string {
return this.utils.getDigitalHelpLabel(digitalHelp);
}
// Digital learning
private async initForm(): Promise<void> {
this.searchService.getCategoriesTraining().subscribe((referentiels) => {
referentiels.forEach((referentiel) => {
if (referentiel.isBaseSkills()) {
this.baseSkillssReferentiel = referentiel;
} else if (referentiel.isRigthtsAccess()) {
this.accessRightsReferentiel = referentiel;
} else if (referentiel.isDigitalCultureSecurity()) {
this.digitalCultureSecuritysReferentiel = referentiel;
} else if (referentiel.isParentingHelp()) {
this.parentingHelpsReferentiel = referentiel;
} else if (referentiel.isSocialAndProfessional()) {
this.socialAndProfessionalsReferentiel = referentiel;
}
});
this.setServiceCategories();
});
const index = this.structure.proceduresAccompaniment.indexOf('autres');
if (index > -1) {
this.structure.proceduresAccompaniment.splice(index, 1);
}
}
public setServiceCategories(): void {
this.baseSkills = this.structure.baseSkills.map((skill) =>
lodash.find(this.baseSkillssReferentiel.modules, { id: skill })
);
this.accessRights = this.structure.accessRight.map((rights) =>
lodash.find(this.accessRightsReferentiel.modules, { id: rights })
);
this.parentingHelp = this.structure.parentingHelp.map((help) =>
lodash.find(this.parentingHelpsReferentiel.modules, { id: help })
);
this.socialAndProfessional = this.structure.socialAndProfessional.map((skill) =>
lodash.find(this.socialAndProfessionalsReferentiel.modules, { id: skill })
);
this.digitalCultureSecurity = this.structure.digitalCultureSecurity.map((skill) =>
lodash.find(this.digitalCultureSecuritysReferentiel.modules, { id: skill })
);
}
public isBaseSkills(): boolean {
return this.baseSkills && this.baseSkills[0] !== undefined;
return this.structure.categories.baseSkills?.length > 0;
}
public isAccessRights(): boolean {
return this.accessRights && this.accessRights[0] !== undefined;
}
public isParentingHelp(): boolean {
return this.parentingHelp && this.parentingHelp[0] !== undefined;
}
public isSocialAndProfessional(): boolean {
return this.socialAndProfessional && this.socialAndProfessional[0] !== undefined;
}
public isDigitalSecurity(): boolean {
return this.digitalCultureSecurity && this.digitalCultureSecurity[0] !== undefined;
}
public containsDigitalLearning(): boolean {
public isAdvancedSkills(): boolean {
return (
this.isAccessRights() ||
this.isBaseSkills() ||
this.isDigitalSecurity() ||
this.isParentingHelp() ||
this.isSocialAndProfessional()
this.structure.categories.advancedSkills?.length > 0
);
}
public containsDigitalLearning(): boolean {
return this.isBaseSkills() || this.isAdvancedSkills();
}
public toggleBaseSkills(): void {
this.showBaseSkills = !this.showBaseSkills;
}
public toggleAccessRights(): void {
this.showAccessRights = !this.showAccessRights;
}
public toggleParentingHelp(): void {
this.showParentingHelp = !this.showParentingHelp;
}
public toggleSocialAndProfessional(): void {
this.showSocialAndProfessional = !this.showSocialAndProfessional;
}
public toggleDigitalSecurity(): void {
this.showDigitalSecurity = !this.showDigitalSecurity;
public toogleAdvancedSkills(): void {
this.showAdvancedSkills = !this.showAdvancedSkills;
}
public getWorkshopPricingLabel(freeWorkshop: FreeWorkshop): string {
......@@ -249,12 +172,10 @@ export class StructureEditionSummaryComponent implements OnInit {
public hasEquipments(structure: Structure): boolean {
return this.utils.hasEquipments(
structure.equipmentsAndServices,
structure.categories.selfServiceMaterial,
structure.nbComputers,
structure.nbNumericTerminal,
structure.nbPrinters,
structure.nbScanners,
structure.nbTablets
structure.nbScanners
);
}
......@@ -265,12 +186,4 @@ export class StructureEditionSummaryComponent implements OnInit {
public getEquipmentsLabelAndValue(equipment: Equipment, number: number): string {
return this.utils.getEquipmentsLabelAndValue(equipment, number);
}
public filterOtherServices(equipmentsAndServices: string[]) {
return this.utils.filterOtherServices(equipmentsAndServices);
}
public getOtherServicesLabel(otherService: OtherServices) {
return this.utils.getOtherServicesLabel(otherService);
}
}
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { map, catchError } from 'rxjs/operators';
import { forkJoin, Observable, Subject } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { Structure } from '../models/structure.model';
import { StructureService } from '../services/structure.service';
import { Category } from '../structure-list/models/category.model';
import { Module } from '../structure-list/models/module.model';
import { SearchService } from '../structure-list/services/search.service';
@Injectable()
export class StructureResolver implements Resolve<Structure> {
constructor(private structureService: StructureService, private router: Router) {}
public subject: Subject<Structure> = new Subject();
constructor(
private structureService: StructureService,
private searchService: SearchService,
private router: Router
) {}
resolve(route: ActivatedRouteSnapshot): Observable<Structure> {
const structureId = route.params.id;
return this.structureService.getStructure(structureId).pipe(
map((res) => res),
catchError(() => {
this.router.navigate(['/home']);
return new Observable<Structure>();
})
);
if (structureId) {
forkJoin({
structure: this.structureService.getStructure(structureId).pipe(
map((res) => res),
catchError(() => {
this.router.navigate(['/home']);
return new Observable<Structure>();
})
),
categories: this.searchService.getCategories(),
}).subscribe((res) => {
const structure = this.setServiceCategories(res.categories, res.structure);
// return res;
this.setSubject(structure);
});
return this.getSubject();
}
}
setSubject(structure: Structure): void {
this.subject.next(structure);
}
getSubject(): Observable<Structure> {
return this.subject.asObservable();
}
public setServiceCategories(categories: Category[], structure: Structure): Structure {
categories.forEach((category) => {
const structureModuleIds = structure.categories[category.id];
if (structureModuleIds) {
const moduleNames = category.modules
.map((module: Module) => {
if (structureModuleIds.includes(module.id)) {
return module.name;
}
})
.filter((value) => value !== undefined);
structure.categoriesDisplay = {
...structure.categoriesDisplay,
[category.id]: moduleNames,
};
}
});
return structure;
}
}
......@@ -39,7 +39,6 @@ export class StructureService {
structure.dataShareConsentDate = new Date().toString();
}
if (!structureId) structureId = structure._id;
// const id = structure._id;
delete structure._id; // id should not be provided for update
return this.http
.patch(`${this.baseUrl}/${structureId}`, structure)
......
<div fxLayout="row" fxLayoutAlign="start center" *ngIf="name">
<img [src]="'assets/logos/' + name + '.svg'" [alt]="'logo ' + name" />
<img [src]="getPath(name)" [alt]="'logo ' + name" />
<p>{{ getName(name) }}</p>
</div>
......@@ -5,17 +5,21 @@ import { Labels } from '../../enum/labels.emum';
@Component({
selector: 'app-logo-card',
templateUrl: './logo-card.component.html',
styleUrls: ['./logo-card.component.scss']
styleUrls: ['./logo-card.component.scss'],
})
export class LogoCardComponent {
@Input() public logoPath: string;
@Input() public name: string;
public getName(key: string): string {
if (Labels[key]) {
return Labels[key];
} else {
return Demarches[key];
return key;
}
}
public getPath(value: string): string {
let path = Object.entries(Demarches).find(([key, val]) => val === value)?.[0];
return `assets/logos/${path ? path : this.name}.svg`;
}
}
......@@ -25,7 +25,7 @@
<app-button
[extraClass]="isModulePicked(categorie, module) ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="module.text"
[text]="module.name"
(action)="pickChoice(categorie, module)"
></app-button>
</ng-container>
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { cloneDeep, remove } from 'lodash';
import { CategoriesToggle } from 'src/app/models/categoriesToggle.model';
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 { cloneDeep, remove } from 'lodash';
import { CategoryEnum } from '../../enum/category.enum';
import { ButtonType } from '../button/buttonType.enum';
@Component({
......@@ -12,10 +13,8 @@ import { ButtonType } from '../button/buttonType.enum';
})
export class TrainingTypePickerComponent implements OnInit {
@Input() public baseSkills: string[];
@Input() public accessRight: string[];
@Input() public digitalCultureSecurity: string[];
@Input() public socialAndProfessional: string[];
@Input() public parentingHelp: string[];
@Input() public advancedSkills: string[];
@Input() public trainingCategories: CategoriesToggle[];
@Output() selectedType: EventEmitter<Category[]> = new EventEmitter<Category[]>();
public buttonTypeEnum = ButtonType;
......@@ -23,36 +22,27 @@ export class TrainingTypePickerComponent implements OnInit {
public categoriesExpanded: string[] = [];
public selectedChoices: Category[] = [];
constructor(private searchService: SearchService) {}
ngOnInit(): void {
this.searchService.getCategoriesTraining().subscribe((categories) => {
this.categories = categories;
this.selectedChoices = cloneDeep(categories);
this.selectedChoices.forEach((cat) => {
let selectedModulesId: string[] = [];
switch (cat.id) {
case 'accessRight':
selectedModulesId = this.accessRight;
break;
case 'socialAndProfessional':
selectedModulesId = this.socialAndProfessional;
break;
case 'baseSkills':
selectedModulesId = this.baseSkills;
break;
case 'parentingHelp':
selectedModulesId = this.parentingHelp;
break;
case 'digitalCultureSecurity':
selectedModulesId = this.digitalCultureSecurity;
break;
}
if (selectedModulesId.length) {
this.categoriesExpanded.push(cat.id);
}
cat.modules = cat.modules.filter((module) => selectedModulesId.includes(module.id));
});
this.trainingCategories.forEach((data) => {
this.categories.push(data.category);
});
this.selectedChoices = cloneDeep(this.categories);
this.selectedChoices.forEach((category) => {
let selectedModulesId: string[] = [];
switch (category.id) {
case CategoryEnum.baseSkills:
selectedModulesId = this.baseSkills;
break;
case CategoryEnum.advancedSkills:
selectedModulesId = this.advancedSkills;
break;
default:
throw new Error(`Unimplemented training type ${category.id}`);
}
if (selectedModulesId.length) {
this.categoriesExpanded.push(category.id);
}
category.modules = category.modules.filter((module) => selectedModulesId.includes(module.id));
});
}
......
export enum CategoryEnum {
publics = 'publics',
labelsQualifications = 'labelsQualifications',
selfServiceMaterial = 'selfServiceMaterial',
solidarityMaterial = 'solidarityMaterial',
equipmentsServices = 'equipmentsServices',
onlineProcedures = 'onlineProcedures',
baseSkills = 'baseSkills',
advancedSkills = 'advancedSkills',
accessModality = 'accessModality',
publicsAccompaniment = 'publicsAccompaniment',
equipmentsAndServices = 'equipmentsAndServices',
labelsQualifications = 'labelsQualifications',
age = 'age',
languageAndIlliteracy = 'languageAndIlliteracy',
handicaps = 'handicaps',
publicOthers = 'publicOthers',
}
export enum Demarches {
accompagnantCaf = 'CAF',
autres = 'Autres',
carsat = 'CARSAT',
caf = 'CAF',
cpam = 'CPAM',
demarcheMetropolitaine = 'Démarches Métropolitaines',
espacePublicNumeriqueepn = 'Espace public Numérique',
impots = 'Impôts',
logement = 'Logements',
poleEmploi = 'Pôle Emploi',
idDoc = 'Carte d’identité, passeport',
needs = 'Énergie, téléphonie, internet',
foreigners = 'Démarches liées aux étrangers',
franceConnect = 'France Connect',
training = 'Formation (CPF...)',
taxes = 'Impôts',
housing = 'Logement',
retirement = 'Retraite',
health = 'Santé (Ameli...)',
scolarity = 'Scolarité (CROUS…)',
transport = 'Transports (carte grise, permis, TCL…)',
work = 'Travail (Pôle emploi, CESU…)',
autres = 'Autres',
}
export enum DemarchesLogo {
caf = 'caf',
cpam = 'cpam',
idDoc = 'Carte d’identité, passeport',
needs = 'Énergie, téléphonie, internet',
foreigners = 'Démarches liées aux étrangers',
franceConnect = 'France Connect',
training = 'Formation (CPF...)',
taxes = 'Impôts',
housing = 'Logement',
retirement = 'Retraite',
health = 'Santé (Ameli...)',
scolarity = 'Scolarité (CROUS…)',
transport = 'Transports (carte grise, permis, TCL…)',
work = 'Travail (Pôle emploi, CESU…)',
autres = 'Autres',
}
export enum Labels {
passNumerique = 'Pass numérique',
espacePublicNumeriqueepn = 'Espace public numérique',
maisonFranceService = 'Maison france service',
aidantsConnect = 'Aidants connect',
fabriqueDeTerritoire = 'Fabrique de territoire',
demarcheMetropolitaine = 'Démarches Métropolitaines',
pix = 'Évaluation des compétences numériques',
pix = 'Pix',
conseillerNumFranceServices = 'Conseiller numérique',
monEspaceSante = 'Mon espace santé',
numRelay = 'Les relais numériques',
}