Skip to content

widget-form-results

App: Backend
Source: web/projects/backend/src/widgets/widget-form-results

Purpose

Displays captured form results for the object currently loaded in the dashboard (Part, Document, Document SO Line, or the Form itself). Allows reviewers to view, print, or delete results.

Context Detection

  • Checks params.model to decide which foreign keys to use:
    • Partwhere.part_id = object.id
    • Documentwhere.document_id = object.id
    • DocumentSOLinewhere.document_so_line_id = object.id
    • Formwhere.form_id = object.id
    • Default → where.object_id = object.id plus module-scoped fallback

Data Fetching

  • Calls FormResultControllerService.find({ filter }) with includes for user_created and form_revision so the table can show author and revision info.
  • Binds results to MatTableDataSource with pagination and local sorting.

Actions

  • View: Opens FormResultViewComponent, which renders <b3-form-renderer> in read-only mode using definition_snapshot to ensure fidelity.
  • Print: Invokes ReportService.generateReport with controller form_result_print and the selected form_result_id; delivers HTML/PDF instantly to the initiating user.
  • Delete: Confirms via ConfirmationDialogService then calls deleteById; upon success it reloads the dataset and shows a toast.

Extension Tips

  • Add filters (status, date range, user) by extending the LoopBack filter and exposing UI controls above the table.
  • Integrate bulk actions by selecting multiple rows and iterating through the relevant SDK calls.

Syneo/Barcoding Documentation