=========================================
  SkatePro Academy - DEPLOYMENT GUIDE
=========================================

WHAT YOU HAVE:
--------------
/dist/                  -> Frontend (HTML, CSS, JS) - upload to web root
/backend/               -> PHP API files - upload to /api/ folder
/backend/sql/           -> MySQL database setup script


STEP 1: CREATE MYSQL DATABASE
------------------------------
1. Login to your hosting control panel (cPanel/phpMyAdmin)
2. Create a new database: skatepro_academy
3. Create a database user with full privileges
4. Open phpMyAdmin, select your database
5. Go to "Import" tab
6. Upload: backend/sql/setup_database.sql
7. Click "Go" - all tables will be created

Alternative: Command line
mysql -u your_db_user -p
CREATE DATABASE skatepro_academy;
USE skatepro_academy;
source backend/sql/setup_database.sql;


STEP 2: UPLOAD BACKEND PHP FILES
---------------------------------
1. In your hosting file manager, create folder: /api/
2. Upload these files to /api/:
   - backend/config/database.php
   - backend/api/*.php (all 11 PHP files)

Final structure on server:
/public_html/
  /api/
    /config/
      database.php
    attendance.php
    auth.php
    clean_database.php
    coaches.php
    equipment.php
    expenses.php
    fees.php
    import_students.php
    sprint_races.php
    students.php
    timing.php


STEP 3: UPDATE DATABASE CONFIG
-------------------------------
Open: /api/config/database.php
Change these lines to your database details:

  define('DB_HOST', 'localhost');
  define('DB_USER', 'your_mysql_username');
  define('DB_PASS', 'your_mysql_password');
  define('DB_NAME', 'skatepro_academy');


STEP 4: UPLOAD FRONTEND FILES
------------------------------
Upload everything inside /dist/ folder to your web root:

/public_html/
  index.html
  logo.jpg
  manifest.json
  /assets/
    index-*.js
    index-*.css


STEP 5: LOGIN AND TEST
-----------------------
Open: https://yourwebsite.com/

Admin Login:
  URL: yourwebsite.com/#/admin
  Username: admin
  Password: admin123

Assistant Coach Login:
  URL: yourwebsite.com/#/coach
  Username: assistant
  Password: assistant123


STEP 6: IMPORT YOUR STUDENT DATA (CSV)
---------------------------------------
1. Prepare CSV file with columns:
   name, mobile, fees, email, password, address

2. Save as .csv file

3. Upload using:
   - POST to: https://yourwebsite.com/api/import_students.php
   - Or use the HTML form (create a simple upload page)

4. Students will get:
   - Email = Login ID
   - Same password as your old app
   - Auto-generated Student ID (SK001, SK002...)


TO CLEAN ALL DATA AND START FRESH:
-----------------------------------
POST to: https://yourwebsite.com/api/clean_database.php
This removes all students and data, keeps only admin login.


COMPLETE FILE LIST:
-------------------
Frontend (dist/):
  index.html, logo.jpg, manifest.json, assets/*.js, assets/*.css

Backend PHP APIs (api/):
  auth.php           - Login system
  students.php       - Student CRUD
  timing.php         - Timing records
  attendance.php     - Attendance marking
  fees.php           - Fee payments
  sprint_races.php   - Sprint race management
  equipment.php      - Equipment inventory
  expenses.php       - Expense tracking
  coaches.php        - Coach management
  import_students.php - CSV student import
  clean_database.php  - Reset all data

MySQL Tables (10 total):
  users, students, attendance, timing_records,
  sprint_races, sprint_rounds, sprint_results,
  fee_receipts, equipment, equipment_transactions,
  expenses, batches


WHAT IS COMPLETE:
-----------------
  Frontend: 100% Complete
  Backend PHP: 100% Complete
  MySQL Database: 100% Complete
  Student Import: 100% Complete
  Data Cleaning: 100% Complete

  Features included:
  - 3 login portals (Admin, Coach, Student)
  - Student management with auto-generated IDs
  - Attendance marking
  - Timing recording (stopwatch + manual)
  - Sprint races with LAP-based timer
  - Fee management + WhatsApp reminders
  - Equipment inventory (buy/sell/profit)
  - Expense tracking
  - Profit dashboard (Fees, Equipment, Combined)
  - Coach management
  - CSV student import
  - Role-based access control
