Linh - Add multi-select and bulk actions to Materials table _be#2178
Open
linh2020 wants to merge 1 commit into
Open
Linh - Add multi-select and bulk actions to Materials table _be#2178linh2020 wants to merge 1 commit into
linh2020 wants to merge 1 commit into
Conversation
… 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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
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)