ajout du parametre de choix de fonctionnement du module

This commit is contained in:
Vincent BENOIT
2022-10-28 11:58:29 +02:00
parent 8f8f1fdf84
commit 56b98d9c44
6 changed files with 22 additions and 4 deletions

View File

@@ -30,6 +30,7 @@ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatGridListModule } from '@angular/material/grid-list'; import { MatGridListModule } from '@angular/material/grid-list';
import { MatTabsModule } from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import { MatSliderModule } from '@angular/material/slider'; import { MatSliderModule } from '@angular/material/slider';
import { MatRadioModule } from '@angular/material/radio';
import { ToastrModule } from 'ngx-toastr'; import { ToastrModule } from 'ngx-toastr';
import { CodeInputModule } from 'angular-code-input'; import { CodeInputModule } from 'angular-code-input';
@@ -91,6 +92,7 @@ import { LogsComponent } from './components/home/workspace/logs/logs.component';
MatGridListModule, MatGridListModule,
MatTabsModule, MatTabsModule,
MatSliderModule, MatSliderModule,
MatRadioModule,
FlexLayoutModule, FlexLayoutModule,
RouterModule, RouterModule,
FontAwesomeModule, FontAwesomeModule,

View File

@@ -12,6 +12,7 @@
} }
table { table {
margin: 1rem;
table-layout: fixed; table-layout: fixed;
align: center; align: center;
width: 80%; width: 80%;

View File

@@ -6,12 +6,20 @@
<div *ngIf="!isProcessing" class="container" <div *ngIf="!isProcessing" class="container"
fxLayout="column" fxLayout="column"
fxLayoutAlign="space-around center"> fxLayoutAlign="space-around center">
<section style="margin-top:1rem; width: 70%;">
<label style="margin-left: 10px; font-size: smaller;">Fonctionnement:</label>
<mat-radio-group [(ngModel)]="defaultOp">
<mat-radio-button style="margin: 10px; font-size: smaller;" *ngFor="let operation of operations" [value]="operation">
{{operation}}
</mat-radio-button>
</mat-radio-group>
</section>
<!-- Params Form --> <!-- Params Form -->
<form [formGroup]="paramsFG" <form [formGroup]="paramsFG"
fxLayout="column"> fxLayout="column">
<mat-slide-toggle [checked]="slideDisable" (change)="onSlideChanged($event)" style="margin-left:10px; margin-top:0.3rem; margin-bottom:1rem; font-size: smaller;">Activer code PIN</mat-slide-toggle>
<mat-slide-toggle [checked]="slideDisable" (change)="onSlideChanged($event)" style="margin: 10px; font-size: smaller;">Activer code PIN</mat-slide-toggle> <code-input [isCodeHidden]="false" [codeLength]="4" [disabled]="!pinChecked" [code]="pinNumber" (codeChanged)="onCodeChanged($event)" (codeCompleted)="onCodeCompleted($event)" style="margin-bottom:1rem;"></code-input>
<code-input [isCodeHidden]="false" [codeLength]="4" [disabled]="!pinChecked" [code]="pinNumber" (codeChanged)="onCodeChanged($event)" (codeCompleted)="onCodeCompleted($event)"></code-input>
<mat-form-field style="margin: 5px 10px 5px 10px;"> <mat-form-field style="margin: 5px 10px 5px 10px;">
<mat-label>Téléphone accepté</mat-label> <mat-label>Téléphone accepté</mat-label>
<span matPrefix style="font-size: smaller;">+33 &nbsp;</span> <span matPrefix style="font-size: smaller;">+33 &nbsp;</span>

View File

@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ThemePalette } from '@angular/material/core';
import { FormBuilder, FormGroup, Validators, ValidatorFn, ValidationErrors, AbstractControl } from '@angular/forms'; import { FormBuilder, FormGroup, Validators, ValidatorFn, ValidationErrors, AbstractControl } from '@angular/forms';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { BackendService } from '../../../../services/backend/backend.service'; import { BackendService } from '../../../../services/backend/backend.service';
@@ -17,6 +18,8 @@ export class ParametresComponent implements OnInit {
pinChecked:boolean=false; pinChecked:boolean=false;
pinNumber:string="0000"; pinNumber:string="0000";
isProcessing:boolean = true; isProcessing:boolean = true;
defaultOp:string = 'Manuel ON';
operations:string[] = ['Manuel ON', 'Manuel OFF', 'Horaires'];
constructor(private fb:FormBuilder, constructor(private fb:FormBuilder,
private bs:BackendService, private bs:BackendService,
@@ -49,6 +52,7 @@ export class ParametresComponent implements OnInit {
this.paramsFG.get('num_tone').setValue(data.tone_duration); this.paramsFG.get('num_tone').setValue(data.tone_duration);
this.paramsFG.get('dtmf_code').setValue(data.dtmf_code); this.paramsFG.get('dtmf_code').setValue(data.dtmf_code);
this.paramsFG.get('dtmf_duration').setValue(data.dtmf_duration); this.paramsFG.get('dtmf_duration').setValue(data.dtmf_duration);
this.defaultOp = data.operation;
this.slideDisable = data.pin_actif; this.slideDisable = data.pin_actif;
this.pinChecked = data.pin_actif; this.pinChecked = data.pin_actif;
this.pinNumber = data.code_pin; this.pinNumber = data.code_pin;
@@ -83,12 +87,14 @@ export class ParametresComponent implements OnInit {
return; return;
} }
let params:Parameters = {pin_actif:false, let params:Parameters = {operation:'',
pin_actif:false,
code_pin:'', code_pin:'',
num_autorized:'', num_autorized:'',
tone_duration:0, tone_duration:0,
dtmf_code:'', dtmf_code:'',
dtmf_duration:0}; dtmf_duration:0};
params.operation = this.defaultOp;
params.pin_actif = this.pinChecked; params.pin_actif = this.pinChecked;
if (this.pinChecked == false) { if (this.pinChecked == false) {
params.code_pin = '0000'; params.code_pin = '0000';

View File

@@ -1,4 +1,5 @@
export interface Parameters { export interface Parameters {
operation:string;
pin_actif:boolean; pin_actif:boolean;
code_pin:string; code_pin:string;
num_autorized:string; num_autorized:string;

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB