Add multi-approver support
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
committed by
Sacha Al Himdani
parent
3d8c7c4dd6
commit
93c7b0c2dc
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<91bce548869c16de31b1edc3445874d2>>
|
||||
* @generated SignedSource<<0948c131a30705ee3921f60bbd40c3cb>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -14,7 +14,7 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||
export type UpdateDocumentInput = {
|
||||
approverId?: string | null | undefined;
|
||||
approverIds?: ReadonlyArray<string> | null | undefined;
|
||||
classification?: DocumentClassification | null | undefined;
|
||||
content?: string | null | undefined;
|
||||
documentType?: DocumentType | null | undefined;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<4aabb7a5e515082b00152627b1f7c2f1>>
|
||||
* @generated SignedSource<<a96a88e4c176f254788930b251e7108e>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -14,7 +14,7 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||
export type CreateDocumentInput = {
|
||||
approverId: string;
|
||||
approverIds: ReadonlyArray<string>;
|
||||
classification: DocumentClassification;
|
||||
content: string;
|
||||
documentType: DocumentType;
|
||||
@@ -210,22 +210,50 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"storageKey": "approvers(first:100)"
|
||||
},
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
@@ -358,12 +386,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "1ec326debfa93388837c2779cb693dca",
|
||||
"cacheID": "927e922143fa7eac4270e7ac0ae7da39",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "CreateDocumentDialogMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
"text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approvers(first: 100) {\n edges {\n node {\n id\n fullName\n }\n }\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<5cb0be6e5ab775bdf7d509d9789e9821>>
|
||||
* @generated SignedSource<<54fdf6ba6490381a269cd77379fe1810>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -13,7 +13,7 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||
export type UpdateDocumentInput = {
|
||||
approverId?: string | null | undefined;
|
||||
approverIds?: ReadonlyArray<string> | null | undefined;
|
||||
classification?: DocumentClassification | null | undefined;
|
||||
content?: string | null | undefined;
|
||||
documentType?: DocumentType | null | undefined;
|
||||
@@ -27,9 +27,13 @@ export type DocumentLayoutDrawerMutation$variables = {
|
||||
export type DocumentLayoutDrawerMutation$data = {
|
||||
readonly updateDocument: {
|
||||
readonly document: {
|
||||
readonly approver: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
readonly approvers: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly classification: DocumentClassification;
|
||||
readonly documentType: DocumentType;
|
||||
@@ -97,22 +101,50 @@ v2 = [
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v1/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"storageKey": "approvers(first:100)"
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -139,16 +171,16 @@ return {
|
||||
"selections": (v2/*: any*/)
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "717ce480e61acba39409ff42ee5344cb",
|
||||
"cacheID": "e92e7774c449389137a3e5fb1b037e8a",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentLayoutDrawerMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation DocumentLayoutDrawerMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n classification\n approver {\n id\n fullName\n }\n }\n }\n}\n"
|
||||
"text": "mutation DocumentLayoutDrawerMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n classification\n approvers(first: 100) {\n edges {\n node {\n id\n fullName\n }\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "815cb617b0685f018afe95e97c910771";
|
||||
(node as any).hash = "6e9b5aa2c9ba01c18bf26c514c3fbcd3";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<f22c42dfa1b8b70ebed9f29c56d42069>>
|
||||
* @generated SignedSource<<547f6c8756b51ff46a73158262f78e8e>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -12,6 +12,14 @@ import { ReaderFragment } from 'relay-runtime';
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentLayoutDrawer_documentFragment$data = {
|
||||
readonly approvers: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly canUpdate: boolean;
|
||||
readonly documentType: DocumentType;
|
||||
readonly id: string;
|
||||
@@ -22,19 +30,21 @@ export type DocumentLayoutDrawer_documentFragment$key = {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentLayoutDrawer_documentFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = {
|
||||
const node: ReaderFragment = (function(){
|
||||
var v0 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentLayoutDrawer_documentFragment",
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -54,12 +64,60 @@ const node: ReaderFragment = {
|
||||
"kind": "ScalarField",
|
||||
"name": "permission",
|
||||
"storageKey": "permission(action:\"core:document:update\")"
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": "approvers(first:100)"
|
||||
}
|
||||
],
|
||||
"type": "Document",
|
||||
"abstractKey": null
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "0f2e539cf30c4e116fe81392605b1481";
|
||||
(node as any).hash = "ffc32318ed0df6b2992eca91bef297e5";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<a1338ba7fb986ab8e4f5d1e0355a4671>>
|
||||
* @generated SignedSource<<7464a4e3e5b2b5b72a6ecda47b5dace7>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -13,10 +13,6 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
|
||||
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentLayoutDrawer_versionFragment$data = {
|
||||
readonly approver: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
readonly classification: DocumentClassification;
|
||||
readonly id: string;
|
||||
readonly publishedAt: string | null | undefined;
|
||||
@@ -30,45 +26,24 @@ export type DocumentLayoutDrawer_versionFragment$key = {
|
||||
readonly " $fragmentSpreads": FragmentRefs<"DocumentLayoutDrawer_versionFragment">;
|
||||
};
|
||||
|
||||
const node: ReaderFragment = (function(){
|
||||
var v0 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
};
|
||||
return {
|
||||
const node: ReaderFragment = {
|
||||
"argumentDefinitions": [],
|
||||
"kind": "Fragment",
|
||||
"metadata": null,
|
||||
"name": "DocumentLayoutDrawer_versionFragment",
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "classification",
|
||||
"name": "id",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"kind": "ScalarField",
|
||||
"name": "classification",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
@@ -103,8 +78,7 @@ return {
|
||||
"type": "DocumentVersion",
|
||||
"abstractKey": null
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "63b956326e98c7620715250f4e7d1129";
|
||||
(node as any).hash = "ebe62fad4b4044be35adb9ba4979a45a";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<41d49c06d7dfad15f6c1d39cd9eddc80>>
|
||||
* @generated SignedSource<<fa40a22c2297c683c649ccac9f6ebe50>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -275,32 +275,13 @@ v19 = {
|
||||
"storageKey": null
|
||||
},
|
||||
v20 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v21 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "updatedAt",
|
||||
"storageKey": null
|
||||
},
|
||||
v22 = {
|
||||
v21 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
@@ -572,6 +553,53 @@ return {
|
||||
"name": "documentType",
|
||||
"storageKey": null
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v3/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": "approvers(first:100)"
|
||||
},
|
||||
{
|
||||
"condition": "versionSpecified",
|
||||
"kind": "Condition",
|
||||
@@ -608,7 +636,6 @@ return {
|
||||
(v19/*: any*/),
|
||||
(v20/*: any*/),
|
||||
(v21/*: any*/),
|
||||
(v22/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/)
|
||||
],
|
||||
@@ -653,7 +680,6 @@ return {
|
||||
(v19/*: any*/),
|
||||
(v20/*: any*/),
|
||||
(v21/*: any*/),
|
||||
(v22/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v9/*: any*/)
|
||||
],
|
||||
@@ -668,12 +694,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "3e4d94e71ac7cf5c557b5ee59e0917ed",
|
||||
"cacheID": "4291fe2afc2c86c77cbfd01d05f16e75",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentLayoutQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query DocumentLayoutQuery(\n $documentId: ID!\n $versionId: ID!\n $versionSpecified: Boolean!\n) {\n version: node(id: $versionId) @include(if: $versionSpecified) {\n __typename\n ... on DocumentVersion {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n id\n }\n document: node(id: $documentId) {\n __typename\n ... on Document {\n id\n title\n canPublish: permission(action: \"core:document-version:publish\")\n controlInfo: controls(first: 0) {\n totalCount\n }\n ...DocumentTitleFormFragment\n ...DocumentActionsDropdown_documentFragment\n ...DocumentLayoutDrawer_documentFragment\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) @skip(if: $versionSpecified) {\n edges {\n node {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentActionsDropdown_documentFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n versions(first: 20) {\n totalCount\n }\n ...UpdateVersionDialogFragment\n}\n\nfragment DocumentActionsDropdown_versionFragment on DocumentVersion {\n id\n version\n status\n canDeleteDraft: permission(action: \"core:document-version:delete-draft\")\n}\n\nfragment DocumentLayoutDrawer_documentFragment on Document {\n id\n documentType\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment DocumentLayoutDrawer_versionFragment on DocumentVersion {\n id\n classification\n approver {\n id\n fullName\n }\n version\n status\n updatedAt\n publishedAt\n}\n\nfragment DocumentTitleFormFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment UpdateVersionDialogFragment on Document {\n id\n versions(first: 20) {\n edges {\n node {\n id\n status\n content\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
"text": "query DocumentLayoutQuery(\n $documentId: ID!\n $versionId: ID!\n $versionSpecified: Boolean!\n) {\n version: node(id: $versionId) @include(if: $versionSpecified) {\n __typename\n ... on DocumentVersion {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n id\n }\n document: node(id: $documentId) {\n __typename\n ... on Document {\n id\n title\n canPublish: permission(action: \"core:document-version:publish\")\n controlInfo: controls(first: 0) {\n totalCount\n }\n ...DocumentTitleFormFragment\n ...DocumentActionsDropdown_documentFragment\n ...DocumentLayoutDrawer_documentFragment\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) @skip(if: $versionSpecified) {\n edges {\n node {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentActionsDropdown_documentFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n versions(first: 20) {\n totalCount\n }\n ...UpdateVersionDialogFragment\n}\n\nfragment DocumentActionsDropdown_versionFragment on DocumentVersion {\n id\n version\n status\n canDeleteDraft: permission(action: \"core:document-version:delete-draft\")\n}\n\nfragment DocumentLayoutDrawer_documentFragment on Document {\n id\n documentType\n canUpdate: permission(action: \"core:document:update\")\n approvers(first: 100) {\n edges {\n node {\n id\n fullName\n }\n }\n }\n}\n\nfragment DocumentLayoutDrawer_versionFragment on DocumentVersion {\n id\n classification\n version\n status\n updatedAt\n publishedAt\n}\n\nfragment DocumentTitleFormFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment UpdateVersionDialogFragment on Document {\n id\n versions(first: 20) {\n edges {\n node {\n id\n status\n content\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<ac954cbaf8e5e859cbf2112ce60b3047>>
|
||||
* @generated SignedSource<<de4e9afc3a3f6d68664e55bfad5952ff>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -14,9 +14,13 @@ export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
import { FragmentRefs } from "relay-runtime";
|
||||
export type DocumentListItemFragment$data = {
|
||||
readonly approver: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
readonly approvers: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly fullName: string;
|
||||
readonly id: string;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
readonly canDelete: boolean;
|
||||
readonly classification: DocumentClassification;
|
||||
@@ -118,22 +122,50 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v0/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"storageKey": "approvers(first:100)"
|
||||
},
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
@@ -244,6 +276,6 @@ return {
|
||||
};
|
||||
})();
|
||||
|
||||
(node as any).hash = "18456198eadac7ae24bbeebf0f75b5c9";
|
||||
(node as any).hash = "440108e302ffc0f15018c14a9e922e88";
|
||||
|
||||
export default node;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<7ed1236265330f981095a621f4462123>>
|
||||
* @generated SignedSource<<5e613b9c850d6b80e1f133ee1d190845>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -14,7 +14,7 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
|
||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
|
||||
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||
export type UpdateDocumentInput = {
|
||||
approverId?: string | null | undefined;
|
||||
approverIds?: ReadonlyArray<string> | null | undefined;
|
||||
classification?: DocumentClassification | null | undefined;
|
||||
content?: string | null | undefined;
|
||||
documentType?: DocumentType | null | undefined;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<bbb5bdb7a678a554aeb043bc7e2941f0>>
|
||||
* @generated SignedSource<<e4b70bd5e8e7ea7e8bb4f66fac469dde>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -298,22 +298,50 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v12/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v12/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"storageKey": "approvers(first:100)"
|
||||
},
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
@@ -507,12 +535,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "0e6f334d4bea09ecf47fe18b87ef3b84",
|
||||
"cacheID": "232b7e2c41d7603f54a3de844506ce08",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentsListQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query DocumentsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: DocumentOrder = {field: TITLE, direction: ASC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentListFragment_16fISc\n id\n }\n}\n\nfragment DocumentListFragment_16fISc on Organization {\n documents(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
"text": "query DocumentsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: DocumentOrder = {field: TITLE, direction: ASC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentListFragment_16fISc\n id\n }\n}\n\nfragment DocumentListFragment_16fISc on Organization {\n documents(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approvers(first: 100) {\n edges {\n node {\n id\n fullName\n }\n }\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<dcfc5a0f97ee1ee02c8679797141e265>>
|
||||
* @generated SignedSource<<ea3e34a592ca995eba32df84e7f42c24>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -313,22 +313,50 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v8/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"storageKey": "approvers(first:100)"
|
||||
},
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
@@ -523,12 +551,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "5d465e00a354c06dc571df056624dd39",
|
||||
"cacheID": "638d1d0f41916e750ecb5ac9312b0c8c",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "DocumentsPageQuery",
|
||||
"operationKind": "query",
|
||||
"text": "query DocumentsPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateDocument: permission(action: \"core:document:create\")\n ...DocumentListFragment_1WMmEg\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n canSendSigningNotifications: permission(action: \"core:document:send-signing-notifications\")\n id\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentListFragment_1WMmEg on Organization {\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
"text": "query DocumentsPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateDocument: permission(action: \"core:document:create\")\n ...DocumentListFragment_1WMmEg\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n canSendSigningNotifications: permission(action: \"core:document:send-signing-notifications\")\n id\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentListFragment_1WMmEg on Organization {\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approvers(first: 100) {\n edges {\n node {\n id\n fullName\n }\n }\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<ca358b419eca687c5ba8119e7de24829>>
|
||||
* @generated SignedSource<<3d906005c4507bfced1f9d7036939157>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -192,22 +192,50 @@ return {
|
||||
},
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"args": [
|
||||
{
|
||||
"kind": "Literal",
|
||||
"name": "first",
|
||||
"value": 100
|
||||
}
|
||||
],
|
||||
"concreteType": "ProfileConnection",
|
||||
"kind": "LinkedField",
|
||||
"name": "approver",
|
||||
"name": "approvers",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"concreteType": "ProfileEdge",
|
||||
"kind": "LinkedField",
|
||||
"name": "edges",
|
||||
"plural": true,
|
||||
"selections": [
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Profile",
|
||||
"kind": "LinkedField",
|
||||
"name": "node",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "fullName",
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
],
|
||||
"storageKey": null
|
||||
"storageKey": "approvers(first:100)"
|
||||
},
|
||||
{
|
||||
"alias": "lastVersion",
|
||||
@@ -324,12 +352,12 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "0672eb52643ef05e90565df777644a7b",
|
||||
"cacheID": "a62979260c1527e43c12c1effa025815",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "PublishDocumentsDialogMutation",
|
||||
"operationKind": "mutation",
|
||||
"text": "mutation PublishDocumentsDialogMutation(\n $input: BulkPublishDocumentVersionsInput!\n) {\n bulkPublishDocumentVersions(input: $input) {\n documentEdges {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
"text": "mutation PublishDocumentsDialogMutation(\n $input: BulkPublishDocumentVersionsInput!\n) {\n bulkPublishDocumentVersions(input: $input) {\n documentEdges {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approvers(first: 100) {\n edges {\n node {\n id\n fullName\n }\n }\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useFormWithSchema } from "../useFormWithSchema";
|
||||
export const documentSchema = z.object({
|
||||
title: z.string().min(1, "Title is required"),
|
||||
content: z.string().min(1, "Content is required"),
|
||||
approverId: z.string().min(1, "Approver is required"),
|
||||
approverIds: z.array(z.string()).min(1, "At least one approver is required"),
|
||||
documentType: z.enum(["OTHER", "ISMS", "POLICY", "PROCEDURE"]),
|
||||
classification: z.enum(["PUBLIC", "INTERNAL", "CONFIDENTIAL", "SECRET"]),
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ import type { CreateDocumentDialogMutation } from "#/__generated__/core/CreateDo
|
||||
import { ControlledField } from "#/components/form/ControlledField";
|
||||
import { DocumentClassificationOptions } from "#/components/form/DocumentClassificationOptions";
|
||||
import { DocumentTypeOptions } from "#/components/form/DocumentTypeOptions";
|
||||
import { PeopleSelectField } from "#/components/form/PeopleSelectField";
|
||||
import { PeopleMultiSelectField } from "#/components/form/PeopleMultiSelectField";
|
||||
import { documentSchema, useDocumentForm } from "#/hooks/forms/useDocumentForm";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
@@ -143,12 +143,12 @@ export function CreateDocumentDialog({ trigger, connection }: Props) {
|
||||
</PropertyRow>
|
||||
|
||||
<PropertyRow
|
||||
id="approverId"
|
||||
label={__("Approver")}
|
||||
error={errors.approverId?.message}
|
||||
id="approverIds"
|
||||
label={__("Approvers")}
|
||||
error={errors.approverIds?.message}
|
||||
>
|
||||
<PeopleSelectField
|
||||
name="approverId"
|
||||
<PeopleMultiSelectField
|
||||
name="approverIds"
|
||||
control={control}
|
||||
organizationId={organizationId}
|
||||
/>
|
||||
|
||||
@@ -12,7 +12,7 @@ import type { DocumentLayoutDrawerMutation } from "#/__generated__/core/Document
|
||||
import { ControlledField } from "#/components/form/ControlledField";
|
||||
import { DocumentClassificationOptions } from "#/components/form/DocumentClassificationOptions";
|
||||
import { DocumentTypeOptions } from "#/components/form/DocumentTypeOptions";
|
||||
import { PeopleSelectField } from "#/components/form/PeopleSelectField";
|
||||
import { PeopleMultiSelectField } from "#/components/form/PeopleMultiSelectField";
|
||||
import { useFormWithSchema } from "#/hooks/useFormWithSchema";
|
||||
import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
@@ -22,6 +22,14 @@ const documentFragment = graphql`
|
||||
id
|
||||
documentType
|
||||
canUpdate: permission(action: "core:document:update")
|
||||
approvers(first: 100) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -29,10 +37,6 @@ const versionFragment = graphql`
|
||||
fragment DocumentLayoutDrawer_versionFragment on DocumentVersion {
|
||||
id
|
||||
classification
|
||||
approver {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
version
|
||||
status
|
||||
updatedAt
|
||||
@@ -47,9 +51,13 @@ const updateDocumentMutation = graphql`
|
||||
id
|
||||
documentType
|
||||
classification
|
||||
approver {
|
||||
id
|
||||
fullName
|
||||
approvers(first: 100) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +65,7 @@ const updateDocumentMutation = graphql`
|
||||
`;
|
||||
|
||||
const schema = z.object({
|
||||
approverId: z.string().min(1, "Approver is required"),
|
||||
approverIds: z.array(z.string()).min(1, "At least one approver is required"),
|
||||
documentType: z.enum(documentTypes),
|
||||
classification: z.enum(documentClassifications),
|
||||
});
|
||||
@@ -80,11 +88,13 @@ export function DocumentLayoutDrawer(props: {
|
||||
|
||||
const isDraft = version.status === "DRAFT";
|
||||
|
||||
const approvers = document.approvers.edges.map(e => e.node);
|
||||
|
||||
const { control, handleSubmit, reset } = useFormWithSchema(
|
||||
schema,
|
||||
{
|
||||
defaultValues: {
|
||||
approverId: version.approver.id,
|
||||
approverIds: approvers.map(a => a.id),
|
||||
documentType: document.documentType,
|
||||
classification: version.classification,
|
||||
},
|
||||
@@ -100,12 +110,12 @@ export function DocumentLayoutDrawer(props: {
|
||||
},
|
||||
);
|
||||
|
||||
const handleUpdateApprover = async (data: { approverId: string }) => {
|
||||
const handleUpdateApprover = async (data: { approverIds: string[] }) => {
|
||||
await updateDocument({
|
||||
variables: {
|
||||
input: {
|
||||
id: document.id,
|
||||
approverId: data.approverId,
|
||||
approverIds: data.approverIds,
|
||||
},
|
||||
},
|
||||
onSuccess: () => {
|
||||
@@ -151,7 +161,7 @@ export function DocumentLayoutDrawer(props: {
|
||||
<div className="text-base text-txt-primary font-medium mb-4">
|
||||
{__("Properties")}
|
||||
</div>
|
||||
<PropertyRow label={__("Approver")}>
|
||||
<PropertyRow label={__("Approvers")}>
|
||||
{isEditingApprover
|
||||
? (
|
||||
<EditablePropertyContent
|
||||
@@ -162,10 +172,11 @@ export function DocumentLayoutDrawer(props: {
|
||||
}}
|
||||
disabled={isUpdatingDocument}
|
||||
>
|
||||
<PeopleSelectField
|
||||
name="approverId"
|
||||
<PeopleMultiSelectField
|
||||
name="approverIds"
|
||||
control={control}
|
||||
organizationId={organizationId}
|
||||
selectedPeople={approvers}
|
||||
/>
|
||||
</EditablePropertyContent>
|
||||
)
|
||||
@@ -174,10 +185,14 @@ export function DocumentLayoutDrawer(props: {
|
||||
onEdit={() => setIsEditingApprover(true)}
|
||||
canEdit={document.canUpdate}
|
||||
>
|
||||
<Badge variant="highlight" size="md" className="gap-2">
|
||||
<Avatar name={version.approver.fullName} />
|
||||
{version.approver.fullName}
|
||||
</Badge>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{approvers.map(approver => (
|
||||
<Badge key={approver.id} variant="highlight" size="md" className="gap-2">
|
||||
<Avatar name={approver.fullName} />
|
||||
{approver.fullName}
|
||||
</Badge>
|
||||
))}
|
||||
</div>
|
||||
</ReadOnlyPropertyContent>
|
||||
)}
|
||||
</PropertyRow>
|
||||
|
||||
@@ -167,7 +167,7 @@ export function DocumentList(props: {
|
||||
{__("Type")}
|
||||
</SortableTh>
|
||||
<Th className="w-32">{__("Classification")}</Th>
|
||||
<Th className="w-60">{__("Approver")}</Th>
|
||||
<Th className="w-60">{__("Approvers")}</Th>
|
||||
<Th className="w-60">{__("Last update")}</Th>
|
||||
<Th className="w-20">{__("Signatures")}</Th>
|
||||
{hasAnyAction && <Th className="w-18"></Th>}
|
||||
|
||||
@@ -17,9 +17,13 @@ const fragment = graphql`
|
||||
classification
|
||||
updatedAt
|
||||
canDelete: permission(action: "core:document:delete")
|
||||
approver {
|
||||
id
|
||||
fullName
|
||||
approvers(first: 100) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
fullName
|
||||
}
|
||||
}
|
||||
}
|
||||
lastVersion: versions(first: 1 orderBy: { field: CREATED_AT direction: DESC }) {
|
||||
edges {
|
||||
@@ -129,8 +133,12 @@ export function DocumentListItem(props: {
|
||||
</Td>
|
||||
<Td className="w-60">
|
||||
<div className="flex gap-2 items-center">
|
||||
<Avatar name={document.approver?.fullName ?? ""} />
|
||||
{document.approver?.fullName}
|
||||
{document.approvers.edges.map(({ node }) => (
|
||||
<div key={node.id} className="flex gap-1 items-center">
|
||||
<Avatar name={node.fullName} />
|
||||
{node.fullName}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Td>
|
||||
<Td className="w-60">{formatDate(document.updatedAt)}</Td>
|
||||
|
||||
Reference in New Issue
Block a user