feat: add warehouse and bin management API with mock data implementation

- Implemented warehouses API with methods for listing, creating, and managing bins.
- Added wastage API to handle stock write-offs and integrate with stock adjustments.
- Created auth token management for storing and retrieving access tokens.
- Developed error mapping for consistent user-facing error messages.
- Introduced client-side validations for GRN, master data, and procurement processes.
- Defined common types for pagination, problem details, and various master data entities.
- Established procurement and stock management types to support frontend functionality.
This commit is contained in:
2026-07-13 17:11:40 +05:30
parent 4e84a15db7
commit 7ac30bb454
79 changed files with 14042 additions and 44 deletions
@@ -0,0 +1,34 @@
import { Badge } from "@/components/ui/badge"
import { GrnStatus, HoldStatus } from "@/types/grn"
// Fixed width (not w-fit) so every status pill is the same size regardless of
// label length ("Draft" vs "Confirmed" vs "Available").
const badgeSize = "h-6 w-28 justify-center px-2.5 py-1 text-sm"
function grnClass(status: GrnStatus) {
if (status === "Draft") return "bg-warning/10 text-warning border-transparent"
if (status === "Confirmed") return "bg-success/10 text-success border-transparent"
return "bg-destructive/10 text-destructive border-transparent" // Closed
}
export function GrnStatusBadge({ status }: { status: GrnStatus }) {
return (
<Badge variant="outline" className={`${badgeSize} ${grnClass(status)}`}>
{status}
</Badge>
)
}
function holdClass(status: HoldStatus) {
if (status === "OnHold") return "bg-warning/10 text-warning border-transparent"
if (status === "Rejected") return "bg-destructive/10 text-destructive border-transparent"
return "bg-success/10 text-success border-transparent" // Available
}
export function HoldStatusBadge({ status }: { status: HoldStatus }) {
return (
<Badge variant="outline" className={`${badgeSize} ${holdClass(status)}`}>
{status}
</Badge>
)
}