====================================================================
SUBJECT ASSIGNMENT BY CLASS - USER GUIDE
====================================================================

NEW FEATURE: Apply Same Subjects to All Groups
====================================================================

This feature allows you to assign the same subjects to ALL active groups 
at once, instead of selecting each group individually.

HOW TO USE:
====================================================================

METHOD 1: Assign to a Single Group (Original Method)
--------------------------------------------------------------------
1. Select Session (optional)
2. Select Class
3. Select a specific Group (e.g., "Commerce")
4. Click "লোড" (Load) button
5. Check the subjects you want to assign
6. Click "সংরক্ষণ করুন" (Save)
   → Subjects will be assigned ONLY to the selected group

METHOD 2: Assign to ALL Groups at Once (NEW!)
--------------------------------------------------------------------
1. Select Session (optional)
2. Select Class
3. You can select any group or leave it blank
4. Click "লোড" (Load) button
5. Check the subjects you want to assign
6. ✓ CHECK the box "সকল গ্রুপে প্রয়োগ করুন" (Apply to All Groups)
7. Click "সংরক্ষণ করুন" (Save)
8. Confirm the action when prompted
   → Subjects will be assigned to ALL active groups (Science, Commerce, Arts, etc.)

EXAMPLE SCENARIOS:
====================================================================

Scenario 1: Common Subjects for All Groups
--------------------------------------------------------------------
You want to assign Bengali, English, Math, Religion to ALL groups:

1. Select Class: "Class 9"
2. Load subjects
3. Check: Bengali, English, Math, Religion
4. ✓ Check "Apply to All Groups"
5. Save
   
Result: All 4 subjects assigned to Science, Commerce, and Arts groups

Scenario 2: Group-Specific Subjects
--------------------------------------------------------------------
You want different subjects for each group:

For Commerce Group:
1. Select Class: "Class 9", Group: "Commerce"
2. Check: Accounting, Business Studies
3. DON'T check "Apply to All Groups"
4. Save

For Science Group:
1. Select Class: "Class 9", Group: "Science"  
2. Check: Physics, Chemistry, Biology
3. DON'T check "Apply to All Groups"
4. Save

Scenario 3: Mixed Assignment
--------------------------------------------------------------------
First, assign common subjects to all:
1. Select Class: "Class 9"
2. Check: Bengali, English, Math
3. ✓ Check "Apply to All Groups"
4. Save

Then, add group-specific subjects:
1. Select Group: "Science"
2. Load (shows Bengali, English, Math already checked)
3. Additionally check: Physics, Chemistry
4. DON'T check "Apply to All Groups"
5. Save
   
Result: 
- Science group: Bengali, English, Math, Physics, Chemistry
- Other groups: Bengali, English, Math only

IMPORTANT NOTES:
====================================================================
⚠ Warning: When you check "Apply to All Groups", it will REPLACE 
   the existing subject assignments for ALL groups in that class.

✓ The system now supports duplicate subjects across different groups.
  The same subject can exist in multiple groups simultaneously.

✓ Make sure your database has the group_name column in the 
  class_subjects table for this feature to work properly.

DATABASE REQUIREMENT:
====================================================================
If you see a warning about missing group_name column, run this SQL:

ALTER TABLE class_subjects ADD COLUMN group_name VARCHAR(100) DEFAULT NULL;
ALTER TABLE class_subjects ADD UNIQUE KEY unique_class_subject_group 
  (class_id, subject_id, group_name);

====================================================================
For questions or issues, contact your system administrator.
====================================================================