Commit 2acece6a authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FEAT #16956 TIME 2:25 WIP user otp

parent 8633f904
......@@ -5,27 +5,36 @@
<mat-spinner style="margin:auto;"></mat-spinner>
</div>
<div *ngIf="!loading" class="userForm">
<mat-form-field>
<mat-form-field appearance="fill" *ngIf="sources.length >= 1">
<mat-label>{{ 'lang.source' | translate }}</mat-label>
<mat-select #source [value]="userOTP.source.id" required>
<mat-option *ngFor="let source of sources" [value]="source.id" >
{{ source.label }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.firstname' | translate}}</mat-label>
<input matInput #firstname type="text" [(ngModel)]="userOTP.firstname" required>
</mat-form-field>
<mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.lastname' | translate}}</mat-label>
<input matInput #lastname type="text" [(ngModel)]="userOTP.lastname" required>
</mat-form-field>
<mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.phoneNumber' | translate}}</mat-label>
<input matInput #phoneNumber type="text" [(ngModel)]="userOTP.phone" required>
<mat-hint align="start">{{ 'lang.frFormatPhone' | translate }}</mat-hint>
</mat-form-field>
<mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.email' | translate}}</mat-label>
<input matInput #email type="email" [(ngModel)]="userOTP.email" required>
</mat-form-field>
<mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{'lang.role' | translate}}</mat-label>
<mat-select #role [(ngModel)]="userOTP.role" required>
<mat-option *ngFor="let role of sampleRoles" [value]="role.id" >
......@@ -34,7 +43,7 @@
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{ 'lang.securityMode' | translate }}</mat-label>
<mat-select #securityMode [(ngModel)]="userOTP.mode" required>
<mat-option *ngFor="let mode of securityModes" [value]="mode.id" >
......
......@@ -18,14 +18,28 @@ import { MatDialogRef } from '@angular/material/dialog';
export class CreateUserOtpComponent implements OnInit {
// For TEST
sources: any[] = [
{
id: 1,
label: 'Yousign 1',
type: 'yousign'
},
{
id: 2,
label: 'Yousign 2',
type: 'yousign'
}
];
sampleRoles: any[] = [
{
id: 'visa',
label: this.translate.instant('lang.visa')
id: 'otp_visa_yousign',
label: this.translate.instant('lang.otp_visa_yousign')
},
{
id: 'stamp',
label: this.translate.instant('lang.stamp')
id: 'otp_sign_yousign',
label: this.translate.instant('lang.otp_sign_yousign')
}
];
......@@ -41,7 +55,7 @@ export class CreateUserOtpComponent implements OnInit {
];
userOTP: any = {
type: 'yousign',
source: this.sources[0],
firstname: '',
lastname: '',
email: '',
......@@ -54,11 +68,29 @@ export class CreateUserOtpComponent implements OnInit {
public translate: TranslateService,
public http: HttpClient,
public functions: FunctionsService,
private dialogRef: MatDialogRef<CreateUserOtpComponent>
private dialogRef: MatDialogRef<CreateUserOtpComponent>,
public notify: NotificationService
) { }
ngOnInit(): void {}
async ngOnInit(): Promise<void> {
// await this.getConfig();
}
getConfig() {
return new Promise((resolve) => {
this.http.get('../rest/maarchParapheurOtp').pipe(
tap((data: any) => {
console.log(data);
resolve(true);
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
});
}
addOtpUser() {
this.dialogRef.close({otp: this.userOTP});
......
......@@ -350,24 +350,19 @@ export class ExternalVisaWorkflowComponent implements OnInit {
dialogRef.afterClosed().pipe(
tap(async (data: any) => {
if (data.otp) {
if (data) {
const user = {
'id': null,
'processingUser': null,
'userId': null,
'labelToDisplay': `${data.otp.firstname} ${data.otp.lastname}`,
'requested_signature': true,
'process_date': null,
'picture': await this.actionService.getUserOtpIcon(data.otp.type),
'hasPrivilege': true,
'isValid': true,
'delegatedBy': null,
'role': data.otp.role,
'status': 'OK',
'externalId': {
item_id: null,
item_type: 'userOtp',
labelToDisplay: `${data.otp.firstname} ${data.otp.lastname}`,
picture: await this.actionService.getUserOtpIcon(data.otp.source.type),
hasPrivilege: true,
isValid: true,
role: data.otp.role,
externalId: {
maarchParapheur: null
},
'externalInformations': data.otp
externalInformations: data.otp
};
this.visaWorkflow.items.push(user);
}
......
......@@ -2509,6 +2509,8 @@
"addOtpUser": "Add OTP user",
"securityMode": "Mode of sending the security code",
"sms": "SMS",
"securityModeInfo": "The user will be notified by <b> mail </b> and will receive a <b> security code </b> by <b> {{mode}} </b> at the time of his turn in the workflow.",
"frFormatPhone": "Format: +33XXXXXXXXX"
"securityModeInfo": "The user will be notified by <b>email</b> and will receive a <b> security code </b> by <b> {{mode}} </b> at the time of his turn in the workflow.",
"frFormatPhone": "Format: +33XXXXXXXXX",
"youSign": "Yousign",
"source": "Source"
}
......@@ -2500,6 +2500,10 @@
"addOtpUser": "Ajouter un utilisateur OTP",
"securityMode": "Mode d'envoi du code de sécurité",
"sms": "SMS",
"securityModeInfo": "L'utilisateur sera notifié par <b>mail</b> et recevra un <b>code de sécurité</b> par <b>{{mode}}</b> au moment de son tour dans le circuit.",
"frFormatPhone": "Format: +33XXXXXXXXX"
"securityModeInfo": "L'utilisateur sera notifié par <b>courriel</b> et recevra un <b>code de sécurité</b> par <b>{{mode}}</b> au moment de son tour dans le circuit.",
"frFormatPhone": "Format: +33XXXXXXXXX",
"youSign": "Yousign",
"otp_visa_yousign": "Viseur (yousign)",
"otp_sign_yousign": "Signataire (yousign)",
"source": "Source"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment