================================================================================
  INDIVIDUAL GRADE SELECTION - DEPLOYMENT CHECKLIST
================================================================================

WHAT YOU'RE DEPLOYING:
----------------------
✓ Admin can individually select which grades their school offers
✓ Each school has independent grade configuration
✓ Visual selection interface with clickable cards
✓ Works with both primary (Grade 4-7) and secondary (Form 1-5)

================================================================================
STEP 1: RUN 3 SQL SCRIPTS IN phpMyAdmin
================================================================================

Login: https://test.melanegroup.com:2083/phpMyAdmin
Database: melane_multi_tenant_skoloi

SQL 1: CREATE school_grades TABLE
----------------------------------
File: database/migrations/create_school_grades_table.sql

Open file, copy ALL contents, paste in SQL tab, click Go

Expected: "Table school_grades created successfully"


SQL 2: ADD PRIMARY GRADES
--------------------------
File: database/seeds/add_primary_grades.sql

Copy contents:
INSERT IGNORE INTO grades (name) VALUES
('Grade 4'), ('Grade 5'), ('Grade 6'), ('Grade 7');

Paste in SQL tab, click Go

Expected: "4 rows inserted" (or "0 rows" if already exist - that's OK!)


SQL 3: ADD PRIMARY SUBJECTS
----------------------------
File: database/seeds/primary_school_subjects_g4_g7.sql

Copy ALL contents, paste in SQL tab, click Go

Expected:
- 11 rows inserted (Grade 4)
- 12 rows inserted (Grade 5)
- 13 rows inserted (Grade 6)
- 12 rows inserted (Grade 7)
- Grade links created

Total: 48 subjects!

================================================================================
STEP 2: UPLOAD 2 PHP FILES TO cPANEL
================================================================================

cPanel File Manager: Multi-Tanent/admin/

FILE 1: manage_grades.php (NEW)
--------------------------------
Local: C:\xampp\htdocs\Multi-Tanent\admin\manage_grades.php
Upload to: public_html/test.melanegroup.com/Multi-Tanent/admin/

This is the NEW interface where admin selects grades


FILE 2: configure_subjects.php (UPDATED)
-----------------------------------------
Local: C:\xampp\htdocs\Multi-Tanent\admin\configure_subjects.php  
Upload to: public_html/test.melanegroup.com/Multi-Tanent/admin/
Action: Delete old file first, then upload new

This now filters to show ONLY selected grades

================================================================================
STEP 3: TEST THE NEW FEATURE
================================================================================

3.1. SELECT YOUR GRADES
------------------------
Go to: https://test.melanegroup.com/Multi-Tanent/admin/manage_grades.php

You'll see two sections:

PRIMARY SCHOOL GRADES (Green):
[ ] Grade 4
[ ] Grade 5
[ ] Grade 6
[ ] Grade 7

SECONDARY SCHOOL GRADES (Blue):
[ ] Form 1
[ ] Form 2
[ ] Form 3
[ ] Form 4
[ ] Form 5

SELECT THE GRADES YOUR SCHOOL OFFERS:

Example 1 - Secondary only school:
  ✓ Form 1, Form 2, Form 3, Form 4, Form 5

Example 2 - Primary only school:
  ✓ Grade 4, Grade 5, Grade 6, Grade 7

Example 3 - Combined school:
  ✓ Grade 6, Grade 7, Form 1, Form 2, Form 3

Click: Save Configuration


3.2. VERIFY IN CONFIGURE SUBJECTS
----------------------------------
Go to: https://test.melanegroup.com/Multi-Tanent/admin/configure_subjects.php

Should see:
- ✓ ONLY the grades you selected
- ✓ "X grade(s) enabled" message
- ✓ Link to "Change Grades"
- ✓ Color-coded (green = primary, blue = secondary)


3.3. CONFIGURE SUBJECTS
------------------------
For each visible grade:
- Click on grade card
- Select subjects
- Click "Update Subjects"
- Save successful!


3.4. TEST PARENT EXPERIENCE
----------------------------
Login as parent

Make payment for student

Should see subjects ONLY from grades you enabled

Perfect filtering!

================================================================================
EXPECTED USER INTERFACE:
================================================================================

MANAGE GRADES PAGE:
-------------------
┌────────────────────────────────────────────────────┐
│ 📊 Manage School Grades                            │
│ Select which grades your school offers             │
├────────────────────────────────────────────────────┤
│ St. Mary's High School [KINE]                      │
├────────────────────────────────────────────────────┤
│                                                     │
│ 📗 PRIMARY SCHOOL GRADES (GRADE 4-7)               │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────┐│
│ │☑ Grade 4 │ │☑ Grade 5 │ │☐ Grade 6 │ │☑ Grade 7││
│ │  Active  │ │  Active  │ │          │ │ Active  ││
│ └──────────┘ └──────────┘ └──────────┘ └─────────┘│
│                                                     │
│ 🎓 SECONDARY SCHOOL GRADES (FORM 1-5)              │
│ ┌────────┐ ┌────────┐ ┌────────┐ ┌────────┐      │
│ │☑ Form 1│ │☑ Form 2│ │☑ Form 3│ │☐ Form 4│      │
│ │ Active │ │ Active │ │ Active │ │        │      │
│ └────────┘ └────────┘ └────────┘ └────────┘      │
│                                                     │
│ Selected: 6 grade(s)                               │
│ [Select All] [Clear All] [Save Configuration]     │
└────────────────────────────────────────────────────┘


CONFIGURE SUBJECTS PAGE (After Selection):
-------------------------------------------
┌────────────────────────────────────────────────────┐
│ ℹ️ Active Grades: 6 grade(s) enabled              │
│                              [Change Grades]       │
├────────────────────────────────────────────────────┤
│                                                     │
│ ┌─────────┐ ┌─────────┐ ┌─────────┐              │
│ │ Grade 4 │ │ Grade 5 │ │ Grade 7 │              │
│ │ (Green) │ │ (Green) │ │ (Green) │              │
│ └─────────┘ └─────────┘ └─────────┘              │
│                                                     │
│ ┌────────┐ ┌────────┐ ┌────────┐                 │
│ │ Form 1 │ │ Form 2 │ │ Form 3 │                 │
│ │ (Blue) │ │ (Blue) │ │ (Blue) │                 │
│ └────────┘ └────────┘ └────────┘                 │
│                                                     │
│ (Only selected grades visible!)                    │
└────────────────────────────────────────────────────┘

================================================================================
WHAT EACH SCHOOL CAN DO:
================================================================================

SCENARIO 1: Primary School
---------------------------
Enable: Grade 4, 5, 6, 7
Result: Only see these 4 grades
Benefit: Clean, focused interface


SCENARIO 2: Secondary School  
-----------------------------
Enable: Form 1, 2, 3, 4, 5
Result: Only see these 5 grades
Benefit: No clutter from primary grades


SCENARIO 3: Junior High
------------------------
Enable: Grade 7, Form 1, 2
Result: Only see these 3 grades
Benefit: Exactly match school structure


SCENARIO 4: Full Combined
--------------------------
Enable: All (Grade 4-7, Form 1-5)
Result: See all 9 grades
Benefit: Maximum flexibility

================================================================================
MULTI-SCHOOL EXAMPLE:
================================================================================

DATABASE STATE:

school_grades table:
academy_reference | grade_id | Grade Name | is_active
------------------|----------|------------|----------
KINE              | 7        | Grade 7    | 1
KINE              | 8        | Form 1     | 1
KINE              | 9        | Form 2     | 1

SCH002            | 4        | Grade 4    | 1
SCH002            | 5        | Grade 5    | 1
SCH002            | 6        | Grade 6    | 1
SCH002            | 7        | Grade 7    | 1

RESULT:
- KINE admin sees: Grade 7, Form 1, Form 2
- SCH002 admin sees: Grade 4, 5, 6, 7
- Complete isolation!

================================================================================
DEPLOYMENT CHECKLIST:
================================================================================

[ ] Step 1: Run create_school_grades_table.sql
[ ] Step 2: Run add_primary_grades.sql
[ ] Step 3: Run primary_school_subjects_g4_g7.sql
[ ] Step 4: Upload admin/manage_grades.php
[ ] Step 5: Upload admin/configure_subjects.php
[ ] Step 6: Test: Visit manage_grades.php
[ ] Step 7: Select grades for your school
[ ] Step 8: Save configuration
[ ] Step 9: Verify: configure_subjects.php shows only selected
[ ] Step 10: Configure subjects for each grade
[ ] Step 11: Test: Parent payment shows correct subjects
[ ] Step 12: Test: Student registration shows correct grades

================================================================================
FILES READY:
================================================================================

SQL SCRIPTS:
1. database/migrations/create_school_grades_table.sql
2. database/seeds/add_primary_grades.sql
3. database/seeds/primary_school_subjects_g4_g7.sql

PHP FILES:
4. admin/manage_grades.php (NEW)
5. admin/configure_subjects.php (UPDATED)

DOCUMENTATION:
6. INDIVIDUAL_GRADE_SELECTION_COMPLETE.md (complete guide)
7. DEPLOY_INDIVIDUAL_GRADES.txt (this file)

Windows Explorer showing manage_grades.php!

================================================================================
QUICK URLS:
================================================================================

Select Grades:
https://test.melanegroup.com/Multi-Tanent/admin/manage_grades.php

Configure Subjects:
https://test.melanegroup.com/Multi-Tanent/admin/configure_subjects.php

Test Moodle Mappings:
https://test.melanegroup.com/Multi-Tanent/admin/moodle/test_mappings.php

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

Your admins can now individually select exactly which grades they want! 🎉

Much more flexible than simple primary/secondary toggle!

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

