Commit graph

49 commits

Author SHA1 Message Date
John Mizerek
e628443c02 Add admin script to cleanup orphan items 2026-01-14 13:31:18 -08:00
John Mizerek
f40d5c1f93 Fix modifier move: use Shift key and dataTransfer data instead of effectAllowed 2026-01-14 12:57:34 -08:00
John Mizerek
ff6e4f2a36 Fix missing closing brace in item drag handler 2026-01-14 12:52:46 -08:00
John Mizerek
b6c1569add Fix syntax error in item card onclick handler 2026-01-14 12:39:30 -08:00
John Mizerek
85510a7647 Fix template loading state stuck on 'Loading templates...' 2026-01-14 12:27:40 -08:00
John Mizerek
fb329727d2 Add drag-and-drop for modifiers at all levels
- Modifiers can be dragged and dropped to reorder within same parent
- Modifiers can be dropped on other modifiers (same or different parent)
- Modifiers can be dropped on items to add as top-level modifier
- Default action is COPY (drag creates a copy)
- Hold Ctrl+Alt while dragging to MOVE instead of copy
- Deep cloning preserves nested options with new IDs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 12:15:44 -08:00
John Mizerek
12b47c3e41 Add accordion behavior to menu builder for all levels
- Categories: Only one category expanded at a time
- Items: Click item to expand/collapse modifiers
- Modifiers: Click modifier with sub-options to expand/collapse nested options
- Clicking a new parent auto-collapses siblings at that level

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 11:40:52 -08:00
John Mizerek
a6259bccb0 Revert deduplication hack - root cause fixed in app
The duplicate modifiers were caused by the app creating nested groups.
That's now fixed, so we can remove the deduplication workaround.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 22:52:12 -08:00
John Mizerek
f6c3729874 Deduplicate modifiers in KDS display
Prevents showing the same modifier twice when data has duplicates.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 22:45:55 -08:00
John Mizerek
70781ab75e Show Takeaway/Delivery instead of Table name in KDS
- Updated listForKDS.cfm to include OrderTypeName in response
- Added getLocationLabel/getLocationValue helpers in kds.js
- Takeaway orders now show "Type: Takeaway"
- Delivery orders now show "Type: Delivery"
- Dine-in orders continue to show "Table: [name]"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 22:38:33 -08:00
John Mizerek
f919ef1cfe Add chat expiration and order management improvements
- Auto-expire stale chats older than 20 minutes in createChat.cfm
- Add expireStaleChats.cfm for scheduled cleanup
- Add abandonOrder.cfm for Start Fresh functionality
- Add closeAllChats action to debugTasks.cfm
- Fix setOrderType NULL value for non-delivery orders
- Add ForceNew parameter to setLineItem for customized items
- Add public endpoint allowlist entries for new endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 19:46:39 -08:00
John Mizerek
f7df6b614c Include delivery fee in payment calculation
createPaymentIntent.cfm now fetches the order's delivery fee
and includes it in the total amount charged to the customer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 11:06:27 -08:00
John Mizerek
bd1e4110f6 Remove debug logging with Windows paths
The fileAppend calls were using Windows paths which fail on the
Linux production server.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:32:06 -08:00
John Mizerek
fc371dca3d Add item names to setLineItem response
loadCartPayload now includes ItemName, ItemParentName, and
ItemIsCheckedByDefault so the cart displays proper breadcrumbs
immediately after adding items.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:12:33 -08:00
John Mizerek
9136ef56a9 Add item names and parent names to cart API response
getCart.cfm now returns ItemName, ItemParentName, and
ItemIsCheckedByDefault for each line item, enabling the
Flutter app to display modifier breadcrumbs like
"Select Drink: Coke" without needing a separate menu lookup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:06:39 -08:00
John Mizerek
0a10380639 Add template modifier support and fix KDS breadcrumbs
- setLineItem.cfm: Attach default children from ItemTemplateLinks
  (fixes drink choices not being saved for combos)
- listForKDS.cfm: Include ItemParentName for modifier categories
- kds.js: Display modifiers as "Category: Selection" format
- Various other accumulated fixes for menu builder, orders, and admin

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:45:06 -08:00
John Mizerek
e20aede25f Fix KDS to show all selected modifiers including defaults
Previously the KDS was skipping modifiers marked as "checked by default",
but for exclusive selection groups (like drink choices) the customer's
actual selection should always be visible to the kitchen.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:09:54 -08:00
John Mizerek
ccb27f679f Show EmployeeStatusID status instead of IsActive flag
- Display Pending/Invited/Active/Suspended from EmployeeStatusID
- Add CSS for pending and suspended status badges
- Update getStatusClass to handle employee status codes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:01:30 -08:00
John Mizerek
0b17d35b31 Add active/inactive status badge CSS styles
- Green background for active employees
- Red background for inactive employees

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:59:56 -08:00
John Mizerek
b8e85f3f11 Add debugEmployees to allowlist 2026-01-11 17:59:03 -08:00
John Mizerek
21dcb19ec4 Add debug endpoint for employee data 2026-01-11 17:58:31 -08:00
John Mizerek
245a37aeab Fix IsActive bit field comparison in team API
Cast BIT(1) to UNSIGNED INT in SQL and use val() for comparison
to correctly handle MySQL bit fields in ColdFusion/Lucee.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:39:48 -08:00
John Mizerek
e586a62a95 Add phone column to team table, add duplicate cleanup script
- Replace Role column with Phone column in team table
- Add formatPhone() helper to format phone numbers nicely
- Add cleanupDuplicateEmployees.cfm admin script to remove duplicates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:32:07 -08:00
John Mizerek
b9f5eb834f Add hiring toggle functionality to portal Team page
- Add setHiring.cfm API endpoint to update BusinessIsHiring
- Add endpoint to Application.cfm allowlist
- Update portal.js to load and sync hiring toggle state
- Wire toggle to call API and show feedback toasts
- Bump portal.js version for cache busting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:13:59 -08:00
John Mizerek
aa80dab890 Add IsHiring field to business get response
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:12:02 -08:00
John Mizerek
8de677ad9e Add debug logging to team loading 2026-01-11 17:08:58 -08:00
John Mizerek
4fdb7fca94 Implement team loading in portal
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:06:37 -08:00
John Mizerek
8092384702 Add team endpoint and chat features for portal
- Add /api/portal/team.cfm for employee listing
- Add chat endpoints (getMessages, sendMessage, markRead, getActiveChat)
- Add OTP authentication endpoints
- Add address management endpoints (delete, setDefault, states)
- Add task completion and chat task endpoints
- Update Application.cfm allowlist

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 17:03:55 -08:00
John Mizerek
d8d7efe056 Add user account APIs and fix Lucee header handling
- Add avatar.cfm: GET/POST for user profile photos with multi-extension support
- Add profile.cfm: GET/POST for user profile (name, email, phone)
- Add history.cfm: Order history endpoint with pagination
- Add addresses/list.cfm and add.cfm: Delivery address management
- Add setOrderType.cfm: Set delivery/takeaway type on orders
- Add checkToken.cfm: Debug endpoint for token validation
- Fix headerValue() in Application.cfm to use servlet request object
  (Lucee CGI scope doesn't expose custom HTTP headers like X-User-Token)
- Update public allowlist for new endpoints
- Add privacy.html page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 20:01:07 -08:00
John Mizerek
e757a4140b Add drink modifiers, unified schema improvements, and portal fixes
Menu System:
- Unified schema with Categories table integration
- Virtual category headers with proper parent ID remapping
- Filter out legacy category headers when using new schema
- Add drink modifier endpoints for Fountain Soda (Size/Flavor)

Admin Tools:
- addDrinkModifiers.cfm - Add size/flavor modifiers to drinks
- copyDrinksToBigDeans.cfm - Copy drink items between businesses
- debugDrinkStructure.cfm - Debug drink item hierarchy

Portal:
- Station assignment improvements with better drag-drop
- Enhanced debug task viewer

API Fixes:
- Application.cfm updated with new admin endpoint allowlist
- setLineItem.cfm formatting cleanup
- listMine.cfm task query fixes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 20:30:58 -08:00
John Mizerek
634148f727 Add Categories table support, KDS station selection, and portal fixes
Categories Migration:
- Add ItemCategoryID column to Items table (api/admin/addItemCategoryColumn.cfm)
- Migration script to populate Categories from unified schema (api/admin/migrateToCategories.cfm)
- Updated items.cfm and getForBuilder.cfm to use Categories table with fallback

KDS Station Selection:
- KDS now prompts for station selection on load (Kitchen, Bar, or All Stations)
- Station filter persists in localStorage
- Updated listForKDS.cfm to filter orders by station
- Simplified KDS UI with station badge in header

Portal Improvements:
- Fixed drag-and-drop in station assignment (proper event propagation)
- Fixed Back button links to use BASE_PATH for local development
- Added console logging for debugging station assignment
- Order detail API now calculates Subtotal, Tax, Tip, Total properly

Admin Tools:
- setupBigDeansStations.cfm - Create Kitchen and Bar stations for Big Dean's

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 15:31:45 -08:00
John Mizerek
ec81af5cdd Add business info, order details, beacon management, and admin tools
API Improvements:
- api/businesses/get.cfm: Fetch address from Addresses table, hours from Hours table
- api/tasks/getDetails.cfm: Add CustomerPhone field from UserContactNumber
- api/orders/getDetail.cfm: New endpoint for order details with line items
- api/Application.cfm: Add new admin endpoints to public allowlist

Admin Tools:
- api/admin/beaconStatus.cfm: View all beacon-to-business mappings
- api/admin/updateBeaconMapping.cfm: Change beacon business assignment
- api/admin/setupBigDeansInfo.cfm: Set Big Dean's address and hours
- api/admin/listTables.cfm: List all database tables
- api/admin/describeTable.cfm: Get table structure and sample data
- api/admin/randomizePrices.cfm: Randomize item prices for testing
- Various Big Dean's debug/update scripts

Portal Enhancements:
- Enhanced CSS styling for portal pages
- Improved portal.js functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 11:45:21 -08:00
John Mizerek
e9b44ec4be Add task details API endpoint
- New endpoint: api/tasks/getDetails.cfm
  - Returns task info, customer info, service point, order line items
  - Joins Tasks, Orders, Users, ServicePoints, OrderLineItems tables
- Add getDetails.cfm to public endpoints allowlist in Application.cfm

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-06 18:02:01 -08:00
John Mizerek
d225133c68 Add menu builder required selection UI and fix portal issues
Menu Builder - Required Selections:
- Added "Selection Rules" section for modifier groups
- Required (Yes/No) dropdown to mark if customer must select an option
- Max Selections input (0 = unlimited) to limit selections
- Visual "Required" badge (red) and "Max X" badge in modifier list
- Updated saveFromBuilder.cfm to persist ItemRequiresChildSelection
  and ItemMaxNumSelectionReq to database

Portal Fixes:
- Fixed menu-builder link to include BASE_PATH for local dev
- Fixed stats.cfm to not reference non-existent Categories table
- Menu items count now uses ItemParentItemID > 0 (not ItemCategoryID)

Stripe Configuration:
- Added api/config/stripe.cfm for centralized Stripe key management
- Supports test/live mode switching
- Fee configuration variables (5% customer, 5% business, 2.9% + $0.30 card)

Payment Intent API:
- Updated createPaymentIntent.cfm with proper fee structure
- Customer pays: subtotal + tax + tip + 5% Payfrit fee + card processing
- Platform receives 10% total (5% from customer + 5% from business)
- Saves fee breakdown to order record

Beacon Management:
- Updated switchBeacons.cfm to move beacons between businesses
- Currently configured: Big Dean's (27) -> In-N-Out (17)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-05 01:56:12 -08:00
John Mizerek
51a80b537d Add local dev support and fix menu builder API
Portal local development:
- Add BASE_PATH detection to all portal files (login, portal.js, menu-builder, station-assignment)
- Allows portal to work at /biz.payfrit.com/ path locally

Menu Builder fixes:
- Fix duplicate template options in getForBuilder.cfm query
- Filter template children by business ID with DISTINCT

New APIs:
- api/portal/myBusinesses.cfm - List businesses for logged-in user
- api/stations/list.cfm - List KDS stations
- api/menu/updateStations.cfm - Update item station assignments
- api/setup/reimportBigDeans.cfm - Full Big Dean's menu import script

Admin utilities:
- Various debug and migration scripts for menu/template management
- Beacon switching, category cleanup, modifier template setup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-04 22:47:12 -08:00
John Mizerek
1f4d06edba Add Payfrit Works (WDS) support and task completion flow
Task System:
- Tasks auto-created when KDS marks order Ready (status 3)
- Duplicate task prevention via TaskOrderID check
- Task completion now marks associated order as Completed (status 4)
- Fixed isNull() check for TaskCompletedOn (use len() instead)
- Added TaskOrderID to task queries for order linking

Worker APIs:
- api/workers/myBusinesses.cfm with GROUP BY to prevent duplicates
- api/tasks/listMine.cfm for worker's claimed tasks with filters
- api/tasks/complete.cfm updates both task and order status
- api/tasks/accept.cfm for claiming tasks

KDS/Portal:
- KDS only shows orders with status < 4
- Portal dashboard improvements

Admin/Debug:
- Debug endpoints for tasks and businesses
- Test data reset endpoint

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 14:52:04 -08:00
John Mizerek
0765dc1e27 Add business portal, Stripe Connect, beacon APIs, and task system
Portal:
- New business portal UI (portal/index.html, portal.css, portal.js)
- Dashboard with real-time stats (orders today, revenue, pending, menu items)
- Business info endpoint (api/businesses/get.cfm)
- Portal stats endpoint (api/portal/stats.cfm)
- Menu page links to existing full-featured menu editor

Stripe Connect:
- Onboarding endpoint (api/stripe/onboard.cfm)
- Status check endpoint (api/stripe/status.cfm)
- Payment intent creation (api/stripe/createPaymentIntent.cfm)
- Webhook handler (api/stripe/webhook.cfm)

Beacon APIs:
- List all beacons (api/beacons/list_all.cfm)
- Get business from beacon (api/beacons/getBusinessFromBeacon.cfm)

Task System:
- List pending tasks (api/tasks/listPending.cfm)
- Accept task (api/tasks/accept.cfm)

Other:
- HUD interface for quick order status display
- KDS debug/test pages
- Updated Application.cfm with public endpoint allowlist
- Order status check improvements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 23:38:26 -08:00
John Mizerek
ea72b120e8 Fix order status polling and delivery fee logic
API Changes:
- checkStatusUpdate.cfm: Fixed to use OrderStatusID != 7 instead of non-existent OrderIsDeleted column
- Application.cfm: Added checkStatusUpdate.cfm to public API allowlist
- getOrCreateCart.cfm: Fixed delivery fee to only apply for OrderTypeID = 2 (delivery)

Order Type Logic:
- 1 = Dine-in (no delivery fee)
- 2 = Delivery (delivery fee applied)
- 3 = Takeaway (no delivery fee)
- 4 = Ship-to (no delivery fee)

Status Translation:
- Uses OrderStatusID != 7 to filter deleted orders (tt_OrderStatuses table)

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 21:38:26 -08:00
John Mizerek
ecea71c533 Implement polling-based order status notifications
Backend changes:
- New API endpoint: checkStatusUpdate.cfm - polls order status and detects changes
- Updated admin.html: added test section for manually updating order status
- Status flow: 1(submitted) → 2(preparing) → 3(ready) → 4(completed)
- Human-readable status messages for each state

Testing interface:
- Order ID input field
- Status dropdown selector
- Direct integration with existing updateStatus.cfm endpoint

This enables real-time status notifications for customer orders with 30-second polling interval (Option 2 approach, with planned migration to self-hosted push).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 16:07:09 -08:00
John Mizerek
b812222314 Add KDS admin interface for manual order creation
- Created admin.html for BusinessID=17 to manually create test orders
- Service point selector with all tables
- Dynamic menu item rows with quantities
- Three-step order creation: cart → line items → submit
- Modern gradient UI with purple theme
- Success/error notifications
- Form auto-resets after successful order creation

Technical details:
- Fixed case sensitivity: API returns uppercase keys (ORDER, ORDERLINEITEMS)
- Fixed parameter naming: BusinessID (not OrderBusinessID)
- Added links to KDS display and debug view

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 15:38:13 -08:00
John Mizerek
4f694850e6 Fix KDS nested modifier display with breadcrumb paths
- Rewrote modifier rendering to display leaf modifiers only
- Added breadcrumb paths for full context (e.g., "Customize Spread: Extra")
- Eliminated nested div wrappers that were breaking the display
- Added comprehensive debug logging for troubleshooting
- Modifiers now show complete hierarchy without clutter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 14:40:53 -08:00
John Mizerek
d7f68e8098 Add KDS web interface files
- index.html: Complete KDS interface with dark theme
  - Responsive grid layout for order cards
  - Status indicator with connection monitoring
  - Configuration panel for settings
  - Empty state display

- kds.js: Real-time order management JavaScript
  - Auto-refresh with configurable interval
  - Order status updates via API
  - Elapsed time calculation with visual warnings
  - Hierarchical line item rendering with recursive modifiers
  - LocalStorage-based configuration persistence

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 17:46:11 -08:00
John Mizerek
97a2621705 Add KDS (Kitchen Display System) with real-time order management
- Created listForKDS.cfm API endpoint for retrieving active orders
  - Filters by BusinessID and optional ServicePointID
  - Returns orders with StatusID 1-3 (New, Preparing, Ready)
  - Includes nested line items with item names
  - Joins customer and service point information

- Created updateStatus.cfm API endpoint for order status transitions
  - Updates OrderStatusID (New -> Preparing -> Ready -> Completed)
  - Updates OrderLastEditedOn timestamp
  - Validates order exists before updating

- Built complete HTML/JavaScript KDS web application
  - Real-time order display with configurable auto-refresh (default 5s)
  - Color-coded status cards: Blue (New), Orange (Preparing), Green (Ready)
  - Elapsed time tracking with visual warnings at 10min and 15min
  - Hierarchical line item display showing root items with nested modifiers
  - One-click status progression buttons
  - Persistent configuration (BusinessID, ServicePointID filter, refresh interval)
  - Responsive grid layout for multiple concurrent orders
  - Dark theme optimized for kitchen environments

- Updated Application.cfm to allow public access to KDS endpoints

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 17:46:01 -08:00
John Mizerek
4dcf4e4385 Add cart endpoints and enhance menu API
Cart management improvements:
- Added cart endpoints to public API allowlist (getOrCreateCart, setLineItem, getCart, submit)
- Fixed setLineItem null parameter handling for remarks
- Standardized API responses to use uppercase keys (ORDER, ORDERLINEITEMS)
- Updated getCart to match response format consistency
- Added CategoryName to menu items endpoint

These changes enable the mobile app to browse menu with categories and manage cart operations without authentication.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-29 11:14:21 -08:00
John Mizerek
d3eef67e2e feat: add menu items endpoint to public API allowlist
- Add /api/menu/items.cfm to public endpoint allowlist
- Allows unauthenticated users to browse menu before ordering
2025-12-29 10:32:42 -08:00
John Mizerek
41122fc0fb fix: correct CFScript syntax in login endpoint
- Fix cflock to lock in CFScript
- Remove var keyword at top-level scope (outside functions)
- Fixes 500 error and now returns proper JSON responses
2025-12-29 10:01:43 -08:00
John Mizerek
363964d9c6 checkpoint 2025-12-28 22:34:01 -08:00
John Mizerek
848544ba53 Public businesses + servicepoints list endpoints; API allowlist; Lucee-safe JSON 2025-12-28 12:30:06 -08:00
John Mizerek
10200ad140 Checkpoint: beacon-servicepoint CRUD + assignments API working 2025-12-27 20:14:55 -08:00