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>
102 lines
3 KiB
Text
102 lines
3 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
|
|
<cffunction name="apiAbort" access="public" returntype="void" output="true">
|
|
<cfargument name="payload" type="struct" required="true">
|
|
<cfcontent type="application/json; charset=utf-8">
|
|
<cfoutput>#serializeJSON(arguments.payload)#</cfoutput>
|
|
<cfabort>
|
|
</cffunction>
|
|
|
|
<cffunction name="readJsonBody" access="public" returntype="struct" output="false">
|
|
<cfset var raw = getHttpRequestData().content>
|
|
<cfif isNull(raw) OR len(trim(raw)) EQ 0>
|
|
<cfreturn {}>
|
|
</cfif>
|
|
<cftry>
|
|
<cfset var data = deserializeJSON(raw)>
|
|
<cfif isStruct(data)>
|
|
<cfreturn data>
|
|
<cfelse>
|
|
<cfreturn {}>
|
|
</cfif>
|
|
<cfcatch>
|
|
<cfreturn {}>
|
|
</cfcatch>
|
|
</cftry>
|
|
</cffunction>
|
|
|
|
<cfset data = readJsonBody()>
|
|
<cfset BusinessID = val( structKeyExists(data,"BusinessID") ? data.BusinessID : 0 )>
|
|
<cfset CategoryID = val( structKeyExists(data,"CategoryID") ? data.CategoryID : 0 )>
|
|
|
|
<cfif BusinessID LTE 0>
|
|
<cfset apiAbort({ "OK": false, "ERROR": "missing_params", "MESSAGE": "BusinessID is required." })>
|
|
</cfif>
|
|
|
|
<cftry>
|
|
<!--- Build WHERE clause --->
|
|
<cfset whereClauses = ["t.TaskBusinessID = ?", "t.TaskStatusID = 0"]>
|
|
<cfset params = [ { value = BusinessID, cfsqltype = "cf_sql_integer" } ]>
|
|
|
|
<!--- Filter by category if provided --->
|
|
<cfif CategoryID GT 0>
|
|
<cfset arrayAppend(whereClauses, "t.TaskCategoryID = ?")>
|
|
<cfset arrayAppend(params, { value = CategoryID, cfsqltype = "cf_sql_integer" })>
|
|
</cfif>
|
|
|
|
<cfset whereSQL = arrayToList(whereClauses, " AND ")>
|
|
|
|
<cfset qTasks = queryExecute("
|
|
SELECT
|
|
t.TaskID,
|
|
t.TaskBusinessID,
|
|
t.TaskCategoryID,
|
|
t.TaskTitle,
|
|
t.TaskDetails,
|
|
t.TaskCreatedOn,
|
|
t.TaskStatusID,
|
|
t.TaskSourceType,
|
|
t.TaskSourceID,
|
|
tc.TaskCategoryName,
|
|
tc.TaskCategoryColor
|
|
FROM Tasks t
|
|
LEFT JOIN TaskCategories tc ON tc.TaskCategoryID = t.TaskCategoryID
|
|
WHERE #whereSQL#
|
|
ORDER BY t.TaskCreatedOn ASC
|
|
", params, { datasource = "payfrit" })>
|
|
|
|
<cfset tasks = []>
|
|
|
|
<cfloop query="qTasks">
|
|
<cfset arrayAppend(tasks, {
|
|
"TaskID": qTasks.TaskID,
|
|
"TaskBusinessID": qTasks.TaskBusinessID,
|
|
"TaskCategoryID": qTasks.TaskCategoryID,
|
|
"TaskTitle": qTasks.TaskTitle,
|
|
"TaskDetails": qTasks.TaskDetails,
|
|
"TaskCreatedOn": dateFormat(qTasks.TaskCreatedOn, "yyyy-mm-dd") & "T" & timeFormat(qTasks.TaskCreatedOn, "HH:mm:ss"),
|
|
"TaskStatusID": qTasks.TaskStatusID,
|
|
"TaskSourceType": qTasks.TaskSourceType,
|
|
"TaskSourceID": qTasks.TaskSourceID,
|
|
"TaskCategoryName": qTasks.TaskCategoryName,
|
|
"TaskCategoryColor": qTasks.TaskCategoryColor
|
|
})>
|
|
</cfloop>
|
|
|
|
<cfset apiAbort({
|
|
"OK": true,
|
|
"ERROR": "",
|
|
"TASKS": tasks,
|
|
"COUNT": arrayLen(tasks)
|
|
})>
|
|
|
|
<cfcatch>
|
|
<cfset apiAbort({
|
|
"OK": false,
|
|
"ERROR": "server_error",
|
|
"MESSAGE": "Error loading tasks",
|
|
"DETAIL": cfcatch.message
|
|
})>
|
|
</cfcatch>
|
|
</cftry>
|