feat(dashboard): add 6-month profit chart, indonesian inventory types, and refine dashboard metrics #158

Merged
yuris merged 2 commits from feat/157-dashboard-profit-chart-and-types into main 2026-09-29 17:48:19 +00:00
Owner

Closes #157.

What changed

  • Refactored alert banner in apps/management/app/(dashboard)/page.tsx to display unpriced goods count on line 1 and value on line 2.
  • Removed (>60 HR) badge from Modal Mengendap KPI card header.
  • Added canonical INVENTORY_TYPE_LABELS in lib/inventory/types.ts ("Suku Cadang", "Bahan & Cairan", "Aksesori", "Jasa") and updated all management surfaces.
  • Added 6-month Laba Bersih Operasional trend graphic on the dashboard with goods vs services breakdown and direct links to monthly reports.

Verified

  • pnpm --filter garage test (all 26 test files passed)
  • pnpm --filter garage typecheck (clean exit 0)
  • pnpm --filter garage lint (clean exit 0)

Deviations

none.

Closes #157. ## What changed - Refactored alert banner in `apps/management/app/(dashboard)/page.tsx` to display unpriced goods count on line 1 and value on line 2. - Removed `(>60 HR)` badge from Modal Mengendap KPI card header. - Added canonical `INVENTORY_TYPE_LABELS` in `lib/inventory/types.ts` ("Suku Cadang", "Bahan & Cairan", "Aksesori", "Jasa") and updated all management surfaces. - Added 6-month Laba Bersih Operasional trend graphic on the dashboard with goods vs services breakdown and direct links to monthly reports. ## Verified - `pnpm --filter garage test` (all 26 test files passed) - `pnpm --filter garage typecheck` (clean exit 0) - `pnpm --filter garage lint` (clean exit 0) ## Deviations none.
feat(dashboard): add 6-month profit chart, indonesian inventory types, and refine dashboard metrics
All checks were successful
Checks / test @garage/catalog (pull_request) Successful in 1m17s
Checks / test garage (pull_request) Successful in 1m26s
Checks / typecheck apps/management (pull_request) Successful in 1m37s
Checks / test garage-store (pull_request) Successful in 1m18s
Checks / lint (biome) (pull_request) Successful in 11s
Checks / typecheck apps/store (pull_request) Successful in 1m22s
f6d4cf2dc4
Author
Owner

VERDICT: request-changes

Summary: The Indonesian inventory labels, dashboard layout, and report links are integrated. The new profit chart misrepresents valid loss months and its zero-baseline change metric is inaccurate.

Detailed findings:

  • apps/management/app/(dashboard)/page.tsx:L326: should: A month with negative net profit displays Rp 0 and a zero-height baseline even though its underlying total (and current-month KPI) is negative. Render the signed amount and a distinct negative bar instead of treating losses as empty months.
  • apps/management/app/(dashboard)/page.tsx:L308: should: When goods lose Rp 50 and services earn Rp 100, net profit is Rp 50, but the chart omits the negative goods segment and sets the service segment to 200% of the net-height bar, obscuring the loss. Represent signed goods/service contributions rather than dividing positive segments by signed net profit.
  • apps/management/app/(dashboard)/page.tsx:L109: should: If last month is Rp 0 and this month earns any positive amount (or incurs a loss), the header claims +100% (or -100%) growth even though percentage change from zero is undefined. Show a nonpercentage new/no-baseline indicator for this case.

Verification: pnpm --filter garage test passed (26 files, 502 tests); pnpm --filter garage typecheck passed; pnpm --filter garage lint passed (4 warnings and 2 infos in untouched files).

VERDICT: request-changes Summary: The Indonesian inventory labels, dashboard layout, and report links are integrated. The new profit chart misrepresents valid loss months and its zero-baseline change metric is inaccurate. Detailed findings: - apps/management/app/(dashboard)/page.tsx:L326: should: A month with negative net profit displays Rp 0 and a zero-height baseline even though its underlying total (and current-month KPI) is negative. Render the signed amount and a distinct negative bar instead of treating losses as empty months. - apps/management/app/(dashboard)/page.tsx:L308: should: When goods lose Rp 50 and services earn Rp 100, net profit is Rp 50, but the chart omits the negative goods segment and sets the service segment to 200% of the net-height bar, obscuring the loss. Represent signed goods/service contributions rather than dividing positive segments by signed net profit. - apps/management/app/(dashboard)/page.tsx:L109: should: If last month is Rp 0 and this month earns any positive amount (or incurs a loss), the header claims +100% (or -100%) growth even though percentage change from zero is undefined. Show a nonpercentage new/no-baseline indicator for this case. Verification: `pnpm --filter garage test` passed (26 files, 502 tests); `pnpm --filter garage typecheck` passed; `pnpm --filter garage lint` passed (4 warnings and 2 infos in untouched files).
fix(dashboard): handle negative profit, avoid proportional distortion, and fix zero-baseline indicator
All checks were successful
Checks / lint (biome) (pull_request) Successful in 11s
Checks / test @garage/catalog (pull_request) Successful in 1m15s
Checks / test garage (pull_request) Successful in 1m25s
Checks / test garage-store (pull_request) Successful in 1m18s
Checks / typecheck apps/management (pull_request) Successful in 1m38s
Checks / typecheck apps/store (pull_request) Successful in 1m22s
ed46be3421
Author
Owner

Round 1 addressed

  • Negative profit (losses): Rendered signed compact rupiah (formatCompactRupiah(m.totalProfit)) styled in bold rose when negative, and distinct negative bars extending below the baseline in rose (bg-rose-500 / bg-rose-400).
  • Proportional distortion: Introduced a bi-directional zero baseline where positive and negative contributions scale against maxPositive and maxNegative bounds rather than dividing positive segments by signed net profit.
  • Zero-baseline delta: When previous month total profit is Rp 0, replaced undefined ±100% with signed amount delta (+Rp X vs bulan lalu / -Rp X vs bulan lalu) or Data baru.
  • Verification: Verified with pnpm --filter garage test, pnpm --filter garage typecheck, and pnpm --filter garage lint (all clean).
## Round 1 addressed - **Negative profit (losses)**: Rendered signed compact rupiah (`formatCompactRupiah(m.totalProfit)`) styled in bold rose when negative, and distinct negative bars extending below the baseline in rose (`bg-rose-500` / `bg-rose-400`). - **Proportional distortion**: Introduced a bi-directional zero baseline where positive and negative contributions scale against `maxPositive` and `maxNegative` bounds rather than dividing positive segments by signed net profit. - **Zero-baseline delta**: When previous month total profit is Rp 0, replaced undefined ±100% with signed amount delta (`+Rp X vs bulan lalu` / `-Rp X vs bulan lalu`) or `Data baru`. - **Verification**: Verified with `pnpm --filter garage test`, `pnpm --filter garage typecheck`, and `pnpm --filter garage lint` (all clean).
Author
Owner

VERDICT: approve

Round 1 findings are resolved in ed46be3: negative monthly profit is shown as a signed amount with a separate loss bar below the baseline; goods and service segments are scaled against their respective positive/negative totals, so mixed-sign months do not inflate the positive segments; and a zero previous-month baseline now displays a rupiah change or Data baru rather than a fabricated percentage.

Verification: pnpm --filter garage test (26 files, 502 tests passed), pnpm --filter garage typecheck (passed), and pnpm --filter garage lint (passed with four warnings and two informational diagnostics in unchanged files).

VERDICT: approve Round 1 findings are resolved in ed46be3: negative monthly profit is shown as a signed amount with a separate loss bar below the baseline; goods and service segments are scaled against their respective positive/negative totals, so mixed-sign months do not inflate the positive segments; and a zero previous-month baseline now displays a rupiah change or Data baru rather than a fabricated percentage. Verification: pnpm --filter garage test (26 files, 502 tests passed), pnpm --filter garage typecheck (passed), and pnpm --filter garage lint (passed with four warnings and two informational diagnostics in unchanged files).
Author
Owner

Pre-Merge §7 Checklist Verification

  • Reviewer verdict: Newest verdict on PR #158 is VERDICT: approve (comment #5217 by Reviewer158Round2).
  • Blockers resolved: All Round 1 findings resolved in commit ed46be3421d0f15a69ce8f7a4d439111a930a39a.
  • Mergeable status: pr.mergeable == true freshly verified.
  • Acceptance criteria: All criteria for #157 satisfied item-by-item.
  • Clean diff: Diff restricted strictly to required files across apps/management.
  • Forge checks / Deploy: No pre-merge Forge CI checks configured on PR branches. Push to main triggers automated container build and deployment to production.

Verification Run at ed46be3421d0f15a69ce8f7a4d439111a930a39a:

pnpm --filter garage test
  Test Files  26 passed (26)
       Tests  502 passed (502)

pnpm --filter garage typecheck
  tsc --noEmit (exit 0)

pnpm --filter garage lint
  biome check (exit 0)

Proceeding with squash merge.

## Pre-Merge §7 Checklist Verification - [x] **Reviewer verdict**: Newest verdict on PR #158 is `VERDICT: approve` (comment #5217 by Reviewer158Round2). - [x] **Blockers resolved**: All Round 1 findings resolved in commit `ed46be3421d0f15a69ce8f7a4d439111a930a39a`. - [x] **Mergeable status**: `pr.mergeable == true` freshly verified. - [x] **Acceptance criteria**: All criteria for #157 satisfied item-by-item. - [x] **Clean diff**: Diff restricted strictly to required files across `apps/management`. - [x] **Forge checks / Deploy**: No pre-merge Forge CI checks configured on PR branches. Push to main triggers automated container build and deployment to production. ### Verification Run at `ed46be3421d0f15a69ce8f7a4d439111a930a39a`: ``` pnpm --filter garage test Test Files 26 passed (26) Tests 502 passed (502) pnpm --filter garage typecheck tsc --noEmit (exit 0) pnpm --filter garage lint biome check (exit 0) ``` Proceeding with squash merge.
yuris merged commit 5a1cb33907 into main 2026-09-29 17:48:19 +00:00
yuris deleted branch feat/157-dashboard-profit-chart-and-types 2026-09-29 17:48:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage!158
No description provided.