ajout de la page horaires

This commit is contained in:
2022-10-16 20:44:46 +02:00
parent fb402ad1ad
commit 2fa0192357
7 changed files with 132 additions and 12278 deletions

12308
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@ import { MatListModule } from '@angular/material/list';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatGridListModule } from '@angular/material/grid-list';
import { ToastrModule } from 'ngx-toastr';
import { CodeInputModule } from 'angular-code-input';
@@ -83,6 +84,7 @@ import { HoursComponent } from './components/home/workspace/hours/hours.componen
MatProgressBarModule,
MatStepperModule,
MatSlideToggleModule,
MatGridListModule,
FlexLayoutModule,
RouterModule,
FontAwesomeModule,

View File

@@ -0,0 +1,3 @@
mat-grid-tile {
background: lightblue;
}

View File

@@ -1 +1,10 @@
<p>hours works!</p>
<ng-container *ngIf="(schedules$ | async) as sched">
<mat-grid-list cols="{{schedCols}}" rowHeight="3:1">
<ng-container *ngFor="let day of sched">
<mat-grid-tile>{{day.name}}</mat-grid-tile>
<ng-container *ngFor="let hours of day.horaires">
</ng-container>
</ng-container>
</mat-grid-list>
</ng-container>

View File

@@ -1,4 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { BackendService } from '../../../../services/backend/backend.service';
import { Scheduler } from '../../../../models/scheduler.model';
import { ToastrService } from 'ngx-toastr';
import { Observable } from 'rxjs';
import { catchError, map, startWith } from 'rxjs/operators';
@Component({
selector: 'app-hours',
@@ -6,10 +12,23 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./hours.component.css']
})
export class HoursComponent implements OnInit {
schedules$:Observable<Scheduler[]>|null=null;
schedCols:number = 0;
constructor() { }
constructor( private bs:BackendService,
private router:Router,
private toast:ToastrService ) { }
ngOnInit(): void {
this.schedules$ = this.bs.retreiveSchedulers().pipe(
map(datas => {
console.log("scheduler OK ...", datas);
console.log("length: ", Object.keys(datas).length);
console.log("horaires ...",datas[0].horaires);
this.schedCols = Object.keys(datas).length;
return datas;
}
));
}
}

View File

@@ -0,0 +1,55 @@
export interface Horaire {
h00_00:boolean;
h00_30:boolean;
h01_00:boolean;
h01_30:boolean;
h02_00:boolean;
h02_30:boolean;
h03_00:boolean;
h03_30:boolean;
h04_00:boolean;
h04_30:boolean;
h05_00:boolean;
h05_30:boolean;
h06_00:boolean;
h06_30:boolean;
h07_00:boolean;
h07_30:boolean;
h08_00:boolean;
h08_30:boolean;
h09_00:boolean;
h09_30:boolean;
h10_00:boolean;
h10_30:boolean;
h11_00:boolean;
h11_30:boolean;
h12_00:boolean;
h12_30:boolean;
h13_00:boolean;
h13_30:boolean;
h14_00:boolean;
h14_30:boolean;
h15_00:boolean;
h15_30:boolean;
h16_00:boolean;
h16_30:boolean;
h17_00:boolean;
h17_30:boolean;
h18_00:boolean;
h18_30:boolean;
h19_00:boolean;
h19_30:boolean;
h20_00:boolean;
h20_30:boolean;
h21_00:boolean;
h21_30:boolean;
h22_00:boolean;
h22_30:boolean;
h23_00:boolean;
h23_30:boolean;
}
export interface Scheduler {
name:string;
horaires:Horaire;
}

View File

@@ -4,6 +4,7 @@ import { Observable } from 'rxjs';
import { environment } from '../../../environments/environment';
import { Utilisateur } from '../../models/utilisateur.model';
import { Parameters } from '../../models/parameters.model';
import { Scheduler } from '../../models/scheduler.model';
@Injectable({
providedIn: 'root'
@@ -80,6 +81,17 @@ export class BackendService {
return this.http.get<Parameters>(host+"/api/configurateur/params", options);
}
retreiveSchedulers():Observable<Scheduler[]> {
let host=environment.host;
const options = {
headers: new HttpHeaders({
'Content-Type' : 'application/json',
}),
withCredentials: true
};
return this.http.get<Scheduler[]>(host+"/api/configurateur/scheduler", options);
}
updateParams(val:Parameters):Observable<any> {
let host=environment.host;
const options = {