================================================================================
  PRIORITY UPLOAD LIST - FIX ERRORS FIRST, THEN ADD FEATURES
================================================================================

This list shows EXACTLY which files to upload in order of priority.
Upload in this order to fix errors first, then add new features.

================================================================================
🔴 CRITICAL - UPLOAD FIRST (Fixes Current Errors)
================================================================================

These files have errors on the live server. Upload these FIRST:

[ ] 1. .htaccess
      Location: Multi-Tanent/.htaccess
      Fix: Simplified version (no more 500 error)
      Local: C:\xampp\htdocs\Multi-Tanent\.htaccess

[ ] 2. super_admin/storage/overview.php
      Location: Multi-Tanent/super_admin/storage/overview.php
      Fix: Table name (academy_references) + collation
      Local: C:\xampp\htdocs\Multi-Tanent\super_admin\storage\overview.php

[ ] 3. admin/storage/usage.php
      Location: Multi-Tanent/admin/storage/usage.php
      Fix: getCurrentSchool() function name
      Local: C:\xampp\htdocs\Multi-Tanent\admin\storage\usage.php

[ ] 4. parent_register.php
      Location: Multi-Tanent/parent_register.php
      Fix: session_start() + success message bug
      Local: C:\xampp\htdocs\Multi-Tanent\parent_register.php

[ ] 5. parent/make_payment.php
      Location: Multi-Tanent/parent/make_payment.php
      Fix: Show grade-level subjects only
      Local: C:\xampp\htdocs\Multi-Tanent\parent\make_payment.php

AFTER UPLOADING THESE 5:
  ✓ No more 500 errors
  ✓ Storage dashboards work
  ✓ Parent registration works
  ✓ Parent payment works

================================================================================
🟡 IMPORTANT - UPLOAD NEXT (Core Features)
================================================================================

[ ] 6. admin/configure_subjects.php
      Location: Multi-Tanent/admin/configure_subjects.php
      Feature: Shows only enabled grades + links to manage_grades
      Local: C:\xampp\htdocs\Multi-Tanent\admin\configure_subjects.php

[ ] 7. admin/manage_grades.php
      Location: Multi-Tanent/admin/manage_grades.php
      Feature: NEW - Select which grades school offers
      Local: C:\xampp\htdocs\Multi-Tanent\admin\manage_grades.php

[ ] 8. super_admin/schools/create.php
      Location: Multi-Tanent/super_admin/schools/create.php
      Feature: Shows URLs + QR code after school creation
      Local: C:\xampp\htdocs\Multi-Tanent\super_admin\schools\create.php

[ ] 9. super_admin/schools/view.php
      Location: Multi-Tanent/super_admin/schools/view.php
      Feature: Shows URLs + QR code on school details
      Local: C:\xampp\htdocs\Multi-Tanent\super_admin\schools\view.php

[ ] 10. includes/school_url_generator.php
       Location: Multi-Tanent/includes/school_url_generator.php
       Feature: NEW - Generates clean URLs for schools
       Local: C:\xampp\htdocs\Multi-Tanent\includes\school_url_generator.php

AFTER UPLOADING THESE 5:
  ✓ Admins can select which grades to offer
  ✓ Configure subjects shows only selected grades
  ✓ URLs displayed after school creation
  ✓ Clean URLs work (if .htaccess works)

================================================================================
🟢 OPTIONAL - UPLOAD WHEN READY (Moodle Integration)
================================================================================

[ ] 11. admin/moodle/configure_mapping.php
       Location: Multi-Tanent/admin/moodle/configure_mapping.php
       Feature: Map subjects to Moodle courses
       NOTE: Create folder: admin/moodle/ first
       Local: C:\xampp\htdocs\Multi-Tanent\admin\moodle\configure_mapping.php

[ ] 12. admin/moodle/test_mappings.php
       Location: Multi-Tanent/admin/moodle/test_mappings.php
       Feature: Test Moodle mappings
       Local: C:\xampp\htdocs\Multi-Tanent\admin\moodle\test_mappings.php

[ ] 13. includes/moodle_enrollment_handler.php
       Location: Multi-Tanent/includes/moodle_enrollment_handler.php
       Feature: Auto-enroll students in Moodle
       Local: C:\xampp\htdocs\Multi-Tanent\includes\moodle_enrollment_handler.php

AFTER UPLOADING THESE 3:
  ✓ Can map subjects to Moodle courses
  ✓ Students auto-enroll when assigned subjects
  ✓ Can test mappings

================================================================================
🔵 OPTIONAL - UPLOAD WHEN READY (Student Self-Registration)
================================================================================

[ ] 14. register_student.php
       Location: Multi-Tanent/register_student.php
       Feature: Student self-registration form
       Local: C:\xampp\htdocs\Multi-Tanent\register_student.php

[ ] 15. verify_registration.php
       Location: Multi-Tanent/verify_registration.php
       Feature: Email verification handler
       Local: C:\xampp\htdocs\Multi-Tanent\verify_registration.php

[ ] 16. payment_for_application.php
       Location: Multi-Tanent/payment_for_application.php
       Feature: Payment for applications
       Local: C:\xampp\htdocs\Multi-Tanent\payment_for_application.php

[ ] 17. registration_complete.php
       Location: Multi-Tanent/registration_complete.php
       Feature: Success page with credentials
       Local: C:\xampp\htdocs\Multi-Tanent\registration_complete.php

[ ] 18. includes/student_account_creator.php
       Location: Multi-Tanent/includes/student_account_creator.php
       Feature: Auto-create accounts from applications
       Local: C:\xampp\htdocs\Multi-Tanent\includes\student_account_creator.php

[ ] 19. admin/applications/list.php
       Location: Multi-Tanent/admin/applications/list.php
       Feature: View registration applications
       NOTE: Create folder: admin/applications/ first
       Local: C:\xampp\htdocs\Multi-Tanent\admin\applications\list.php

AFTER UPLOADING THESE 6:
  ✓ Students can register themselves
  ✓ Admins can monitor applications
  ✓ Accounts auto-created after payment

================================================================================
📋 SQL SCRIPTS TO RUN (phpMyAdmin)
================================================================================

RUN THESE IN phpMyAdmin BEFORE UPLOADING FILES:

[ ] SQL 1: add_primary_grades.sql
      Creates: Grade 4, 5, 6, 7
      File: database/seeds/add_primary_grades.sql

[ ] SQL 2: primary_school_subjects_g4_g7.sql
      Creates: 48 primary school subjects
      File: database/seeds/primary_school_subjects_g4_g7.sql

[ ] SQL 3: create_school_grades_table.sql
      Creates: school_grades table (for grade selection)
      File: database/migrations/create_school_grades_table.sql

[ ] SQL 4: create_moodle_mapping_table.sql (if using Moodle)
      Creates: Moodle mapping tables
      File: database/migrations/create_moodle_mapping_table.sql

[ ] SQL 5: create_student_applications_table.sql (if enabling self-registration)
      Creates: Application tables
      File: database/migrations/create_student_applications_table.sql

================================================================================
🎯 RECOMMENDED DEPLOYMENT ORDER:
================================================================================

DAY 1: Fix Critical Errors
---------------------------
1. Upload files 1-5 (CRITICAL section)
2. Test all pages work
3. Verify no more errors

DAY 2: Add Core Features
-------------------------
1. Run SQL scripts 1-3
2. Upload files 6-10 (IMPORTANT section)
3. Test grade management
4. Configure grades for your school

DAY 3: Add Moodle (Optional)
-----------------------------
1. Run SQL script 4
2. Upload files 11-13
3. Configure Moodle mappings
4. Test auto-enrollment

DAY 4: Add Self-Registration (Optional)
----------------------------------------
1. Run SQL script 5
2. Upload files 14-19
3. Test registration flow
4. Share URLs with students

================================================================================
CURRENT STATUS:
================================================================================

FIXED AND READY:
  ✓ .htaccess (simplified, no 500 error)
  ✓ Storage dashboards (all function names fixed)
  ✓ Parent portal (session + success message fixed)
  ✓ Configure subjects (grade filtering)
  ✓ Moodle integration (function names fixed)
  ✓ Grade management (individual selection)
  ✓ Self-registration (complete system)
  ✓ Clean URLs (auto-generation + display)

TOTAL FILES READY: 19 PHP files + 5 SQL scripts

WINDOWS EXPLORER: Showing admin/storage/usage.php (one of the fixed files)

================================================================================
QUICK START:
================================================================================

FASTEST WAY TO FIX ERRORS (5 minutes):
  1. Upload files 1-5 (critical fixes)
  2. Test site
  3. Done!

FULL DEPLOYMENT (1 hour):
  1. Run all 5 SQL scripts
  2. Upload all 19 files
  3. Configure grades
  4. Test everything
  5. Share URLs

================================================================================

See: FINAL_DEPLOYMENT_CHECKLIST.txt for complete details!

All files are in: C:\xampp\htdocs\Multi-Tanent\

Ready to upload! 🚀

================================================================================

