/**
* Saadhanam Registration - Education Level Cascade
* Flow: State → Language → Education Level → Goal → Stream → Exam
* Version: 4.0.0 — Comprehensive (all 137 exams, all states)
*/
let currentState = null;
let currentLanguage = null;
let currentEducationLevel = null;
let currentGoal = null;
let currentFieldValue = null;
// ── GOAL MAP ────────────────────────────────────────────────────────────────
// Education Level → list of Goals (with emoji, label)
const GOAL_MAP = {
OLYMPIADS: [
{ code: 'OLYMPIAD', emoji: '🏆', label: 'Olympiad (IMO / NSO / NCO / IEO)' },
{ code: 'SCHOLARSHIP', emoji: '🎓', label: 'Scholarship (NTSE / NMMS)' },
],
SCHOOL_LEVEL: [
{ code: 'NAVODAYA', emoji: '🏫', label: 'Navodaya Vidyalaya (JNVST)' },
{ code: 'SAINIK_SCH', emoji: '🎖️', label: 'Sainik School Entrance' },
],
AFTER_10TH: [
{ code: 'POLYTECHNIC', emoji: '🔧', label: 'Polytechnic / Diploma' },
{ code: 'ITI', emoji: '⚙️', label: 'ITI / Vocational' },
{ code: 'RESIDENTIAL_SCH',emoji: '🏫', label: 'Residential / Welfare Schools' },
{ code: 'RECRUITMENT_10', emoji: '🚂', label: 'Recruitment (Railway / Govt)' },
{ code: 'DEFENCE_10', emoji: '🎖️', label: 'Defence (Sainik / NDA Foundation)' },
],
DIPLOMA_PASSED: [
{ code: 'LATERAL_ENTRY', emoji: '🎓', label: 'Lateral Entry to B.Tech (2nd Year)' },
],
AFTER_12TH: [
{ code: 'ENGINEERING', emoji: '👨💻', label: 'Engineering / Technology' },
{ code: 'MEDICAL', emoji: '⚕️', label: 'Medical / MBBS / BDS' },
{ code: 'PHARMACY', emoji: '💊', label: 'Pharmacy (B.Pharm)' },
{ code: 'DEFENCE', emoji: '🎖️', label: 'Defence / NDA / Agniveer' },
{ code: 'LAW', emoji: '⚖️', label: 'Law / LLB' },
{ code: 'DESIGN', emoji: '🎨', label: 'Design / Architecture / Fashion' },
{ code: 'FINANCE', emoji: '📊', label: 'CA / Finance / Commerce' },
{ code: 'RESEARCH', emoji: '🔬', label: 'Research / Pure Science' },
{ code: 'AGRICULTURE', emoji: '🌾', label: 'Agriculture / Veterinary' },
{ code: 'HOTEL_MGMT', emoji: '🏨', label: 'Hotel Management' },
{ code: 'INTEGRATED_MBA', emoji: '📈', label: 'Integrated MBA (5 Year)' },
{ code: 'TEACHER_12', emoji: '📖', label: 'Teacher Training (D.El.Ed)' },
{ code: 'RECRUITMENT_12', emoji: '👮', label: 'Police / Govt Jobs' },
],
UG_PASSED: [
{ code: 'MANAGEMENT', emoji: '💼', label: 'MBA / Management (CAT/XAT/MAT)' },
{ code: 'PG_ENGINEERING', emoji: '⚙️', label: 'M.Tech / GATE' },
{ code: 'MEDICAL_PG', emoji: '⚕️', label: 'NEET PG / Medical Postgraduate' },
{ code: 'MCA_PG', emoji: '💻', label: 'MCA (NIMCET / ICET)' },
{ code: 'LAW_PG', emoji: '⚖️', label: 'LLM / Law PG' },
{ code: 'CIVIL_SERVICES', emoji: '🏛️', label: 'Civil Services / UPSC / PSC' },
{ code: 'TEACHING_PG', emoji: '📖', label: 'B.Ed / Teacher Training' },
],
AFTER_GRADUATION: [
{ code: 'UGC_NET', emoji: '🎓', label: 'UGC NET (Lectureship / JRF)' },
{ code: 'CSIR_NET', emoji: '🔬', label: 'CSIR NET (Science / Engineering)' },
{ code: 'PHD_ENTRANCE', emoji: '📖', label: 'PhD Entrance (University)' },
{ code: 'FELLOWSHIP', emoji: '🏅', label: 'Research Fellowship (DST/DBT/ICMR)' },
],
};
// ── STREAM MAP ───────────────────────────────────────────────────────────────
// Goal → list of Streams (subjects/specialization) — null means no stream needed
const STREAM_MAP = {
// Olympiads
OLYMPIAD: null,
SCHOLARSHIP: null,
// School Level
NAVODAYA: null,
SAINIK_SCH: null,
// After 10th
POLYTECHNIC: null,
ITI: null,
RESIDENTIAL_SCH: null,
RECRUITMENT_10: null,
DEFENCE_10: null,
// After 12th (no stream)
TEACHER_12: null,
RECRUITMENT_12: null,
// Diploma Passed
LATERAL_ENTRY: null,
// After 12th - Engineering streams
ENGINEERING: [
{ code: 'PCM', emoji: '📢', label: 'PCM (Physics, Chemistry, Maths)' },
{ code: 'PCMB', emoji: '🧬', label: 'PCMB (All four subjects)' },
{ code: 'CS', emoji: '💻', label: 'Computer Science / IT' },
],
MEDICAL: [
{ code: 'PCB', emoji: '🧬', label: 'PCB (Physics, Chemistry, Biology)' },
{ code: 'PCMB', emoji: '🔬', label: 'PCMB (All four subjects)' },
],
PHARMACY: null,
DEFENCE: null,
LAW: null,
DESIGN: [
{ code: 'FINE_ARTS', emoji: '🎨', label: 'Fine Arts / Drawing' },
{ code: 'SCIENCE_DES', emoji: '📐', label: 'Science Background' },
{ code: 'ANY_DES', emoji: '✏️', label: 'Any Stream' },
],
FINANCE: null,
RESEARCH: [
{ code: 'PCM', emoji: '📢', label: 'Physics / Chemistry / Maths' },
{ code: 'PCB', emoji: '🧬', label: 'Biology / Life Sciences' },
],
AGRICULTURE: null,
HOTEL_MGMT: null,
INTEGRATED_MBA: null,
TEACHER_12: null,
RECRUITMENT_12: null,
OTHER_12: null,
// UG Passed
PG_ENGINEERING: [
{ code: 'CIVIL', emoji: '🏗️', label: 'Civil Engineering' },
{ code: 'MECH', emoji: '⚙️', label: 'Mechanical Engineering' },
{ code: 'ECE', emoji: '📡', label: 'Electronics / ECE' },
{ code: 'CSE', emoji: '💻', label: 'Computer Science / IT' },
{ code: 'EEE', emoji: '⚡', label: 'Electrical Engineering' },
{ code: 'CHEM', emoji: '🧪', label: 'Chemical Engineering' },
],
MANAGEMENT: [
{ code: 'GENERAL_MBA', emoji: '💼', label: 'General MBA' },
{ code: 'FINANCE_MBA', emoji: '📊', label: 'Finance / Banking' },
{ code: 'TECH_MBA', emoji: '💻', label: 'Tech / IT Management' },
],
MEDICAL_PG: null,
MCA_PG: null,
LAW_PG: null,
CIVIL_SERVICES: null,
TEACHING_PG: null,
// PG Passed
UGC_NET: [
{ code: 'HUMANITIES', emoji: '📚', label: 'Humanities / Social Sciences' },
{ code: 'COMMERCE', emoji: '💼', label: 'Commerce / Management' },
{ code: 'SCIENCES', emoji: '🔬', label: 'Sciences' },
{ code: 'CS_IT', emoji: '💻', label: 'Computer Science / IT' },
{ code: 'EDUCATION', emoji: '🎓', label: 'Education' },
],
CSIR_NET: [
{ code: 'LIFE_SCI', emoji: '🧬', label: 'Life Sciences' },
{ code: 'CHEM_SCI', emoji: '🧪', label: 'Chemical Sciences' },
{ code: 'PHY_SCI', emoji: '⚛️', label: 'Physical Sciences' },
{ code: 'MATH_SCI', emoji: '📐', label: 'Mathematical Sciences' },
{ code: 'EARTH_SCI', emoji: '🌍', label: 'Earth Sciences' },
],
PHD_ENTRANCE: null,
FELLOWSHIP: null,
};
// ── EXAM MAP ─────────────────────────────────────────────────────────────────
// Goal + Stream + State → filtered exam list
function getExamsForGoalStream(goal, stream, state) {
const S = state || '';
const G = goal || '';
const ST = stream || '';
// ── School Level ─────────────────────────────────────────────────────────
if (G === 'NAVODAYA') {
return [
{ exam_code: 'JNVST_6', exam_name: 'Navodaya Class 6 (JNVST)', is_national: true },
{ exam_code: 'JNVST_9', exam_name: 'Navodaya Class 9 (JNVST)', is_national: true },
];
}
if (G === 'SAINIK_SCH') {
return [
{ exam_code: 'SAINIK_6', exam_name: 'Sainik School Class 6', is_national: true },
{ exam_code: 'SAINIK_9', exam_name: 'Sainik School Class 9', is_national: true },
];
}
// ── Olympiads ─────────────────────────────────────────────────────────────
if (G === 'OLYMPIAD') {
return [
{ exam_code: 'IMO', exam_name: 'International Mathematics Olympiad', is_national: true },
{ exam_code: 'NSO', exam_name: 'National Science Olympiad', is_national: true },
{ exam_code: 'NCO', exam_name: 'National Cyber Olympiad', is_national: true },
{ exam_code: 'IEO', exam_name: 'International English Olympiad', is_national: true },
{ exam_code: 'IGKO', exam_name: 'International General Knowledge Olympiad', is_national: true },
];
}
if (G === 'SCHOLARSHIP') {
return [
{ exam_code: 'NTSE', exam_name: 'NTSE (National Talent Search)', is_national: true },
{ exam_code: 'NMMS', exam_name: 'NMMS Scholarship', is_national: true },
];
}
// ── After 10th ────────────────────────────────────────────────────────────
if (G === 'POLYTECHNIC') {
const stateExams = {
TG: [
{ exam_code: 'TS_POLYCET', exam_name: 'TS POLYCET (MPC) — Engineering', is_national: false, state_name: 'Telangana', exam_stream: 'MPC', stream_desc: 'Maths + Physics + Chemistry (120 questions)' },
{ exam_code: 'TS_POLYCET', exam_name: 'TS POLYCET (MBiPC) — Agriculture/Veterinary', is_national: false, state_name: 'Telangana', exam_stream: 'MBiPC', stream_desc: 'Maths + Physics + Chemistry + Biology (150 questions)' },
],
AP: [{ exam_code: 'AP_POLYCET', exam_name: 'AP POLYCET', is_national: false, state_name: 'Andhra Pradesh' }],
AS: [{ exam_code: 'AS_PAT', exam_name: 'Assam PAT Polytechnic', is_national: false, state_name: 'Assam' }],
BR: [{ exam_code: 'BR_DCECE', exam_name: 'Bihar DCECE Polytechnic', is_national: false, state_name: 'Bihar' }],
CG: [{ exam_code: 'CG_PPT', exam_name: 'CG PPT Polytechnic', is_national: false, state_name: 'Chhattisgarh' }],
HP: [{ exam_code: 'HP_PAT', exam_name: 'HP PAT Polytechnic', is_national: false, state_name: 'Himachal Pradesh' }],
JH: [{ exam_code: 'JH_PECE', exam_name: 'Jharkhand PECE', is_national: false, state_name: 'Jharkhand' }],
KA: [{ exam_code: 'KA_DCET', exam_name: 'Karnataka DCET', is_national: false, state_name: 'Karnataka' }],
MP: [{ exam_code: 'MP_PPT', exam_name: 'MP PPT Polytechnic', is_national: false, state_name: 'Madhya Pradesh' }],
NE: [{ exam_code: 'NE_POLY', exam_name: 'NE Polytechnic', is_national: false, state_name: 'North East' }],
PB: [{ exam_code: 'PB_POLYCET', exam_name: 'Punjab POLYCET', is_national: false, state_name: 'Punjab' }],
UP: [{ exam_code: 'UP_JEECUP', exam_name: 'UP JEECUP Polytechnic', is_national: false, state_name: 'Uttar Pradesh' }],
WB: [{ exam_code: 'WB_JEXPO', exam_name: 'WB JEXPO Polytechnic', is_national: false, state_name: 'West Bengal' }],
};
return [...(stateExams[S] || [])];
}
if (G === 'ITI') {
const stateExams = {
TG: [{ exam_code: 'ITI_TG', exam_name: 'ITI Entrance Telangana', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'ITI_AP', exam_name: 'ITI Entrance AP', is_national: false, state_name: 'Andhra Pradesh' }],
};
const national = [
{ exam_code: 'ITI_NCVT', exam_name: 'NCVT ITI (National)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'RESIDENTIAL_SCH') {
const stateExams = {
TG: [
{ exam_code: 'TSRJC', exam_name: 'TSRJC CET', is_national: false, state_name: 'Telangana' },
{ exam_code: 'TSSWREIS', exam_name: 'TS Social Welfare RJC',is_national: false, state_name: 'Telangana' },
{ exam_code: 'MJPBCWREIS', exam_name: 'TS BC Welfare RJC', is_national: false, state_name: 'Telangana' },
{ exam_code: 'TTWREIS', exam_name: 'TS Tribal Welfare RJC',is_national: false, state_name: 'Telangana' },
],
AP: [
{ exam_code: 'APRJC', exam_name: 'APRJC CET', is_national: false, state_name: 'Andhra Pradesh' },
{ exam_code: 'APSWREIS', exam_name: 'AP Social Welfare RJC', is_national: false, state_name: 'Andhra Pradesh' },
],
};
}
if (G === 'RECRUITMENT_10') {
return [
{ exam_code: 'RRB_GRP_D', exam_name: 'Railway Group D', is_national: true },
];
}
if (G === 'DEFENCE_10') {
return [
{ exam_code: 'SAINIK_6', exam_name: 'Sainik School Entrance', is_national: true },
{ exam_code: 'SAINIK_9', exam_name: 'Sainik School Entrance (Class 9)', is_national: true },
];
}
if (G === 'PARAMEDICAL') {
const stateExams = {
};
const national = [
];
return [...(stateExams[S] || []), ...national];
}
// ── Diploma Passed ────────────────────────────────────────────────────────
if (G === 'LATERAL_ENTRY') {
const stateExams = {
TG: [{ exam_code: 'TG_ECET', exam_name: 'Telangana ECET', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_ECET', exam_name: 'AP ECET', is_national: false, state_name: 'Andhra Pradesh' }],
KA: [{ exam_code: 'KA_DCET', exam_name: 'Karnataka DCET', is_national: false, state_name: 'Karnataka' }],
MH: [{ exam_code: 'MH_CET_LE', exam_name: 'Maharashtra CET Lateral Entry', is_national: false, state_name: 'Maharashtra' }],
DL: [{ exam_code: 'DL_CET_LE', exam_name: 'Delhi CET Lateral Entry', is_national: false, state_name: 'Delhi' }],
GJ: [{ exam_code: 'GJ_LEET', exam_name: 'Gujarat LEET', is_national: false, state_name: 'Gujarat' }],
PB: [{ exam_code: 'PB_LEET', exam_name: 'Punjab LEET', is_national: false, state_name: 'Punjab' }],
RJ: [{ exam_code: 'RJ_LEET', exam_name: 'Rajasthan LEET', is_national: false, state_name: 'Rajasthan' }],
UP: [{ exam_code: 'UP_LEET', exam_name: 'UP Lateral Entry', is_national: false, state_name: 'Uttar Pradesh' }],
WB: [{ exam_code: 'WB_JELET', exam_name: 'WB JELET', is_national: false, state_name: 'West Bengal' }],
};
}
// ── After 12th ────────────────────────────────────────────────────────────
if (G === 'ENGINEERING') {
const stateExams = {
TG: [{ exam_code: 'TS_EAMCET', exam_name: 'TS EAMCET', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_EAMCET', exam_name: 'AP EAMCET', is_national: false, state_name: 'Andhra Pradesh' }],
AS: [{ exam_code: 'AS_CEE', exam_name: 'Assam CEE', is_national: false, state_name: 'Assam' }],
BR: [{ exam_code: 'BCECE', exam_name: 'Bihar BCECE', is_national: false, state_name: 'Bihar' }],
GJ: [{ exam_code: 'GUJCET', exam_name: 'GUJCET', is_national: false, state_name: 'Gujarat' }],
KA: [
{ exam_code: 'KCET', exam_name: 'Karnataka CET (KCET)', is_national: false, state_name: 'Karnataka' },
{ exam_code: 'COMEDK', exam_name: 'COMEDK (Private Colleges)', is_national: false, state_name: 'Karnataka' },
{ exam_code: 'MANIPAL_MET', exam_name: 'Manipal Engineering Test', is_national: false, state_name: 'Karnataka' },
],
KL: [{ exam_code: 'KEAM', exam_name: 'Kerala KEAM', is_national: false, state_name: 'Kerala' }],
MH: [{ exam_code: 'MHT_CET', exam_name: 'MHT CET', is_national: false, state_name: 'Maharashtra' }],
OD: [{ exam_code: 'OJEE', exam_name: 'Odisha JEE', is_national: false, state_name: 'Odisha' }],
TN: [{ exam_code: 'TNEA', exam_name: 'TN Engineering Admissions', is_national: false, state_name: 'Tamil Nadu' }],
UP: [{ exam_code: 'UPSEE', exam_name: 'UPSEE / AKTU', is_national: false, state_name: 'Uttar Pradesh' }],
WB: [{ exam_code: 'WBJEE', exam_name: 'WBJEE', is_national: false, state_name: 'West Bengal' }],
};
const national = [
{ exam_code: 'JEE_MAIN', exam_name: 'JEE Main', is_national: true },
{ exam_code: 'JEE_ADVANCED', exam_name: 'JEE Advanced (IIT)', is_national: true },
{ exam_code: 'BITSAT', exam_name: 'BITSAT (BITS Pilani)', is_national: true },
{ exam_code: 'VITEEE', exam_name: 'VITEEE (VIT)', is_national: true },
{ exam_code: 'SRMJEEE', exam_name: 'SRMJEEE (SRM)', is_national: true },
{ exam_code: 'CUET_UG', exam_name: 'CUET UG (Central Universities)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'MEDICAL') {
const stateExams = {
TG: [{ exam_code: 'TS_EAMCET', exam_name: 'TS EAMCET (Medical)', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_EAMCET', exam_name: 'AP EAMCET (Medical)', is_national: false, state_name: 'Andhra Pradesh' }],
KA: [{ exam_code: 'KCET', exam_name: 'KCET (Medical)', is_national: false, state_name: 'Karnataka' }],
};
const national = [
{ exam_code: 'NEET_UG', exam_name: 'NEET UG (MBBS/BDS)', is_national: true },
{ exam_code: 'AIIMS', exam_name: 'AIIMS UG', is_national: true },
{ exam_code: 'JIPMER', exam_name: 'JIPMER MBBS', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'PHARMACY') {
const stateExams = {
TG: [{ exam_code: 'TS_PHARCET', exam_name: 'TS Pharmacy CET', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_PHARCET', exam_name: 'AP Pharmacy CET', is_national: false, state_name: 'Andhra Pradesh' }],
KA: [{ exam_code: 'KA_PHARCET', exam_name: 'KA Pharmacy CET', is_national: false, state_name: 'Karnataka' }],
MH: [{ exam_code: 'MH_PHARCET', exam_name: 'MH Pharmacy CET', is_national: false, state_name: 'Maharashtra' }],
TN: [{ exam_code: 'TN_PHARCET', exam_name: 'TN Pharmacy CET', is_national: false, state_name: 'Tamil Nadu' }],
};
const national = [
{ exam_code: 'NEET_UG', exam_name: 'NEET UG (also for Pharmacy)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'DEFENCE') {
return [
{ exam_code: 'NDA', exam_name: 'NDA (Army/Navy/Air Force)', is_national: true },
{ exam_code: 'NDA_1', exam_name: 'NDA Exam 1', is_national: true },
{ exam_code: 'NDA_2', exam_name: 'NDA Exam 2', is_national: true },
{ exam_code: 'AGNIVEER', exam_name: 'Agniveer (Army/Navy/AF)', is_national: true },
];
}
if (G === 'LAW') {
const stateExams = {
TG: [{ exam_code: 'TS_LAWCET', exam_name: 'Telangana LAWCET', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_LAWCET', exam_name: 'AP LAWCET', is_national: false, state_name: 'Andhra Pradesh' }],
MH: [
{ exam_code: 'MH_CET_LAW', exam_name: 'MH CET Law', is_national: false, state_name: 'Maharashtra' },
{ exam_code: 'SLAT', exam_name: 'Symbiosis Law (SLAT)', is_national: false, state_name: 'Maharashtra' },
],
DL: [
{ exam_code: 'AILET', exam_name: 'AILET (NLU Delhi)', is_national: false, state_name: 'Delhi' },
{ exam_code: 'DU_LLB', exam_name: 'Delhi University LLB', is_national: false, state_name: 'Delhi' },
],
};
const national = [
{ exam_code: 'CLAT', exam_name: 'CLAT (NLUs)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'DESIGN') {
const stateExams = {
DL: [{ exam_code: 'PEARL', exam_name: 'Pearl Academy Entrance', is_national: false, state_name: 'Delhi' }],
};
const national = [
{ exam_code: 'NID_DAT', exam_name: 'NID (National Institute of Design)', is_national: true },
{ exam_code: 'NIFT', exam_name: 'NIFT Entrance', is_national: true },
{ exam_code: 'UCEED', exam_name: 'UCEED (IIT B.Des)', is_national: true },
{ exam_code: 'AIEED', exam_name: 'All India Entrance Exam Design', is_national: true },
{ exam_code: 'NATA', exam_name: 'NATA (Architecture)', is_national: true },
{ exam_code: 'JEE_BARCH',exam_name: 'JEE Paper 2 (B.Arch)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'FINANCE') {
return [
{ exam_code: 'CA_FOUNDATION', exam_name: 'CA Foundation (ICAI)', is_national: true },
{ exam_code: 'CA_FOUNDATION_MAY', exam_name: 'CA Foundation - May Sitting', is_national: true },
{ exam_code: 'CA_FOUNDATION_NOV', exam_name: 'CA Foundation - November Sitting', is_national: true },
];
}
if (G === 'RESEARCH') {
return [
{ exam_code: 'IISER_IAT', exam_name: 'IISER Aptitude Test', is_national: true },
{ exam_code: 'NEST', exam_name: 'NEST (NISER/CBS)', is_national: true },
{ exam_code: 'CUET_UG', exam_name: 'CUET UG (Science)', is_national: true },
];
}
if (G === 'AGRICULTURE') {
const stateExams = {
TG: [{ exam_code: 'TS_EAMCET', exam_name: 'TS EAMCET (Agriculture)', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_EAMCET', exam_name: 'AP EAMCET (Agriculture)', is_national: false, state_name: 'Andhra Pradesh' }],
};
const national = [
{ exam_code: 'ICAR_AIEEA_UG', exam_name: 'ICAR AIEEA UG (Agriculture)', is_national: true },
{ exam_code: 'CUET_UG', exam_name: 'CUET UG (Agriculture)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'HOTEL_MGMT') {
return [
{ exam_code: 'NCHMCT_JEE', exam_name: 'NCHMCT JEE (IHMs)', is_national: true },
];
}
if (G === 'INTEGRATED_MBA') {
const stateExams = {
DL: [{ exam_code: 'DU_JAT', exam_name: 'Delhi University BBA/BMS', is_national: false, state_name: 'Delhi' }],
MH: [
{ exam_code: 'NPAT', exam_name: 'NMIMS NPAT', is_national: false, state_name: 'Maharashtra' },
{ exam_code: 'SET', exam_name: 'Symbiosis SET', is_national: false, state_name: 'Maharashtra' },
],
MP: [{ exam_code: 'IPMAT', exam_name: 'IIM Indore IPMAT', is_national: false, state_name: 'Madhya Pradesh' }],
};
const national = [
{ exam_code: 'JIPMAT', exam_name: 'JIPMAT (IIM Jammu/Bodhgaya)', is_national: true },
{ exam_code: 'IPMAT', exam_name: 'IIM Indore IPMAT', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'TEACHER_12') {
const stateExams = {
TG: [{ exam_code: 'DELED_TG', exam_name: 'D.El.Ed CET Telangana', is_national: false, state_name: 'Telangana' }],
};
}
if (G === 'RECRUITMENT_12') {
const stateExams = {
TG: [{ exam_code: 'TS_POLICE', exam_name: 'TS Police Constable', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_POLICE', exam_name: 'AP Police Constable', is_national: false, state_name: 'Andhra Pradesh' }],
};
const national = [
{ exam_code: 'AGNIVEER', exam_name: 'Agniveer (Army/Navy/AF)', is_national: true },
{ exam_code: 'SSC_CHSL', exam_name: 'SSC CHSL', is_national: true },
{ exam_code: 'RRB_GRP_D',exam_name: 'Railway Group D', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
// ── UG Passed ─────────────────────────────────────────────────────────────
if (G === 'MANAGEMENT') {
const stateExams = {
TG: [{ exam_code: 'TG_ICET', exam_name: 'TG ICET (MBA/MCA)', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_ICET', exam_name: 'AP ICET (MBA/MCA)', is_national: false, state_name: 'Andhra Pradesh' }],
KA: [{ exam_code: 'KA_PGCET', exam_name: 'Karnataka PGCET (MBA)', is_national: false, state_name: 'Karnataka' }],
MH: [{ exam_code: 'MH_MBA_CET', exam_name: 'MH MBA CET', is_national: false, state_name: 'Maharashtra' }],
TN: [{ exam_code: 'TN_TANCET', exam_name: 'TN TANCET', is_national: false, state_name: 'Tamil Nadu' }],
UP: [{ exam_code: 'UP_SEE', exam_name: 'UP SEE (MBA)', is_national: false, state_name: 'Uttar Pradesh' }],
};
const national = [
{ exam_code: 'CAT', exam_name: 'CAT (IIMs)', is_national: true },
{ exam_code: 'XAT', exam_name: 'XAT (XLRI)', is_national: true },
{ exam_code: 'MAT', exam_name: 'MAT', is_national: true },
{ exam_code: 'CMAT', exam_name: 'CMAT', is_national: true },
{ exam_code: 'SNAP', exam_name: 'SNAP (Symbiosis)', is_national: true },
{ exam_code: 'NMAT', exam_name: 'NMAT (NMIMS)', is_national: true },
{ exam_code: 'ATMA', exam_name: 'ATMA', is_national: true },
{ exam_code: 'IBSAT', exam_name: 'IBSAT (ICFAI)', is_national: true },
{ exam_code: 'IIFT', exam_name: 'IIFT MBA', is_national: true },
{ exam_code: 'MICAT', exam_name: 'MICAT (MICA)', is_national: true },
{ exam_code: 'TISSNET', exam_name: 'TISSNET (TISS)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'PG_ENGINEERING') {
const stateExams = {
KA: [{ exam_code: 'KA_PGCET', exam_name: 'Karnataka PGCET (M.Tech)', is_national: false, state_name: 'Karnataka' }],
};
const national = [
{ exam_code: 'GATE', exam_name: 'GATE', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'MEDICAL_PG') {
const stateExams = {
KA: [{ exam_code: 'KA_PGET', exam_name: 'Karnataka PGET', is_national: false, state_name: 'Karnataka' }],
MH: [{ exam_code: 'MH_MPHARM',exam_name: 'MH M.Pharm CET', is_national: false, state_name: 'Maharashtra' }],
};
const national = [
{ exam_code: 'NEET_PG', exam_name: 'NEET PG (Medical Postgraduate)', is_national: true },
{ exam_code: 'GPAT', exam_name: 'GPAT (Pharmacy PG)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'MCA_PG') {
const stateExams = {
TG: [{ exam_code: 'TG_ICET', exam_name: 'TG ICET (MCA)', is_national: false, state_name: 'Telangana' }],
AP: [{ exam_code: 'AP_ICET', exam_name: 'AP ICET (MCA)', is_national: false, state_name: 'Andhra Pradesh' }],
KA: [{ exam_code: 'KA_PGCET', exam_name: 'Karnataka PGCET (MCA)', is_national: false, state_name: 'Karnataka' }],
WB: [{ exam_code: 'WB_JECA', exam_name: 'WB JECA (MCA)', is_national: false, state_name: 'West Bengal' }],
};
const national = [
{ exam_code: 'NIMCET', exam_name: 'NIMCET (NIT MCA)', is_national: true },
{ exam_code: 'CUET_PG', exam_name: 'CUET PG (Central Universities)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'LAW_PG') {
const stateExams = {
KL: [{ exam_code: 'KL_LET', exam_name: 'Kerala Law Entrance Test', is_national: false, state_name: 'Kerala' }],
};
const national = [
{ exam_code: 'PGAT', exam_name: 'NLU Postgraduate Admission Test', is_national: true },
{ exam_code: 'CUET_PG', exam_name: 'CUET PG (Law)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'CIVIL_SERVICES') {
const stateExams = {
};
const national = [
{ exam_code: 'SSC_CGL', exam_name: 'SSC CGL', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
if (G === 'BANKING') {
return [
{ exam_code: 'SSC_CGL', exam_name: 'SSC CGL', is_national: true },
];
}
if (G === 'TEACHING_PG') {
const stateExams = {
RJ: [{ exam_code: 'RJ_PTET', exam_name: 'Rajasthan PTET (B.Ed)', is_national: false, state_name: 'Rajasthan' }],
};
const national = [
{ exam_code: 'CUET_PG', exam_name: 'CUET PG (Education)', is_national: true },
];
return [...(stateExams[S] || []), ...national];
}
// ── PG Passed / Masters Done ──────────────────────────────────────────────
if (G === 'UGC_NET') {
return [{ exam_code: 'UGC_NET', exam_name: 'UGC NET (All Subjects)', is_national: true }];
}
if (G === 'CSIR_NET') {
return [{ exam_code: 'CSIR_NET', exam_name: 'CSIR NET', is_national: true }];
}
if (G === 'PHD_ENTRANCE') {
return [
{ exam_code: 'UGC_NET', exam_name: 'UGC NET JRF (PhD eligibility)', is_national: true },
{ exam_code: 'CSIR_NET', exam_name: 'CSIR NET JRF', is_national: true },
{ exam_code: 'CUET_PG', exam_name: 'CUET PG (Research programs)', is_national: true },
{ exam_code: 'JNUEE', exam_name: 'JNU Entrance Examination', is_national: true },
];
}
if (G === 'FELLOWSHIP') {
return [
{ exam_code: 'GATE', exam_name: 'GATE (for Research Fellowship)', is_national: true },
{ exam_code: 'UGC_NET', exam_name: 'UGC NET JRF', is_national: true },
{ exam_code: 'CSIR_NET', exam_name: 'CSIR NET JRF', is_national: true },
];
}
// Fallback
}
// ── DROPDOWN UPDATERS ────────────────────────────────────────────────────────
function updateLanguageDropdown(languages) {
const dd = document.getElementById('languageSelect');
dd.innerHTML = '';
languages.forEach(lang => {
const o = document.createElement('option');
o.value = lang.code;
o.textContent = lang.native;
dd.appendChild(o);
});
dd.disabled = false;
if (languages.length > 0) {
dd.value = languages[0].code;
currentLanguage = languages[0].code;
onLanguageChange();
}
}
function updateEducationLevelDropdown(levels) {
const dd = document.getElementById('educationLevelSelect');
dd.innerHTML = '';
levels.forEach(level => {
const o = document.createElement('option');
o.value = level.code;
o.textContent = `${level.emoji} ${level.name}`;
dd.appendChild(o);
});
dd.disabled = false;
resetGoalDropdown();
resetStreamDropdown();
resetExamDropdown();
}
function updateGoalDropdown(goals) {
const dd = document.getElementById('goalSelect');
if (!dd) return;
dd.innerHTML = '';
goals.forEach(g => {
const o = document.createElement('option');
o.value = g.code;
const gLabel = (typeof i18n !== 'undefined' && i18n[curLang] && i18n[curLang]['goal_' + g.code])
? i18n[curLang]['goal_' + g.code]
: `${g.emoji} ${g.label}`;
o.textContent = gLabel;
dd.appendChild(o);
});
dd.disabled = false;
document.getElementById('goalContainer').style.display = 'block';
resetStreamDropdown();
resetExamDropdown();
}
function updateStreamDropdown(streams) {
const dd = document.getElementById('fieldSelect');
const container = document.getElementById('fieldContainer');
if (!dd) return;
dd.innerHTML = '';
streams.forEach(s => {
const o = document.createElement('option');
o.value = s.code;
const sLabel = (typeof i18n !== 'undefined' && i18n[curLang] && i18n[curLang]['stream_' + s.code])
? i18n[curLang]['stream_' + s.code]
: `${s.emoji} ${s.label}`;
o.textContent = sLabel;
dd.appendChild(o);
});
container.style.display = 'block';
dd.disabled = false;
resetExamDropdown();
}
function updateExamDropdown(exams) {
const dd = document.getElementById('examSelect');
dd.innerHTML = '';
if (!exams || exams.length === 0) {
dd.innerHTML = '';
return;
}
const stateExams = exams.filter(e => !e.is_national);
const nationalExams = exams.filter(e => e.is_national);
if (stateExams.length > 0) {
const g = document.createElement('optgroup');
g.label = `${stateExams[0].state_name || 'State'} Exams`;
stateExams.forEach(e => {
const o = document.createElement('option');
o.value = e.exam_code;
o.textContent = e.exam_name;
g.appendChild(o);
});
dd.appendChild(g);
}
if (nationalExams.length > 0) {
const g = document.createElement('optgroup');
g.label = 'All India Exams';
nationalExams.forEach(e => {
const o = document.createElement('option');
o.value = e.exam_code;
o.textContent = e.exam_name;
g.appendChild(o);
});
dd.appendChild(g);
}
dd.disabled = false;
}
// ── RESET HELPERS ────────────────────────────────────────────────────────────
function resetGoalDropdown() {
const dd = document.getElementById('goalSelect');
const container = document.getElementById('goalContainer');
if (dd) { dd.innerHTML = ''; dd.disabled = true; }
if (container) container.style.display = 'none';
currentGoal = null;
}
function resetStreamDropdown() {
const dd = document.getElementById('fieldSelect');
const container = document.getElementById('fieldContainer');
if (dd) { dd.innerHTML = ''; dd.disabled = true; }
if (container) container.style.display = 'none';
currentFieldValue = null;
}
function resetExamDropdown() {
const dd = document.getElementById('examSelect');
if (dd) { dd.innerHTML = ''; dd.disabled = true; }
}
function resetEducationLevelDropdown() {
const dd = document.getElementById('educationLevelSelect');
if (dd) { dd.innerHTML = ''; dd.disabled = true; }
currentEducationLevel = null;
resetGoalDropdown();
resetStreamDropdown();
resetExamDropdown();
}
// ── EVENT HANDLERS ────────────────────────────────────────────────────────────
async function onStateChange() {
const dd = document.getElementById('stateSelect');
const selectedState = dd.value;
if (!selectedState) return;
currentState = selectedState;
try {
const r = await fetch(`/api/state-config/${selectedState}`);
const d = await r.json();
if (d.success) {
updateLanguageDropdown(d.languages);
resetEducationLevelDropdown();
}
} catch(e) { console.error('State config error:', e); }
}
async function onLanguageChange() {
const dd = document.getElementById('languageSelect');
const selectedLang = dd.value;
if (!selectedLang) return;
currentLanguage = selectedLang;
if (typeof applyLang === 'function') {
const langSwitch = document.getElementById('langSwitch');
if (langSwitch) langSwitch.value = selectedLang;
applyLang(selectedLang);
}
try {
const r = await fetch(`/api/education-levels/${selectedLang}`);
const d = await r.json();
if (d.success) {
updateEducationLevelDropdown(d.levels);
}
} catch(e) { console.error('Language change error:', e); }
}
function onEducationLevelChange() {
const dd = document.getElementById('educationLevelSelect');
const selectedLevel = dd.value;
if (!selectedLevel) return;
currentEducationLevel = selectedLevel;
const goals = GOAL_MAP[selectedLevel];
if (goals && goals.length > 0) {
updateGoalDropdown(goals);
} else {
resetGoalDropdown();
resetStreamDropdown();
const exams = getExamsForGoalStream(null, null, currentState);
updateExamDropdown(exams);
}
}
function onGoalChange() {
const dd = document.getElementById('goalSelect');
const selectedGoal = dd.value;
if (!selectedGoal) return;
currentGoal = selectedGoal;
const streams = STREAM_MAP[selectedGoal];
if (streams && streams.length > 0) {
updateStreamDropdown(streams);
resetExamDropdown();
} else {
resetStreamDropdown();
const exams = getExamsForGoalStream(selectedGoal, null, currentState);
updateExamDropdown(exams);
}
}
function onFieldChange() {
const dd = document.getElementById('fieldSelect');
const selectedField = dd.value;
if (!selectedField) return;
currentFieldValue = selectedField;
const exams = getExamsForGoalStream(currentGoal, selectedField, currentState);
updateExamDropdown(exams);
}
// ── INIT ──────────────────────────────────────────────────────────────────────
document.addEventListener('DOMContentLoaded', function() {
const stateDD = document.getElementById('stateSelect');
const langDD = document.getElementById('languageSelect');
const levelDD = document.getElementById('educationLevelSelect');
const goalDD = document.getElementById('goalSelect');
const fieldDD = document.getElementById('fieldSelect');
if (stateDD) stateDD.addEventListener('change', onStateChange);
if (langDD) langDD.addEventListener('change', onLanguageChange);
if (levelDD) levelDD.addEventListener('change', onEducationLevelChange);
if (goalDD) goalDD.addEventListener('change', onGoalChange);
if (fieldDD) fieldDD.addEventListener('change', onFieldChange);
resetEducationLevelDropdown();
resetGoalDropdown();
resetStreamDropdown();
resetExamDropdown();
});