fix(workspace): pass the active document into sign and audit views
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { DeesElement, state, html, customElement, type TemplateResult, css } from '@design.estate/dees-element';
|
||||
import { actionButton, demoFields, fakeDocument, icon, pill, workspaceBaseStyles, workspaceDemoFrame, type IFieldPlacement } from './sdig-workspace.shared.js';
|
||||
import { DeesElement, property, state, html, customElement, type TemplateResult, css } from '@design.estate/dees-element';
|
||||
import { actionButton, demoDocuments, demoFields, fakeDocument, icon, pill, workspaceBaseStyles, workspaceDemoFrame, type IDocumentRow, type IFieldPlacement } from './sdig-workspace.shared.js';
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
@@ -12,6 +12,7 @@ export class SdigWorkspaceSign extends DeesElement {
|
||||
public static demo = () => workspaceDemoFrame(html`<sdig-workspace-sign></sdig-workspace-sign>`);
|
||||
public static demoGroups = ['Signature Digital Workspace'];
|
||||
|
||||
@property({ attribute: false }) public accessor document: IDocumentRow = demoDocuments[0];
|
||||
@state() private accessor activeFieldId: string = 'f1';
|
||||
@state() private accessor signedFieldIds: string[] = [];
|
||||
|
||||
@@ -51,13 +52,14 @@ export class SdigWorkspaceSign extends DeesElement {
|
||||
}
|
||||
|
||||
public render(): TemplateResult {
|
||||
const document = this.document || demoDocuments[0];
|
||||
const completed = this.signedFieldIds.length;
|
||||
const progress = Math.round((completed / this.signFields.length) * 100);
|
||||
const activeField = this.signFields.find((field) => field.id === this.activeFieldId) || this.signFields[0];
|
||||
|
||||
return html`
|
||||
<div class="recipient-header">
|
||||
<div style="display: flex; align-items: center; gap: 12px;"><span class="logomark">s</span><div><div style="font-size: 12px; font-weight: 600;">Master Services Agreement</div><div class="mono" style="font-size: 10px; color: var(--text-muted);">From Lossless GmbH · doc_8mK3pL · 14 pages</div></div></div>
|
||||
<div style="display: flex; align-items: center; gap: 12px;"><span class="logomark">s</span><div><div style="font-size: 12px; font-weight: 600;">${document.title}</div><div class="mono" style="font-size: 10px; color: var(--text-muted);">From ${document.sender} · ${document.id} · ${document.pages} pages</div></div></div>
|
||||
<div class="actions"><span class="pill success">${icon('shield', 12)} Verified sender · DKIM ✓</span>${actionButton('Decline', 'outline')}${actionButton('PDF', 'outline', 'download')}</div>
|
||||
</div>
|
||||
<div class="progress-track"><div class="progress-fill" style="width: ${progress}%"></div></div>
|
||||
@@ -70,7 +72,7 @@ export class SdigWorkspaceSign extends DeesElement {
|
||||
const active = this.activeFieldId === field.id && !filled;
|
||||
return html`<div class="field-box ${active ? 'selected' : ''}" style="--x: ${field.x}px; --y: ${field.y}px; --w: ${field.w}px; --h: ${field.h}px; --field-color: ${filled ? 'transparent' : 'var(--accent)'}; color: ${filled ? 'hsl(220 50% 30%)' : 'var(--accent)'}; background: ${filled ? 'transparent' : 'color-mix(in srgb, var(--accent) 12%, transparent)'};" @click=${() => !filled ? this.signField(field.id) : undefined}>${filled ? this.renderSignedValue(field) : html`${icon(this.fieldIcon(field.type), 12)}<span>${active ? html`<span style="display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite;"></span>` : ''}${field.label}</span>`}</div>`;
|
||||
})}
|
||||
<div class="mono" style="position: absolute; bottom: 14px; right: 18px; font-size: 9px; color: hsl(0 0% 60%);">Page 1 of 14</div>
|
||||
<div class="mono" style="position: absolute; bottom: 14px; right: 18px; font-size: 9px; color: hsl(0 0% 60%);">Page 1 of ${document.pages}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sign-panel">
|
||||
|
||||
Reference in New Issue
Block a user