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 256 additions and 224 deletions
import { StructureCategoryEnum } from '../shared/enum/structureCategory.enum';
import { StructureCategoryIconEnum } from '../shared/enum/structureCategoryIcon.enum';
import { StructureTypeEnum } from '../shared/enum/structureType.enum';
import { Equipment } from '../structure-list/enum/equipment.enum';
import { typeStructureEnum } from '../shared/enum/typeStructure.enum';
import { Weekday } from '../structure-list/enum/weekday.enum';
import { Address } from './address.model';
import { Day } from './day.model';
import { OpeningDay } from './openingDay.model';
import { Week } from './week.model';
import { PersonalOffer } from './personalOffer.model';
import { StructureType } from './structureType.model';
import { Week } from './week.model';
export class Structure {
public _id: string = null;
......@@ -14,7 +17,7 @@ export class Structure {
public updatedAt: string = null;
public toBeDeletedAt: string = null;
public structureName: string = null;
public structureType: string = null;
public structureType: StructureType = null;
public description: string = null;
public address: Address = new Address();
public contactPhone: string = null;
......@@ -66,6 +69,7 @@ export class Structure {
public alreadySelected? = false;
public isClaimed?: boolean = null;
public idCNFS?: string;
constructor(obj?: any) {
Object.assign(this, obj, {
......@@ -188,8 +192,21 @@ export class Structure {
}
}
public getLabelTypeStructure(): string {
return typeStructureEnum[this.structureType] ? typeStructureEnum[this.structureType] : '';
public getLabelTypeStructure(): StructureTypeEnum | '' {
return StructureTypeEnum[this.structureType.value] || '';
}
public getTypeStructureIcon(): StructureCategoryIconEnum {
switch (this.structureType.category) {
case StructureCategoryEnum.public:
return StructureCategoryIconEnum['public'];
case StructureCategoryEnum.private:
return StructureCategoryIconEnum['private'];
case StructureCategoryEnum.privateLucrative:
return StructureCategoryIconEnum['privateLucrative'];
default:
return StructureCategoryIconEnum['public'];
}
}
public hasSocialNetwork(): boolean {
......
export class StructureType {
values: string[];
name: string;
_id: string;
category: string;
value: string;
// Boolean set to false if user can't select this type during structure creation
selectable: boolean;
constructor(obj?: any) {
Object.assign(this, obj);
......
......@@ -7,9 +7,9 @@
(click)="toggleDetails()"
>
<div fxLayout="row" fxLayoutAlign="space-between center" fxLayoutGap="16px">
<app-svg-icon [type]="'ico'" [icon]="'structureAvatar'" [iconClass]="'icon-52'"></app-svg-icon>
<app-svg-icon [type]="'ico'" [icon]="getStructureTypeIcon()" [iconClass]="'icon-52'"></app-svg-icon>
<div fxLayout="column" fxLayoutAlign="space-between start">
<p class="structureName">{{ structureWithOwners.structure.structureName }}</p>
<p class="structureName">{{ structure.structureName }}</p>
<p class="structureType">{{ getStructureTypeLabel() }}</p>
</div>
</div>
......@@ -40,7 +40,7 @@
[text]="'Voir la structure'"
[style]="buttonTypeEnum.SecondaryWide"
routerLink="./"
[queryParams]="{ id: structureWithOwners.structure._id }"
[queryParams]="{ id: structure._id }"
[routerLinkActive]="'active'"
></app-button>
<app-button
......@@ -50,7 +50,7 @@
[iconType]="'form'"
[style]="buttonTypeEnum.SecondaryOnlyIcon"
routerLink="./"
[queryParams]="{ id: structureWithOwners.structure._id }"
[queryParams]="{ id: structure._id }"
[routerLinkActive]="'active'"
></app-button>
<app-button
......@@ -60,7 +60,7 @@
[iconBtn]="'edit'"
[text]="'Modifier la structure'"
[style]="buttonTypeEnum.SecondaryWide"
routerLink="./edit-structure/{{ structureWithOwners.structure._id }}"
routerLink="./edit-structure/{{ structure._id }}"
[routerLinkActive]="'active'"
[ngClass]="{ warning: !isValid() }"
></app-button>
......@@ -70,7 +70,7 @@
[type]="'button'"
[iconBtn]="'edit'"
[style]="buttonTypeEnum.SecondaryOnlyIcon"
routerLink="./edit-structure/{{ structureWithOwners.structure._id }}"
routerLink="./edit-structure/{{ structure._id }}"
[routerLinkActive]="'active'"
[ngClass]="{ warning: !isValid() }"
></app-button>
......@@ -81,11 +81,11 @@
<p>{{ getAddress() }}</p>
</div>
<div>
<p>{{ structureWithOwners.structure.contactPhone }}</p>
<p>{{ structure.contactPhone }}</p>
</div>
<div>
<a class="email" href="mailto:{{ structureWithOwners.structure.contactMail }}">
{{ structureWithOwners.structure.contactMail }}
<a class="email" href="mailto:{{ structure.contactMail }}">
{{ structure.contactMail }}
</a>
</div>
</div>
......@@ -100,7 +100,7 @@
[iconBtn]="'edit'"
[text]="'Gérer les membres'"
[style]="buttonTypeEnum.SecondaryWide"
routerLink="./structure-members-management/{{ structureWithOwners.structure._id }}"
routerLink="./structure-members-management/{{ structure._id }}"
[routerLinkActive]="'active'"
></app-button>
<app-button
......@@ -109,7 +109,7 @@
[type]="'button'"
[iconBtn]="'edit'"
[style]="buttonTypeEnum.SecondaryOnlyIcon"
routerLink="./structure-members-management/{{ structureWithOwners.structure._id }}"
routerLink="./structure-members-management/{{ structure._id }}"
[routerLinkActive]="'active'"
></app-button>
</div>
......
......@@ -4,7 +4,7 @@
@import '../../../assets/scss/shapes';
.structureCard {
padding: 5px 6px;
padding: 8px 16px 8px 8px;
border: 1px solid $grey-5;
border-radius: 4px;
overflow: hidden;
......
......@@ -33,6 +33,7 @@ export class ProfileStructureComponent implements OnInit {
public buttonTypeEnum = ButtonType;
public showDetails: boolean = false;
public addMemberModalOpenned: boolean = false;
public structure: Structure;
constructor(
private router: Router,
......@@ -51,6 +52,7 @@ export class ProfileStructureComponent implements OnInit {
this.members.push(res);
});
});
this.structure = new Structure(this.structureWithOwners.structure);
}
public goBack(): void {
......@@ -63,14 +65,17 @@ export class ProfileStructureComponent implements OnInit {
return this.structureForm.valid;
}
public getStructureTypeLabel(): string {
return new Structure(this.structureWithOwners.structure).getLabelTypeStructure();
return this.structure.getLabelTypeStructure();
}
public getStructureTypeIcon(): string {
return this.structure.getTypeStructureIcon();
}
public toggleDetails(): void {
this.showDetails = !this.showDetails;
}
public getAddress(): string {
const address = this.structureWithOwners.structure.address;
const address = this.structure.address;
return address.numero
? address.numero + ' ' + address.street + ' - ' + address.commune
: address.street + ' - ' + address.commune;
......
......@@ -12,7 +12,7 @@ export class GeojsonService {
constructor(private http: HttpClient) {}
/**
* Retrive an address by geolocation
* Retrieve an address by geolocation
* @param idVoie Number
*/
public getAddressByCoord(longitude: number, latitude: number): Observable<any> {
......@@ -30,7 +30,7 @@ export class GeojsonService {
}
/**
* Retrive an address by geolocation
* Retrieve an address by geolocation
* @param idVoie Number
*/
public getMDMGeoJson(): Observable<GeoJson[]> {
......
import { TestBed } from '@angular/core/testing';
import { OnlineMediationService } from './online-mediation.service';
describe('OnlineMediationService', () => {
let service: OnlineMediationService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(OnlineMediationService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { IOnlineMediation } from '../form/orientation-form-view/interfaces/onlineMediation.interface';
@Injectable({
providedIn: 'root',
})
export class OnlineMediationService {
constructor(private http: HttpClient) {}
/**
* Retrive all tcl stop point around given coord
*/
public createOnlineMediation(newMediation: IOnlineMediation): Observable<IOnlineMediation> {
return this.http.post<IOnlineMediation>('/api/online-mediation', newMediation);
}
}
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { StructureType } from '../models/structure-type.model';
import { StructureType } from '../models/structureType.model';
@Injectable({
providedIn: 'root',
......@@ -10,9 +10,16 @@ export class StructureTypeService {
constructor(private http: HttpClient) {}
/**
* Retrive all tcl stop point around given coord
* Retrieve all structure types
*/
public getStructureTypes(): Observable<any> {
public getStructureTypes(): Observable<StructureType[]> {
return this.http.get<StructureType[]>('/api/structure-type');
}
/**
* Retrieve a structure type by its id
*/
public getStructureTypeById(id: string): Observable<StructureType> {
return this.http.get<StructureType>(`/api/structure-type/${id}`);
}
}
......@@ -27,8 +27,10 @@ export class StructureService {
.pipe(map((item: Structure) => new Structure(item)));
}
public createStructure(structure: Structure, profile: User): Observable<Structure> {
const idUser = profile.email;
return this.http.post(`${this.baseUrl}`, { structure, idUser }).pipe(map((item: Structure) => new Structure(item)));
const userEmail = profile.email;
return this.http
.post(`${this.baseUrl}`, { structure, userEmail })
.pipe(map((item: Structure) => new Structure(item)));
}
public editStructure(structure: Partial<Structure>, structureId?: string): Observable<Structure> {
......
......@@ -10,7 +10,7 @@ export class TclService {
constructor(private http: HttpClient) {}
/**
* Retrive all tcl stop point around given coord
* Retrieve all tcl stop point around given coord
*/
public getTclStopPointBycoord(longitude: number, latitude: number): Observable<any> {
return this.http.post<TclStopPoint[]>('/api/tcl/closest', { coordinates: [longitude, latitude] });
......
<div class="container">
<div
class="boutonSection"
[ngClass]="{ selectedType: type.name == pickedType }"
*ngFor="let type of structureTypes"
fxLayout="column"
fxLayoutGap="8px"
>
<ng-container *ngIf="type.name === 'Publique'">
<div fxLayout="column" class="collapse" [ngClass]="{ notCollapsed: !showPublic }">
<div
class="collapseHeader"
fxLayoutAlign="flex-start center"
fxLayout="row"
(click)="toggleCollapse(type.name)"
>
<div class="svgContainer">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#' + getStructureTypeIcon(type.name)"></use>
</svg>
</div>
<div class="titleCollapse">
{{ type.name }}
</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use>
</svg>
</div>
<div class="boutonSection" fxLayout="column" fxLayoutGap="8px">
<div fxLayout="column" class="collapse" [ngClass]="{ notCollapsed: !showPublic }">
<div class="collapseHeader" fxLayoutAlign="flex-start center" fxLayout="row" (click)="togglePublic()">
<div class="svgContainer">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/ico/sprite.svg#' + structureTypeIconEnum.public"></use>
</svg>
</div>
<div *ngIf="showPublic" class="btn-grid">
<span *ngFor="let choice of getChoices(pickedType)">
<app-button
[extraClass]="choice == pickedChoice ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="getStructureTypeName(choice)"
(action)="pickChoice(choice)"
></app-button>
</span>
<div class="titleCollapse">
{{ structureTypeCategoryEnum.public }}
</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use>
</svg>
</div>
</div>
<div *ngIf="showPublic" class="btn-grid">
<span *ngFor="let type of publicTypes">
<app-button
[extraClass]="type._id == pickedTypeId ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="getStructureTypeLabel(type.value)"
(action)="pickStructureType(type._id)"
></app-button>
</span>
</div>
</ng-container>
<ng-container *ngIf="type.name === 'Privée à but non lucratif'">
<div fxLayout="column" class="collapse" [ngClass]="{ notCollapsed: !showPrivate }">
<div
class="collapseHeader"
fxLayoutAlign="flex-start center"
fxLayout="row"
(click)="toggleCollapse(type.name)"
>
<div class="svgContainer">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#' + getStructureTypeIcon(type.name)"></use>
</svg>
</div>
<div class="titleCollapse">
{{ type.name }}
</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use>
</svg>
</div>
</div>
<div fxLayout="column" class="collapse" [ngClass]="{ notCollapsed: !showPrivate }">
<div class="collapseHeader" fxLayoutAlign="flex-start center" fxLayout="row" (click)="togglePrivate()">
<div class="svgContainer">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/ico/sprite.svg#' + structureTypeIconEnum.private"></use>
</svg>
</div>
<div class="titleCollapse">
{{ structureTypeCategoryEnum.private }}
</div>
<div *ngIf="showPrivate" class="btn-grid">
<span *ngFor="let choice of getChoices(pickedType)">
<app-button
[extraClass]="choice == pickedChoice ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="getStructureTypeName(choice)"
(action)="pickChoice(choice)"
></app-button>
</span>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use>
</svg>
</div>
</div>
</ng-container>
<ng-container *ngIf="type.name === 'Privée à but lucratif'">
<div fxLayout="column" class="collapse" [ngClass]="{ notCollapsed: !showPrivateLucrative }">
<div
class="collapseHeader"
fxLayoutAlign="flex-start center"
fxLayout="row"
(click)="toggleCollapse(type.name)"
>
<div class="svgContainer">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#' + getStructureTypeIcon(type.name)"></use>
</svg>
</div>
<div class="titleCollapse">
{{ type.name }}
</div>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use>
</svg>
</div>
<div *ngIf="showPrivate" class="btn-grid">
<span *ngFor="let type of privateTypes">
<app-button
[extraClass]="type._id == pickedTypeId ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="getStructureTypeLabel(type.value)"
(action)="pickStructureType(type._id)"
></app-button>
</span>
</div>
</div>
<div fxLayout="column" class="collapse" [ngClass]="{ notCollapsed: !showPrivateLucrative }">
<div class="collapseHeader" fxLayoutAlign="flex-start center" fxLayout="row" (click)="togglePrivateLucrative()">
<div class="svgContainer">
<svg aria-hidden="true">
<use [attr.xlink:href]="'assets/ico/sprite.svg#' + structureTypeIconEnum.privateLucrative"></use>
</svg>
</div>
<div class="titleCollapse">
{{ structureTypeCategoryEnum.privateLucrative }}
</div>
<div *ngIf="showPrivateLucrative" class="btn-grid">
<span *ngFor="let choice of getChoices(pickedType)">
<app-button
[extraClass]="choice == pickedChoice ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="getStructureTypeName(choice)"
(action)="pickChoice(choice)"
></app-button>
</span>
<div class="logo">
<svg class="show" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#show'"></use>
</svg>
<svg class="hide" aria-hidden="true">
<use [attr.xlink:href]="'assets/form/sprite.svg#hide'"></use>
</svg>
</div>
</div>
</ng-container>
<div *ngIf="showPrivateLucrative" class="btn-grid">
<span *ngFor="let type of privateLucrativeTypes">
<app-button
[extraClass]="type._id == pickedTypeId ? 'selected' : ''"
[style]="buttonTypeEnum.CheckButton"
[text]="getStructureTypeLabel(type.value)"
(action)="pickStructureType(type._id)"
></app-button>
</span>
</div>
</div>
</div>
</div>
......@@ -57,17 +57,6 @@ button {
}
}
svg {
width: 28px;
height: 40px;
&.validate {
width: 13px;
height: 10px;
margin-left: -17px;
stroke: $white;
}
}
.collapse {
border: 1px solid $grey-5;
border-radius: 4px;
......@@ -94,7 +83,7 @@ svg {
}
.collapseHeader {
height: 65px;
padding: 0 15px 0 12px;
padding: 0 16px 0 8px;
cursor: pointer;
.titleCollapse {
width: 100%;
......@@ -102,13 +91,9 @@ svg {
color: $grey-1;
}
.svgContainer {
height: 48px;
width: 48px;
svg {
margin-right: 8px;
stroke: $grey-1;
fill: $grey-1;
}
height: 52px;
width: 52px;
margin-right: 8px;
}
}
.logo {
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { StructureType } from '../../../models/structure-type.model';
import { Structure } from '../../../models/structure.model';
import { StructureType } from '../../../models/structureType.model';
import { StructureTypeService } from '../../../services/structure-type.service';
import { typeStructureEnum } from '../../enum/typeStructure.enum';
import { StructureCategoryEnum } from '../../enum/structureCategory.enum';
import { StructureTypeEnum } from '../../enum/structureType.enum';
import { ButtonType } from '../button/buttonType.enum';
export enum structureTypes {
public = 'Publique',
private = 'Privée à but non lucratif',
privateLucratif = 'Privée à but lucratif',
}
import { StructureCategoryIconEnum } from '../../enum/structureCategoryIcon.enum';
@Component({
selector: 'app-structure-type-picker',
......@@ -17,10 +12,11 @@ export enum structureTypes {
styleUrls: ['./structure-type-picker.component.scss'],
})
export class StructureTypePickerComponent implements OnInit {
public pickedType: string;
public structureTypes: StructureType[];
@Input() public pickedChoice?: string;
@Input() public isEditMode?: boolean;
public pickedCategory: string;
public publicTypes: StructureType[];
public privateTypes: StructureType[];
public privateLucrativeTypes: StructureType[];
@Input() public pickedTypeId?: string;
@Output() selectedType: EventEmitter<string> = new EventEmitter<string>();
// Collapse var
......@@ -29,83 +25,68 @@ export class StructureTypePickerComponent implements OnInit {
public showPrivateLucrative: boolean;
public buttonTypeEnum = ButtonType;
public structureTypeIconEnum = StructureCategoryIconEnum;
public structureTypeCategoryEnum = StructureCategoryEnum;
constructor(private structureTypeService: StructureTypeService) {}
ngOnInit() {
this.structureTypeService.getStructureTypes().subscribe((types) => {
this.structureTypes = types;
if (this.pickedChoice) {
this.pickedType = this.getType(this.pickedChoice);
}
if (this.isEditMode && this.pickedChoice) {
this.toggleCollapse(this.pickedType);
// Filter "other" structure type
types = types.filter((type) => type.selectable);
this.publicTypes = types.filter((type) => type.category === this.structureTypeCategoryEnum.public);
this.privateTypes = types.filter((type) => type.category === this.structureTypeCategoryEnum.private);
this.privateLucrativeTypes = types.filter(
(type) => type.category === this.structureTypeCategoryEnum.privateLucrative
);
if (this.pickedTypeId) {
this.initPickedType(this.pickedTypeId);
}
});
}
public togglePublic(): void {
this.pickedCategory = this.structureTypeCategoryEnum.public;
this.showPublic = !this.showPublic;
this.showPrivate = false;
this.showPrivateLucrative = false;
}
public togglePrivate(): void {
this.pickedCategory = this.structureTypeCategoryEnum.private;
this.showPrivate = !this.showPrivate;
this.showPrivateLucrative = false;
this.showPublic = false;
}
public togglePrivateLucrative(): void {
this.pickedCategory = this.structureTypeCategoryEnum.privateLucrative;
this.showPrivateLucrative = !this.showPrivateLucrative;
this.showPrivate = false;
this.showPublic = false;
}
public getType(nameChoice: string): string {
return this.structureTypes.filter((type) => {
if (type.values.includes(nameChoice)) {
return type.name;
public initPickedType(pickedTypeId: string): void {
this.structureTypeService.getStructureTypeById(pickedTypeId).subscribe((structureType) => {
this.pickedCategory = structureType.category;
switch (structureType.category) {
case this.structureTypeCategoryEnum.public:
this.togglePublic();
break;
case this.structureTypeCategoryEnum.private:
this.togglePrivate();
break;
case this.structureTypeCategoryEnum.privateLucrative:
this.togglePrivateLucrative();
break;
}
})[0].name;
}
public getChoices(nameType: string): string[] {
return this.structureTypes.filter((type) => {
if (type.name == nameType) {
return type.values;
}
})[0].values;
}
public toggleCollapse(structureName: string): void {
this.pickType(structureName);
if (structureName === 'Publique') this.togglePublic();
if (structureName === 'Privée à but non lucratif') this.togglePrivate();
if (structureName === 'Privée à but lucratif') this.togglePrivateLucrative();
}
public pickType(type: string): void {
this.pickedType = type;
}
public pickChoice(choice: string): void {
this.pickedChoice = choice;
this.selectedType.emit(choice);
});
}
public getStructureTypeIcon(type: string): string {
switch (type) {
case structureTypes.public:
return 'typeStructure_public';
case structureTypes.private:
return 'typeStructure_private';
case structureTypes.privateLucratif:
return 'typeStructure_privateLucratif';
default:
throw new Error('Structure type not handle');
}
public pickStructureType(structureTypeId: string): void {
this.pickedTypeId = structureTypeId;
this.selectedType.emit(structureTypeId);
}
public getStructureTypeName(type: string): string {
return typeStructureEnum[type];
public getStructureTypeLabel(type: string): string {
return StructureTypeEnum[type];
}
}
export enum StructureCategoryEnum {
public = 'Publique',
private = 'Privée à but non lucratif',
privateLucrative = 'Privée à but lucratif',
}
export enum StructureCategoryIconEnum {
public = 'structureCategory_public',
private = 'structureCategory_private',
privateLucrative = 'structureCategory_privateLucrative',
}
export enum typeStructureEnum {
export enum StructureTypeEnum {
fablab = 'Fablab',
// A supprimer ?
......@@ -9,6 +9,7 @@ export enum typeStructureEnum {
// En attente de suppression remplacer par CAF CARSAT, Pole Emploi et CCAS
grandOrganismePublic = 'Grand organisme public (CAF, CARSAT, Pôle emploi...)',
// Publique
mdm = 'Maison de la Métropole',
mairie = 'Mairie',
CAF = 'CAF',
......@@ -20,7 +21,9 @@ export enum typeStructureEnum {
bijPij = 'BIJ/PIJ',
logement = 'Logement',
MaisonFranceService = 'Maison France Service',
autre = 'Autre',
// Privée à but non lucratif
association = 'Association',
centreSocio = 'Centre socio-culturel',
mjc = 'MJC / Cyberbase',
......@@ -28,6 +31,7 @@ export enum typeStructureEnum {
sij = 'Structure information jeunesse (SIJ)',
missionsLocales = 'Missions locales',
// Privée à but lucratif
formation = 'Structure de formation',
insertion = "Structure d'insertion",
}
......@@ -2,7 +2,7 @@
<div class="structure-details-container">
<!-- Header info -->
<div class="structure-details-title" fxLayout="row" fxLayoutGap="8px" fxLayoutAlign="space-evenly center">
<app-svg-icon [type]="'ico'" [icon]="'structureAvatar'" [iconClass]="'icon-52'"></app-svg-icon>
<app-svg-icon [type]="'ico'" [icon]="getStructureTypeIcon()" [iconClass]="'icon-52'"></app-svg-icon>
<h1 class="bold">{{ structure.structureName }}</h1>
<div class="ico-close">
<div (click)="close()" class="ico-close-details"></div>
......
......@@ -404,14 +404,17 @@ export class StructureDetailsComponent implements OnInit {
}
public goToWebsite(): void {
if (!this.structure.website.includes('http')) {
const url = 'https://'.concat(this.structure.website);
window.open(url, '_blank');
} else {
window.open(this.structure.website, '_blank');
let url = this.structure.website;
if (!url.startsWith('http')) {
url = 'https://' + url;
}
window.open(url, '_blank');
}
public displayJobEmployer(profile: User): string {
return new Utils().getJobEmployer(profile);
}
public getStructureTypeIcon(): string {
return this.structure.getTypeStructureIcon();
}
}
......@@ -79,7 +79,7 @@ export class formUtils {
*/
public createStructureForm(structure: Structure, isEditMode?: boolean): UntypedFormGroup {
return new UntypedFormGroup({
_id: new UntypedFormControl(structure._id),
_id: new UntypedFormControl(structure._id, Validators.required),
coord: new UntypedFormControl(structure.coord),
structureType: new UntypedFormControl(structure.structureType, Validators.required),
structureName: new UntypedFormControl(structure.structureName, Validators.required),
......