fix: Implement comprehensive edit event button functionality and resolve authentication issues

Major fixes and improvements:
- Fixed edit event button functionality with proper event handlers and DOM ready state checking
- Added status column to tickets table via Supabase migration to resolve 500 API errors
- Updated stats API to correctly calculate revenue from decimal price values
- Resolved authentication redirect loops by fixing cookie configuration for Docker environment
- Fixed Permissions-Policy header syntax errors
- Added comprehensive debugging and error handling for event management
- Implemented modal-based event editing with form validation and API integration
- Enhanced event data loading with proper error handling and user feedback

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-14 18:49:49 -06:00
parent b07ee8cdff
commit dbf4b11e81
216 changed files with 15891 additions and 468 deletions

97
test-stats-api.cjs Normal file
View File

@@ -0,0 +1,97 @@
const { chromium } = require('playwright');
async function testStatsAPI() {
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext();
const page = await context.newPage();
try {
console.log('🔑 Authenticating...');
// Login first
await page.goto('http://192.168.0.46:3000/login-new');
await page.waitForTimeout(1000);
// Accept cookies
const cookieBanner = await page.$('#cookie-consent-banner');
if (cookieBanner) {
await page.click('#cookie-accept-btn');
await page.waitForTimeout(500);
}
await page.fill('#email', 'tmartinez@gmail.com');
await page.fill('#password', 'TestPassword123!');
await page.click('#login-btn');
await page.waitForTimeout(3000);
console.log('✅ Authenticated');
console.log('\n🧪 Testing stats API directly...');
// Test the stats API endpoint directly
const statsUrl = 'http://192.168.0.46:3000/api/events/7ac12bd2-8509-4db3-b1bc-98a808646311/stats';
const response = await page.evaluate(async (url) => {
try {
const res = await fetch(url, {
method: 'GET',
credentials: 'include', // Include cookies
headers: {
'Content-Type': 'application/json'
}
});
const text = await res.text();
return {
status: res.status,
statusText: res.statusText,
headers: Object.fromEntries(res.headers.entries()),
body: text,
ok: res.ok
};
} catch (error) {
return {
error: error.message,
status: 0
};
}
}, statsUrl);
console.log('📊 Stats API Response:');
console.log('Status:', response.status);
console.log('OK:', response.ok);
console.log('Body:', response.body);
if (!response.ok) {
console.log('❌ Stats API failed');
// Try to get more details from the server logs
console.log('\n🔍 Checking server logs...');
// Navigate to a page that might show server errors
await page.goto('http://192.168.0.46:3000/events/7ac12bd2-8509-4db3-b1bc-98a808646311', {
waitUntil: 'networkidle'
});
await page.waitForTimeout(2000);
} else {
console.log('✅ Stats API working!');
// Parse the JSON response
try {
const data = JSON.parse(response.body);
console.log('📈 Stats data:', data);
} catch (error) {
console.log('⚠️ Response is not valid JSON');
}
}
} catch (error) {
console.error('💥 Test failed:', error);
} finally {
await browser.close();
}
}
testStatsAPI();