Commit Graph

4 Commits

Author SHA1 Message Date
Kilo
916455351d fix(admin): connect api.js and admin.js, fix property modal, add analytics endpoint
- admin.html: removed conflicting inline script, added api.js + admin.js
- admin.js: dynamic section loader with fetch, init navigates to hash
- api.js: credentials: 'include' for all admin requests
- propertyModal: added name attributes to all form fields, saveProperty onclick handler
- server/index.ts: added POST /api/analytics/event with daily aggregation
- server/validation.ts: removed min(6) from password for 401 on invalid credentials
- capability-index.yaml: added 11 MCP capability routes
- docker-compose-mcp.yml: created for MCP servers
2026-04-27 11:42:05 +01:00
TenerifeProp Dev
9cffbb3bf3 refactor: split admin.html into modular section files with dynamic loading
- Extracted 10 sections from admin.html (3315 lines) into separate files:
  - dashboard.html (298 lines)
  - properties.html (242 lines)
  - leads.html (280 lines)
  - testimonials.html (78 lines)
  - faq.html (91 lines)
  - services.html (61 lines)
  - settings.html (93 lines)
  - users.html (73 lines)
  - analytics.html (64 lines)
  - traffic.html (69 lines)
- admin.html reduced from 3315 to 1582 lines
- Added dynamic section loader via fetch()
- Sections load on-demand when clicking sidebar links
- Previously loaded sections cached in memory
- Updated server routes to serve all section files
- DataTables initialized per-section on load
2026-04-07 00:25:36 +01:00
TenerifeProp Dev
343a9381e1 feat: add real data to admin dashboard with charts
- Add analytics tables (analytics_events, analytics_daily)
- Add /api/admin/leads endpoint for lead listing
- Add /api/admin/analytics/overview and /api/admin/analytics/charts endpoints
- Seed database with 15 leads and 30 days of analytics data
- Update dashboard.html with:
  - Animated counters for stats
  - Performance chart (views/leads over 6 months)
  - Leads status pie chart
  - Property types bar chart
  - Traffic sources doughnut chart
  - Top properties horizontal bar chart
  - Recent properties table with images
  - Recent leads list with status badges
- Add API methods: getAnalyticsOverview(), getAnalyticsCharts()
2026-04-06 10:54:26 +01:00
TenerifeProp Dev
bf6c477772 refactor: modular admin panel architecture
## Structure Created
- public/admin.html - main admin page (3251 lines)
- public/admin/*.html - component files:
  - sidebar.html (96 lines)
  - topbar.html (42 lines)
  - dashboard.html (198 lines)
  - properties.html (194 lines)
  - leads.html (185 lines)
  - testimonials.html (85 lines)
  - faq.html (95 lines)
  - services.html (89 lines)
  - settings.html (160 lines)
- public/css/admin.css (1135 lines)
- public/js/admin-components.js (247 lines)

## Clean URLs
- /login (was /login.html)
- /admin (was /admin.html)

## Issues Created
Milestone #52: Admin Panel Modular Refactoring
- #32: Dashboard - Statistics and Charts
- #33: Properties - CRUD Management
- #34: Leads - CRM Management
- #35: Testimonials - Management
- #36: FAQ - Management
- #37: Services - Management
- #38: Users - Management
- #39: Settings - Site Configuration

## TODO
Server routing needs update to serve:
- GET /admin/* -> public/admin/*.html
- GET /css/* -> public/css/*
- GET /js/* -> public/js/*

Current routes only handle SPA paths.
Components are ready but need server config.

## Verified
 Component files created
 CSS extracted (1135 lines)
 JS loader created (247 lines)
 All 8 admin sections modularized
 Clean URLs working (/login, /admin)
2026-04-06 02:00:22 +01:00