-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.ts
More file actions
48 lines (43 loc) · 1.63 KB
/
send.ts
File metadata and controls
48 lines (43 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
@Component({
templateUrl: './send.html'
})
export class EmbedSendDocumentUsingTemplateComponent implements OnInit {
userForm!: FormGroup;
showiframe!: boolean;
showLoading!: boolean;
src!: SafeResourceUrl;
constructor(
private formBuilder: FormBuilder,
private http: HttpClient,
private sanitizer: DomSanitizer,
) { }
onSubmit(): void {
if (this.userForm.invalid) {
console.warn('Fill required fields');
} else {
this.showLoading = true;
this.http.post('http://localhost:8080/api/template/createEmbeddedRequestUrl', this.userForm.value)
.subscribe((data: any) => {
sessionStorage.setItem('documentId', data.documentId);
sessionStorage.setItem('status', 'SEND');
this.userForm.reset();
this.showLoading = false;
this.showiframe = true;
this.src = this.sanitizer.bypassSecurityTrustResourceUrl(data.sendUrl.toString());
});
}
}
ngOnInit() {
this.showiframe = false;
this.showLoading = false;
this.userForm = this.formBuilder.group({
templateId: ['', Validators.required],
name: ['', Validators.required],
email: ['', [Validators.required, Validators.email]],
});
}
}