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>
149 lines
5.9 KiB
Text
149 lines
5.9 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfcontent type="application/json; charset=utf-8" reset="true">
|
|
|
|
<cfscript>
|
|
businessId = 27;
|
|
response = { "OK": false };
|
|
|
|
try {
|
|
// Big Dean's actual info
|
|
// Address: 1615 Ocean Front Walk, Santa Monica, CA 90401
|
|
// Phone: (310) 393-2666
|
|
// Hours: Mon-Thu: 11am-10pm, Fri-Sat: 11am-11pm, Sun: 11am-10pm
|
|
|
|
// Get California StateID
|
|
qState = queryExecute("SELECT tt_StateID FROM tt_States WHERE tt_StateAbbreviation = 'CA' LIMIT 1");
|
|
stateId = qState.recordCount > 0 ? qState.tt_StateID : 5; // Default to 5 if not found
|
|
|
|
// Check if Big Dean's already has an address
|
|
existingAddr = queryExecute("
|
|
SELECT AddressID FROM Addresses
|
|
WHERE AddressBusinessID = :bizId AND AddressUserID = 0
|
|
", { bizId: businessId });
|
|
|
|
if (existingAddr.recordCount == 0) {
|
|
// Insert new address
|
|
queryExecute("
|
|
INSERT INTO Addresses (AddressUserID, AddressBusinessID, AddressTypeID, AddressLine1, AddressCity, AddressStateID, AddressZIPCode, AddressIsDeleted, AddressAddedOn)
|
|
VALUES (0, :bizId, '2', :line1, :city, :stateId, :zip, 0, NOW())
|
|
", {
|
|
bizId: businessId,
|
|
line1: "1615 Ocean Front Walk",
|
|
city: "Santa Monica",
|
|
stateId: stateId,
|
|
zip: "90401"
|
|
});
|
|
response["ADDRESS_ACTION"] = "inserted";
|
|
} else {
|
|
// Update existing address
|
|
queryExecute("
|
|
UPDATE Addresses
|
|
SET AddressLine1 = :line1, AddressCity = :city, AddressStateID = :stateId, AddressZIPCode = :zip
|
|
WHERE AddressBusinessID = :bizId AND AddressUserID = 0
|
|
", {
|
|
bizId: businessId,
|
|
line1: "1615 Ocean Front Walk",
|
|
city: "Santa Monica",
|
|
stateId: stateId,
|
|
zip: "90401"
|
|
});
|
|
response["ADDRESS_ACTION"] = "updated";
|
|
}
|
|
|
|
// Check existing hours for this business
|
|
existingHours = queryExecute("
|
|
SELECT COUNT(*) as cnt FROM Hours WHERE HoursBusinessID = :bizId
|
|
", { bizId: businessId });
|
|
|
|
if (existingHours.cnt == 0) {
|
|
// Insert hours for each day
|
|
// Days: 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday
|
|
// Mon-Thu: 11am-10pm (days 2-5)
|
|
// Fri-Sat: 11am-11pm (days 6-7)
|
|
// Sun: 11am-10pm (day 1)
|
|
|
|
// Sunday (1): 11am-10pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 1, '11:00:00', '22:00:00')", { bizId: businessId });
|
|
|
|
// Monday (2): 11am-10pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 2, '11:00:00', '22:00:00')", { bizId: businessId });
|
|
|
|
// Tuesday (3): 11am-10pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 3, '11:00:00', '22:00:00')", { bizId: businessId });
|
|
|
|
// Wednesday (4): 11am-10pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 4, '11:00:00', '22:00:00')", { bizId: businessId });
|
|
|
|
// Thursday (5): 11am-10pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 5, '11:00:00', '22:00:00')", { bizId: businessId });
|
|
|
|
// Friday (6): 11am-11pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 6, '11:00:00', '23:00:00')", { bizId: businessId });
|
|
|
|
// Saturday (7): 11am-11pm
|
|
queryExecute("INSERT INTO Hours (HoursBusinessID, HoursDayID, HoursOpenTime, HoursClosingTime) VALUES (:bizId, 7, '11:00:00', '23:00:00')", { bizId: businessId });
|
|
|
|
response["HOURS_ACTION"] = "inserted 7 days";
|
|
} else {
|
|
// Update existing hours
|
|
// Mon-Thu: 11am-10pm
|
|
queryExecute("UPDATE Hours SET HoursOpenTime = '11:00:00', HoursClosingTime = '22:00:00' WHERE HoursBusinessID = :bizId AND HoursDayID IN (1, 2, 3, 4, 5)", { bizId: businessId });
|
|
// Fri-Sat: 11am-11pm
|
|
queryExecute("UPDATE Hours SET HoursOpenTime = '11:00:00', HoursClosingTime = '23:00:00' WHERE HoursBusinessID = :bizId AND HoursDayID IN (6, 7)", { bizId: businessId });
|
|
response["HOURS_ACTION"] = "updated";
|
|
}
|
|
|
|
// Update phone on Businesses table (if column exists)
|
|
try {
|
|
queryExecute("UPDATE Businesses SET BusinessPhone = :phone WHERE BusinessID = :bizId", {
|
|
phone: "(310) 393-2666",
|
|
bizId: businessId
|
|
});
|
|
response["PHONE_ACTION"] = "updated";
|
|
} catch (any e) {
|
|
response["PHONE_ACTION"] = "column may not exist: " & e.message;
|
|
}
|
|
|
|
// Verify the data
|
|
address = queryExecute("
|
|
SELECT a.*, s.tt_StateAbbreviation
|
|
FROM Addresses a
|
|
LEFT JOIN tt_States s ON s.tt_StateID = a.AddressStateID
|
|
WHERE a.AddressBusinessID = :bizId AND a.AddressUserID = 0
|
|
", { bizId: businessId });
|
|
|
|
hours = queryExecute("
|
|
SELECT h.*, d.tt_DayName
|
|
FROM Hours h
|
|
JOIN tt_Days d ON d.tt_DayID = h.HoursDayID
|
|
WHERE h.HoursBusinessID = :bizId
|
|
ORDER BY h.HoursDayID
|
|
", { bizId: businessId });
|
|
|
|
response["OK"] = true;
|
|
response["BUSINESS_ID"] = businessId;
|
|
response["ADDRESS"] = address.recordCount > 0 ? {
|
|
"line1": address.AddressLine1,
|
|
"city": address.AddressCity,
|
|
"state": address.tt_StateAbbreviation,
|
|
"zip": address.AddressZIPCode
|
|
} : "not found";
|
|
|
|
hoursArr = [];
|
|
for (h in hours) {
|
|
arrayAppend(hoursArr, {
|
|
"day": h.tt_DayName,
|
|
"open": timeFormat(h.HoursOpenTime, "h:mm tt"),
|
|
"close": timeFormat(h.HoursClosingTime, "h:mm tt")
|
|
});
|
|
}
|
|
response["HOURS"] = hoursArr;
|
|
|
|
} catch (any e) {
|
|
response["ERROR"] = e.message;
|
|
response["DETAIL"] = e.detail;
|
|
}
|
|
|
|
writeOutput(serializeJSON(response));
|
|
</cfscript>
|