Skip to content

Linh - Add multi-select and bulk actions to Materials table _be#2178

Open
linh2020 wants to merge 1 commit into
developmentfrom
linh_bulk_actions_materials_backend
Open

Linh - Add multi-select and bulk actions to Materials table _be#2178
linh2020 wants to merge 1 commit into
developmentfrom
linh_bulk_actions_materials_backend

Conversation

@linh2020
Copy link
Copy Markdown
Contributor

@linh2020 linh2020 commented Apr 23, 2026

Description

image

Please include the exact bug/functionality description and a summary of the changes/ related issues. Please also include any other relevant motivation and context:
Adds backend persistence for new bulk material actions so frontend actions are not local-only and survive refresh/reload.

Fixes # (bug list priority high/medium/low x.y.z)
Fixes #MEDIUM-bmdashboard-materials-bulk-actions

Or Implements # (WBS)
Implements #WBS-BM-Materials-Bulk-Actions

Related PRS (if any):

This backend PR is related to the #YYY frontend PR.
To test this backend PR you need to checkout the #YYY frontend PR.

Main changes explained:

Update buildingMaterial.js to add persistent fields:

stockHold (Boolean)
isReviewed (Boolean)
notes (String)
Update bmMaterialsController.js to add bmApplyMaterialBulkAction:

validates materialIds and action
supports actions: hold, review, notes
updates selected materials via updateMany
returns applied-record count summary
Update bmMaterialsRouter.js to expose:

POST /bm/materials/bulk-actions

How to test:

check into current branch (frontend + backend PR branches)
backend:
cd backend/HGNRest
npm install
npm run dev (or project-standard start command)
frontend:
cd frontend/HighestGoodNetworkApp
npm install
npm run dev
Clear site data/cache
log as admin user
go to /bmdashboard/materials
verify:
row checkboxes appear and select-all works
rows are highlighted when selected
Bulk Actions is disabled with 0 selected rows
select multiple rows and run Mark as Hold, then confirm Hold column/status reflects persisted value after refresh
select multiple rows and run Mark as Reviewed, then confirm persisted value after refresh
run Add/Update Notes and confirm status chip appears and persists after refresh
run Export Selected (CSV/PDF) and confirm file contents are for selected items only
verify this new feature works in dark mode
verify responsive behavior at mobile/tablet widths (bulk bar wraps correctly and remains usable)

… hold/review/notes

- extend buildingMaterial schema with persistent bulk-action fields:
  - stockHold (Boolean, default false)
  - isReviewed (Boolean, default false)
  - notes (String, default empty)
- add controller handler bmApplyMaterialBulkAction to process bulk material updates
- support bulk actions:
  - hold
  - review
  - notes
- validate request payload (materialIds, action, notes requirements)
- apply updates via updateMany and return affected count in response
- expose new route:
  - POST /bm/materials/bulk-actions

Files updated:
- backend/HGNRest/src/models/bmdashboard/buildingMaterial.js
- backend/HGNRest/src/controllers/bmdashboard/bmMaterialsController.js
- backend/HGNRest/src/routes/bmdashboard/bmMaterialsRouter.js
@sonarqubecloud
Copy link
Copy Markdown

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants