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.modelto decide which foreign keys to use:Part→where.part_id = object.idDocument→where.document_id = object.idDocumentSOLine→where.document_so_line_id = object.idForm→where.form_id = object.id- Default →
where.object_id = object.idplus module-scoped fallback
Data Fetching
- Calls
FormResultControllerService.find({ filter })with includes foruser_createdandform_revisionso the table can show author and revision info. - Binds results to
MatTableDataSourcewith pagination and local sorting.
Actions
- View: Opens
FormResultViewComponent, which renders<b3-form-renderer>in read-only mode usingdefinition_snapshotto ensure fidelity. - Print: Invokes
ReportService.generateReportwith controllerform_result_printand the selectedform_result_id; delivers HTML/PDF instantly to the initiating user. - Delete: Confirms via
ConfirmationDialogServicethen callsdeleteById; 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.