Commit graph

17 commits

Author SHA1 Message Date
John Mizerek
d1910a7d34 Add staff role system: Staff keeps cash, Manager/Admin collect for restaurant
- Create tt_StaffRoles lookup table (Staff, Manager, Admin)
- Add RoleID column to Employees table (default: Staff)
- Wire portal role dropdown to addTeamMember API
- Return RoleName in team list and RoleID to Android
- Skip worker payout ledger and cash_debit for Manager/Admin roles
  on cash task completion (they collect on behalf of the restaurant)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 11:19:22 -08:00
John Mizerek
fc310c35cf Fix cancel task to not cancel order, standardize OTP messages
- Cancel Task now leaves order untouched (customer can pay another way)
- Standardized SMS text to "Your Payfrit code is:" across all endpoints

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 11:11:37 -08:00
John Mizerek
7f4af8b910 Add CancelOrder option for cash tasks
When worker passes CancelOrder: true to complete.cfm:
- Skips all cash validation and financial processing
- Sets order status to 6 (cancelled)
- Completes the task normally
- Returns OrderCancelled: true in response

For when customer changes their mind about paying with cash.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 09:39:35 -08:00
John Mizerek
eb92042de5 Use business PayfritFee instead of hardcoded 5% in task order totals
Fixed complete.cfm, getDetails.cfm, listMine.cfm, listPending.cfm to pull
PayfritFee from Businesses table with 0.05 fallback if not set.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-17 09:20:18 -08:00
John Mizerek
01cb11dad3 fix: Cash task completion now triggers kitchen flow
When a cash task is completed, the order now goes to status 1 (submitted)
instead of directly to status 5 (complete). This allows the normal kitchen
flow to proceed: kitchen sees order → prepares → marks status 3 → delivery
task is auto-created.

Also sets PaymentStatus, PaymentCompletedOn, and SubmittedOn to match the
Stripe webhook behavior for paid orders.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 18:22:14 -08:00
John Pinkyfloyd
df903a9c75 Allow completing orphaned cash tasks without payment processing
Skip cash validation and processing for tasks with no linked order.
These are likely test tasks that were created before order linking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 12:26:24 -08:00
John Mizerek
c5614f0f50 Disable worker-rates-customer rating prompt temporarily
Rating UI not ready in Works app yet. Will re-enable when implemented.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 11:58:20 -08:00
John Mizerek
5e9be8c2ca Fix min() function call in complete.cfm
Lucee's min() only takes 2 args, not 3. Use nested min() calls.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:30:12 -08:00
John Mizerek
31a89018f5 Launch prep: fix menu builder, payment flow, comment out pre-launch features
- Fix menu builder dropdown showing empty names (return MenuName instead of Name)
- Add default menu selection (setDefault action, DefaultMenuID in getForBuilder)
- Fix createPaymentIntent column names for dev schema (ID, StripeAccountID, etc.)
- Fix menu-builder favicon and remove redundant business label
- Comment out Tabs/Running Checks feature for launch (HTML + JS)
- Comment out Service Point Marketing/Grants feature for launch (HTML + JS)
- Add testMarkPaid.cfm for testing orders without Stripe webhooks
- Task API updates for worker payout ledger integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:18:33 -08:00
John
16a3b7c9a3 Replace queryExecute with queryTimed across all endpoints for perf tracking
Converts 200+ endpoint files to use queryTimed() wrapper which tracks
DB query count and execution time. Restores perf dashboard files that
were accidentally moved to _scripts/. Includes portal UI updates.
2026-02-02 00:28:37 -08:00
John Mizerek
6b66d2cef8 Fix normalized DB column names across all API files
Sweep of 26 API files to use prefixed column names matching the
database schema (e.g. BusinessID not ID, BusinessName not Name,
BusinessDeliveryFlatFee not DeliveryFlatFee, ServicePointName not Name).

Files fixed: auth, beacons, businesses, menu, orders, setup, stripe,
tasks, and workers endpoints.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:56:41 -08:00
John Mizerek
8dff081407 Fix remaining old column names missed by initial batch rename
Second pass fixing 70+ references across 32 files:
- Orders: DeliveryMultiplier→BusinessDeliveryMultiplier, OrderTipAmount→TipAmount,
  OrderPaymentCompletedOn→PaymentCompletedOn, OrderPaymentError→PaymentError
- Orders PK: WHERE OrderID=? → WHERE ID=? on Orders table
- OrderLineItems PK: OrderLineItemID→ID in INSERT, WHERE, and query results
- Items: parent.ItemID→parent.ID in JOIN conditions
- Tasks: t.TaskID→t.ID in JOIN conditions
- Users PK: WHERE UserID=X → WHERE ID=X on Users table
- Addresses PK: A.AddressID→A.ID in JOIN conditions
- tt_States: tt_StateID→ID, remove nonexistent tt_StateCountryID/tt_StateSortOrder
- tt_OrderTypes: tt_OrderTypeID→ID, tt_OrderTypeName→Name
- tt_Days: D.tt_DayID→D.ID
- confirm_email.cfm: Add missing SELECT/FROM to queries
- setLineItem.cfm: Fix 13 old column references
- Stripe webhook/payment: Fix column names and PK references

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 22:58:46 -08:00
John Mizerek
1210249f54 Normalize database column and table names across entire codebase
Update all SQL queries, query result references, and ColdFusion code to match
the renamed database schema. Tables use plural CamelCase, PKs are all `ID`,
column prefixes stripped (e.g. BusinessName→Name, UserFirstName→FirstName).

Key changes:
- Strip table-name prefixes from all column references (Businesses, Users,
  Addresses, Hours, Menus, Categories, Items, Stations, Orders,
  OrderLineItems, Tasks, TaskCategories, TaskRatings, QuickTaskTemplates,
  ScheduledTaskDefinitions, ChatMessages, Beacons, ServicePoints, Employees,
  VisitorTrackings, ApiPerfLogs, tt_States, tt_Days, tt_AddressTypes,
  tt_OrderTypes, tt_TaskTypes)
- Rename PK references from {TableName}ID to ID in all queries
- Rewrite 7 admin beacon files to use ServicePoints.BeaconID instead of
  dropped lt_Beacon_Businesses_ServicePoints link table
- Rewrite beacon assignment files (list, save, delete) for new schema
- Fix FK references incorrectly changed to ID (OrderLineItems.OrderID,
  Categories.MenuID, Tasks.CategoryID, ServicePoints.BeaconID)
- Update Addresses: AddressLat→Latitude, AddressLng→Longitude
- Update Users: UserPassword→Password, UserIsEmailVerified→IsEmailVerified,
  UserIsActive→IsActive, UserBalance→Balance, etc.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:39:12 -08:00
John Mizerek
8f9da2fbf0 Add Manage Menus toolbar button, photo upload, and various improvements
- Move menu manager button to toolbar next to Save Menu for visibility
- Implement server-side photo upload for menu items
- Strip base64 data URLs from save payload to reduce size
- Add scheduled tasks, quick tasks, ratings, and task categories APIs
- Add vertical support and brand color features

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 14:43:41 -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
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
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