Skip to main content

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 field is a string).
  • The panel: PREVIEW_INCLUDE_KEYS / FORM_DETAIL_ROW_KEYS / SAVED_KEY in features/forms/hooks/use-preview-settings.ts:13-62; features/forms/components/preview/preview-settings-panel.tsx:91-111.
  • Pattern to follow: ENG-3197 (commit 44c6480fe0 core-lib/core-api, 2a493c3a5b web-app-react).

Change (common foundation for ENG-3781, ENG-1564, and ENG-1604)

  1. core-lib/core-api: DOCUMENT_OUTPUT_INCLUDE_PROJECT, _PROJECT_NUMBER, _CUSTOMER, _ADDRESS, _CATEGORY, _OWNER, _DUE_DATE, _CREATED_AT in MetaFormField, MetaFormTemplateField, FORM_META_TO_COPY, and FORM_TEMPLATE_META_TO_FORM. Trace `documentOutputIncludeTask
  2. `
  3. through `helpers/form/form.ts ` (processor + `default`
  4. set to
  5. `true`), `form.dto.ts`,
  6. `
  7. put-form.dto.ts, put-form.interface.ts, form.service.ts, form-template.dto.ts, put-form-template.dto.ts, the template interfaces, and form-template.service.ts.
  8. PDF: In doc-generator-form-info-utils.ts:79-97, each row returns null when documentOutputSetting(form, …) is false.
  9. orval: pnpm generate:api:core in apps/web-app-react.
  10. lib/document-output.ts: new keys in DOCUMENT_OUTPUT_INCLUDE_KEYS, INCLUDE_PAYLOAD_KEY, and readDocumentOutput (flag(key, true)).
  11. lib/document-preview/preview-head.ts: extend FormDetailExtras; each row in formDetailRows returns "" when the option is off.
  12. use-preview-settings.ts: separate PREVIEW_DETAIL_ROW_KEYS in the PDF's order (, formId, project, projectNumber, customer, address...)
Status: Pågår

Log in to comment and vote

No comments yet

Be the first to share your thoughts.