62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import { loadingPanelService } from './../../hrm-loding panel/loding.panel.service';
|
|
import {Component, OnInit} from '@angular/core';
|
|
import { AuthService } from 'src/app/_services/auth/auth.service';
|
|
import { ApiService } from 'src/app/app.api.service';
|
|
import { HRMNotificationService } from 'src/app/app.notification.service';
|
|
|
|
@Component({
|
|
selector: 'app-cipher-engine',
|
|
templateUrl: './cipher-engine.component.html',
|
|
styleUrl: './cipher-engine.component.scss',
|
|
standalone: false,
|
|
})
|
|
export class CipherEngineComponent implements OnInit{
|
|
constructor(public notificationService: HRMNotificationService,
|
|
public authService: AuthService, public apiService: ApiService,
|
|
public loadingPanelService : loadingPanelService) {
|
|
this.apiService.selectedMenuName = 'Cipher Engine';
|
|
}
|
|
|
|
decryptedvalue : any = "";
|
|
encryptedValue : any = "";
|
|
|
|
ngOnInit() {
|
|
this.decryptedvalue = "";
|
|
this.encryptedValue = "";
|
|
}
|
|
clearInput() {
|
|
this.decryptedvalue = "";
|
|
}
|
|
handleEnterKey(event: KeyboardEvent): void {
|
|
event.preventDefault();
|
|
if (this.encryptedValue?.trim()) {
|
|
|
|
}
|
|
}
|
|
CipherMechanism(){
|
|
if(!this.decryptedvalue){
|
|
this.notificationService.showWarning("Please enter text to encrypt first.");
|
|
return;
|
|
}
|
|
const data = {
|
|
decryptedvalue : this.decryptedvalue
|
|
}
|
|
this.loadingPanelService.ShowLoadingPanel = true;
|
|
this.authService.CipherMechanism(data).subscribe(
|
|
(resp: any) => {
|
|
this.encryptedValue = resp as string;
|
|
},
|
|
(err) => {
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
this.notificationService.showError(err.error);
|
|
},
|
|
() => {
|
|
this.loadingPanelService.ShowLoadingPanel = false;
|
|
});
|
|
}
|
|
copyDecryptValueToClipboard(){
|
|
if (!this.encryptedValue) return;
|
|
navigator.clipboard.writeText(this.encryptedValue).catch(() => {});
|
|
}
|
|
}
|