Commit graph

211 commits

Author SHA1 Message Date
John Mizerek
c1edb20e53 Fix customer lookup - treat UserID 0 as NULL 2026-02-06 18:24:52 -08:00
John Mizerek
14c9336025 Fix getDetails customer info 2026-02-06 18:22:45 -08:00
John Mizerek
407f68655e Add UserID and customer info to service bell tasks
- Store UserID when creating service bell tasks
- Return CustomerID and CustomerName in listPending and listMine
- Join Users table to fetch customer first/last name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:57:22 -08:00
John Mizerek
d8565deda1 Fix customer data query - remove invalid t.UserID join
Tasks table doesn't have UserID column. Customer data comes from Order.UserID only.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:52:40 -08:00
John Mizerek
b1a263bb36 Fix task APIs to get ServicePointName from Task.ServicePointID
- Use COALESCE(t.ServicePointID, o.ServicePointID) in JOIN
- Add ServicePointID to JSON response
- Fixes service bell tasks showing table name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:46:04 -08:00
John Mizerek
8c247eb000 KDS: Dark minimal theme matching HUD, fix updateStatus column names
- Redesign KDS with HUD-matching dark theme (pure black background)
- Header styling identical to HUD: position, font, clock format
- Status indicator moved to bottom-right corner like HUD
- Remove business ID config - now uses portal localStorage only
- Keep station toggle functionality
- Fix updateStatus.cfm: use correct column names for dev DB
  (sp.Name instead of sp.ServicePointName, sp.ID instead of sp.ServicePointID)
- Use relative API URL instead of hardcoded production URL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:45:11 -08:00
John Mizerek
17d17071d1 Fix service bell task to include ServicePointID
- Add ServicePointID to INSERT statement for service bell tasks
- Fix tt_TaskTypes query to use ID instead of tt_TaskTypeID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:42:56 -08:00
John Mizerek
d8333b3747 Add ServicePointName to task list endpoints
Returns service point name in listMine and listPending responses.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:34:12 -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
f2a186c727 Fix tt_TaskTypes column name in callServer.cfm
Column is ID, not tt_TaskTypeID (per new naming convention).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:27:24 -08:00
John Mizerek
8696e3002f Fix callServer.cfm TaskTypeID null constraint error
TaskTypeID column is NOT NULL, so insert 0 instead of NULL when
no TaskTypeID is provided.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:25:15 -08:00
John Mizerek
3089f84873 Add beacon UUID sharding system and fix task customer info
- Add beacon-sharding API endpoints for scalable iBeacon addressing
  (64 shard UUIDs × 65k businesses = ~4.2M capacity)
- Fix callServer.cfm to save UserID when creating Call Server tasks
- Fix getDetails.cfm to return customer info from Task.UserID when
  Order.UserID is null (for tasks without orders)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 17:16:08 -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 Mizerek
d7632c5d35 Menu builder and portal updates
- Menu builder UI improvements
- Portal CSS and JS updates
- Station assignment updates
- Add business tabs update endpoint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:08:54 -08:00
John Mizerek
e21a7f7266 Remove DeliveryMultiplier from Businesses query (column no longer exists)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:11:34 -08:00
John Mizerek
152ac572c7 Add detailed error message to getOrCreateCart for debugging
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 11:07:03 -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
f52d14bb7e Add Service Point Sharing infrastructure
Grant-based system allowing businesses to share service points with
other businesses. Includes grant CRUD API, time/eligibility/economics
policies, enforcement at cart creation and order submit, Stripe payment
routing for owner fees, and portal UI for managing grants.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:34:03 -08:00
John Mizerek
82293c944d Add CLAUDE.md project documentation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 20:06:57 -08:00
John Mizerek
89f339a9fd Fix order history and active cart API response keys
- Replace tt_OrderTypes JOIN with CASE statement (table casing on Linux)
- Fix key mismatches: Name->BusinessName, UUID->OrderUUID, StatusID->OrderStatusID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 10:12:03 -08:00
John Mizerek
4dfd0db833 Make menu-builder sidebar consistent with portal index
Move business card to top, remove logout button and sidebar-footer,
add missing Task Admin nav item.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:48:42 -08:00
John Mizerek
87e38649c4 Use business name initial for user avatar instead of first name
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:47:02 -08:00
John Mizerek
7b19979118 Show user's first initial in profile avatar instead of hardcoded U
Save FirstName to localStorage on login (both OTP and password paths).
Portal reads it back and displays the first letter in the user avatar.
Falls back to 'U' if no name is stored. Cleared on logout.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:38:36 -08:00
John Mizerek
05a52c6159 Move business card to top of sidebar, remove empty footer
Business info card now sits between the Payfrit logo and the nav links.
Sidebar footer removed entirely.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:29:02 -08:00
John Mizerek
e4afa61f13 Remove Switch/Add Business from sidebar footer
These actions are now only in the user dropdown menu in the top-right.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:28:16 -08:00
John Mizerek
fcfaa5b869 Move Switch/Add Business to user dropdown, remove sidebar logout
User icon dropdown now has: Settings, Switch Business, Add New Business,
Logout. Removed redundant logout from sidebar footer.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:27:16 -08:00
John Mizerek
d6478da03f Fix brand color display and header upload collision
- Brand color: add # prefix when loading from DB (stored without #,
  CSS needs it for backgroundColor)
- Header upload: delete destination file before rename to prevent
  collision when re-uploading same extension
- Header preview: prepend BASE_PATH to image URL for local dev

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:10:45 -08:00
John Mizerek
db90d9911a Add OTP email login to business portal
Replace default password login with email-based OTP flow. User enters
email, receives 6-digit code, enters it to log in. Password login
retained as fallback via link. On dev, magic OTP code is shown directly
for easy testing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 09:03:40 -08:00
John Mizerek
77fb8b9780 Add user dropdown menu with Settings and Logout options
The user icon in the top-right header now opens a dropdown
with Settings and Logout links, making both accessible on mobile
where the sidebar is hidden.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:18:36 -08:00
John Mizerek
0258531c3d Remove debug alerts from portal.js
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:15:22 -08:00
John Mizerek
6ba3f3dffd Add debug alerts to diagnose mobile settings load issue
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:12:28 -08:00
John Mizerek
2562c51c27 Normalize API response keys to uppercase for consistent access
Lucee serializeJSON casing varies by server config (preserveCaseForStructKey).
Normalize all biz object keys to uppercase on the JS side so lookups
work regardless of server config.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:08:03 -08:00
John Mizerek
abbe1d60a6 Add temporary debug alerts for mobile header/color issue
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 08:02:45 -08:00
John Mizerek
80b4c0da52 Fix header image and brand color swatch on mobile
- Hide wrapper div instead of img (avoids mobile empty-src issues)
- Use img onload handler to show wrapper after image loads
- Use backgroundColor instead of background shorthand for swatch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:59:21 -08:00
John Mizerek
69c51b90cb Fix header preview box and brand color swatch for mobile
- Header preview: max-width 1200px, white background, no border-radius on img
- Brand color swatch: change span to div with min-width/min-height and
  flex-shrink:0 to prevent collapse on mobile flex layouts
- Remove headerPreviewWrapper brand color tinting (wrapper stays white)
- Fix swatch border from white-alpha to black-alpha for visibility on white cards

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:50:25 -08:00
John Mizerek
db5cd90875 Switch header preview from CSS background-image to <img> tag
CSS background-image with padding-bottom trick for aspect ratio was not
rendering on mobile. Using an actual <img> element with width:100% is
universally reliable across all browsers and devices.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:48:47 -08:00
John Mizerek
d86ca5a894 Fix header image display on mobile and brand color preview
- Replace fixed 120px height with aspect-ratio padding (33.3%) so image
  scales properly on narrow mobile screens
- Use background-size: cover instead of contain for better fill
- Add wrapper div that shows brand color behind the header image
- Update saveBrandColor to also update the header wrapper background

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:45:46 -08:00
John Mizerek
b65d536342 Left-justify header image preview
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:42:22 -08:00
John Mizerek
c41b3950d2 Change header preview background to white
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:40:15 -08:00
John Mizerek
6b1d4b724b Change header image preview background from dark (#333) to light (#e9ecef)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 07:38:41 -08:00
John Mizerek
3f15b0c8b6 Fix SQL injection, wrong PK, and hardcoded production URLs
Security:
- orders/submit.cfm: parameterize IN clause (was string-interpolated)
- auth/completeProfile.cfm: fix UserID → ID on Users table PK

Environment-aware URLs:
- Add application.baseUrl to config/environment.cfm
- Replace all hardcoded https://biz.payfrit.com with application.baseUrl in:
  orders/getDetail, tasks/getDetails, auth/completeProfile, auth/avatar,
  stripe/onboard, users/search, workers/onboardingLink, workers/earlyUnlock

Also fix submit.cfm qMeta.ItemID → qMeta.ID (column not in SELECT)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:14:19 -08:00
John Mizerek
e30a757c39 Fix missing datasource in addresses/list.cfm and LIKE on INT column in setDefault.cfm
- list.cfm: add missing datasource: "payfrit" parameter to queryExecute
- setDefault.cfm: change AddressTypeID LIKE '%2%' to AddressTypeID = 2 (INT column)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:05:06 -08:00
John Mizerek
3dc15f8c13 Fix TaskID → ID in WHERE clauses on Tasks table (4 files + cron copy)
- tasks/accept.cfm: WHERE TaskID → WHERE ID
- tasks/completeChat.cfm: WHERE TaskID → WHERE ID
- tasks/expireStaleChats.cfm: WHERE TaskID → WHERE ID
- cron/expireStaleChats.cfm: WHERE TaskID → WHERE ID
- chat/closeChat.cfm: WHERE TaskID → WHERE ID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:00:46 -08:00
John Mizerek
a7b7717ccd Fix prefixed column names in uploadHeader, stripe/onboard, stripe/createPaymentIntent
- uploadHeader.cfm: WHERE BusinessID → WHERE ID (Businesses table PK)
- onboard.cfm: WHERE BusinessID → WHERE ID, BusinessStripeOnboardingStarted → StripeOnboardingStarted
- createPaymentIntent.cfm: WHERE BusinessID → WHERE ID, OrderDeliveryFee → DeliveryFee, WHERE OrderID → WHERE ID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:56:35 -08:00
John Mizerek
09172ace40 Fix header image URL to use relative path instead of hardcoded production domain
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:52:19 -08:00
John Mizerek
c5e9d1b0ff Fix settings page element ID mismatches
settingName -> settingBusinessName, settingLine1 -> settingAddressLine1
to match actual HTML element IDs. The mismatch caused null reference
errors that broke the entire settings page load.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:44:26 -08:00
John Mizerek
89ec86c9d2 Move 70 one-off admin scripts to api/admin/_scripts/ (gitignored)
Only quickTasks/ and scheduledTasks/ subdirectories remain tracked
since those are actively used by the portal.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:38:49 -08:00
John Mizerek
78035e9cf6 Fix remaining prefixed DB column names across 17 API files
Hours: HoursBusinessID/HoursDayID/HoursOpenTime/HoursClosingTime -> BusinessID/DayID/OpenTime/ClosingTime
ServicePoints: ServicePointID/ServicePointName/ServicePointBusinessID -> ID/Name/BusinessID
Users: UserFirstName/UserLastName/UserEmailAddress/UserContactNumber -> FirstName/LastName/EmailAddress/ContactNumber
Orders: BusinessDeliveryMultiplier -> DeliveryMultiplier (column renamed in dev DB)
Businesses: BusinessParentBusinessID -> ParentBusinessID
tt_Days: tt_DayID/tt_DayName -> ID/Name

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:35:24 -08:00
John Mizerek
4f5ba7f549 Fix businesses/get.cfm: use un-prefixed dev DB column names
Hours query was still using HoursDayID, HoursOpenTime etc. which
don't exist in payfrit_dev. Now uses DayID, OpenTime, ClosingTime.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:06:52 -08:00
John Mizerek
8acf2f3249 Complete DB column normalization: strip redundant table-name prefixes from all SQL queries
Updated 70 files to match the payfrit_dev schema where columns like
BusinessName→Name, UserFirstName→FirstName, AddressCity→City, etc.
PKs renamed to ID, FKs keep referenced table name (e.g. BusinessID).
SQL aliases preserve original JSON response keys for API compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:03:40 -08:00