diff --git a/src/app/structure-list/components/card/card.component.ts b/src/app/structure-list/components/card/card.component.ts index 5a255e1e182d9dd58079955425b64bdc4ce89bb0..a54d92069790ea5651f8547aeb9939851f770e8b 100644 --- a/src/app/structure-list/components/card/card.component.ts +++ b/src/app/structure-list/components/card/card.component.ts @@ -11,7 +11,7 @@ const { DateTime } = require('luxon'); }) export class CardComponent implements OnInit { structures: Structure[] = []; - @Input() filter: string; + @Input() filter: Filter[]; constructor(private structureService: StructureService) {} ngOnInit(): void { @@ -19,8 +19,10 @@ export class CardComponent implements OnInit { } ngOnChanges(): void { let filters: Filter[] = []; - filters.push(new Filter('nom', this.filter)); - this.getStructures(filters); + if (this.filter) { + filters = this.filter; + this.getStructures(filters); + } } public getStructures(filters): void { diff --git a/src/app/structure-list/components/search/search.component.html b/src/app/structure-list/components/search/search.component.html index ab6ba5235d985897c2ad4361bef019040da7d048..8236e0fcd146738189beb4f1be4f9af9bd43d3d6 100644 --- a/src/app/structure-list/components/search/search.component.html +++ b/src/app/structure-list/components/search/search.component.html @@ -7,34 +7,36 @@ <div class="ico-pin-search grey"></div> </div> <input type="text" [(ngModel)]="searchTerm" placeholder="Rechercher une adresse, une association..." /> - <button type="button" (click)="submitSearch(searchTerm)">Rechercher</button> + <button type="button" (click)="applyFilter()">Rechercher</button> </div> - <div class="btnSection" fxLayout="row" fxLayoutAlign="space-between center"> - <button - type="button" - [className]="modalTypeOpened == modalType[0] ? 'selected' : ''" - (click)="openModal(this.modalType[0])" - > - <span class="btnText">Accompagnement</span> - <div class="arrow"></div> - </button> - <button - type="button" - [className]="modalTypeOpened == modalType[1] ? 'selected' : ''" - (click)="openModal(this.modalType[1])" - > - <span class="btnText">Formations</span> - <div class="arrow"></div> - </button> - <button - type="button" - [className]="modalTypeOpened == modalType[2] ? 'selected' : ''" - (click)="openModal(this.modalType[2])" - > - <span class="btnText">Plus de filtres</span> - <div class="arrow"></div> - </button> + <div class="btnSection"> + <div class="phoneSection" fxLayout="row" fxLayoutAlign="center center"> + <button + type="button" + [className]="modalTypeOpened === modalType[0] ? 'selected' : ''" + (click)="openModal(this.modalType[0])" + > + <span class="btnText">Accompagnement</span> + <div class="arrow"></div> + </button> + <button + type="button" + [className]="modalTypeOpened === modalType[1] ? 'selected' : ''" + (click)="openModal(this.modalType[1])" + > + <span class="btnText">Formations</span> + <div class="arrow"></div> + </button> + <button + type="button" + [className]="modalTypeOpened === modalType[2] ? 'selected' : ''" + (click)="openModal(this.modalType[2])" + > + <span class="btnText">Plus de filtres</span> + <div class="arrow"></div> + </button> + </div> </div> <div *ngIf="modalTypeOpened" @@ -42,25 +44,25 @@ fxLayoutAlign="space-between" [ngClass]="['modal', 'modal' + modalTypeOpened]" > - <div class="contentModal" fxLayout="row wrap" fxLayoutAlign="flex-start"> + <div class="contentModal" fxLayout="row wrap" fxLayoutAlign="flex-start" *ngIf="categories.length > 0"> <!--<div class="blockFiltre" *ngFor="let s of services">--> <div class="blockFiltre" *ngFor="let c of categories"> - <h4>{{ c.title }}</h4> + <h4>{{ c.name }}</h4> <ul class="blockLigne"> <div fxLayout="row" class="ligneFiltre" fxLayoutAlign="space-between center" *ngFor="let module of c.modules"> <li class="checkbox"> - <div class="testBox"> + <div class="checkboxItem"> <label> <input type="checkbox" - [checked]="this.checkedModules.indexOf(module) > -1" - [value]="module" - (change)="onCheckboxChange($event, false)" + [checked]="getIndex(module.id, c.name) > -1" + [value]="module.id" + (change)="onCheckboxChange($event, c.name)" /> <span class="customCheck"></span> </label> - <div class="label">{{ module }}</div> + <div class="label">{{ module.text }}</div> </div> </li> <span class="nbResult">34</span> @@ -76,11 +78,13 @@ </div> <div class="footer" fxLayout="row" fxLayoutAlign="space-between center"> <div class="checkbox"> - <label> - <input type="checkbox" /> - <span class="customCheck"></span> - </label> - <div class="label">Pass numérique</div> + <div class="checkboxItem"> + <label> + <input type="checkbox" /> + <span class="customCheck"></span> + </label> + <div class="label">Pass numérique</div> + </div> </div> <a href="">Ajouter une structure</a> </div> diff --git a/src/app/structure-list/components/search/search.component.scss b/src/app/structure-list/components/search/search.component.scss index 2a64a684542ff03eb1402af56b33586f8835543f..cbe065b6cccbd71c3e659855b818d4de97db7736 100644 --- a/src/app/structure-list/components/search/search.component.scss +++ b/src/app/structure-list/components/search/search.component.scss @@ -1,6 +1,7 @@ @import '../../../../assets/scss/icons'; @import '../../../../assets/scss/color'; @import '../../../../assets/scss/typography'; +@import '../../../../assets/scss/breakpoint'; .header { .title { @@ -46,6 +47,9 @@ } .btnSection { padding: 16px 0 16px 0; + .phoneSection { + display: none; + } button { outline: none; border: 1px solid $grey; @@ -130,7 +134,7 @@ -moz-column-gap: 46px; -webkit-column-count: 2; -webkit-column-gap: 46px; - column-count: 1; + column-count: 2; column-gap: 46px; column-rule: dashed 1px $grey; } @@ -175,18 +179,13 @@ } } .checkbox { - .testBox { + .checkboxItem { position: relative; display: inline-grid; align-items: center; grid-template-columns: min-content auto; min-height: 25px; } - /*position: relative; - display: grid; - align-items: center; - grid-template-columns: min-content auto; - min-height: 25px;*/ list-style-type: none; input { opacity: 0; @@ -239,3 +238,11 @@ } } } +/*@media #{$phone} { + .allSection { + display: none !important; + } + .phoneSection { + display: flex; + } +}*/ diff --git a/src/app/structure-list/components/search/search.component.ts b/src/app/structure-list/components/search/search.component.ts index 9c3694255d68d04ad5dea9a5e94fc154a853ef04..86550580e0e0cddcf21c2e5140012f10cf0c8b14 100644 --- a/src/app/structure-list/components/search/search.component.ts +++ b/src/app/structure-list/components/search/search.component.ts @@ -1,5 +1,8 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { Category } from '../../models/category.model'; +import { Filter } from '../../models/filter.model'; +import { Module } from '../../models/module.model'; +import { SearchService } from '../../services/search.service'; @Component({ selector: 'app-search', @@ -7,11 +10,14 @@ import { Category } from '../../models/category.model'; styleUrls: ['./search.component.scss'], }) export class SearchComponent implements OnInit { - constructor() {} + constructor(private searchService: SearchService) {} @Output() searchEvent = new EventEmitter(); + + // Search input variable searchTerm: string = ''; - // button variable + + // Button variable modalType: string[] = ['services', 'modalite', 'plusFiltres']; // Modal variable @@ -19,11 +25,11 @@ export class SearchComponent implements OnInit { modalTypeOpened: string; // Checkbox variable - checkedModules: string[]; - checkedModulesFilter: string[]; + checkedModules: Module[]; + checkedModulesFilter: Module[]; ngOnInit(): void { - // Store the different categories + // Will store the different categories this.categories = []; // Manage checkbox @@ -31,6 +37,11 @@ export class SearchComponent implements OnInit { this.checkedModulesFilter = new Array(); } + // Delete when getting back-end + private mockApiNumber(nb: number): string { + return ('00' + nb).slice(-3); + } + // Open the modal and display the list according to the right filter button public openModal(option: string): void { this.categories = []; @@ -50,62 +61,81 @@ export class SearchComponent implements OnInit { this.checkedModulesFilter = this.checkedModules.slice(); this.openModal(this.modalTypeOpened); - // Simulation send filter - console.log(this.checkedModulesFilter); + // Send search input filter + let filters: Filter[] = []; + if (this.searchTerm) { + filters.push(new Filter('nom', this.searchTerm, false)); + } + + // Send checked box filter + this.checkedModulesFilter.forEach((cm) => { + filters.push(new Filter(this.fromStringToIdExcel(cm.text), this.mockApiNumber(cm.id), false)); + }); + this.searchEvent.emit(filters); } // Management of the checkbox event (Check / Uncheck) - public onCheckboxChange(event): void { + public onCheckboxChange(event, categ: string): void { + const checkValue: number = parseInt(event.target.value); if (event.target.checked) { - this.checkedModules.push(event.target.value); + this.checkedModules.push(new Module(checkValue, categ)); } else { // Check if the unchecked module is present in the list and remove it - if (this.checkedModules.indexOf(event.target.value) > -1) { - this.checkedModules.splice(this.checkedModules.indexOf(event.target.value), 1); + if (this.getIndex(checkValue, categ) > -1) { + this.checkedModules.splice(this.getIndex(checkValue, categ), 1); } } } + // Return index of a specific module in array modules + public getIndex(id: number, categ: string): number { + return this.checkedModules.findIndex((m: Module) => m.id === id && m.text === categ); + } + // Clear only filters in the current modal - private clearFilters(): void { - this.categories.forEach((categ) => { - categ.modules.forEach((module) => { - if (this.checkedModules.indexOf(module) > -1) - this.checkedModules.splice(this.checkedModules.indexOf(module), 1); + public clearFilters(): void { + this.categories.forEach((categ: Category) => { + categ.modules.forEach((module: Module) => { + if (this.getIndex(module.id, categ.name) > -1) + this.checkedModules.splice(this.getIndex(module.id, categ.name), 1); }); }); } - public submitSearch(searchTerm: string): void { - this.searchEvent.emit(searchTerm); + // Format title of category to id of excel category + private fromStringToIdExcel(categ: string): string { + let splitStr = categ.toLowerCase().split(' '); + for (let i = 1; i < splitStr.length; i++) { + splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].substring(1); + } + return splitStr + .join('') + .normalize('NFD') + .replace(/[\u0300-\u036f'’°()]/g, '') + .replace(/[\s-]/g, ' ') + .replace('?', ''); } - - /** - * En attendant l'api - */ - private mockService(module: Category[], titre: string, categ: string, nbCateg: number): void { - var m = new Category(); - m.title = titre; + // Fake service api + private mockService(module: Category[], titre: string, categ: any, nbCateg: number): void { + let m = new Category(); + m.name = titre; m.modules = []; - for (var i = 0; i < nbCateg; i++) { - m.modules.push(categ + i); + for (let i = 0; i < nbCateg; i++) { + m.modules.push(new Module(categ.id, categ.name + i)); } module.push(m); } + + // Fake data private fakeData(option: string): void { if (option === this.modalType[0]) { - this.mockService(this.categories, 'Accompagnement aux démarches en ligne', 'CAF', 7); + this.mockService(this.categories, 'Accompagnement des démarches', { name: 'CAF', id: '' }, 7); } else if (option === this.modalType[1]) { - this.mockService(this.categories, 'Compétences de base', 'Faire un diagnostic des compétences', 8); - this.mockService(this.categories, 'Insertion sociale et professionnelle', ' Diffuser son CV en ligne', 5); - this.mockService( - this.categories, - 'Accès aux droits', - 'Déclarer ses revenus en ligne et découvertes des services proposés', - 8 - ); - this.mockService(this.categories, 'Aide à la parentalité/éducation', 'Découvrir l’univers des jeux vidéos', 4); - this.mockService(this.categories, 'Culture et sécurité numérique', 'Traitement de texte : découverte', 4); + this.searchService.getCategories().subscribe((d) => { + d.forEach((element) => { + this.categories.push(element); + }); + }); } else if (option === this.modalType[2]) { this.mockService(this.categories, 'Équipements', 'Accès à des revues ou livres infoirmatiques numériques', 8); this.mockService(this.categories, "Modalité d'accueil", 'Matériel mis à dispostion', 6); diff --git a/src/app/structure-list/models/category.model.ts b/src/app/structure-list/models/category.model.ts index 102ac062a9c2f5eb8133fcbf12225a8373bce5c4..f6c60e54e45427e03ce9c5c8fc9886baf823118d 100644 --- a/src/app/structure-list/models/category.model.ts +++ b/src/app/structure-list/models/category.model.ts @@ -1,5 +1,6 @@ +import { Module } from './module.model'; + export class Category { - title: string; - modules: string[]; - size: number; + name: string; + modules: Module[]; } diff --git a/src/app/structure-list/models/filter.model.ts b/src/app/structure-list/models/filter.model.ts index 1cee683bd0cae2ae003dba72bd466c7ae813a479..826633f504a445e6ff4c829fec405255a291e9dd 100644 --- a/src/app/structure-list/models/filter.model.ts +++ b/src/app/structure-list/models/filter.model.ts @@ -1,9 +1,11 @@ export class Filter { name: string; value: string; + isStrict: boolean; - constructor(name: string, value: string) { + constructor(name: string, value: any, isStrict: boolean) { this.name = name; - this.value = value; + this.value = value.toString(); + this.isStrict = isStrict; } } diff --git a/src/app/structure-list/models/module.model.ts b/src/app/structure-list/models/module.model.ts new file mode 100644 index 0000000000000000000000000000000000000000..83d025356912464a4b01d71fa36ae68e6def6d96 --- /dev/null +++ b/src/app/structure-list/models/module.model.ts @@ -0,0 +1,9 @@ +export class Module { + id: number; + text: string; + + constructor(id: number, text: string) { + this.id = id; + this.text = text; + } +} diff --git a/src/app/structure-list/services/search.service.spec.ts b/src/app/structure-list/services/search.service.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..23c42c7bb5a21d54fb6c45beedabe92458005fb7 --- /dev/null +++ b/src/app/structure-list/services/search.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { SearchService } from './search.service'; + +describe('SearchService', () => { + let service: SearchService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(SearchService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/structure-list/services/search.service.ts b/src/app/structure-list/services/search.service.ts new file mode 100644 index 0000000000000000000000000000000000000000..d48c602e1fa51501389f404a50e357d30c57b65b --- /dev/null +++ b/src/app/structure-list/services/search.service.ts @@ -0,0 +1,14 @@ +import { HttpClient } from '@angular/common/http'; +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs'; + +@Injectable({ + providedIn: 'root', +}) +export class SearchService { + constructor(private http: HttpClient) {} + + public getCategories(): Observable<any> { + return this.http.get('/api/Categories'); + } +} diff --git a/src/app/structure-list/services/structure-list.service.ts b/src/app/structure-list/services/structure-list.service.ts index 6ac8794637b742bb83bd94127b0e25b812d5ddc7..0a1d1e34a698e616b8644890fa8cce6df5218db4 100644 --- a/src/app/structure-list/services/structure-list.service.ts +++ b/src/app/structure-list/services/structure-list.service.ts @@ -9,7 +9,6 @@ import { OpeningDay } from '../models/openingDay.model'; import { Structure } from '../models/structure.model'; import { Time } from '../models/time.model'; import { Weekday } from '../enum/weekday.enum'; -import { Week } from '../models/week.model'; import { WeekDay } from '@angular/common'; import { Filter } from '../models/filter.model'; @@ -32,7 +31,11 @@ export class StructureService { if (api) { api = api + '&'; } - api = api + filter.name + '_like=' + filter.value; + if (filter.isStrict) { + api = api + filter.name + '=' + filter.value; + } else { + api = api + filter.name + '_like=' + filter.value; + } }); } return api; diff --git a/src/app/structure-list/structure-list.component.ts b/src/app/structure-list/structure-list.component.ts index 8db285d5f1c79af2ec3434ec83c313ceffc02c36..e62cff38c58b3617e28765664990c6210fc87f3a 100644 --- a/src/app/structure-list/structure-list.component.ts +++ b/src/app/structure-list/structure-list.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { Filter } from './models/filter.model'; @Component({ selector: 'app-structure-list', @@ -7,10 +8,10 @@ import { Component, OnInit } from '@angular/core'; }) export class StructureListComponent implements OnInit { constructor() {} - currentFilter: string; + currentFilter: Filter[]; ngOnInit(): void {} - fetchResults(filter: string) { + fetchResults(filter: Filter[]) { this.currentFilter = filter; } } diff --git a/src/app/structure/components/card/card.component.html b/src/app/structure/components/card/card.component.html deleted file mode 100644 index e2443b8c8794dd8d1998a26b13661ad8eb4ef049..0000000000000000000000000000000000000000 --- a/src/app/structure/components/card/card.component.html +++ /dev/null @@ -1,25 +0,0 @@ -<span class="nbStructuresLabel">{{ structures.length }} structures</span> -<div class="structure" fxLayout="column" *ngFor="let structure of structures"> - <span class="nomStructure">{{ structure.nom }}</span> - - <div class="headerStructure" fxLayout="row" fxLayoutAlign="space-between center"> - <span class="typeStructure">{{ structure.type_de_structure }}</span> - <span class="distanceStructure">|-| 63 m</span> - </div> - <br /> - <div class="statusStructure" fxLayout="row" fxLayoutAlign="start center" fxLayoutGap="1vw"> - <div *ngIf="structure.estOuvert; else closed"> - <span class="ico-dot-available"></span> - <span> Ouvert actuellement</span> - </div> - <ng-template #closed> - <span class="ico-dot-unavailable"></span> - <span *ngIf="structure.ouvreLe.jour; else noTime"> - Fermé - Ouvre {{ structure.ouvreLe.jour }} à {{ structure.ouvreLe.horaire }}</span - > - </ng-template> - </div> -</div> -<ng-template #noTime> - <span> Fermé - Aucun horaire disponible</span> -</ng-template> diff --git a/src/app/structure/components/card/card.component.scss b/src/app/structure/components/card/card.component.scss deleted file mode 100644 index f3f3748014fad362523696315a02fe31a89967e8..0000000000000000000000000000000000000000 --- a/src/app/structure/components/card/card.component.scss +++ /dev/null @@ -1,52 +0,0 @@ -@import '../../../../assets/scss/icons'; -.nbStructuresLabel { - color: #828282; - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 16px; - line-height: 19px; - display: flex; - align-items: center; -} -.structure { - padding: 12px 0 12px 0; - border-bottom: 1px dashed #bdbdbd; - .typeStructure { - color: #828282; - font-family: Times New Roman; - font-style: normal; - font-weight: normal; - font-size: 16px; - line-height: 100%; - } - .nomStructure { - padding-top: 13px; - color: #594d59; - font-family: Trebuchet MS; - font-style: normal; - font-weight: bold; - font-size: 20px; - line-height: 103%; - padding-bottom: 5px; - } - .distanceStructure { - font-family: Times New Roman; - font-style: normal; - font-size: 16px; - line-height: 103%; - color: #594d59; - } - &:last-child { - border-bottom: none; - } -} -.statusStructure { - span { - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 15px; - line-height: 103%; - } -} diff --git a/src/app/structure/components/card/card.component.spec.ts b/src/app/structure/components/card/card.component.spec.ts deleted file mode 100644 index c0787da7b20f605785da5d180179d53737a572ef..0000000000000000000000000000000000000000 --- a/src/app/structure/components/card/card.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CardComponent } from './card.component'; -import { HttpClientModule } from '@angular/common/http'; -describe('CardComponent', () => { - let component: CardComponent; - let fixture: ComponentFixture<CardComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [HttpClientModule], - declarations: [CardComponent], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(CardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/structure/components/card/card.component.ts b/src/app/structure/components/card/card.component.ts deleted file mode 100644 index ad3154950dade75c9556447ac4543ca70a5b824c..0000000000000000000000000000000000000000 --- a/src/app/structure/components/card/card.component.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Structure } from '../../models/structure.model'; -import { StructureService } from '../../services/structure.service'; -const { DateTime } = require('luxon'); - -@Component({ - selector: 'app-card', - templateUrl: './card.component.html', - styleUrls: ['./card.component.scss'], -}) -export class CardComponent implements OnInit { - structures: Structure[] = []; - constructor(private _structureService: StructureService) {} - - ngOnInit(): void { - var dt = DateTime.local(); - this._structureService.recupererStructures().subscribe((structures: Structure[]) => { - structures.forEach((s: Structure) => { - this.structures.push(this._structureService.majOuvertureStructure(s, dt)); - }); - }); - } -} diff --git a/src/app/structure/components/recherche/recherche.component.html b/src/app/structure/components/recherche/recherche.component.html deleted file mode 100644 index 00eecd6dae38e1e104c5b0a5000a87ca201fe5b1..0000000000000000000000000000000000000000 --- a/src/app/structure/components/recherche/recherche.component.html +++ /dev/null @@ -1,83 +0,0 @@ -<div class="header"> - <span class="title">Acteurs de la médiation</span> -</div> -<div class="content" fxLayout="column"> - <div class="searchSection" fxLayout="row" fxLayoutGap="1.5vw"> - <div class="icon"> - <div class="ico-pin-search grey"></div> - </div> - <input type="text" placeholder="Rechercher une adresse, une association..." /> - <button type="button">Rechercher</button> - </div> - - <div class="btnSection" fxLayout="row" fxLayoutAlign="space-between center"> - <button - type="button" - [className]="modalOpened == modalType[0] ? 'selected' : ''" - (click)="openModal(this.modalType[0])" - > - <span class="btnText">Services</span> - <div class="arrow"></div> - </button> - <button - type="button" - [className]="modalOpened == modalType[1] ? 'selected' : ''" - (click)="openModal(this.modalType[1])" - > - <span class="btnText">Accueil</span> - <div class="arrow"></div> - </button> - <button - type="button" - [className]="modalOpened == modalType[2] ? 'selected' : ''" - (click)="openModal(this.modalType[2])" - > - <span class="btnText">Plus de filtres</span> - <div class="arrow"></div> - </button> - </div> - <div *ngIf="modalOpened" fxLayout="column" fxLayoutAlign="space-between" [ngClass]="['modal', 'modal' + modalOpened]"> - <div class="contentModal" fxLayout="row wrap"> - <!--<div class="blockFiltre" *ngFor="let s of services">--> - <div class="blockFiltre" *ngFor="let m of modules"> - <div class="blockLigne"> - <h4>{{ m.titre }}</h4> - <div - fxLayout="row" - class="ligneFiltre" - fxLayoutAlign="space-between center" - *ngFor="let categ of m.categories" - > - <div class="checkbox"> - <label> - <input - type="checkbox" - [checked]="this.checkedTab.indexOf(categ) > -1" - [value]="categ" - (change)="onCheckboxChange($event, false)" - /> - <span class="customCheck"></span> - </label> - <div class="label">{{ categ }}</div> - </div> - <span class="nbResult">34</span> - </div> - </div> - </div> - </div> - <div class="footer" fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="3vw"> - <a (click)="onCheckboxChange($event, true)">Effacer</a> - <button type="button" (click)="applyFilter(modalOpened)">Appliquer</button> - </div> - </div> -</div> -<div class="footer" fxLayout="row" fxLayoutAlign="space-between center"> - <div class="checkbox"> - <label> - <input type="checkbox" /> - <span class="customCheck"></span> - </label> - <div class="label">Pass numérique</div> - </div> - <a href="">Ajouter une structure</a> -</div> diff --git a/src/app/structure/components/recherche/recherche.component.scss b/src/app/structure/components/recherche/recherche.component.scss deleted file mode 100644 index e1ac58b8da643240cc956af7b1325cf1029b20e2..0000000000000000000000000000000000000000 --- a/src/app/structure/components/recherche/recherche.component.scss +++ /dev/null @@ -1,257 +0,0 @@ -@import '../../../../assets/scss/icons'; -@import '../../../../assets/scss/color'; - -.header { - .title { - font-family: Times New Roman; - font-style: normal; - font-weight: bold; - font-size: 20px; - line-height: 103%; - padding: 16px 0 16px 0; - - display: flex; - align-items: center; - text-transform: uppercase; - } -} -.content { - margin: 10px 0 0px 0; - .icon { - border: 1px solid $grey; - padding: 4px 6px 8px 6px; - border-radius: 4px; - cursor: pointer; - } - input { - width: 100%; - background-color: $grey-4; - border: none; - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 12px; - line-height: 17px; - display: flex; - align-items: center; - padding-left: 10px; - text-overflow: ellipsis; - color: $grey-1; - outline: none; - } - .searchSection { - button { - border: none; - cursor: pointer; - background-color: $purple; - font-family: Trebuchet MS; - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 100%; - align-items: center; - text-align: center; - color: $white; - padding: 3px 16px 3px 16px; - outline: none; - } - } - .btnSection { - padding: 16px 0 16px 0; - button { - outline: none; - - border: 1px solid $grey; - border-radius: 33px; - background-color: $white; - padding: 2px 6px 2px 13px; - align-items: center; - display: flex; - cursor: pointer; - .btnText { - justify-content: center; - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 19px; - display: flex; - align-items: center; - } - } - .selected { - border: 1px solid $orange-light; - color: $orange-light; - .arrow { - background-color: transparent; - border-bottom: 1px solid $orange-light; - border-right: 1px solid $orange-light; - transform: translateY(25%) rotate(-135deg); - margin: 0 5px 0 10px; - height: 7px; - width: 7px; - } - } - .arrow { - background-color: transparent; - border-bottom: 1px solid $grey; - border-right: 1px solid $grey; - transform: translateY(-25%) rotate(45deg); - margin: 0 5px 0 10px; - height: 7px; - width: 7px; - } - } -} -.footer { - margin: 0px 0 16px 0; - a { - font-family: Trebuchet MS; - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 18px; - /* or 120% */ - - display: flex; - align-items: center; - text-decoration-line: underline; - } -} -.modalaccueil { - margin-left: 100px; -} -.modalplusFiltres { - margin-left: 196px; -} -.modal { - max-height: 654px; - max-width: 1100px; - background: $white; - border: 1px solid $purple; - box-sizing: border-box; - border-radius: 8px; - z-index: 1; - position: absolute; - margin-top: 80px; - padding: 20px 16px 10px 16px; - .contentModal { - writing-mode: vertical-lr; - overflow-y: hidden; - max-width: 1100px; - border-bottom: 1px solid grey; - margin-bottom: 10px; - .blockFiltre { - writing-mode: horizontal-tb; - max-width: 320px; - padding: 0 30px 10px 10px; - } - .ligneFiltre { - margin: 5px 0 5px 0; - } - h4 { - font-family: Trebuchet MS; - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 17px; - display: flex; - align-items: center; - margin-top: 0; - } - .nbResult { - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 13px; - line-height: 15px; - } - label { - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 14px; - line-height: 16px; - } - } - .footer { - height: 32px; - button { - height: 100%; - border: none; - cursor: pointer; - background-color: $purple; - font-family: Trebuchet MS; - font-style: normal; - font-weight: bold; - font-size: 13px; - line-height: 100%; - align-items: center; - text-align: center; - color: $white; - padding: 3px 16px 3px 16px; - outline: none; - } - } -} -.checkbox { - position: relative; - display: grid; - align-items: center; - grid-template-columns: min-content auto; - min-height: 25px; - input { - opacity: 0; - display: none; - &:checked ~ .customCheck { - background-color: $orange-light; - border-color: transparent; - } - &:checked ~ .customCheck:after { - display: block; - } - } - label { - display: inline-grid; - } - .label { - padding-left: 8px; - font-family: Trebuchet MS; - font-style: normal; - font-weight: normal; - font-size: 14px; - line-height: 17px; - padding: 0 16px 0 16px; - } - .customCheck { - display: inline-grid; - width: 18px; - height: 18px; - background-color: $white; - border: 1px solid $grey; - cursor: pointer; - position: relative; - - top: 0; - left: 0; - &:hover { - background-color: $grey-4; - } - &:after { - content: ''; - position: absolute; - display: none; - } - &:after { - left: 7px; - top: 3px; - width: 4px; - height: 8px; - border: solid white; - border-width: 0 2px 2px 0; - transform: rotate(45deg); - -webkit-transform: rotate(45deg); - -ms-transform: rotate(45deg); - } - } -} diff --git a/src/app/structure/components/recherche/recherche.component.spec.ts b/src/app/structure/components/recherche/recherche.component.spec.ts deleted file mode 100644 index e38e4d4e837b3cae1b8b7ac52cc98cb1ca9b97a3..0000000000000000000000000000000000000000 --- a/src/app/structure/components/recherche/recherche.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { RechercheComponent } from './recherche.component'; - -describe('RechercheComponent', () => { - let component: RechercheComponent; - let fixture: ComponentFixture<RechercheComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ RechercheComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(RechercheComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/structure/components/recherche/recherche.component.ts b/src/app/structure/components/recherche/recherche.component.ts deleted file mode 100644 index 34881d906883cd3a710b1732194f59883a54cbc3..0000000000000000000000000000000000000000 --- a/src/app/structure/components/recherche/recherche.component.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Module } from '../../models/recherche.model'; - -@Component({ - selector: 'app-recherche', - templateUrl: './recherche.component.html', - styleUrls: ['./recherche.component.scss'], -}) -export class RechercheComponent implements OnInit { - constructor() {} - //Variables btn filtres - modalType: string[] = ['services', 'accueil', 'plusFiltres']; - - //Variable gestion liste modal - servicesCategories: Module[]; - modaliteCategories: Module[]; - modules: Module[]; - filtresCategories: Module[]; - modalOpened: string; - - //Variable gestion Checkbox - checkedTab: string[]; - filterCheck: string[]; - - ngOnInit(): void { - //Sert à afficher la modal et indiquer le type de filtre choisit - this.modalOpened = null; - - //Sert à stocker les différentes catégories - this.servicesCategories = []; - this.modaliteCategories = []; - this.modules = []; - this.filtresCategories = []; - - //Sert à gérer la checkbox multiple - this.checkedTab = new Array(); - this.filterCheck = new Array(); - } - - //Ouvrir la modal et afficher la liste en fonction du btn de filtre appuyé - openModal(option: string) { - this.modules = []; - switch (option) { - case this.modalType[0]: - //Vérifie si le btn n'est pas actif - if (this.modalOpened != this.modalType[0]) { - this.modalOpened = this.modalType[0]; - this.fakeDataServices(); - } else { - this.modalOpened = null; - } - break; - case this.modalType[1]: - //Vérifie si le btn n'est pas actif - if (this.modalOpened != this.modalType[1]) { - this.modalOpened = this.modalType[1]; - this.fakeDataModalite(); - } else { - this.modalOpened = null; - } - break; - case this.modalType[2]: - //Vérifie si le btn n'est pas actif - if (this.modalOpened != this.modalType[2]) { - this.modalOpened = this.modalType[2]; - this.fakeDataFiltres(); - } else { - this.modalOpened = null; - } - break; - } - //Initialisation de la liste temporaire - this.checkedTab = this.filterCheck.slice(); - } - - //Envoie d'un tableau contenant tous les filtres - applyFilter() { - this.filterCheck = this.checkedTab.slice(); - this.openModal(this.modalOpened); - console.log(this.filterCheck); - } - - //Gestion de l'evenement checkbox(Cocher/Décocher) - onCheckboxChange(e, reset: boolean) { - //Condition btn effacer filtre d'une liste - if (!reset) { - if (e.target.checked) { - this.checkedTab.push(e.target.value); - } else { - //Vérifie si la case décochée est présente dans la liste temporaire et la supprime - if (this.checkedTab.indexOf(e.target.value) > -1) { - this.checkedTab.splice(this.checkedTab.indexOf(e.target.value), 1); - } - } - } else { - //Efface uniquement les éléments de la liste en cours - this.modules.forEach((m) => { - m.categories.forEach((categ) => { - if (this.checkedTab.indexOf(categ) > -1) this.checkedTab.splice(this.checkedTab.indexOf(categ), 1); - }); - }); - } - } - - /** - * En attendant les apis - */ - mockService(module: Module[], titre: string, categ: string, nbCateg: number) { - var m = new Module(); - m.titre = titre; - m.categories = []; - for (var i = 0; i < nbCateg; i++) { - m.categories.push(categ + i); - } - module.push(m); - } - fakeDataServices() { - this.mockService(this.modules, 'Accompagnement aux démarches en ligne', 'CAF', 7); - this.mockService(this.modules, 'Insertion sociale et professionnelle', ' Diffuser son CV en ligne', 5); - this.mockService( - this.modules, - 'Accès aux droits', - 'Déclarer ses revenus en ligne et découvertes des services proposés', - 8 - ); - this.mockService(this.modules, 'Aide à la parentalité/éducation', 'Découvrir l’univers des jeux vidéos', 4); - this.mockService(this.modules, 'Compétences de base', 'Faire un diagnostic des compétences', 8); - this.mockService(this.modules, 'Culture et sécurité numérique', 'Traitement de texte : découverte', 4); - } - fakeDataModalite() { - this.mockService(this.modules, "Modalité d'accueil", 'Matériel mis à dispostion', 6); - } - fakeDataFiltres() { - this.mockService(this.modules, 'Équipements', 'Accès à des revues ou livres infoirmatiques numériques', 8); - this.mockService(this.modules, "Type d'acteurs", 'Lieux de médiation (Pimms, assos...)', 5); - this.mockService(this.modules, 'Publics', 'Langues étrangères autres qu’anglais', 12); - this.mockService(this.modules, 'Labelisation', 'Prescripteur du Pass Numérique', 6); - this.mockService(this.modules, 'Type de structure', 'Espace de co-working', 6); - } -} diff --git a/src/app/structure/models/recherche.model.ts b/src/app/structure/models/recherche.model.ts deleted file mode 100644 index a498b7318945a60e7476b2e612bd2cadfb3a1524..0000000000000000000000000000000000000000 --- a/src/app/structure/models/recherche.model.ts +++ /dev/null @@ -1,5 +0,0 @@ -export class Module { - titre: string; - categories: string[]; - size: number; -} diff --git a/src/app/structure/models/structure.model.ts b/src/app/structure/models/structure.model.ts deleted file mode 100644 index 5617a79481a85fe487eb42bb6a6cea1bb1ef8fe1..0000000000000000000000000000000000000000 --- a/src/app/structure/models/structure.model.ts +++ /dev/null @@ -1,44 +0,0 @@ -export class Structure { - numero: string; - date_de_creation: string; - derniere_modification: string; - nom_de_lusager: string; - votre_structure_est_elle: string; - nom_de_votre_structure: string; - type_de_structure: string; - description: string; - n: string; - voie: string; - telephone: string; - courriel: string; - site_web: string; - facebook: string; - twitter: string; - instagram: string; - civilite: string; - nom: string; - prenom: string; - email_contact: string; - fonction: string; - accessibilite_personnes_a_mobilite_reduite_pmr: boolean; - jaccompagne_les_usagers_dans_leurs_demarches_en_ligne: boolean; - accompagnement_des_demarches: string[]; - wifi: boolean; - horaires: horaireStructure; - estOuvert: boolean; - ouvreLe: { jour: string; horaire: string }; -} - -export class horaireStructure { - lundi: Jour; - mardi: Jour; - mercredi: Jour; - jeudi: Jour; - vendredi: Jour; - samedi: Jour; - dimanche: Jour; -} -export class Jour { - open: boolean; - time: { openning: number; closing: number }[]; -} diff --git a/src/app/structure/services/structure.service.spec.ts b/src/app/structure/services/structure.service.spec.ts deleted file mode 100644 index 7c885d6699d0cdf7f8cc33513668fe2988855657..0000000000000000000000000000000000000000 --- a/src/app/structure/services/structure.service.spec.ts +++ /dev/null @@ -1,221 +0,0 @@ -import { HttpClient, HttpClientModule } from '@angular/common/http'; -import { inject, TestBed } from '@angular/core/testing'; -import { horaireStructure, Jour, Structure } from '../models/structure.model'; -import { StructureService } from './structure.service'; -const { DateTime } = require('luxon'); - -describe('StructureService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [HttpClientModule], - }); - }); - let _structureService: StructureService; - beforeEach(inject([StructureService], (_s: StructureService) => { - _structureService = _s; - })); - it('should return an hour string', () => { - const result = _structureService.numberToHour(928); - expect(result).toBe('9h28'); - }); - - it('should return a day string', () => { - const result = _structureService.numberToDay(1); - expect(result).toBe('lundi'); - }); - it('should return null', () => { - const result = _structureService.numberToDay(8); - expect(result).toBeNull(); - }); - - it('Comparer Horaire : should return true', () => { - const result = _structureService.comparerHoraire(830, 1200, 900); - expect(result).toBeTrue(); - }); - - it('Comparer Horaire : should return false', () => { - const result = _structureService.comparerHoraire(830, 1200, 800); - expect(result).toBeFalse(); - }); - - it('Recuperer Horaire : should return an object (Jour)', () => { - const s: Structure = new Structure(); - var horaire = [ - { openning: 800, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - s.horaires = new horaireStructure(); - s.horaires.mardi = new Jour(); - s.horaires.mardi.open = true; - s.horaires.mardi.time = horaire; - const jour: Jour = new Jour(); - jour.open = true; - jour.time = horaire; - const result = _structureService.recupererHoraire(s, 2); - expect(result).toEqual(jour); - }); - - it('Recuperer Horaire : should return undefined', () => { - const s: Structure = new Structure(); - var horaire = [ - { openning: 800, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.lundi.open = true; - s.horaires.lundi.time = horaire; - const jour: Jour = new Jour(); - jour.open = true; - jour.time = horaire; - const result = _structureService.recupererHoraire(s, 2); - expect(result).toBeUndefined(); - }); - - it('Recuperer Horaire : should return null', () => { - const s: Structure = new Structure(); - var horaire = [ - { openning: 800, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - s.horaires = new horaireStructure(); - s.horaires.mardi = new Jour(); - s.horaires.mardi.open = true; - s.horaires.mardi.time = horaire; - const result = _structureService.recupererHoraire(s, 8); - expect(result).toBeNull(); - }); - - it('Recuperer Prochaine Ouverture : should return an object ({Jour/Horaire})', () => { - //Init structure - const s: Structure = new Structure(); - var horaire = [ - { openning: 805, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.mardi = new Jour(); - s.horaires.mercredi = new Jour(); - s.horaires.jeudi = new Jour(); - s.horaires.vendredi = new Jour(); - s.horaires.samedi = new Jour(); - s.horaires.dimanche = new Jour(); - s.horaires.mardi.open = true; - s.horaires.mardi.time = horaire; - - //Init sur vendredi à 14h00 - const result = _structureService.recupererProchaineOuverture(s, 5, 5, 1400); - expect(result).toEqual({ jour: 'mardi', horaire: '8h05' }); - }); - - it('Recuperer Prochaine Ouverture dans la journée : should return an object ({Jour/Horaire})', () => { - //Init structure - const s: Structure = new Structure(); - var horaire = [ - { openning: 805, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.mardi = new Jour(); - s.horaires.mercredi = new Jour(); - s.horaires.jeudi = new Jour(); - s.horaires.vendredi = new Jour(); - s.horaires.samedi = new Jour(); - s.horaires.dimanche = new Jour(); - s.horaires.mardi.open = true; - s.horaires.mardi.time = horaire; - - //Init sur mardi à 12h06 - const result = _structureService.recupererProchaineOuverture(s, 2, 2, 1206); - expect(result).toEqual({ jour: ' ', horaire: '14h00' }); - }); - - it('Recuperer Prochaine Ouverture pour la semaine prochaine sur le même jour : should return an object ({Jour/Horaire})', () => { - //Init structure avec deux horaires le mardi - const s: Structure = new Structure(); - var horaire = [ - { openning: 805, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.mardi = new Jour(); - s.horaires.mercredi = new Jour(); - s.horaires.jeudi = new Jour(); - s.horaires.vendredi = new Jour(); - s.horaires.samedi = new Jour(); - s.horaires.dimanche = new Jour(); - s.horaires.mardi.open = true; - s.horaires.mardi.time = horaire; - - //Init sur mardi à 15h15 - const result = _structureService.recupererProchaineOuverture(s, 2, 2, 1515); - expect(result).toEqual({ jour: 'mardi', horaire: '8h05' }); - }); - - it('Recuperer Prochaine Ouverture : should return an error string', () => { - //Init structure avec aucun horaire - const s: Structure = new Structure(); - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.mardi = new Jour(); - s.horaires.mercredi = new Jour(); - s.horaires.jeudi = new Jour(); - s.horaires.vendredi = new Jour(); - s.horaires.samedi = new Jour(); - s.horaires.dimanche = new Jour(); - - //Init sur jeudi à 12h06 - const result = _structureService.recupererProchaineOuverture(s, 4, 2, 1206); - expect(result).toEqual('Aucun horaire disponible'); - }); - - it('Mise à jour ouverture de la structure : should return true', () => { - var horaire = [ - { openning: 805, closing: 1200 }, - { openning: 1400, closing: 1600 }, - ]; - //Init structure avec aucun horaire - const s: Structure = new Structure(); - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.mardi = new Jour(); - s.horaires.mercredi = new Jour(); - s.horaires.jeudi = new Jour(); - s.horaires.vendredi = new Jour(); - s.horaires.samedi = new Jour(); - s.horaires.dimanche = new Jour(); - - s.horaires.jeudi.open = true; - s.horaires.jeudi.time = horaire; - - //Init date sur un jeudi à 9h05 - var dt = new DateTime.local(2020, 10, 8, 9, 5); - const result = _structureService.majOuvertureStructure(s, dt); - expect(result.estOuvert).toEqual(true); - }); - - it('Mise à jour ouverture de la structure : should return false', () => { - var horaire = [{ openning: 1400, closing: 1600 }]; - //Init structure avec aucun horaire - const s: Structure = new Structure(); - s.horaires = new horaireStructure(); - s.horaires.lundi = new Jour(); - s.horaires.mardi = new Jour(); - s.horaires.mercredi = new Jour(); - s.horaires.jeudi = new Jour(); - s.horaires.vendredi = new Jour(); - s.horaires.samedi = new Jour(); - s.horaires.dimanche = new Jour(); - - s.horaires.jeudi.open = true; - s.horaires.jeudi.time = horaire; - - //Init date sur un jeudi à 9h05 - var dt = new DateTime.local(2020, 10, 8, 9, 5); - const result = _structureService.majOuvertureStructure(s, dt); - expect(result.estOuvert).toEqual(false); - }); -}); diff --git a/src/app/structure/services/structure.service.ts b/src/app/structure/services/structure.service.ts deleted file mode 100644 index f1897802403e7372bbc59685313d5d36251e18d1..0000000000000000000000000000000000000000 --- a/src/app/structure/services/structure.service.ts +++ /dev/null @@ -1,163 +0,0 @@ -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { Jour, Structure } from '../models/structure.model'; - -@Injectable({ - providedIn: 'root', -}) -export class StructureService { - constructor(private http: HttpClient) {} - - recupererStructures() { - return this.http.get('/api/Structures'); - } - - majOuvertureStructure(structure: Structure, dateActuelle: any) { - //Récupère le jour de la semaine. - var jourSemaine: number = dateActuelle.weekday; - - //Vérifie si les minutes commencent par zéro pour éviter la suppression. - var now: number; - if (dateActuelle.minute.toString().length != 1) { - now = parseInt('' + dateActuelle.hour + dateActuelle.minute, 10); - } else { - now = parseInt('' + dateActuelle.hour + 0 + dateActuelle.minute, 10); - } - - //Récupérer les horaires d'une structure en fonction de son jour pour indiquer si elle est ouverte. - var horaireStructure: Jour = this.recupererHoraire(structure, jourSemaine); - structure.estOuvert = false; - if (horaireStructure.open) { - horaireStructure.time.forEach((periode) => { - if (this.comparerHoraire(periode.openning, periode.closing, now)) { - structure.estOuvert = true; - } - }); - } - structure.ouvreLe = this.recupererProchaineOuverture(structure, jourSemaine, jourSemaine, now); - return structure; - } - - //Récupère les horaires d'une structure en fonction du jour de la semaine - recupererHoraire(structure: Structure, jourActuel: number) { - switch (jourActuel) { - case 1: - return structure.horaires.lundi; - case 2: - return structure.horaires.mardi; - case 3: - return structure.horaires.mercredi; - case 4: - return structure.horaires.jeudi; - case 5: - return structure.horaires.vendredi; - case 6: - return structure.horaires.samedi; - case 7: - return structure.horaires.dimanche; - default: - return null; - } - } - //Vérifie si l'heure actuelle est dans l'interval des horaires de la structure - comparerHoraire(heureDeb: number, heureFin: number, heureActuelle: number) { - return heureActuelle >= heureDeb && heureActuelle <= heureFin; - } - - recupererProchaineOuverture(s: Structure, j: number, baseJour: number, baseHeure: number) { - //Récupérer horaire du jour en cours - var horaires = this.recupererHoraire(s, j); - //Condition pour stopper la récursion (Si le jour du compteur est égal au jour en cours) - if (j + 1 != baseJour) { - if (horaires.open) { - //Vérifie si le compteur correspond au jour en cours pour éviter de proposer - //les horaires déjà passés. - if (j != baseJour) { - var jourOuverture = null; - horaires.time.every((periode) => { - if (periode.openning) { - jourOuverture = { jour: this.numberToDay(j), horaire: this.numberToHour(periode.openning) }; - return false; - } - return true; - }); - //Si pas de période trouvée, on réitère. - if (!jourOuverture) { - return this.recupererProchaineOuverture(s, j + 1, baseJour, baseHeure); - } - return jourOuverture; - } else { - var jourOuverture = null; - horaires.time.every((periode) => { - if (periode.openning >= baseHeure) { - jourOuverture = { jour: ' ', horaire: this.numberToHour(periode.openning) }; - return false; - } - return true; - }); - //Si pas de période trouvée, on réitère. - if (!jourOuverture) { - return this.recupererProchaineOuverture(s, j + 1, baseJour, baseHeure); - } - return jourOuverture; - } - } else { - //Si le jour n'est pas égal à Dimanche, on l'incrémente de 1. - if (j != 7) { - return this.recupererProchaineOuverture(s, j + 1, baseJour, baseHeure); - } - //Si le jour est égal à Lundi, on le positionne sur 0 pour activer la condition d'arrêt. - if (baseJour == 1) { - return this.recupererProchaineOuverture(s, 0, baseJour, baseHeure); - } - //Si le jour est égal à Dimanche, on le positionne sur Lundi. - return this.recupererProchaineOuverture(s, 1, baseJour, baseHeure); - } - } - var lastChancehoraire = this.recupererHoraire(s, j + 1); - var lastJour: any; - if (lastChancehoraire.open) { - lastChancehoraire.time.every((periode) => { - if (periode.openning && periode.openning < baseHeure) { - lastJour = { jour: this.numberToDay(j + 1), horaire: this.numberToHour(periode.openning) }; - return false; - } - lastJour = 'Aucun horaire disponible'; - }); - } else { - lastJour = 'Aucun horaire disponible'; - } - return lastJour; - } - - numberToDay(n: number) { - switch (n) { - case 1: - return 'lundi'; - case 2: - return 'mardi'; - case 3: - return 'mercredi'; - case 4: - return 'jeudi'; - case 5: - return 'vendredi'; - case 6: - return 'samedi'; - case 7: - return 'dimanche'; - default: - return null; - } - } - - numberToHour(n: number) { - if (n.toString().length == 3) { - var tabNum = n.toString().match(/.{1,1}/g); - return tabNum[0] + 'h' + tabNum[1] + tabNum[2]; - } else if (n.toString().length == 4) { - var tabNum = n.toString().match(/.{1,2}/g); - return tabNum[0] + 'h' + tabNum[1]; - } - } -} diff --git a/src/app/structure/structure.component.html b/src/app/structure/structure.component.html deleted file mode 100644 index 86c8f63084f2b297a19da3a746ae9411fe54a54b..0000000000000000000000000000000000000000 --- a/src/app/structure/structure.component.html +++ /dev/null @@ -1,5 +0,0 @@ -<div class="container"> - <app-recherche></app-recherche> - <div class="divider"></div> - <app-card></app-card> -</div> diff --git a/src/app/structure/structure.component.scss b/src/app/structure/structure.component.scss deleted file mode 100644 index 2d506b58df5f9e05bb03f988a1fbd0a0d6e7a058..0000000000000000000000000000000000000000 --- a/src/app/structure/structure.component.scss +++ /dev/null @@ -1,11 +0,0 @@ -@import '../../assets/scss/color'; - -.divider { - width: 100%; - height: 1px; - background-color: $grey-4; -} -//En attendant de l'intégrer avec la map -.container { - width: 320px; -} diff --git a/src/app/structure/structure.component.spec.ts b/src/app/structure/structure.component.spec.ts deleted file mode 100644 index 47da9d53d240b0cfd8f22740bf94dfa47b63eae7..0000000000000000000000000000000000000000 --- a/src/app/structure/structure.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { StructureComponent } from './structure.component'; - -describe('StructureComponent', () => { - let component: StructureComponent; - let fixture: ComponentFixture<StructureComponent>; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ StructureComponent ] - }) - .compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(StructureComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/structure/structure.component.ts b/src/app/structure/structure.component.ts deleted file mode 100644 index c74423ddcaed92178392097388a60071b824682c..0000000000000000000000000000000000000000 --- a/src/app/structure/structure.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-structure', - templateUrl: './structure.component.html', - styleUrls: ['./structure.component.scss'] -}) -export class StructureComponent implements OnInit { - - constructor() { } - - ngOnInit(): void { - } - -} diff --git a/src/app/structure/structure.module.ts b/src/app/structure/structure.module.ts deleted file mode 100644 index fdc77203d1ea382ece397e0c9cdba5151f8e6dff..0000000000000000000000000000000000000000 --- a/src/app/structure/structure.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { StructureComponent } from './structure.component'; -import { CardComponent } from './components/card/card.component'; -import { RechercheComponent } from './components/recherche/recherche.component'; -import { HttpClientModule } from '@angular/common/http'; -import { FlexLayoutModule } from '@angular/flex-layout'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; - -@NgModule({ - declarations: [StructureComponent, CardComponent, RechercheComponent], - imports: [CommonModule, HttpClientModule, FlexLayoutModule, ReactiveFormsModule], - exports: [StructureComponent], -}) -export class StructureModule {}