Adithya Fix Labor Cost Variance#5260
Open
adithya-6101 wants to merge 3 commits into
Open
Conversation
✅ Deploy Preview for highestgoodnetwork-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
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
Enhances the Paid Labor Cost chart to include budget comparison and variance indicators. Previously, the view only showed actual paid labor costs, making it difficult for project managers to assess cost overruns or financial risks. This PR introduces a dual-bar chart and a dynamic summary section to display budgeted amounts alongside actuals, complete with color-coded variance tracking.
This PR implements:
Actual - Budget. Uses color indicators (Red for over-budget, Green for under-budget) and displays the percentage variance.MOCK_DBspanning 30 days. Since the backend endpoint does not yet support budget data, the component intercepts API calls in development mode to allow full testing of the UI and filters without throwing 404 errors.aggregateDatafunction so that filtering by Task, Project, or Date Range instantly recalculates both the chart rendering and the bottom summary numbers.Related PRS (if any):
#4105
Main changes explained:
PaidLaborCost.jsx:aggregateData: Rewritten to calculate and storetotalCostandtotalBudgetsimultaneously across all active filters.processApiResponse: Added a fallback mechanism that injects calculated budget data if the live database is missing it, ensuring the UI always has data to render.fetchData&fetchLaborCostData: Added short-circuit logic (isDevelopmentEnvironment()) to intercept 404 errors and route the component to use the expanded 30-dayMOCK_DB.borderDash).How to test:
npm installandnpm startto run this PR locally.(Actual)and(Budget)entries.Screenshots or videos of changes:
Total.Construction.Summary.-.Google.Chrome.2026-05-28.14-11-37.mp4
Note:
The backend endpoint (
/api/labor-cost) is currently mocked viaMOCK_DBfor local development to prevent 404 crashes and allow full interaction with the Date/Project/Task filters.