mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-09 19:27:44 +02:00
EQMS-1650: External approvers (#9987)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
+10
@@ -53,6 +53,7 @@
|
||||
currentStepUpdated
|
||||
} from '../../stores/wizards/create-document'
|
||||
import FailedToCreateDocument from '../FailedToCreateDocument.svelte'
|
||||
import { updateExternalApproversAccess } from '../../utils'
|
||||
|
||||
export let _class: Ref<Class<ControlledDocument>> = documents.class.ControlledDocument
|
||||
|
||||
@@ -119,6 +120,7 @@
|
||||
requests: 0,
|
||||
reviewers: [],
|
||||
approvers: [],
|
||||
externalApprovers: [],
|
||||
coAuthors: [],
|
||||
plannedEffectiveDate: 0,
|
||||
reviewInterval: DEFAULT_PERIODIC_REVIEW_INTERVAL
|
||||
@@ -176,6 +178,14 @@
|
||||
|
||||
await createChangeControl(client, ccRecordId, ccRecord, _space)
|
||||
|
||||
if (docObject.externalApprovers.length > 0) {
|
||||
const controlledDoc = await client.findOne(documents.class.ControlledDocument, { _id: newDocId })
|
||||
|
||||
if (controlledDoc !== undefined) {
|
||||
await updateExternalApproversAccess(client, controlledDoc, docObject.externalApprovers, [])
|
||||
}
|
||||
}
|
||||
|
||||
const loc = getProjectDocumentLink(newDocId, $locationStep.project)
|
||||
navigate(loc)
|
||||
|
||||
|
||||
+10
@@ -52,6 +52,7 @@
|
||||
wizardClosed
|
||||
} from '../../stores/wizards/create-document'
|
||||
import FailedToCreateDocument from '../FailedToCreateDocument.svelte'
|
||||
import { updateExternalApproversAccess } from '../../utils'
|
||||
|
||||
export let _class: Ref<Class<ControlledDocument>> = documents.class.ControlledDocument
|
||||
export let _templateMixin: Ref<Mixin<DocumentTemplate>> = documents.mixin.DocumentTemplate
|
||||
@@ -114,6 +115,7 @@
|
||||
requests: 0,
|
||||
reviewers: [],
|
||||
approvers: [],
|
||||
externalApprovers: [],
|
||||
coAuthors: [],
|
||||
plannedEffectiveDate: 0,
|
||||
reviewInterval: DEFAULT_PERIODIC_REVIEW_INTERVAL
|
||||
@@ -178,6 +180,14 @@
|
||||
|
||||
await createChangeControl(client, ccRecordId, ccRecord, space)
|
||||
|
||||
if (docObject.externalApprovers.length > 0) {
|
||||
const controlledDoc = await client.findOne(documents.class.ControlledDocument, { _id: newDocId })
|
||||
|
||||
if (controlledDoc !== undefined) {
|
||||
await updateExternalApproversAccess(client, controlledDoc, docObject.externalApprovers, [])
|
||||
}
|
||||
}
|
||||
|
||||
const loc = getProjectDocumentLink(newDocId, $locationStep.project)
|
||||
navigate(loc)
|
||||
|
||||
|
||||
+11
-2
@@ -26,7 +26,7 @@
|
||||
async function handleUpdate ({
|
||||
detail
|
||||
}: {
|
||||
detail: { type: 'reviewers' | 'approvers', users: Ref<Employee>[] }
|
||||
detail: { type: 'reviewers' | 'approvers' | 'coAuthors' | 'externalApprovers', users: Ref<Employee>[] }
|
||||
}): Promise<void> {
|
||||
if (docObject === undefined) {
|
||||
return
|
||||
@@ -40,11 +40,20 @@
|
||||
$: reviewers = docObject?.reviewers ?? []
|
||||
$: approvers = docObject?.approvers ?? []
|
||||
$: coAuthors = docObject?.coAuthors ?? []
|
||||
$: externalApprovers = docObject?.externalApprovers ?? []
|
||||
</script>
|
||||
|
||||
{#if docObject !== undefined}
|
||||
<div class="root">
|
||||
<DocTeam controlledDoc={docObject} {space} on:update={handleUpdate} {approvers} {reviewers} {coAuthors} />
|
||||
<DocTeam
|
||||
controlledDoc={docObject}
|
||||
{space}
|
||||
on:update={handleUpdate}
|
||||
{approvers}
|
||||
{reviewers}
|
||||
{coAuthors}
|
||||
{externalApprovers}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user