From 8163a30b77f5238d5a3b40ab904b26bad3d907c2 Mon Sep 17 00:00:00 2001 From: Alexey Zinoviev Date: Tue, 23 Jul 2024 08:09:54 +0400 Subject: [PATCH] EZQMS-1109: Add signature details for reviews/approvals (#6111) * ezqms-1109: add signature details for reviews/approvals Signed-off-by: Alexey Zinoviev --- .../document/DocumentSignatories.svelte | 23 ++---- .../right-panel/DocumentApprovalItem.svelte | 80 ++++++++++++------- .../document/right-panel/SignatureInfo.svelte | 24 ++++++ .../src/utils.ts | 17 +++- .../documents/document-approvals-page.ts | 2 +- 5 files changed, 99 insertions(+), 47 deletions(-) create mode 100644 plugins/controlled-documents-resources/src/components/document/right-panel/SignatureInfo.svelte diff --git a/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte b/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte index 74351ba58a..29ec9d7169 100644 --- a/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte +++ b/plugins/controlled-documents-resources/src/components/document/DocumentSignatories.svelte @@ -14,7 +14,7 @@ --> + +
ID: {id}
+
{formatSignatureDate(timestamp)}
diff --git a/plugins/controlled-documents-resources/src/utils.ts b/plugins/controlled-documents-resources/src/utils.ts index 00b2173f96..ef6a6f4917 100644 --- a/plugins/controlled-documents-resources/src/utils.ts +++ b/plugins/controlled-documents-resources/src/utils.ts @@ -35,7 +35,7 @@ import contact, { type Employee, type PersonAccount } from '@hcengineering/conta import request, { RequestStatus } from '@hcengineering/request' import textEditor from '@hcengineering/text-editor' import { isEmptyMarkup } from '@hcengineering/text' -import { getEventPositionElement, showPopup, type Location } from '@hcengineering/ui' +import { getEventPositionElement, showPopup, getUserTimezone, type Location } from '@hcengineering/ui' import { type KeyFilter } from '@hcengineering/view' import chunter from '@hcengineering/chunter' import documents, { @@ -835,3 +835,18 @@ export async function createTemplate (space: OrgSpace): Promise { wizardOpened({ $$currentStep: 'info', location: { space: space._id, project: project ?? documents.ids.NoProject } }) showPopup(documents.component.QmsTemplateWizard, {}) } + +export function formatSignatureDate (date: number): string { + const timeZone: string = getUserTimezone() + + return new Date(date).toLocaleDateString('default', { + year: 'numeric', + month: 'short', + day: 'numeric', + timeZone, + timeZoneName: 'short', + hour: 'numeric', + minute: 'numeric', + second: 'numeric' + }) +} diff --git a/qms-tests/sanity/tests/model/documents/document-approvals-page.ts b/qms-tests/sanity/tests/model/documents/document-approvals-page.ts index e0c1d8ebfa..e9c31cf7d7 100644 --- a/qms-tests/sanity/tests/model/documents/document-approvals-page.ts +++ b/qms-tests/sanity/tests/model/documents/document-approvals-page.ts @@ -19,7 +19,7 @@ export class DocumentApprovalsPage extends DocumentCommonPage { } async checkSuccessApproval (approvalName: string): Promise { - await expect(this.page.locator('svg[fill*="accepted"]').locator('xpath=..').locator('span.ap-label')).toHaveText( + await expect(this.page.locator('svg[fill*="accepted"]').locator('xpath=../..').locator('span.ap-label')).toHaveText( approvalName ) }