Skip to content

Adithya fix consumables usability#4828

Merged
one-community merged 6 commits into
developmentfrom
adithya_fix_consumables_usability
Mar 22, 2026
Merged

Adithya fix consumables usability#4828
one-community merged 6 commits into
developmentfrom
adithya_fix_consumables_usability

Conversation

@adithya-6101
Copy link
Copy Markdown
Contributor

@adithya-6101 adithya-6101 commented Feb 12, 2026

Description

Enhances the usability and visual clarity of the Consumables Dashboard. As the list of consumables grows, it becomes difficult for users to scan and quickly identify critical information like low stock or distinguish action buttons. This PR introduces visual hierarchies, sticky headers, and data formatting to solve these issues. Additionally, it fixes a bug where the Consumables filter dropdown was displaying "No data" and rendering empty "ghost" rows in the table.

image

This PR implements:

  1. Low Inventory Indicators: Added a red "Low" badge that dynamically appears next to the quantity when Available stock drops below a threshold (< 10).
  2. Sticky Headers: Wrapped the table in a scrollable container with a sticky <thead> so column titles remain visible during vertical scrolling.
  3. Data & Dropdown Fixes: Flattened the nested project and itemType objects before passing them to the generic table, eliminating ghost rows and allowing the top-right Consumables dropdown to populate correctly.
  4. Readability Improvements: Right-aligned all numeric columns (Bought, Used, Available, Waste) for easier comparison.
  5. Action Column Grouping: Added a visual vertical divider to separate the data from the action buttons, along with descriptive tooltips (e.g., "View usage history") for better context.

Related PRS (if any):

This frontend PR utilizes existing backend endpoints. No new backend PR is required as the styling, sorting, and badging logic are handled client-side.


Main changes explained:

  • Modified ConsumableListView.jsx:
    • Implemented a data transformation function to flatten nested objects and preserve the itemType label.
    • Added a .filter() to strip out incomplete "ghost" rows where the item name is 'N/A'.
  • Modified ItemListView.jsx & SelectItem.jsx:
    • Passed the itemType label down to the <SelectItem /> component.
    • Added specific else if (label === 'Consumables') logic inside SelectItem.jsx to correctly populate the dropdown filter with unique consumable names instead of showing "No data".
  • Modified ItemsTable.jsx:
    • Sticky Header: Applied custom inline styles (position: 'sticky') to header cells and wrapped the table in a container with maxHeight: '75vh' and overflowY: 'auto'.
    • Badges: Injected logic into the dynamic column map to render a Reactstrap <Badge color="danger">Low</Badge> when the stockAvailable key is less than 10.
    • Alignment & Dividers: Applied textAlign: 'right' to numeric columns and a borderLeft style to the "Usage Record" column to group the actions visually. Added title attributes for tooltips.

How to test:

  1. Checkout the current branch adithya_fix_consumables_usability.
  2. Do npm install and npm start to run this PR locally.
  3. Clear site data/cache.
  4. Log in as an Admin or Owner.
  5. Navigate to BM DashboardConsumables. http://localhost:5173/bmdashboard/consumables
  6. Verify Data & Filters:
    • Check the top-right filter dropdown. It should display available items (e.g., "Batteries") instead of "No data".
    • Verify that no empty/blank rows appear in the table.
  7. Verify Visual Enhancements:
    • Scroll down the table (if enough data exists) and verify the gray header row stays pinned to the top.
    • Check the numeric columns (Bought, Used, Available, Waste) and verify they are right-aligned.
    • Notice the gray vertical divider line separating the "Waste" column from the "Usage Record" column.
  8. Verify Low Stock Badges:
    • Look for any row where the "Available" count is less than 10. You should see a red Low badge next to the number.
  9. Verify this new feature works in dark mode.

Screenshots or videos of changes:

Consumables with Low Stock badges Dark Mode

Note:

The low stock threshold is currently hardcoded to < 10 for testing and immediate visual feedback.

@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 12, 2026

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 560fe5e
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69c02dcea0ce0d000853c1d5
😎 Deploy Preview https://deploy-preview-4828--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@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 Mar 21, 2026
@adithya-6101 adithya-6101 changed the title Adithya_fix_consumables_usability Adithya fix consumables usability Mar 21, 2026
Copy link
Copy Markdown

@rohanrastogi311 rohanrastogi311 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Adithya,

Well done with this impementaiton.

Image

@sonarqubecloud
Copy link
Copy Markdown

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit 8c52d46 into development Mar 22, 2026
10 checks passed
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.

3 participants