7 HOUSE SHORTHAND ONLINE INSTITUTE

Succeed Confidently
LOGIN / INFO
Google

4.6 ★ Rating (92+ Reviews)

Top Student Feedbacks from Google Maps

★★★★★

"Best institute for stenography. Deepak Sir is the best teacher."

- Vishal Saroha
★★★★★

"The way Sir explains everything is astonishing. Competitive environment."

- Manisha Chandra Oli
★★★★★

"Cleared my basics in such less time. Highly recommended for SSC Steno."

- Priya Raikwar
★★★★★

"7 House Institute is not just about learning, it’s about a brighter tomorrow."

- Ani Mehra
VIEW ALL 92 ON GOOGLE
// 1. CONFIGURATION & INITIALIZATION const firebaseConfig = { apiKey: "AIzaSyBWbuh7eX-dbbJ0DyLoBRiwzAS2HbYi5QU", authDomain: "house-shorthand.firebaseapp.com", databaseURL: "https://house-shorthand-default-rtdb.firebaseio.com", projectId: "house-shorthand", storageBucket: "house-shorthand.firebasestorage.app", messagingSenderId: "1040239918670", appId: "1:1040239918670:web:26cf10bdae4d1670988d1f" }; firebase.initializeApp(firebaseConfig); const auth = firebase.auth(), db = firebase.database(); let currentUser = null; // 2. REAL-TIME DATA LISTENERS db.ref('siteAbout').on('value', snap => { if(snap.exists()) { const aboutData = snap.val(); if(document.getElementById('aboutContentDisplay')) { document.getElementById('aboutContentDisplay').innerText = aboutData; } } }); db.ref('studentMsg').on('value', snap => { const msg = snap.val(); // 1. Dashboard wala chota area (studentMessageArea) const msgDiv = document.getElementById('studentMessageArea'); // 2. Naya Page wala area (fullMessageDisplay) - ISKI WAJAH SE BLANK AA RAHA THA const fullMsgDisplay = document.getElementById('fullMessageDisplay'); if (msg && msg.content && msg.content.trim() !== "") { // Dashboard par chota notice dikhane ke liye if(msgDiv) { msgDiv.style.display = 'block'; msgDiv.innerHTML = `

${msg.title || 'Important Notice'}

${msg.content.substring(0, 100)}...

Click "Message" button to read full.
`; } // Naye Page (Message View) par poora message load karne ke liye if(fullMsgDisplay) { fullMsgDisplay.innerText = msg.content; } } else { if(msgDiv) msgDiv.style.display = 'none'; if(fullMsgDisplay) fullMsgDisplay.innerText = "Filhal koi naya sandesh nahi hai."; } }); db.ref('siteUpdates').on('value', snap => { if(snap.exists()){ const n = snap.val(); if(document.getElementById('news1')) document.getElementById('news1').innerText = n.n1 || ""; if(document.getElementById('news2')) document.getElementById('news2').innerText = n.n2 || ""; if(document.getElementById('news3')) document.getElementById('news3').innerText = n.n3 || ""; } }); // 3. AUTHENTICATION & PROFILE // Direct Login & Profile Open Switch function handleUserStatusClick() { if (!currentUser) { // Agar user login nahi hai toh direct Google Login Popup khole auth.signInWithPopup(new firebase.auth.GoogleAuthProvider()).catch(err => { alert("Login Failed: " + err.message); }); } else { // Agar user pehle se login hai toh Right Sidebar (Profile/Updates) khole toggleRightSidebar(); } } // User state change hone par button text aur icon badle auth.onAuthStateChanged(user => { currentUser = user; const statusDiv = document.getElementById('userStatusSidebar'); const statusText = document.getElementById('userStatusText'); const statusIcon = document.getElementById('userStatusIcon'); if (user) { if(statusText) statusText.innerText = "PROFILE"; if(statusIcon) statusIcon.className = "fas fa-user-check"; db.ref('users/' + user.uid).once('value', snap => { const uData = snap.val(); if (!uData || !uData.phone || !uData.name) document.getElementById('regModal').style.display = 'flex'; updateUserStatsSidebar(user.uid); if(statusDiv) { statusDiv.innerHTML = `
Welcome, ${uData?.name || user.email.split('@')[0]}
`; } }); } else { if(statusText) statusText.innerText = "LOGIN"; if(statusIcon) statusIcon.className = "fas fa-user-circle"; if(statusDiv) { statusDiv.innerHTML = ``; } } }); // Browser history mein state push karne ke liye function navigateToSection(viewName) { history.pushState({ screen: viewName }, ""); } function loadErrorBank() { db.ref('commonErrors').on('value', snap => { let h = ""; const displayDiv = document.getElementById('commonErrorDisplay'); if(!displayDiv) return; if(snap.exists()){ snap.forEach(child => { let d = child.val(); h += `
${d.word}
`; }); displayDiv.innerHTML = h; } else { displayDiv.innerHTML = "

No outlines yet.

"; } }); } function logout() { auth.signOut().then(() => location.reload()); } function saveProfile() { const name = document.getElementById('regName').value.trim(); const dob = document.getElementById('regDOB').value; const phone = document.getElementById('regPhone').value.trim(); // 🚨 Deepak Sir's Strict Logic if(name && dob && phone.length === 10) { db.ref('users/' + currentUser.uid).update({ name: name, dob: dob, phone: phone, isPaid: false }).then(() => { alert("Profile saved successfully! You can now access the portal."); location.reload(); }); } else { alert("Please provide your full name and a valid 10-digit WhatsApp number."); } } // Ye naya function hai, ise copy karke paste karein function showStudentMsg() { navigateToSection('studentMsg'); document.getElementById('mainMenu').style.display = 'none'; // Dashboard chhupao document.getElementById('messageView').style.display = 'block'; // Message dikhao window.scrollTo(0,0); } // 4. NAVIGATION & SIDEBAR function showAbout() { navigateToSection('about'); document.getElementById('mainMenu').style.display = 'none'; // Dashboard chhupao document.getElementById('aboutView').style.display = 'block'; // About dikhao window.scrollTo(0,0); } function showHistory() { if (!currentUser) return alert("Please login first to proceed."); navigateToSection('history'); document.getElementById('mainMenu').style.display = 'none'; document.getElementById('historyView').style.display = 'block'; // Data load karne wala function bulayein loadHistory(); window.scrollTo(0,0); } function loadHistory() { const historyBody = document.getElementById('historyBody'); if (!historyBody || !currentUser) return; db.ref('testHistory/' + currentUser.uid).on('value', (snapshot) => { if (snapshot.exists()) { renderHistoryData(snapshot.val()); } else { historyBody.innerHTML = 'No test records found yet. Start practicing to see your progress.'; } }); } function renderHistoryData(data) { const historyBody = document.getElementById('historyBody'); if (!historyBody) return; // ग्राफ अपडेट करें drawPerformanceGraph(data); let html = ""; // डेटा को पलटें ताकि नया टेस्ट ऊपर आये let tests = Object.values(data).reverse(); tests.forEach((test) => { // 🚀 Deepak Sir Special: Memory Safety Logic let miniTest = {...test}; if(miniTest.fullReport && miniTest.fullReport.length > 5000) { delete miniTest.fullReport; // Agar report bahut badi hai toh use delete kar do taaki button na fase } let dateDisplay = test.date ? test.date.split(',')[0] : '---'; let titleDisplay = (test.passage || test.title || "Shorthand Test").toString(); if(titleDisplay.length > 25) titleDisplay = titleDisplay.substring(0, 25) + "..."; let m = test.totalMistakes || test.mistakes || 0; let mistakesNum = parseFloat(m); let accValue = test.accuracy ? parseFloat(test.accuracy.toString().replace('%', '')) : 0; if (accValue < 0) accValue = 0; let color = accValue >= 95 ? "#2ecc71" : accValue >= 90 ? "#f39c12" : "#e74c3c"; // ✅ TABLE ROW GENERATION html += ` ${dateDisplay} ${titleDisplay} ${mistakesNum} ${accValue.toFixed(2)}% `; }); // <--- forEach यहाँ खत्म हुआ // 🚀 IMPORTANT: Ye line table mein data dikhane ke liye zaroori hai historyBody.innerHTML = html; } function toggleStudentMsg() { const msgArea = document.getElementById('studentMessageArea'); if(msgArea) { msgArea.style.display = (msgArea.style.display === 'none' || msgArea.style.display === '') ? 'block' : 'none'; } } function goBackMenu() { const allViews = [ 'gameView', 'messageView', 'weakWordsView', 'aboutView', 'historyView', 'pricingView', 'transHistoryView', 'iCardView', 'reportSection', 'askAnythingFinal' ]; allViews.forEach(id => { const el = document.getElementById(id); if (el) el.style.display = 'none'; }); const mainMenu = document.getElementById('mainMenu'); if (mainMenu) mainMenu.style.display = 'block'; window.scrollTo({ top: 0, behavior: 'smooth' }); } // Exit Game ko update karein taaki wo 'gameView' ko band kare function exitGame() { console.log("Stopping Game and Clearing Screen..."); // 1. Game ki logic roko gameActive = false; if (typeof gameInterval !== 'undefined') clearInterval(gameInterval); // 2. Screen par gire huye words mitao if (typeof fallingWords !== 'undefined') { fallingWords.forEach(w => { if (w.element) w.element.remove(); }); fallingWords = []; } // 3. MASTER CLEAN: Sab kuch hide karke Dashboard dikhao goBackMenu(); // 4. EXTRA SAFETY: Game view ko forcefully band karo const gView = document.getElementById('gameView'); if (gView) gView.style.display = 'none'; window.scrollTo(0,0); } function toggleSidebar() { const sidebar = document.getElementById('leftSidebar') || document.querySelector('.app-sidebar'); const backdrop = document.getElementById('sidebarBackdrop'); if (!sidebar) return; sidebar.classList.toggle('active'); // Mobile par dark backdrop toggle karne ke liye if (backdrop) { if (sidebar.classList.contains('active') && window.innerWidth <= 1024) { backdrop.style.display = 'block'; } else { backdrop.style.display = 'none'; } } } function closeSidebar() { const left = document.getElementById('leftSidebar'); const right = document.getElementById('rightSidebar'); const backdrop = document.getElementById('sidebarBackdrop'); if (left) left.classList.remove('active'); if (right) right.classList.remove('active'); if (backdrop) backdrop.style.display = 'none'; } function toggleRightSidebar() { const right = document.getElementById('rightSidebar'); const backdrop = document.getElementById('sidebarBackdrop'); if (!right) return; right.classList.toggle('active'); if (backdrop) { if (right.classList.contains('active')) { backdrop.style.display = 'block'; } else { backdrop.style.display = 'none'; } } } // Avatar Modals function openAvatarModal() { document.getElementById('avatarModal').style.display = "block"; } function closeAvatarModal() { document.getElementById('avatarModal').style.display = "none"; } // Outside Click / Touch Listener (Mobile aur Desktop dono ke liye) document.addEventListener('click', function(event) { const left = document.getElementById('leftSidebar') || document.querySelector('.app-sidebar'); const right = document.getElementById('rightSidebar'); const menuToggle = document.getElementById('menuToggle'); const reviewBox = document.getElementById('reviewsSection'); // 1. Mobile par left sidebar close logic if (window.innerWidth <= 1024 && left && left.classList.contains('active')) { const clickedInsideSidebar = left.contains(event.target); const clickedMenuBtn = menuToggle && (menuToggle === event.target || menuToggle.contains(event.target)); const clickedNavItem = event.target.closest('.nav-item'); // Agar bahar tap kiya ya kisi nav option par click kiya toh sidebar band ho jaye if ((!clickedInsideSidebar && !clickedMenuBtn) || clickedNavItem) { closeSidebar(); } } // 2. Right sidebar close logic if (window.innerWidth <= 1199 && right && right.classList.contains('active')) { const bellBtn = event.target.closest('.fa-bell'); if (!right.contains(event.target) && !bellBtn) { right.classList.remove('active'); } } // 3. Review popup backdrop click logic if (reviewBox && event.target === reviewBox) { goBackMenu(); } }); // 6. HISTORY & REVIEWS function loadHistoryData() { if(!currentUser) return; // Pehle loading dikhao document.getElementById('historyBody').innerHTML = "Loading your records..."; db.ref('testHistory/' + currentUser.uid).on('value', snap => { let h = ""; if(snap.exists()){ snap.forEach(child => { let d = child.val(); let numAcc = parseFloat(d.accuracy); // SSC Mistake % Logic let displayMistakePer = (numAcc > 50) ? (100 - numAcc).toFixed(2) + "%" : d.accuracy; h += ` ${d.date ? d.date.split(',')[0] : 'N/A'} ${d.title} ${d.mistakes || 0} ${displayMistakePer} `; }); document.getElementById('historyBody').innerHTML = h; } else { document.getElementById('historyBody').innerHTML = "No record found. Start practicing!"; } }); } function updateUserStatsSidebar(uid) { db.ref('testHistory/' + uid).on('value', snap => { if (snap.exists()) { const tests = Object.values(snap.val()); document.getElementById('statTotalTests').innerText = tests.length; let lowestMistake = 100; tests.forEach(t => { let val = parseFloat(t.accuracy); if (val > 50) val = 100 - val; if (val < lowestMistake) lowestMistake = val; }); document.getElementById('statBestAcc').innerText = lowestMistake.toFixed(2) + "%"; document.getElementById('myStatsSidebar').style.display = 'block'; } }); } // Review Modal kholne ke liye function showReviews() { // 1. Modal dikhao const modal = document.getElementById('reviewsSection'); if (modal) { modal.style.display = 'block'; // 2. Data load karo loadReviewsList(); } } // Review submit karne ka sahi logic function submitReview() { const name = document.getElementById('revName').value.trim(); const text = document.getElementById('revText').value.trim(); if (!name || !text) { return alert("Please enter both your name and review."); } db.ref('studentReviews').push({ name: name, text: text, date: new Date().toLocaleDateString('en-IN'), timestamp: firebase.database.ServerValue.TIMESTAMP }).then(() => { alert("Thank you! Your review has been added."); document.getElementById('revName').value = ""; document.getElementById('revText').value = ""; }).catch(err => { console.error(err); alert("Error: Review submit nahi hua."); }); } // 2. Reviews load karne ke liye function loadReviewsList() { const reviewsDiv = document.getElementById('reviewsList'); if (!reviewsDiv) return; // Pehle loading dikhao reviewsDiv.innerHTML = "

Loading reviews...

"; // Firebase se 'studentReviews' uthao db.ref('studentReviews').on('value', snap => { let html = ""; if (snap.exists()) { snap.forEach(child => { let r = child.val(); // Ek card banate hain har review ke liye html = `
${r.name} ${r.date || ''}

"${r.text}"

` + html; // Naya review upar dikhega }); reviewsDiv.innerHTML = html; } else { reviewsDiv.innerHTML = "

Abhi tak koi review nahi mila.

"; } }); } // 7. LEGAL POLICIES function showLegal(type) { let t = "", c = ""; if (type === 'privacy') { t = "🔒 PRIVACY POLICY"; c = `Privacy Policy 7 House Shorthand Online Institute is committed to protecting your privacy. Please read this policy to understand how we collect and use your personal data. Personal Data that We may Collect We may collect information related to your personal identity when you use 7 House Shorthand services. This includes, but is not limited to, personal identification information, device information, and location data. If you upload or post information in public areas that are visible to other users, please note that such information may be collected and used by others. If you notice any improper collection or use of information, please contact us at 7houseshorthandinstitute@gmail.com. How We Collect and Use the Information - Information Provided by you when registering or using 7 House Shorthand services. - Information shared by other parties through their use of 7 House Shorthand services. - Information collected through cookies, web beacons, and log archives. We use cookies to provide users with a personalized experience, including remembering your identity and analyzing your use of our services. You can manage cookies through your browser settings. Push Notifications and Advertising We may use your information to send you marketing messages, notifications related to service updates, and promotional content. You can opt-out of these communications through settings on your device or by following unsubscribe guidelines in messages. Sharing, Transfer, and Disclosure of Information - We may share your information with partners and third parties to provide better services or as required by law. - Your information may be transferred if there are mergers, acquisitions, or similar transactions. - We will disclose your information only under the conditions required by law or with your explicit consent. How We Protect Your Information We retain your information during the period required to provide services and within time limits required by law. We employ industry-standard security measures such as encryption and strict access control to protect your data from unauthorized access, alteration, or destruction. However, the internet is not entirely secure, and we encourage you to use strong passwords and be careful when sharing information. Managing Your Information You have the right to access, update, or delete your personal information. Please contact us at 7houseshorthandinstitute@gmail.com for any requests related to your data. Age Limit We recommend that minors obtain prior consent from their parents or guardians before using 7 House Shorthand services. We do not knowingly process personal data from minors without parental consent. If you believe we have any personal data from minors, please contact us. Notice and Amendment We may revise this Privacy Policy as necessary. We encourage you to review the policy periodically. By continuing to use 7 House Shorthand services, you agree to the revised policy. How to Contact Us If you have any questions, comments, or suggestions regarding this Privacy Policy, please contact us at 7houseshorthandinstitute@gmail.com.`; } else if (type === 'terms') { t = "📜 TERMS & CONDITIONS"; // Aapka poora text bina kisi badlav ke neeche hai c = `Terms & Conditions: 7 House Shorthand Online Institute Welcome to 7 House Shorthand Online Institute's Terms & Conditions. Please read these carefully before using our platform. What do our Terms & Conditions cover? These terms and conditions ("Terms and Conditions") are between 7 House Shorthand Online Institute and you, (hereinafter referred to as "You" or "Your" or "User(s)"). By accessing our website and services, together referred to as "7 House Platform", you agree to be bound by the provisions of these Terms and Conditions. Please read these Terms and Conditions, along with the Privacy Policy and all other rules as they shall govern your use of the 7 House Platform. By using or visiting the 7 House Platform or any software, data feeds, and services provided to you, you signify your agreement to (1) these "Terms and Conditions", (2) 7 House Shorthand’s Privacy Policy. If you do not agree to any of these terms, please do not use the 7 House Platform. About 7 House Shorthand The services and platform are owned, registered, and operated by 7 House Shorthand Online Institute, managed by Deepak Koli (hereinafter referred to as "7 House Shorthand" or "us" or "we" or "our"). 7 House Platform These Terms and Conditions apply to all Users of the 7 House Platform. The platform provides educational shorthand dictations, tutorials, and materials. Content uploaded through the use of the 7 House Platform shall hereinafter be referred to as "7 House Content". Subject to these Terms and Conditions, 7 House Shorthand hereby grants you a non-exclusive, non-transferable, non-sublicensable, limited license to use the platform in accordance with these Terms and Conditions. 7 House Accounts In order to access premium features, you have to create an account. You agree and confirm that you will never use another User's account nor provide access to your account to any third party. You are solely responsible for the activities that occur on your account. Important: If a user's account is found to be active on multiple devices or multiple users are found operating a single account, 7 House Shorthand reserves the right to suspend the subscription(s) linked to that account or even the account itself, without any prior notice. Access, Permissions, and Restrictions You agree not to distribute any part of the 7 House Content without prior written authorization. You agree not to alter or modify any part of the platform. You agree not to use the 7 House Platform for any commercial uses. Content Use 7 House Content utilized on the platform, which includes but is not limited to trademarks, logos, audio dictations, and shorthand outlines, are owned by or licensed to 7 House Shorthand and are subject to copyright and other intellectual property rights under the law. Limitation of Liability In no event shall 7 House Shorthand or its owner be liable to you for any direct, indirect, or consequential damages resulting from errors in content, unauthorized access to secure servers, or any interruption of service. 7 House Shorthand reserves the right to terminate your account and subscriptions if you engage in behavior that violates our standards of conduct. If any user exhibits abusive, derogatory, or offensive language on the Platform or via affiliated channels (WhatsApp, etc.), 7 House Shorthand may immediately suspend or cancel all active subscriptions without any prior notice and shall not be liable for any refund. By using the 7 House Platform, you acknowledge and agree to these Terms & Conditions.`; } else if (type === 'refund') { t = "💳 REFUND & CANCELLATION POLICY"; c = `Refund and Cancellation Policy Effective Date: 13th Feb. 2013 Introduction Thank you for choosing 7 House Shorthand! We appreciate your trust in our platform. Please read our refund and cancellation policy carefully before enrolling in any of our courses. At 7 House Shorthand, we are committed to providing high-quality education and resources to our users. We aim to maintain transparency and fairness in our refund and cancellation policy. This policy outlines the terms and conditions governing refunds and cancellations for courses offered on our website. Refund and Cancellation Timeline Once a user enrolls in a course on 7 House Shorthand and makes the required payment, the following refund and cancellation policy applies: 2.1 Refunds Once a user is enrolled in a pass/subscription/batch, it is treated as final, and no refund is provided in any circumstances. 2.2 No Refund for Referral Code Usage Under no circumstances will a refund be provided if a user has used a referral code while signing up/ purchasing any plan or subscription on the website. This policy applies even within the initial 24 hours window. 2.3 No Refund for Coupon code usages No refund is provided if the user has used any coupon code while purchasing any pass/subscription/batch on 7 House Shorthand. Contacting Customer Support To inquiry about any possible exception, users should contact our customer support team at 7houseshorthandinstitute@gmail.com with the following information: - Full name - Email address associated with the account - Course title - Reason for the request Account Suspension due to False or Unethical News 7 House Shorthand is committed to promoting accurate and ethical information. If it is found that a user is spreading false or unethical news without contacting our support team to address the issue, we reserve the right to suspend or disable their account immediately. In such cases, no refunds will be provided for the remaining subscription period. Conclusion At 7 House Shorthand, we strive to provide the best learning experience to our users. We believe our refund and cancellation policy maintains a fair balance between user flexibility and our commitment to delivering high-quality educational content. Please ensure that you read and understand this policy before enrolling in any course on our platform. By enrolling in a 7 House Shorthand course, you acknowledge and agree to abide by the terms and conditions outlined in this refund and cancellation policy. For any questions or clarifications regarding this policy, please contact our customer support team at 7houseshorthandinstitute@gmail.com.`; } document.getElementById('legalTitle').innerText = t; // Title set karega document.getElementById('legalBody').innerText = c; // Pura text bharega document.getElementById('legalModal').style.display = "block"; // Box ko dikhayega } function closeLegalModal() { document.getElementById('legalModal').style.display = "none"; } // 1. Galtiyon ko Save karne ka function (Ise checkResult function ke andar bulana hoga) function trackWeakWords(mistakesArray) { // Agar bacha login nahi hai ya galti nahi hai toh rukh jao if (!currentUser || !mistakesArray || mistakesArray.length === 0) return; mistakesArray.forEach(word => { // Word ko saaf karna (symbols hatana) let cleanWord = word.toLowerCase().trim().replace(/[.,#!$%&;:{}=\-_`~()]/g,""); // Sirf 2 se bade words (jaise 'the', 'is' ko chhod kar) if(cleanWord.length > 2) { // Firebase Path: studentAnalysis/UID/weakWords/word_name const wordPath = 'studentAnalysis/' + currentUser.uid + '/weakWords/' + cleanWord; // Transaction use kar rahe hain taaki count sahi se update ho db.ref(wordPath).transaction((currentData) => { if (currentData) { currentData.count = (currentData.count || 0) + 1; return currentData; } else { return { count: 1 }; } }); } }); } // 2. Section dikhane ke liye function showWeakWords() { if (!currentUser) return alert("Pehle Login karein!"); navigateToSection('weakWords'); // baaki code wahi rahega... document.getElementById('mainMenu').style.display = 'none'; document.getElementById('weakWordsView').style.display = 'block'; const listDiv = document.getElementById('weakWordsList'); listDiv.innerHTML = "

Loading weak words...

"; db.ref('studentAnalysis/' + currentUser.uid + '/weakWords').once('value', snap => { if (snap.exists()) { let html = ""; let words = Object.entries(snap.val()).sort((a,b) => b[1].count - a[1].count); words.forEach(([word, data]) => { html += `
${word.toUpperCase()} ${data.count}
`; }); listDiv.innerHTML = html; } else { listDiv.innerHTML = "

No weak words recorded yet. Start taking tests to track errors.

"; } }); } // 3. Words ko screen par dikhane ke liye function loadWeakWords() { const listDiv = document.getElementById('weakWordsList'); const weakWords = JSON.parse(localStorage.getItem('weakWords')) || {}; let html = ""; // Words ko sort karna (jo sabse zyada galat hue wo pehle) const sortedWords = Object.entries(weakWords).sort((a,b) => b[1] - a[1]); if(sortedWords.length === 0) { listDiv.innerHTML = "

Abhi tak koi galti record nahi hui. Practice jari rakhein!

"; return; } sortedWords.forEach(([word, count]) => { if(count >= 2) { // Jo word kam se kam 2 baar galat hua ho html += `
${word} ${count}
`; } }); listDiv.innerHTML = html || "

Thodi aur practice karein, tabhi data dikhega!

"; } async function shareWeakWordsOnWhatsApp() { if (!currentUser) return alert("Pehle login karein!"); try { // 1. Firebase se data uthao const snapshot = await db.ref('studentAnalysis/' + currentUser.uid + '/weakWords').once('value'); const weakWordsData = snapshot.val(); // CHECK: Agar data bilkul khali hai if (!weakWordsData) { alert("Deepak Sir, Database mein abhi koi galti record nahi hui hai!"); return; } // 2. Data ko List mein badlo (Handle both formats) let words = []; for (let word in weakWordsData) { let count = 0; // Agar data { count: 5 } ke roop mein hai if (typeof weakWordsData[word] === 'object') { count = weakWordsData[word].count || 0; } else { // Agar data seedha number hai { "apple": 5 } count = weakWordsData[word]; } words.push({ word: word, count: count }); } // 3. Sorting (Zyada galti wale upar) words.sort((a, b) => b.count - a.count); // 4. Message Design let message = "*🔥 MY WEAK SHORTHAND WORDS LIST *%0A"; message += "--------------------------------%0A"; let hasWords = false; words.forEach(item => { if(item.count >= 2) { // Kam se kam 2 baar galti message += `👉 *${item.word.toUpperCase()}* (Mistakes: ${item.count})%0A`; hasWords = true; } }); if (!hasWords) { alert("Deepak Sir, 2 se kam galti wale words share nahi honge. Thoda aur practice karein!"); return; } message += "--------------------------------%0A"; message += "🎯 *Target:* In words ki 10-10 line practice karni hai.%0A"; message += "🚀 *Source:* 7 House Shorthand Portal"; // 5. WhatsApp Par Bhejo window.location.href = `https://wa.me/?text=${message}`; } catch (error) { console.error("Firebase Error:", error); alert("Data load karne mein dikkat hui!"); } } function clearWeakWords() { if (!currentUser) return alert("Please login first!"); if (confirm("Are you sure you want to delete all weak words data?")) { // 1. LocalStorage se delete karein localStorage.removeItem('weakWords'); // 2. Firebase Database se permanently delete karein db.ref('studentAnalysis/' + currentUser.uid + '/weakWords').remove() .then(() => { alert("Weak words data cleared successfully!"); const listDiv = document.getElementById('weakWordsList'); if (listDiv) { listDiv.innerHTML = "

No weak words recorded yet. Start taking tests to track errors.

"; } }) .catch(err => { console.error("Error deleting weak words:", err); alert("Failed to clear data from server. Please try again."); }); } } function testButton() { alert("System kaam kar raha hai!"); } let gameActive = false; let score = 0; let fallingWords = []; let gameWords = ["government", "parliament", "honorable", "committee", "shorthand", "dictation", "accuracy", "president", "justice", "education", "financial", "official"]; let gameInterval; // 1. Game View dikhane ke liye function showGame() { navigateToSection('game'); // Sabse pehle dashboard chhupao (ID: mainMenu) document.getElementById('mainMenu').style.display = 'none'; // Game dikhao (ID: gameView) document.getElementById('gameView').style.display = 'block'; // Start screen dikhao document.getElementById('startScreen').style.display = 'flex'; } // 2. Game shuru karne ke liye function initGame() { document.getElementById('startScreen').style.display = 'none'; score = 0; document.getElementById('gameScore').innerText = score; gameActive = true; fallingWords = []; document.getElementById('gameInput').value = ""; document.getElementById('gameInput').focus(); // Har 2.5 second mein naya word banega gameInterval = setInterval(createWord, 2500); // Game loop shuru (Words ko niche girana shuru) requestAnimationFrame(updateGame); } // 3. Naya shabd banane ke liye // Is hisse ko dhyan se dekhiye aur aise hi replace kijiye function createWord() { if (!gameActive) return; // Aapke photos ke naye naam yahan likhein (Bina .png ke) const gameWords = ["iwish", "ishall", "iwouldlike", "beyond", "historical", "government"]; const word = gameWords[Math.floor(Math.random() * gameWords.length)]; const x = Math.random() * (document.getElementById('gameCanvas').offsetWidth - 80); const wordObj = { text: word, x: x, y: 0, element: document.createElement('div') }; wordObj.element.className = 'falling-word'; wordObj.element.innerHTML = `
`; wordObj.element.style.cssText = `position:absolute; left:${x}px; top:0px; z-index:100;`; const canvas = document.getElementById('gameCanvas'); if (canvas) { canvas.appendChild(wordObj.element); fallingWords.push(wordObj); } } // 4. Words ko niche girane wala engine (MAIN ENGINE) function updateGame() { if(!gameActive) return; let canvasHeight = document.getElementById('gameCanvas').offsetHeight; for(let i = 0; i < fallingWords.length; i++) { let word = fallingWords[i]; word.y += 1.2; // Yahan se speed control hoti hai word.element.style.top = word.y + "px"; // Agar word niche touch ho gaya toh GAME OVER if(word.y > (canvasHeight - 40)) { gameOver(); return; } } requestAnimationFrame(updateGame); } // 5. Typing check karne ke liye document.getElementById('gameInput').addEventListener('input', (e) => { const typed = e.target.value.toLowerCase().replace(/\s+/g, ''); // Space hata kar check karega for (let i = 0; i < fallingWords.length; i++) { if (fallingWords[i].text === typed) { fallingWords[i].element.remove(); fallingWords.splice(i, 1); score += 10; document.getElementById('gameScore').innerText = score; e.target.value = ""; break; } } }); // 6. Game khatam hone par function gameOver() { gameActive = false; clearInterval(gameInterval); // High Score save karna let oldHighScore = localStorage.getItem('gameHighScore') || 0; if(score > oldHighScore) { localStorage.setItem('gameHighScore', score); if(document.getElementById('statHighScore')) { document.getElementById('statHighScore').innerText = score; } alert("💥 NEW RECORD! Your Score: " + score); } else { alert("Game Over! Your final score: " + score); } // Canvas saaf karna fallingWords.forEach(w => w.element.remove()); fallingWords = []; document.getElementById('startScreen').style.display = 'flex'; } function loadLeaderboard() { const filter = document.getElementById('leaderboardFilter').value; const today = new Date().toISOString().split('T')[0]; const lbBody = document.getElementById('leaderboardBody'); // सही रास्ता (Path) चुनना let path = (filter === 'today') ? 'leaderboard/' + today : 'allTimeLeaderboard'; db.ref(path).on('value', snap => { let players = []; if (snap.exists()) { snap.forEach(child => { let data = child.val(); players.push(data); }); // 🥇 सबसे कम गलती वाला सबसे ऊपर players.sort((a, b) => parseFloat(a.mistakePer || 100) - parseFloat(b.mistakePer || 100)); let html = ""; let top10 = players.slice(0, 10); // सिर्फ टॉप 10 top10.forEach((d, index) => { let medal = (index === 0) ? "🥇" : (index === 1) ? "🥈" : (index === 2) ? "🥉" : (index + 1); // साफ़-सुथरा नाम और पैसेज let pName = String(d.name || "Student").substring(0, 25); let pPassage = String(d.passage || "Test").substring(0, 30); let pMistakes = d.totalMistakes || 0; let pPercent = (d.mistakePer !== undefined) ? parseFloat(d.mistakePer).toFixed(2) + "%" : "0%"; html += ` ${medal} ${pName}
${pPassage}... ${pMistakes} ${pPercent} `; }); lbBody.innerHTML = html; } else { lbBody.innerHTML = "No data found for this selection."; } }); } // Dashboard load hote hi leaderboard active ho jaye window.addEventListener('load', loadLeaderboard); // Phone ka hardware/gesture Back button dabane par website band hone se rokne ke liye // Phone ka hardware/gesture Back button dabane par website band hone se rokne ke liye window.addEventListener('popstate', function(event) { // 1. Check karein kya koi modal khula hai (Sabse pehle popup modals band honge) const modals = [ { id: 'feeModalV2', closeFn: closeFeeModal }, { id: 'avatarModal', closeFn: closeAvatarModal }, { id: 'legalModal', closeFn: closeLegalModal }, { id: 'errorBankModal', closeFn: closeErrorBank }, { id: 'transcriptionModal', closeFn: closeTranscriptionModal }, { id: 'iCardModal', closeFn: closeModal }, { id: 'regModal', closeFn: () => { const el = document.getElementById('regModal'); if (el) el.style.display = 'none'; } }, { id: 'reviewsSection', closeFn: () => { const el = document.getElementById('reviewsSection'); if (el) el.style.display = 'none'; } } ]; for (let m of modals) { const el = document.getElementById(m.id); if (el && el.style.display !== 'none' && el.style.display !== '') { m.closeFn(); return; } } // 2. Check karein kya koi game ya active session chal raha hai const gameView = document.getElementById('gameView'); if (gameView && gameView.style.display !== 'none' && gameView.style.display !== '') { exitGame(); return; } // 3. Agar user Dashboard ke alawa kisi bhi view (history, i-card, report, etc.) mein hai, toh Dashboard par layein const mainMenu = document.getElementById('mainMenu'); if (mainMenu && mainMenu.style.display === 'none') { goBackMenu(); } });function drawPerformanceGraph(historyData) { const canvas = document.getElementById('performanceChart'); if (!canvas) return; const ctx = canvas.getContext('2d'); // 1. Purana chart saaf karo taaki naya ban sake if (window.stenoChart) { window.stenoChart.destroy(); } // 2. Data taiyar karo let labels = []; let accuracyPoints = []; // Sabhi tests ko date ke hisab se sort karna let tests = Object.values(historyData).sort((a, b) => new Date(a.date) - new Date(b.date)); // Pichle 10 tests nikalna let last10Tests = tests.slice(-10); last10Tests.forEach((test) => { // Date format fix: Agar date hai toh pehle 5 characters (DD/MM) lo let shortDate = test.date ? test.date.split(',')[0].substring(0, 5) : "00/00"; labels.push(shortDate); let accValue = test.accuracy ? parseFloat(test.accuracy.toString().replace('%', '')) : 0; accuracyPoints.push(accValue); }); // 3. Chart Design & Logic window.stenoChart = new Chart(ctx, { type: 'line', data: { labels: labels, datasets: [{ label: 'Accuracy %', data: accuracyPoints, borderColor: '#0a192f', // Premium Navy backgroundColor: 'rgba(255, 202, 40, 0.2)', // Gold Shade borderWidth: 3, pointRadius: 6, pointBackgroundColor: '#d63031', // Red dots for visibility fill: true, tension: 0.3 }] }, options: { responsive: true, maintainAspectRatio: false, // Isse height control mein rahegi plugins: { legend: { display: false } }, scales: { y: { min: 50, max: 100, ticks: { stepSize: 10, callback: (v) => v + "%" } } } } }); } function openFeeModal() { navigateToSection('feeModal'); document.getElementById('feeModalV2').style.display = 'flex'; } function closeFeeModal() { document.getElementById('feeModalV2').style.display = 'none'; } // Passbook View Logic function viewMyPassbookV2() { const adm = document.getElementById('passAdmNo').value.trim(); if(!adm) return alert("Please enter your Admission Number!"); const body = document.getElementById('passbookBodyV2'); const resTable = document.getElementById('passbookTableV2'); body.innerHTML = ' Loading...'; resTable.style.display = 'block'; db.ref('studentPassbookV2/' + adm).once('value', snap => { if (snap.exists()) { let html = ""; snap.forEach(c => { const f = c.val(); const receiptData = { receiptNo: f.receiptNo || "---", admNo: f.admNo || adm, name: f.name || "Student", fatherName: f.father || f.fatherName || "---", joinDate: f.joinDate || "---", amount: f.amount || "0", paidDate: f.paidDate || "---", dueDate: f.dueDate || "---", phone: f.phone || "" }; // ✅ DEEPAK SIR: Yahan formatMyDate lagaya gaya hai html = ` ${receiptData.receiptNo} ${receiptData.admNo} ₹${receiptData.amount} ${formatMyDate(receiptData.dueDate)} ` + html; }); body.innerHTML = html; } else { body.innerHTML = 'Koi record nahi mila.'; } }); } // Download Logic // --- EXACT IMAGE 3 DESIGN (VIP Receipt) --- function generateVIPReceiptPhoto(data) { // Buttons ke spinner ka logic (Naya) const btn = event.target.closest('button'); if(btn) btn.innerHTML = ''; // Invisible div for photo generation const receiptDiv = document.createElement('div'); receiptDiv.style.width = "450px"; receiptDiv.style.padding = "40px"; receiptDiv.style.background = "#ffffff"; receiptDiv.style.color = "#333"; receiptDiv.style.border = "15px double #1a2a6c"; receiptDiv.style.fontFamily = "'Segoe UI', Arial, sans-serif"; receiptDiv.style.position = "fixed"; receiptDiv.style.top = "-10000px"; // Screen se bahar // VIP Design receiptDiv.innerHTML = `

7 HOUSE SHORTHAND INSTITUTE

Deepak Koli Shorthand & Typing Academy

Fee Receipt

Receipt No: ${data.receiptNo}
Adm No: ${data.admNo}
Student: ${data.name}
Father's Name: ${data.fatherName || data.father || '---'}
Joining Date: ${data.joinDate || '---'}
Amount Paid: ₹${data.amount}
Pay Date: ${data.paidDate || 'N/A'}

NEXT DUE DATE: ${formatMyDate(data.dueDate)}

7 HOUSE
STAMP
System Generated Receipt.
Generated on: ${new Date().toLocaleDateString()}
Deepak Koli
AUTHORISED SIGNATORY
`; document.body.appendChild(receiptDiv); // Html2Canvas Generation setTimeout(() => { html2canvas(receiptDiv, { scale: 2.5 }).then(canvas => { const link = document.createElement('a'); link.download = `7House_Receipt_${data.receiptNo}.png`; link.href = canvas.toDataURL("image/png"); link.click(); // cleanup document.body.removeChild(receiptDiv); if(btn) btn.innerHTML = ''; }); }, 300); // Thoda wait taaki layout render ho jaye } // 2. Alert Logic (Check if fee is due) function checkDueStatusV2(latestReceipt) { const alertBox = document.getElementById('feeDueAlert'); if(!latestReceipt || !latestReceipt.dueDate) return; const today = new Date(); const dueDate = new Date(latestReceipt.dueDate); // Agar aaj ki date Due Date se aage nikal gayi hai toh alert dikhao if (today > dueDate) { alertBox.style.display = 'block'; // Pop-up bhi de dete hain alert("⚠️ IMPORTANT: Aapki Shorthand Class ki fees due hai! Please pay as soon as possible."); } else { alertBox.style.display = 'none'; } } function openReportSection() { navigateToSection('reportSection'); goBackMenu(); document.getElementById('mainMenu').style.display = 'none'; document.getElementById('reportSection').style.display = 'block'; resetReportSelection(); loadAllDictationsForReport(); if(window.innerWidth <= 1024) toggleSidebar(); window.scrollTo(0,0); } function loadAllDictationsForReport() { const container = document.getElementById('reportListContainer'); container.innerHTML = '

Loading dictations...

'; db.ref('dictations').once('value', snap => { let h = ""; if(snap.exists()){ snap.forEach(child => { let d = child.val(); h += `
${d.title} (${d.category})
`; }); container.innerHTML = h; } else { container.innerHTML = "

No dictations found.

"; } }); } function filterDictationsForReport() { let input = document.getElementById('dictationSearch').value.toUpperCase(); let items = document.querySelectorAll('.report-item'); items.forEach(item => { item.style.display = item.innerText.toUpperCase().includes(input) ? "" : "none"; }); } function selectForReport(id, title) { selectedDictationForReport = { id: id, title: title }; document.getElementById('actualSelectedName').innerText = title; document.getElementById('reportSearchArea').style.display = 'none'; document.getElementById('messageBoxArea').style.display = 'block'; if (currentUser) { db.ref('users/' + currentUser.uid).once('value', snap => { if(snap.exists() && snap.val().phone) { document.getElementById('reportPhone').value = snap.val().phone; } }); } } function resetReportSelection() { selectedDictationForReport = null; document.getElementById('reportSearchArea').style.display = 'block'; document.getElementById('messageBoxArea').style.display = 'none'; } function sendReportToDeepakSir() { const msg = document.getElementById('reportMessage').value.trim(); const phone = document.getElementById('reportPhone').value.trim(); if(!selectedDictationForReport) return alert("Pehle dictation select karein!"); if(!msg || phone.length < 10) return alert("Deepak Sir: Message aur 10-digit number dono zaroori hain!"); db.ref('adminInbox/reports').push({ studentName: currentUser ? (currentUser.displayName || currentUser.email.split('@')[0]) : "Student", studentPhone: phone, dictationTitle: selectedDictationForReport.title, message: msg, timestamp: firebase.database.ServerValue.TIMESTAMP, status: "Unread", type: "Report" }).then(() => { alert("Deepak Sir tak report pahunch gayi hai!"); goBackMenu(); }); } function checkErrorBankAccess() { if (!currentUser) return alert("Pehle login karein!"); db.ref('users/' + currentUser.uid).once('value', snap => { const u = snap.val(); document.getElementById('errorBankModal').style.display = 'block'; // Agar bacha Paid hai (isPaid: true) if (u && u.isPaid === true) { document.getElementById('errorPayWall').style.display = 'none'; document.getElementById('premiumErrorContent').style.display = 'flex'; document.getElementById('premiumErrorContent').innerHTML = "Loading Outlines..."; loadPremiumErrorBank(); // Outlines load karne wala function } else { // Agar Free bacha hai document.getElementById('premiumErrorContent').style.display = 'none'; document.getElementById('errorPayWall').style.display = 'block'; } }); } function loadPremiumErrorBank() { db.ref('commonErrors').once('value', snap => { let h = ""; if(snap.exists()){ snap.forEach(child => { let d = child.val(); h += `
${d.word}
`; }); document.getElementById('premiumErrorContent').innerHTML = h; } else { document.getElementById('premiumErrorContent').innerHTML = "No outlines available right now."; } }); } function closeErrorBank() { document.getElementById('errorBankModal').style.display = 'none'; } // 1. आपके पुराने कोड में कहीं ये फंक्शन होगा // --- LOGOUT LOGIC --- function logout() { auth.signOut().then(() => location.reload()); } // --- DEEPAK SIR LIVE MUSIC SYNC (Direct from Admin) --- db.ref('portalMusic').on('value', snap => { const selector = document.getElementById('songSelector'); if (!selector) return; let html = ''; if(snap.exists()){ let groups = {}; // 1. गानों को कैटेगरी में बांटना snap.forEach(child => { let s = child.val(); let cat = s.category || "General"; if(!groups[cat]) groups[cat] = []; groups[cat].push(s); }); // 2. "CLASS SONGS" को हमेशा टॉप पर रखने के लिए प्रायोरिटी देना const sortedCategories = Object.keys(groups).sort((a, b) => { if (a.includes("CLASS")) return -1; if (b.includes("CLASS")) return 1; return a.localeCompare(b); }); // 3. HTML Dropdown बनाना sortedCategories.forEach(category => { html += ``; groups[category].forEach(song => { // Class songs के लिए अलग स्टाइल let isClass = category.includes("CLASS") ? 'style="font-weight:bold; color:#b8860b;"' : ''; html += ``; }); html += ``; }); } else { // अगर डेटाबेस खाली है तो पुराने स्टैटिक गाने (Backup) html += ``; html += ``; } selector.innerHTML = html; }); // --- SIDEBAR MUSIC PLAYER ENGINE --- function playSelectedSong() { const selector = document.getElementById('songSelector'); const player = document.getElementById('sidebarAudio'); const titleDisplay = document.getElementById('songTitle'); if (selector && selector.value !== "") { player.src = selector.value; player.controls = true; player.play(); const songName = selector.options[selector.selectedIndex].text; titleDisplay.innerText = "Playing: " + songName; // ✅ DEEPAK SIR LIVE MONITOR LOGIC (इसे जोड़ें) if (currentUser) { db.ref('liveListening/' + currentUser.uid).set({ studentName: currentUser.displayName || currentUser.email.split('@')[0], song: songName, time: new Date().toLocaleTimeString(), timestamp: firebase.database.ServerValue.TIMESTAMP }); } } else { if(player) player.pause(); // अगर गाना बंद किया, तो लिस्ट से नाम हटा दें if(currentUser) db.ref('liveListening/' + currentUser.uid).remove(); } } // 📅 DEEPAK SIR: Date ko Month Name mein badalne wala function // 📅 Date Formatter function formatMyDate(dateStr) { if (!dateStr || dateStr === "---") return "---"; const date = new Date(dateStr); if (isNaN(date)) return dateStr; const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; return `${date.getDate()} ${months[date.getMonth()]} ${date.getFullYear()}`; } // 🪪 Load Card Function function loadMyICard() { const adm = document.getElementById('searchMyCard').value.trim(); if(!adm) return alert("Please enter your Admission Number."); db.ref('iCards/' + adm).once('value', snap => { if(snap.exists()){ const d = snap.val(); // 📝 Data Fill Karna document.getElementById('cardName').innerText = d.name || "---"; document.getElementById('cardAdm').innerText = d.admNo || adm; document.getElementById('cardFather').innerText = d.father || "---"; document.getElementById('cardPhone').innerText = d.phone || "---"; document.getElementById('cardJoin').innerText = formatMyDate(d.joinDate); document.getElementById('cardExp').innerText = formatMyDate(d.expDate); // 🖼️ Photo Set Karna const photoEl = document.getElementById('cardPhoto'); if(photoEl) photoEl.src = d.photo || "vishnu.jpg"; // 🚀 Modal aur Container Dono ko Show karna (Double Safety) const modal = document.getElementById('iCardModal'); const container = document.getElementById('idCardContainer'); if(modal) modal.style.display = 'block'; if(container) container.style.display = 'block'; console.log("I-Card Loaded for Adm: " + adm); } else { alert("Identity card record not found for this Admission Number."); } }); } function closeModal() { document.getElementById('iCardModal').style.display = 'none'; } // 📥 Download Card function downloadCard() { const card = document.getElementById('idCardContainer'); html2canvas(card, { scale: 3, useCORS: true }).then(canvas => { const link = document.createElement('a'); link.download = '7House_ICard.png'; link.href = canvas.toDataURL(); link.click(); }); } // 1. Dropdown fill karna (1-528) function initTranscriptionSystem() { const pSelect = document.getElementById('transPassage'); if(!pSelect) return; pSelect.innerHTML = ""; for (let i = 1; i <= 528; i++) { let opt = document.createElement('option'); opt.value = "KC Passage " + i; opt.innerText = "KC Passage " + i; pSelect.appendChild(opt); } const today = new Date().toISOString().split('T')[0]; document.getElementById('transDate').value = today; } // Page load par system chalu ho window.addEventListener('DOMContentLoaded', initTranscriptionSystem); // 1. Modal Kholne aur Mobile Number set karne ka logic function openTranscriptionModal() { document.getElementById('transcriptionModal').style.display = 'flex'; // Pehle localStorage check karein (agar bacha pehle daal chuka hai) let savedPhone = localStorage.getItem('user_last_phone'); const phoneInput = document.getElementById('transPhone'); if(savedPhone) { phoneInput.value = savedPhone; } else if(currentUser) { // Agar local mein nahi hai toh Firebase profile se uthayein db.ref('users/' + currentUser.uid).once('value', snap => { if(snap.exists() && snap.val().phone) { phoneInput.value = snap.val().phone; localStorage.setItem('user_last_phone', snap.val().phone); } }); } if(window.innerWidth <= 768) toggleSidebar(); } function closeTranscriptionModal() { document.getElementById('transcriptionModal').style.display = 'none'; } // 2. Submit & Save Logic (With 2 Photos & Auto-Phone) async function saveTranscription() { if(!currentUser) return alert("Please login first to submit transcription!"); const phone = document.getElementById('transPhone').value.trim(); const date = document.getElementById('transDate').value; const passage = document.getElementById('transPassage').value; const mistakes = document.getElementById('transMistakes').value; const notes = document.getElementById('transNotes').value; const btn = document.getElementById('transSubmitBtn'); // Validation if(!phone || phone.length < 10) return alert("Please enter a valid 10-digit WhatsApp number!"); if(!date || !mistakes) return alert("Date and Mistakes count are required!"); // Button loading state const originalText = btn.innerText; btn.innerText = "Uploading... Please Wait"; btn.disabled = true; // Local Storage mein save karein taaki agli baar na bharna pade localStorage.setItem('user_last_phone', phone); // Photo ko Base64 mein badalne ka helper function const getBase64 = (file) => new Promise((resolve) => { if(!file) return resolve("none"); const reader = new FileReader(); reader.readAsDataURL(file); reader.onload = () => resolve(reader.result); reader.onerror = () => resolve("none"); }); try { // Dono photos ko process karein const photo1 = await getBase64(document.getElementById('transPhoto1').files[0]); const photo2 = await getBase64(document.getElementById('transPhoto2').files[0]); const payload = { studentName: currentUser.displayName || currentUser.email.split('@')[0], phone: phone, date: date, passage: passage, mistakes: mistakes, notes: notes, photo1: photo1, photo2: photo2, timestamp: firebase.database.ServerValue.TIMESTAMP }; const newEntryKey = db.ref().child('dailyTranscriptionLogs').push().key; const updates = {}; // Path 1: Aapke Admin Panel ke liye updates['/dailyTranscriptionLogs/' + newEntryKey] = payload; // Path 2: Student ki apni history ke liye updates['/users/' + currentUser.uid + '/transcriptionHistory/' + newEntryKey] = payload; await db.ref().update(updates); alert("Great job! Your work and photos have been submitted to Deepak Sir. ✅"); closeTranscriptionModal(); // Form Reset document.getElementById('transMistakes').value = ""; document.getElementById('transNotes').value = ""; document.getElementById('transPhoto1').value = ""; document.getElementById('transPhoto2').value = ""; } catch(e) { alert("Error: " + e.message); } finally { btn.innerText = originalText; btn.disabled = false; } } // 3. History dikhane ka Logic (With Card View Fix) function showTranscriptionHistory() { if(!currentUser) return alert("Deepak Sir: Pehle Login karein!"); navigateToSection('transHistory'); goBackMenu(); document.getElementById('mainMenu').style.display = 'none'; const viewArea = document.getElementById('transHistoryView'); if(viewArea) viewArea.style.display = 'block'; const container = document.getElementById('transHistoryCards'); if(!container) return; container.innerHTML = '

Loading records...

'; db.ref('users/' + currentUser.uid + '/transcriptionHistory').orderByChild('timestamp').on('value', snap => { let h = ""; if(snap.exists()) { let records = []; snap.forEach(child => { records.push(child.val()); }); records.reverse().forEach(d => { let displayDate = d.date ? formatMyDate(d.date) : "---"; // Photo check logic let photoHTML = ""; if(d.photo1 && d.photo1 !== "none") { photoHTML = `
${d.photo2 && d.photo2 !== "none" ? `` : ''}
Click photo to enlarge`; } h += `
${displayDate} ${d.mistakes || '0'} Mistakes

${d.passage || 'KC Passage'}

Sir's Guidance / Notes:

"${d.notes || 'No notes added.'}"

${photoHTML}
`; }); container.innerHTML = h; } else { container.innerHTML = '
Deepak Sir, abhi tak koi record nahi mila.
'; } }); } function downloadICard() { const card = document.getElementById('idCardContainer'); html2canvas(card, { scale: 3, useCORS: true }).then(canvas => { const link = document.createElement('a'); link.download = '7House_ICard.png'; link.href = canvas.toDataURL("image/png"); link.click(); }); } function showICard() { navigateToSection('icard'); if(!currentUser) return alert("Pehle Login karein!"); // Purane saare parda (sections) band karo goBackMenu(); // Dashboard chhupao aur I-Card wala dabba dikhao document.getElementById('mainMenu').style.display = 'none'; document.getElementById('iCardView').style.display = 'block'; // Mobile par sidebar ko band karne ke liye if(window.innerWidth <= 768) toggleSidebar(); window.scrollTo(0,0); } // ========================================== // 🚀 DEEPAK SIR: ASK ANYTHING SECTION (PERMANENT FIX) // ========================================== function openAskSection() { if (!currentUser) { alert("Please login first to ask questions or submit queries!"); auth.signInWithPopup(new firebase.auth.GoogleAuthProvider()).catch(err => { console.log("Login popup closed"); }); return; } navigateToSection('askSection'); console.log("Deepak Sir: Opening Ask Section..."); // 1. डैशबोर्ड को पूरी तरह छिपाओ const mainMenu = document.getElementById('mainMenu'); if (mainMenu) mainMenu.style.display = 'none'; // 2. पुराने किसी भी पर्डे को साफ करो const views = ['listView', 'practiceArea', 'gameView', 'messageView', 'historyView', 'reportSection', 'iCardView']; views.forEach(id => { const el = document.getElementById(id); if (el) el.style.display = 'none'; }); // 3. अब 'askAnythingFinal' को दिखाओ const askBox = document.getElementById('askAnythingFinal'); if (askBox) { askBox.style.display = 'block'; // इसे दिखाना है // WhatsApp number autofill if (currentUser) { db.ref('users/' + currentUser.uid).once('value', snap => { if (snap.exists() && snap.val().phone) { const phoneInput = document.getElementById('doubtPhone'); if(phoneInput) phoneInput.value = snap.val().phone; } }); } } else { alert("Deepak Sir: 'askAnythingFinal' वाली ID HTML में नहीं मिली!"); } window.scrollTo(0, 0); } // Deepak Sir, ye function purana wala hata kar naya wala rakhein function sendDoubtToDeepakSir() { if (!currentUser) { return alert("Please login first to send your query!"); } const msg = document.getElementById('askMessage').value.trim(); const phone = document.getElementById('doubtPhone').value.trim(); if (phone.length < 10) { return alert("Please enter a valid 10-digit WhatsApp number!"); } if (!msg) { return alert("Please enter your question or query!"); } db.ref('adminInbox/reports').push({ studentName: currentUser.displayName || currentUser.email.split('@')[0], studentPhone: phone, message: msg, status: "Unread", type: "Doubt", timestamp: firebase.database.ServerValue.TIMESTAMP }).then(() => { alert("Your question has been sent to Deepak Sir! You will receive a response soon."); document.getElementById('askMessage').value = ""; goBackMenu(); }).catch(err => { alert("Network error! Message could not be sent."); }); } // Deepak Sir: Ye bache ke click karte hi menu ko side kar dega document.addEventListener('click', function(e) { const right = document.getElementById('rightSidebar'); // 2. Right sidebar close logic (Mobile fix) if (window.innerWidth <= 1199 && right && right.classList.contains('active')) { const userBtn = e.target.closest('#userStatusBtn') || e.target.closest('#userStatus'); // Agar click sidebar ke andar nahi hua aur profile button par bhi nahi hua if (!right.contains(e.target) && !userBtn) { right.classList.remove('active'); const backdrop = document.getElementById('sidebarBackdrop'); if (backdrop) backdrop.style.display = 'none'; } } }); // 🪪 DEEPAK SIR: I-Card Report Problem Engine window.submitProblem = function() { // 🔴 IDs theek kar di hain: cardAdm aur cardName const adm = document.getElementById('cardAdm').innerText; const name = document.getElementById('cardName').innerText; const msg = document.getElementById('studentComment').value.trim(); if(!msg) return alert("Please write your comment or correction request!"); if(adm === "----") return alert("Please enter Admission Number and click VIEW first!"); const problemData = { admNo: adm, studentName: name, message: msg, timestamp: firebase.database.ServerValue.TIMESTAMP, date: new Date().toLocaleString('en-IN'), status: "Pending" }; db.ref('studentReports').push(problemData).then(() => { alert("Your report has been sent to the admin successfully! ✅"); document.getElementById('studentComment').value = ""; }).catch(err => alert("Error: " + err.message)); } function submitReport() { // 1. Textarea se message lena (ID: reportInput) const reportText = document.getElementById('reportInput').value.trim(); // 2. Modal ke andar se data uthana (Check karein ki ye IDs wahan maujood hain) // Hum direct modal ke text se data uthayenge const adm = document.getElementById('modalAdm').innerText; const name = document.getElementById('modalName').innerText; if(!reportText) { return alert("Please enter your report details!"); } // 🔥 "undefined" se bachne ke liye hum check kar rahe hain const reportData = { admNo: adm || "N/A", studentName: name || "Student", // Agar naam nahi mila toh 'Student' dikhayega message: reportText, timestamp: firebase.database.ServerValue.TIMESTAMP }; // 🚀 Database mein bhej rahe hain db.ref('adminInbox').push(reportData).then(() => { alert("Deepak Sir ko report bhej di gayi hai! ✅"); document.getElementById('reportInput').value = ""; // Box khali karein }).catch(e => { alert("Error: " + e.message); }); } // ================= MOBILE TOUCH SWIPE TO CLOSE SIDEBARS ================= // ================= MOBILE TOUCH SWIPE TO CLOSE BOTH SIDEBARS ================= let touchStartX = 0; let touchStartY = 0; let touchEndX = 0; let touchEndY = 0; document.addEventListener('touchstart', function(e) { touchStartX = e.changedTouches[0].clientX; touchStartY = e.changedTouches[0].clientY; }, { passive: true }); document.addEventListener('touchend', function(e) { touchEndX = e.changedTouches[0].clientX; touchEndY = e.changedTouches[0].clientY; handleSidebarSwipe(); }, { passive: true }); function handleSidebarSwipe() { const leftSidebar = document.getElementById('leftSidebar'); const rightSidebar = document.getElementById('rightSidebar'); const diffX = touchEndX - touchStartX; const diffY = touchEndY - touchStartY; // Check: Swipe horizontal hona chahiye (vertical scroll ke sath conflict na ho) if (Math.abs(diffX) > Math.abs(diffY)) { // 1. Agar Left Sidebar khula hai aur Left taraf slide kiya (diffX <= -40px) if (leftSidebar && leftSidebar.classList.contains('active')) { if (diffX < -40) { closeSidebar(); } } // 2. Agar Right Sidebar khula hai aur Right taraf slide kiya (diffX >= 40px) if (rightSidebar && rightSidebar.classList.contains('active')) { if (diffX > 40) { closeSidebar(); } } } } // 🎆 Realistic Fireworks Animation Engine function triggerFireworks() { if (typeof confetti !== 'function') return; const duration = 3.5 * 1000; const animationEnd = Date.now() + duration; const defaults = { startVelocity: 30, spread: 360, ticks: 60, zIndex: 9999999 }; function randomInRange(min, max) { return Math.random() * (max - min) + min; } const interval = setInterval(function() { const timeLeft = animationEnd - Date.now(); if (timeLeft <= 0) { return clearInterval(interval); } const particleCount = 60 * (timeLeft / duration); // Left aur Right se do taraf se aatisbaji ke gole confetti(Object.assign({}, defaults, { particleCount, origin: { x: randomInRange(0.1, 0.3), y: Math.random() - 0.2 }, colors: ['#ffca28', '#2ecc71', '#e74c3c', '#3498db', '#f39c12'] })); confetti(Object.assign({}, defaults, { particleCount, origin: { x: randomInRange(0.7, 0.9), y: Math.random() - 0.2 }, colors: ['#ffca28', '#2ecc71', '#e74c3c', '#3498db', '#f39c12'] })); }, 250); }