Select which general details are displayed in the PDF form
I only want to include the customer, project number, and project name. No form details. Category: Form ID: Created: Created by: Responsible:
Featurebase: https://support.gripr.no/p/tilpasse-generelle-detaljer-som-skal-vises-pa-skjema-pdf
Plan (React web app)
Applies only to the React web app. The Vue app and mobile app will not be changed. Note: The PDF is generated in the core API (
doc-generator), so the backend must be modified for the selection to be reflected in the PDF. Submitted as a single PR together with ENG-1564 and ENG-1604.
Context – The customer wants the “General Details” section in the form PDF to display only Customer, Project Number, and Project (not Category, Form ID, Created, Created By, or Responsible). The selection is made in the “View” panel in the preview (features/forms/FormDetailPage.tsx).
Currently
- The PDF is generated on the server: “Download”/“Save”/“Send” calls
GET /doc-generator?type=form(features/forms/hooks/use-form-document.ts:26-33) →services/core-api/src/modules/doc-generator/services/doc-generator.service.ts:259-272. The React preview simply mirrors the PDF (components/common/document-preview/document-preview.tsx:44). - React rows:
lib/document-preview/preview-head.ts:65-105(formDetailRows). Only Form ID, Created by, and Task have their own options (FormDetailExtras,:35-39). Project, Project Number, Customer, Address, Category, Responsible, Deadline, and Created are always displayed when they have a value. - PDF rows:
services/core-api/src/modules/doc-generator/utils/doc-generator-form-info-utils.ts:76-99. - The options are stored per form as
meta_form rows(DOCUMENT_OUTPUT_*), inherited from the template (FORM_TEMPLATE_META_TO_FORM), and carried over when copying (FORM_META_TO_COPY),packages/core-lib/src/enums/form.enum.ts:115-186. No migration is needed (the fieldis a string). - The panel:
PREVIEW_INCLUDE_KEYS/FORM_DETAIL_ROW_KEYS/SAVED_KEYinfeatures/forms/hooks/use-preview-settings.ts:13-62;features/forms/components/preview/preview-settings-panel.tsx:91-111. - Pattern to follow: ENG-3197 (commit
44c6480fe0core-lib/core-api,2a493c3a5bweb-app-react).
Change (common foundation for ENG-3781, ENG-1564, and ENG-1604)
- core-lib/core-api:
DOCUMENT_OUTPUT_INCLUDE_PROJECT,_PROJECT_NUMBER,_CUSTOMER,_ADDRESS,_CATEGORY,_OWNER,_DUE_DATE,_CREATED_ATinMetaFormField,MetaFormTemplateField,FORM_META_TO_COPY, andFORM_TEMPLATE_META_TO_FORM. Trace`documentOutputIncludeTask` - through
`helpers/form/form.ts` (processor + `default` set to -
`true`),`form.dto.ts`, ` -
put-form.dto.ts,put-form.interface.ts,form.service.ts,form-template.dto.ts,put-form-template.dto.ts, the template interfaces, andform-template.service.ts. - PDF: In
doc-generator-form-info-utils.ts:79-97, each row returnsnullwhendocumentOutputSetting(form, …)is false. - orval:
pnpm generate:api:coreinapps/web-app-react. lib/document-output.ts: new keys inDOCUMENT_OUTPUT_INCLUDE_KEYS,INCLUDE_PAYLOAD_KEY, andreadDocumentOutput(flag(key, true)).lib/document-preview/preview-head.ts: extendFormDetailExtras; each row informDetailRowsreturns""when the option is off.use-preview-settings.ts: separatePREVIEW_DETAIL_ROW_KEYSin the PDF's order (, formId, project, projectNumber, customer, address...)
Log in to comment and vote
No comments yet
Be the first to share your thoughts.