Commit graph

40 commits

Author SHA1 Message Date
53c35cc273 feat: add order ack detail/PDF, BOL detail/PDF, coil activity usage & receipts
Some checks failed
Build and Deploy / build (push) Successful in 10m53s
Build and Deploy / deploy (push) Failing after 2s
C-005: Order Acknowledgement Detail + PDF
- Order detail page with full line items, releases, addresses, paint codes
- PDF export via Puppeteer matching legacy format
- Clickable order # links and PDF icons in orders table

C-007: BOL Detail + PDF
- BOL detail page with ship-from/to, line items, weights
- PDF export matching legacy BOL format
- PDF icon column in shipments table

C-008: Coil Activity - Usage Report
- Date range picker (max 31 days, default last 10 days)
- Reusable UI: Popover, Calendar (react-day-picker v9), DateRangePicker
- SQL from legacy portal_CoilActivityUsage.sql with OnHandQty dedup
- 11-column sortable table with search and CSV export

C-009: Coil Activity - Receipts Report
- VGL customer exception (special SQL vs portal view)
- 10-column sortable table with search and CSV export
- Shared date range picker component

Also: dashboard API route, shipments API route, HDC→HDM mapping,
Puppeteer PDF infrastructure, improved error handling.

Progress: 9/16 Phase 2 tasks complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 09:14:52 -05:00
cd95bc4218 Add shipments feature - page, components, and service layer
Some checks failed
Build and Deploy / build (push) Successful in 3m20s
Build and Deploy / deploy (push) Failing after 2s
2026-02-17 01:43:07 +00:00
a9ba3791f7 feat: add sortable column headers with color-coded table headers
Some checks failed
Build and Deploy / build (push) Failing after 11m47s
Build and Deploy / deploy (push) Has been cancelled
Add reusable SortableTableHead component and useSortableTable hook
with tri-state sorting (asc/desc/none). Apply colored headers and
zebra striping to orders, inventory summary, and inventory detail
tables. Widen detail modal to 95vw.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:35:09 +00:00
9fad8af225 feat: add local dev workflow with hot reload via Traefik
Route dev domain through Traefik to host:3001 instead of Docker
container, enabling instant hot reload. Expose PostgreSQL and Redis
ports to localhost for local dev server connectivity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 19:55:26 +00:00
19e8730d41 feat: add inventory detail modal with correct legacy columns
Some checks failed
Build and Deploy / build (push) Successful in 2m51s
Build and Deploy / deploy (push) Failing after 1s
Replace full-page navigation with an inline modal dialog when clicking
View on inventory summary rows. Fix V6 detail stored procedure params
(@CUSTID/@sub instead of @Customer/@SUBUSER) and update detail table
columns to match legacy portal: Cust Part#, Skid#, Lot#, Mfg Lot#,
Bin#, Qty LB, Lin. Ft, Theo. Wt, WIP/FG, # Coils, PO#, Sales
Order/Job, Alloc#/Release, Date Processed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 19:30:27 +00:00
56ce4ba940 feat: replace company switcher button with searchable combobox
Some checks failed
Build and Deploy / build (push) Successful in 3m26s
Build and Deploy / deploy (push) Failing after 2s
Add cmdk-based combobox to portal header for inline company switching
with search by name or Epicor ID. Also update select-company page to
use the same pattern. Fix admin company switching by allowing admins
to switch to any active company without requiring a quest_user_company
link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:07:39 +00:00
87c1cdf8da feat: update inventory columns to match legacy portal and grant admins all companies
Some checks failed
Build and Deploy / build (push) Successful in 4m57s
Build and Deploy / deploy (push) Failing after 13s
Inventory summary table now shows Plant, Cust Part#, Vorteq Part#,
Vorteq Desc, Warehouse, Qty LB, Rows with a blue View button for
drill-down. Admins see all active companies in the company selector.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:02:20 +00:00
cf9af94f7d fix: map Epicor SP column names and use portal_Orders view
Some checks failed
Build and Deploy / build (push) Successful in 4m42s
Build and Deploy / deploy (push) Failing after 18s
Inventory service now maps PascalCase SP columns (VorteqPartNum,
OnHandQty, etc.) to snake_case types. Fixed non-V6 SP parameter
from Customer to CUSTID. Orders service now uses the portal_Orders
view instead of raw table queries with nonexistent columns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:39:14 +00:00
90ad1925e7 fix: correct Epicor stored procedure names and parameter mappings
Some checks failed
Build and Deploy / build (push) Successful in 6m38s
Build and Deploy / deploy (push) Failing after 5s
Update inventory service to use actual PascalCase SP names
(e.g. PortalWorkInProgressInventorySummaryV6) and correct parameter
names (Customer, SUBUSER) matching the Epicor database.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:21:49 +00:00
3cd5b05c46 fix: bypass auth in dev mode and add mock session for development
Add DEV_MODE env var check to return mock admin session when auth is
unavailable, hostname-based middleware bypass for dev domain, and
window.location.href for login redirect to ensure cookies are sent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:18:48 +00:00
b389d8b482 fix: bypass auth in dev mode and add mock session for development
next build bakes NODE_ENV=production into the bundle, so a custom
DEV_MODE env var is used instead. Middleware bypasses auth by hostname
for the dev domain, and getQuestSession returns a mock admin session
when DEV_MODE=true. Login page now uses window.location.href for
full-page navigation to ensure the session cookie is sent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:45:09 +00:00
e371581375 fix: update middleware for custom auth and increase dev rate limit
Some checks failed
Build and Deploy / build (push) Successful in 3m53s
Build and Deploy / deploy (push) Failing after 4s
- Change session cookie name from better-auth.session_token to session_token
- Increase rate limit to 100 req/min in development (10 in production)
- Fix DATABASE_URL to use URL-encoded password for special characters

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 13:13:56 +00:00
a123d5e394 fix: remove Better Auth useSession dependency from portal header
Some checks failed
Build and Deploy / build (push) Successful in 5m47s
Build and Deploy / deploy (push) Failing after 10s
Replace client-side useSession hook with server-side prop passing.
Portal layout fetches user email server-side and passes to header.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 13:02:14 +00:00
cdd897abbc feat: implement custom login system to replace Better Auth
Some checks failed
Build and Deploy / deploy (push) Blocked by required conditions
Build and Deploy / build (push) Has been cancelled
- Add custom login API route with bcrypt password verification
- Update auth client to use custom endpoints
- Simplify login page to use new auth client
- Remove Better Auth dependencies that were causing issues
2026-02-16 12:55:57 +00:00
17f6188132 fix: map custom Prisma model names to Better Auth schema 2026-02-16 12:52:10 +00:00
17ef200f6a fix: add secret and baseURL to Better Auth config 2026-02-16 12:48:26 +00:00
992a7fe72b fix: use Prisma adapter for Better Auth to resolve database adapter error 2026-02-16 12:45:22 +00:00
239f0e1227 docs: mark C-004 as complete in TASKS.md
Some checks failed
Build and Deploy / build (push) Successful in 3m34s
Build and Deploy / deploy (push) Failing after 3s
2026-02-16 12:38:05 +00:00
d697cfff37 feat(C-004): implement orders list page with search and CSV export
- Add orders service with getTop100Orders and getOrderDetails
- Add special HDC/HDM customer exception handling
- Add OrdersTable component with search, filter, CSV export
- Add orders list page at /orders
- Create public folder for Next.js static assets

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 12:37:42 +00:00
d924db88a3 docs: mark C-002 and C-003 as complete in TASKS.md 2026-02-16 12:35:35 +00:00
3a5bf14007 feat(C-003): implement inventory detail views with drill-down
- Add inventory detail service functions for all 6 categories
- Update stored procedure names to match Epicor database
- Add InventoryDetailTable component with search and CSV export
- Add dynamic detail page at /inventory/[category]/detail
- Update summary table links to point to detail pages
- Fix InventoryDetailRow type to support flexible field names
- Add Dockerfile prisma generate step before build

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 12:35:06 +00:00
a8d53eef82 fix: add explicit types to all callback parameters in permissions.ts and update inventory detail stored procedure names 2026-02-16 12:21:09 +00:00
e6e3afac56 fix: add explicit type to permissions.ts find callback parameter 2026-02-16 12:19:18 +00:00
ebd91c8fac feat(C-002): complete all 6 inventory category pages
Some checks failed
Build and Deploy / build (push) Failing after 3m57s
Build and Deploy / deploy (push) Has been skipped
- Finished Goods inventory page
- Processed Other inventory page
- Unprocessed inventory page (blocks sub-users)
- Unprocessed R&R inventory page (blocks sub-users)
- Processed R&R inventory page (blocks sub-users)
- All pages use same pattern: server component, Suspense, loading skeleton
- Sub-user access restrictions enforced

C-002 Inventory Summary Views now 100% complete.
2026-02-16 12:10:49 +00:00
6329d9f357 fix: make pages dynamic and fix middleware for Edge Runtime
Some checks failed
Build and Deploy / build (push) Failing after 2m25s
Build and Deploy / deploy (push) Has been skipped
2026-02-16 12:03:01 +00:00
7774af03a5 feat(C-001,C-002): implement dashboard and begin inventory views
Some checks failed
Build and Deploy / build (push) Failing after 10m59s
Build and Deploy / deploy (push) Has been skipped
Implements complete dashboard with metrics, recent activity, and quick navigation.
Begins inventory system with service layer and category selector.

Dashboard (C-001) - Complete:
- Server component with parallel data fetching
- Summary cards: WIP, Finished Goods, Total Weight, Recent Orders
- Recent activity tables: top 5 orders and shipments
- Alert banner for important notifications
- Quick navigation cards to all major features
- Loading skeletons with Suspense boundaries
- Reusable components: SummaryCard, QuickNavCard, tables
- Dashboard service with typed Epicor queries

Inventory (C-002) - Core Complete:
- Complete service layer for all 6 inventory categories
- Category selector page with permission-based visibility
- Reusable inventory summary table with search and CSV export
- WIP inventory page as template for other categories
- Sub-user permission enforcement at service layer
- Type-safe stored procedure calls with proper error handling

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 11:41:56 +00:00
a67558de23 feat(F-008,F-009,F-010): complete Phase 1 foundation with middleware, navigation, and migrations
Implements authentication middleware with rate limiting, comprehensive permission
system, full portal navigation with sidebar and header, company selection flow,
and data migration tooling from SQL Server to PostgreSQL.

Key additions:
- Middleware: auth guards, rate limiting, session management
- Permissions: role-based access control with hierarchical permission rules
- Navigation: responsive sidebar with expandable sections, header with notifications
- Company selector: multi-company user support with session-based active company
- Data migration: comprehensive script for migrating auth and quest domain tables
- Schema: added auth_user_type_permission_group junction table

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 11:07:44 +00:00
bbcee034cb feat(F-007): implement Better Auth with login and account request
Some checks failed
Build and Deploy / build (push) Failing after 3m6s
Build and Deploy / deploy (push) Has been skipped
Better Auth Configuration:
- Database adapter for PostgreSQL with custom schema mapping
- Email/password authentication enabled
- 7-day session expiration with 24-hour update frequency
- Custom field mappings for auth_user, auth_session, auth_account tables
- Server-side auth helpers: getSession(), requireAuth()
- Client-side React hooks: signIn, signOut, signUp, useSession

Authentication Pages:
- /login: Email/password login with error handling
- /forgot-password: Password reset request flow
- /account-request: New user registration form
  - Captures: name, email, phone, company, Epicor ID, message
  - Creates quest_account_request record for admin approval
  - Success confirmation with next steps

API Routes:
- /api/auth/[...all]: Better Auth handler for all auth operations
- /api/account-request: Account request submission endpoint

UI Components:
- Added Textarea component from shadcn/ui
- Form validation and loading states
- Toast notifications for user feedback
- Responsive card-based layouts

Session management and enhanced context (company, permissions) will be
added in F-008 middleware implementation.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 02:25:52 +00:00
10028bcd47 feat(F-006): enhance Epicor MSSQL connection service
Some checks failed
Build and Deploy / build (push) Failing after 7m11s
Build and Deploy / deploy (push) Has been skipped
Enhanced Connection Management:
- Custom error classes: EpicorConnectionError, EpicorQueryError, EpicorTimeoutError
- Connection pool reuse with state tracking
- Configuration validation on startup
- Configurable timeouts (connect: 30s, request: 60s)

Query Execution:
- execStoredProc: execute stored procedures with typed parameters
- execQuery: execute raw SQL queries with parameterization
- execPortalStoredProc: helper for standard portal SP params (CustID, DBNAME, sub)
- Comprehensive error handling with timeout detection

Health & Utilities:
- checkConnection: validates connection with actual query test
- closeConnection: graceful pool shutdown
- getPortalDbName: helper for cross-database query parameters
- Graceful shutdown handlers (SIGINT, SIGTERM)

Type Definitions (src/types/epicor.ts):
- Inventory: summary, detail, with paint codes and dimensions
- Orders: list, acknowledgement with lines
- Shipments: list, BOL detail with lines
- Coil Activity: usage, receipts, coil-by-coil
- Jobs: status, traveler with operations and materials
- Customers: ship-to addresses
- Invoices: customer/job matching
- Shipping Reports: monthly and YTD

Ready for service layer implementation in Phase 2.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 02:18:00 +00:00
d8af580d93 feat(F-004,F-005): complete Quest and remaining domain schemas
Some checks failed
Build and Deploy / deploy (push) Blocked by required conditions
Build and Deploy / build (push) Has been cancelled
Quest Domain Complete (F-004):
- quest_account_request: new user registration requests
- quest_notification + alert reads: notification/alert system
- quest_email_event + subscriptions: email event management
- quest_email_log: email tracking
- quest_plant + inventory_type + inventory_plant: plant/inventory configuration
- quest_processed_order_acknowledgement_email: duplicate prevention

Remaining Domains Complete (F-005):

Shipment Requests:
- ship_request + ship_request_detail: shipment request cart workflow

Allocation Requests:
- alloc_request + alloc_request_detail + alloc_plant: coil allocation workflow

Invoice Management:
- inv_upload + inv_upload_entry + inv_upload_status: invoice upload/processing

Finance/AP:
- finance_ap_check_processing_batch + status: AP check processing

Paint Schedule:
- paint_plant + paint_line + paint_line_type + paint_plant_line + paint_schedule

Documentation:
- doc_category + doc_article + doc_article_permission_group: knowledge base

Wave/EDI:
- wave_process + wave_process_history: EDI processing

Task Scheduler:
- lts_task + lts_task_type + lts_task_schedule + lts_task_execution

Total: 60+ tables, 600+ columns across all domains. All migrations applied successfully.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 02:16:28 +00:00
e643af1fe6 feat(F-003): implement auth domain Prisma schema and migration
Some checks failed
Build and Deploy / build (push) Failing after 5m18s
Build and Deploy / deploy (push) Has been skipped
Auth Domain (Complete):
- auth_user: Better Auth compatible with password, 2FA, SSO support
- auth_session: session management with IP and user agent tracking
- auth_account: OAuth provider accounts
- auth_oauth_client + tokens: OAuth client configuration and token management
- auth_user_type: role definitions (admin, customer, internal)
- auth_domain: multi-tenant domain grouping
- auth_password_history + reset: password security and recovery
- auth_permission_group + rule + category: RBAC system with granular permissions
- auth_security_question + answer: account recovery mechanism

Quest Domain (Partial - Core User/Company):
- quest_user: portal-specific user data (sub-user flag, API tokens)
- quest_company: customer/company info (Epicor integration, invoicing flags)
- quest_user_company: many-to-many with active company tracking

Migration applied successfully to PostgreSQL 16 database.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 02:08:09 +00:00
7cd434aa82 feat(F-001): scaffold Next.js 15 project with TypeScript and Tailwind
Some checks failed
Build and Deploy / build (push) Failing after 18m25s
Build and Deploy / deploy (push) Has been skipped
- Initialize Next.js 15 with App Router and TypeScript strict mode
- Configure Tailwind CSS with shadcn/ui theme system
- Install shadcn/ui components (button, card, input, table, etc.)
- Set up ESLint and Prettier with automatic formatting
- Configure path aliases (@/*) in tsconfig.json
- Create full project structure per CLAUDE.md
- Add health check endpoint at /api/health
- Configure next.config.ts with output: 'standalone' for Docker
- Set up Prisma with placeholder schema
- Configure Vitest (unit) and Playwright (E2E) testing
- Add VS Code settings for consistent development experience

Build verification: TypeScript compilation, ESLint, and production build all pass.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-16 00:04:44 +00:00
6ef918aad4 Add reference docs and update CLAUDE.md
Some checks failed
Build and Deploy / build (push) Failing after 5s
Build and Deploy / deploy (push) Has been skipped
2026-02-15 23:33:57 +00:00
fbe79c0773 Update CLAUDE.md and TASKS.md to match infrastructure
Some checks failed
Build and Deploy / build (push) Failing after 9s
Build and Deploy / deploy (push) Has been skipped
2026-02-15 23:25:24 +00:00
66ba6a6c89 Update CLAUDE.md to match actual infrastructure
Some checks failed
Build and Deploy / build (push) Failing after 8s
Build and Deploy / deploy (push) Has been skipped
2026-02-15 23:17:06 +00:00
9b75729bac Remove DOCKER_HOST from workflow
Some checks failed
Build and Deploy / build (push) Failing after 33s
Build and Deploy / deploy (push) Has been skipped
2026-02-15 22:52:33 +00:00
9100695253 Simplify CI to use plain docker build
Some checks failed
Build and Deploy / build (push) Failing after 4s
Build and Deploy / deploy (push) Has been skipped
2026-02-15 22:50:24 +00:00
50833b778a Add Dockerfile and CI/CD pipeline
Some checks failed
Build and Deploy / build (push) Failing after 56s
Build and Deploy / deploy (push) Has been skipped
2026-02-15 22:42:41 +00:00
36c157893e Add test workflow
All checks were successful
Test CI / test (push) Successful in 33s
2026-02-15 22:15:14 +00:00
91f4ba3dbf Initial infrastructure setup 2026-02-15 19:31:34 +00:00