diff --git a/apps/console/src/components/form/PeopleMultiSelectField.tsx b/apps/console/src/components/form/PeopleMultiSelectField.tsx index 4d760de79..e8b98e3bc 100644 --- a/apps/console/src/components/form/PeopleMultiSelectField.tsx +++ b/apps/console/src/components/form/PeopleMultiSelectField.tsx @@ -18,12 +18,14 @@ type Props = { label?: string; error?: string; selectedPeople?: Person[]; + placeholder?: string; } & ComponentProps; export function PeopleMultiSelectField({ organizationId, control, selectedPeople = [], + placeholder, ...props }: Props) { return ( @@ -37,6 +39,7 @@ export function PeopleMultiSelectField({ name={props.name} disabled={props.disabled} selectedPeople={selectedPeople} + placeholder={placeholder} /> @@ -44,10 +47,10 @@ export function PeopleMultiSelectField({ } function PeopleMultiSelectWithQuery( - props: Pick, "organizationId" | "control" | "name" | "disabled" | "selectedPeople">, + props: Pick, "organizationId" | "control" | "name" | "disabled" | "selectedPeople" | "placeholder">, ) { const { __ } = useTranslate(); - const { name, organizationId, control, selectedPeople = [] } = props; + const { name, organizationId, control, selectedPeople = [], placeholder } = props; const people = usePeople(organizationId, { excludeContractEnded: true }); const [isOpen, setIsOpen] = useState(false); @@ -91,7 +94,7 @@ function PeopleMultiSelectWithQuery( disabled={props.disabled} id={name} variant="editor" - placeholder={__("Add attendees...")} + placeholder={placeholder ?? __("Add people...")} onValueChange={handleAddPerson} key={`${selectedPeopleIds.length}-${people.length}`} className="w-full" diff --git a/apps/console/src/pages/organizations/documents/_components/CreateDocumentDialog.tsx b/apps/console/src/pages/organizations/documents/_components/CreateDocumentDialog.tsx index 4d7ea4d13..432c5a9fc 100644 --- a/apps/console/src/pages/organizations/documents/_components/CreateDocumentDialog.tsx +++ b/apps/console/src/pages/organizations/documents/_components/CreateDocumentDialog.tsx @@ -151,6 +151,7 @@ export function CreateDocumentDialog({ trigger, connection }: Props) { name="approverIds" control={control} organizationId={organizationId} + placeholder={__("Add approvers...")} /> diff --git a/apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx b/apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx index a1277553d..3de4c0fbc 100644 --- a/apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx +++ b/apps/console/src/pages/organizations/documents/_components/DocumentLayoutDrawer.tsx @@ -177,6 +177,7 @@ export function DocumentLayoutDrawer(props: { control={control} organizationId={organizationId} selectedPeople={approvers} + placeholder={__("Add approvers...")} /> ) diff --git a/apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx b/apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx index 7897aa344..55af986a6 100644 --- a/apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx +++ b/apps/console/src/pages/organizations/documents/_components/DocumentListItem.tsx @@ -1,6 +1,6 @@ import { formatDate, getDocumentClassificationLabel, getDocumentTypeLabel, sprintf } from "@probo/helpers"; import { useTranslate } from "@probo/i18n"; -import { ActionDropdown, Avatar, Badge, Checkbox, DropdownItem, IconTrashCan, Td, Tr, useConfirm } from "@probo/ui"; +import { ActionDropdown, Badge, Checkbox, DropdownItem, IconTrashCan, Td, Tr, useConfirm } from "@probo/ui"; import { useFragment } from "react-relay"; import { type DataID, graphql } from "relay-runtime"; @@ -132,14 +132,7 @@ export function DocumentListItem(props: { {getDocumentClassificationLabel(__, document.classification)} -
- {document.approvers.edges.map(({ node }) => ( -
- - {node.fullName} -
- ))} -
+ {document.approvers.edges.map(({ node }) => node.fullName).join(", ")} {formatDate(document.updatedAt)} diff --git a/apps/console/src/pages/organizations/meetings/dialogs/CreateMeetingDialog.tsx b/apps/console/src/pages/organizations/meetings/dialogs/CreateMeetingDialog.tsx index 977f4a196..617010cdf 100644 --- a/apps/console/src/pages/organizations/meetings/dialogs/CreateMeetingDialog.tsx +++ b/apps/console/src/pages/organizations/meetings/dialogs/CreateMeetingDialog.tsx @@ -104,6 +104,7 @@ export function CreateMeetingDialog({ children, connectionId }: Props) { control={control} organizationId={organizationId} label={__("Attendees")} + placeholder={__("Add attendees...")} /> diff --git a/pkg/docgen/generator.go b/pkg/docgen/generator.go index eb5a76c7f..2a3de7d7f 100644 --- a/pkg/docgen/generator.go +++ b/pkg/docgen/generator.go @@ -204,7 +204,7 @@ type ( Content string Version int Classification Classification - Approver string + Approvers []string Description string PublishedAt *time.Time Signatures []SignatureData diff --git a/pkg/docgen/generator_test.go b/pkg/docgen/generator_test.go index b90264481..a9a77582f 100644 --- a/pkg/docgen/generator_test.go +++ b/pkg/docgen/generator_test.go @@ -41,7 +41,7 @@ func TestRenderHTML(t *testing.T) { Content: "# Main Title\n\nThis is **bold** text with *italic* formatting.", Version: 1, Classification: ClassificationPublic, - Approver: "John Doe", + Approvers: []string{"John Doe"}, PublishedAt: &now, Signatures: []SignatureData{ { @@ -66,9 +66,9 @@ func TestRenderHTML(t *testing.T) { { name: "document with HTML characters that need escaping", data: DocumentData{ - Title: "Test & Doe", + Title: "Test & Doe"}, Signatures: []SignatureData{ { SignedBy: "Alice & ", @@ -253,8 +253,8 @@ func TestClassificationConstants(t *testing.T) { func TestHTMLEscaping(t *testing.T) { dangerousData := DocumentData{ - Title: "", - Approver: "User & ", + Title: "", + Approvers: []string{"User & "}, Signatures: []SignatureData{ { SignedBy: "tag", @@ -385,7 +385,7 @@ func BenchmarkGenerateHTML(b *testing.B) { Content: "# Title\n\nThis is **bold** text with *italic* formatting.\n\n- Item 1\n- Item 2", Version: 1, Classification: ClassificationPublic, - Approver: "John Doe", + Approvers: []string{"John Doe"}, PublishedAt: &now, Signatures: []SignatureData{ { diff --git a/pkg/docgen/template.html b/pkg/docgen/template.html index 968b76e5d..54f46f5a9 100644 --- a/pkg/docgen/template.html +++ b/pkg/docgen/template.html @@ -363,8 +363,18 @@ - Approver - {{.Approver}} + Approver{{- if gt (len .Approvers) 1}}s{{- end}} + + {{- if eq (len .Approvers) 1}} + {{index .Approvers 0}} + {{- else}} +
    + {{- range .Approvers}} +
  • {{.}}
  • + {{- end}} +
+ {{- end}} + Version: diff --git a/pkg/probo/document_service.go b/pkg/probo/document_service.go index 9232f2a8f..48f6d2ae1 100644 --- a/pkg/probo/document_service.go +++ b/pkg/probo/document_service.go @@ -1927,7 +1927,7 @@ func exportDocumentPDF( Content: version.Content, Version: version.VersionNumber, Classification: classification, - Approver: strings.Join(approverNames, ", "), + Approvers: approverNames, PublishedAt: version.PublishedAt, Signatures: signatureData, CompanyHorizontalLogoBase64: horizontalLogoBase64, diff --git a/pkg/trust/document_service.go b/pkg/trust/document_service.go index 534684a71..b5acc88b5 100644 --- a/pkg/trust/document_service.go +++ b/pkg/trust/document_service.go @@ -18,7 +18,6 @@ import ( "context" "fmt" "io" - "strings" "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" @@ -215,7 +214,7 @@ func (s *DocumentService) exportPDFData( Content: version.Content, Version: version.VersionNumber, Classification: classification, - Approver: strings.Join(approverNames, ", "), + Approvers: approverNames, PublishedAt: version.PublishedAt, CompanyHorizontalLogoBase64: horizontalLogoBase64, }