feading right data to signature form

This commit is contained in:
2023-03-06 20:21:57 +01:00
parent ab0111c1f5
commit 9035824248
2 changed files with 27 additions and 5 deletions

View File

@@ -34,6 +34,11 @@ export class SidenavComponent {
link: "/contracts/drafts", link: "/contracts/drafts",
icon: IconNamesEnum.PencilSquare icon: IconNamesEnum.PencilSquare
}, },
{
title: "Contracts",
link: "/contracts",
icon: IconNamesEnum.FileEarmarkTextFill
},
] ]
constructor(private router: Router) {} constructor(private router: Router) {}

View File

@@ -1,10 +1,12 @@
import { Component, Input } from '@angular/core'; import {Component, Input, OnInit} from '@angular/core';
import { fabric } from 'fabric'; import { fabric } from 'fabric';
import {ActivatedRoute, ParamMap} from "@angular/router";
import {DomSanitizer} from "@angular/platform-browser";
export class BaseContractsComponent { export class BaseContractsComponent {
protected resource: string = "contract/draft"; protected resource: string = "contract";
protected schema: string = "ContractDraft"; protected schema: string = "Contract";
} }
@Component({ @Component({
@@ -36,7 +38,7 @@ export class ContractsCardComponent extends BaseContractsComponent{
</ng-template> </ng-template>
<ng-template ngbPanelContent> <ng-template ngbPanelContent>
<iframe width="100%" <iframe width="100%"
src="/api/v1/contract/print/" [src]="getPreview()"
onload='javascript:(function(o){o.style.height=o.contentWindow.document.body.scrollHeight+"px";o.style.width=o.contentWindow.document.body.scrollWidth+"px";}(this));' style="height:200px;width:100%;border:none;overflow:hidden;"></iframe> onload='javascript:(function(o){o.style.height=o.contentWindow.document.body.scrollHeight+"px";o.style.width=o.contentWindow.document.body.scrollWidth+"px";}(this));' style="height:200px;width:100%;border:none;overflow:hidden;"></iframe>
</ng-template> </ng-template>
</ngb-panel> </ngb-panel>
@@ -51,5 +53,20 @@ export class ContractsCardComponent extends BaseContractsComponent{
</ngb-accordion> </ngb-accordion>
` `
}) })
export class ContractsSignatureComponent { export class ContractsSignatureComponent implements OnInit {
signature_id: string | null = null;
constructor(
private route: ActivatedRoute,
private sanitizer: DomSanitizer
) {}
ngOnInit() {this.route.paramMap.subscribe((params: ParamMap) => {
this.signature_id = params.get('id')
})
}
getPreview() {
return this.sanitizer.bypassSecurityTrustResourceUrl("/api/v1/contract/print/preview/" + this.signature_id);
}
} }