Merge branch 'staging' into develop

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-02-19 14:12:43 +07:00
14 changed files with 140 additions and 64 deletions
@@ -20,7 +20,7 @@
import { getClient } from '@hcengineering/presentation'
import view from '@hcengineering/view'
import attachment, { Attachment } from '@hcengineering/attachment'
import documents from '@hcengineering/controlled-documents'
import documents, { DocumentState } from '@hcengineering/controlled-documents'
import { Editor, Heading } from '@hcengineering/text-editor'
import {
CollaboratorEditor,
@@ -34,8 +34,9 @@
highlightUpdateCommand,
getNodeElement
} from '@hcengineering/text-editor-resources'
import { navigate, EditBox, Scroller } from '@hcengineering/ui'
import { navigate, EditBox, Scroller, Label } from '@hcengineering/ui'
import { getCollaborationUser, getObjectLinkFragment } from '@hcengineering/view-resources'
import plugin from '../../plugin'
import {
$areDocumentCommentPopupsOpened as areDocumentCommentPopupsOpened,
@@ -248,7 +249,7 @@
<TableOfContents items={headings} enumerated={true} on:select={(ev) => handleShowHeading(ev.detail)} />
</div>
<Scroller>
<div class="content">
<div class="content relative">
<DocumentTitle>
{#if $isEditable}
<EditBox
@@ -262,6 +263,13 @@
{$controlledDocument.title}
{/if}
</DocumentTitle>
{#if $controlledDocument.state === DocumentState.Obsolete}
<div class="watermark-container">
{#each { length: 24 } as _, i}
<div class="watermark"><Label label={plugin.string.Obsolete} /></div>
{/each}
</div>
{/if}
<CollaboratorEditor
bind:this={textEditor}
object={$controlledDocument}
@@ -351,6 +359,34 @@
}
.bottomSpacing {
padding-bottom: 30vh;
padding-bottom: 55vh;
}
.watermark-container {
position: absolute;
z-index: 100;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
gap: 35rem;
padding-top: 20rem;
overflow: hidden;
pointer-events: none;
}
.watermark {
z-index: 100;
margin: auto;
height: 4rem;
width: 100%;
color: var(--theme-divider-color);
font-size: 8rem;
transform: rotate(-45deg);
display: flex;
align-items: center;
justify-content: center;
}
</style>
@@ -58,33 +58,33 @@
const client = getClient()
async function changePlannedEffectiveDate (plannedEffectiveDate: Timestamp) {
if (!$controlledDocument) {
return
}
// async function changePlannedEffectiveDate (plannedEffectiveDate: Timestamp) {
// if (!$controlledDocument) {
// return
// }
await client.update($controlledDocument, { plannedEffectiveDate })
}
// await client.update($controlledDocument, { plannedEffectiveDate })
// }
let selectedDate: Timestamp =
$controlledDocument?.plannedEffectiveDate != null && $controlledDocument?.plannedEffectiveDate > 0
? $controlledDocument.plannedEffectiveDate
: Date.now()
// let selectedDate: Timestamp =
// $controlledDocument?.plannedEffectiveDate != null && $controlledDocument?.plannedEffectiveDate > 0
// ? $controlledDocument.plannedEffectiveDate
// : Date.now()
let selected: IntlString | undefined = undefined
if ($controlledDocument?.plannedEffectiveDate === 0) {
selected = documentsRes.string.EffectiveImmediately
} else if ($controlledDocument?.plannedEffectiveDate != null) {
selected = documentsRes.string.EffectiveOn
}
// let selected: IntlString | undefined = undefined
// if ($controlledDocument?.plannedEffectiveDate === 0) {
// selected = documentsRes.string.EffectiveImmediately
// } else if ($controlledDocument?.plannedEffectiveDate != null) {
// selected = documentsRes.string.EffectiveOn
// }
async function changeSelectedDate (ev: CustomEvent) {
if (ev.detail !== undefined) {
selectedDate = ev.detail
await changePlannedEffectiveDate(ev.detail)
selected = documentsRes.string.EffectiveOn
}
}
// async function changeSelectedDate (ev: CustomEvent) {
// if (ev.detail !== undefined) {
// selectedDate = ev.detail
// await changePlannedEffectiveDate(ev.detail)
// selected = documentsRes.string.EffectiveOn
// }
// }
const reviewIntervals: DropdownTextItem[] = []
for (const interval of periodicReviewIntervals) {
@@ -254,10 +254,10 @@
gap="none"
/>
</div>
<header class="fs-title text-lg my-4">
<header class="fs-title text-lg mt-4">
<Label label={documentsRes.string.EffectiveDocumentLifecycle} />
</header>
<span class="fs-title text-normal">
<!-- <span class="fs-title text-normal">
<Label label={documentsRes.string.EffectiveDate} />
</span>
<div>
@@ -298,7 +298,7 @@
</div>
</RadioButton>
</div>
</div>
</div> -->
<div class="flex-row-center flex-gap-2">
<span class="whitespace-nowrap fs-title text-normal">
<Label label={documentsRes.string.PeriodicReviewToBeCompleted} />
@@ -54,7 +54,7 @@
$controlledDocument != null &&
(isOrgSpace
? $controlledDocument.state !== DocumentState.Effective
: ![DocumentState.Effective, DocumentState.Obsolete, DocumentState.Archived].includes($controlledDocument.state))
: ![DocumentState.Effective, DocumentState.Archived].includes($controlledDocument.state))
</script>
{#if $controlledDocument !== null}