Werkstatt & Asset Management Module
Enterprise-grade asset and storage unit tracking with checkout/return capability.
Overview
The Werkstatt & Asset Management module provides comprehensive tracking of assets (tools, machines, devices, parts) and their storage locations. Based on concepts from Tool Pro, adapted for Lager Guru's multi-tenant architecture.
Features
- Asset Management: Track tools, machines, devices, and parts with full lifecycle management
- Storage Unit Management: Organize assets in drawers, cabinets, shelves, lockers, etc.
- Checkout/Return System: Track asset usage with user attribution and timestamps
- QR/Barcode Scanning: Fast asset lookup via QR codes or barcodes
- Usage History: Complete audit trail of asset usage
- Condition Tracking: Monitor asset condition states (new, used, needs_repair, etc.)
- Maintenance Integration: Link assets to maintenance module equipment
- Safety Integration: Connect with incidents and training requirements
- Configurable Entities: Fully customizable asset types, storage unit types, and conditions
Permissions
- Admin: Full access to all Werkstatt features
- Werkstatt Manager: Can manage assets, storage units, and view reports
- Tool Admin: Can manage assets and storage units
- Regular Worker: Limited access - can checkout/return assets, view own usage history
Database Schema
Configuration Tables
asset_types: Configurable asset categories (e.g., tools, machines, devices, parts)storage_unit_types: Configurable storage types (e.g., drawer, cabinet, shelf, locker)asset_conditions: Configurable condition states (e.g., new, used, needs_repair)
Core Tables
assets: Trackable assets with checkout/return capabilitystorage_units: Physical storage locations for assetsasset_usage_logs: History of asset checkout and return operationsasset_maintenance_links: Links assets to maintenance module equipment
Key Functions
getAssets(filters): Get assets with optional filtersgetStorageUnits(): Get all storage unitsstartAssetUsage(assetId, options): Check out an assetendAssetUsage(usageLogId): Return an assetgetActiveUsageLogs(): Get all currently checked out assetsgetAssetUsageHistory(assetId): Get usage history for an assetlinkAssetToEquipment(assetId, equipmentId): Link asset to maintenance equipment
Integration
- Maintenance Module: Assets can be linked to equipment for integrated maintenance tracking
- Safety Module: Assets can be associated with incidents and training requirements
- Equipment Tracking: QR/barcode scanning integrates with equipment tracking system
Configuration
All entity types are configurable per tenant:
- Asset Types: Define categories (e.g., "Power Tools", "Hand Tools", "Machines")
- Storage Unit Types: Define storage types (e.g., "Drawer", "Cabinet", "Shelf")
- Asset Conditions: Define condition states (e.g., "New", "Good", "Needs Repair")
Workflow Example
- Admin creates asset types, storage unit types, and conditions
- Admin creates storage units (e.g., "Tool Drawer A1")
- Admin creates assets and assigns them to storage units
- Worker scans QR code or searches for asset
- Worker checks out asset with optional user name and reason
- System tracks usage with timestamps
- Worker returns asset when done
- System maintains complete usage history
Migration from Tool Pro
Key differences from Tool Pro:
- Multi-tenant: All tables include
tenant_idfor isolation - Configurable: No hardcoded types (knife/material → asset_types, drawer → storage_unit_types)
- Integrated: Links to existing Lager Guru modules (maintenance, safety)
- RLS Protected: Row-level security policies enforce tenant isolation
API Usage
typescript
import {
getAssets,
startAssetUsage,
endAssetUsage
} from '@/lib/werkstatt';
// Get all assets
const assets = await getAssets();
// Check out an asset
const usage = await startAssetUsage(assetId, {
user_name: "John Doe",
usage_reason: "Production line maintenance",
notes: "Will return by end of shift"
});
// Return an asset
await endAssetUsage(usage.id);