WinTechGuru Token System

Customer Registration

Your Tokens

Admin Dashboard

Total Customers
0
Total Tokens
0
Gold Plans
0
Diamond Plans
0
Master ID Name Mobile Plan Tokens Actions
`); printWindow.document.close(); } // SAVE AS PDF FUNCTION function saveAsPDF() { const printContainer = document.getElementById('printContainer'); if (printContainer.children.length === 0) { Swal.fire({ icon: 'info', title: 'No Tokens', text: 'First generate sample tokens or register a customer' }); return; } const element = document.createElement('div'); element.innerHTML = `

WinTechGuru Business Tokens

Generated on: ${new Date().toLocaleDateString('hi-IN')}

${printContainer.innerHTML}
`; const opt = { margin: 0.5, filename: `WinTechGuru_Tokens_${Date.now()}.pdf`, image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'cm', format: 'a4', orientation: 'portrait' } }; // Show loading Swal.fire({ title: 'Generating PDF...', text: 'Please wait', allowOutsideClick: false, didOpen: () => { Swal.showLoading(); } }); // Generate PDF html2pdf().set(opt).from(element).save().then(() => { Swal.fire({ icon: 'success', title: 'PDF Saved!', text: 'Your tokens have been saved as PDF' }); }); } // Generate Sample Tokens for Print/PDF function generateSampleTokens() { let html = ''; // Generate 4 sample tokens for(let i = 1; i <= 4; i++) { const planType = i % 2 === 0 ? 'SG' : 'SD'; const tokenClass = planType === 'SG' ? 'token-gold' : 'token-diamond'; const badgeClass = planType === 'SG' ? 'badge-gold' : 'badge-diamond'; html += `
WTG

WinTechGuru

WTG00${i}234${i}
${planType} TOKEN

Issue Date: ${new Date().toLocaleDateString('hi-IN')}

Name: Sample Customer ${i}

Mobile: 987654321${i}

WhatsApp: 987654321${i}

Aadhar: XXXX-XXXX-XXX${i}

PAN: AXXXX1234${i}

Valid after 20,000+ customers
`; } document.getElementById('printContainer').innerHTML = html; } // Generate Tokens for All Customers function generateTokensForAll() { if(tokens.length === 0) { Swal.fire('No Data', 'First register some customers', 'info'); return; } let html = ''; let tokenCount = 0; // Group tokens by customer const tokenGroups = {}; tokens.forEach(token => { if(!tokenGroups[token.customerId]) { tokenGroups[token.customerId] = []; } tokenGroups[token.customerId].push(token); }); // Generate HTML for all tokens Object.keys(tokenGroups).forEach(customerId => { const customerTokens = tokenGroups[customerId]; const customer = customers.find(c => c.id == customerId); customerTokens.forEach((token, index) => { if(tokenCount >= 12) return; // Limit to 12 tokens (3 pages) const tokenClass = token.planType === 'SG' ? 'token-gold' : token.planType === 'SD' ? 'token-diamond' : 'token-corporate'; const badgeClass = token.planType === 'SG' ? 'badge-gold' : token.planType === 'SD' ? 'badge-diamond' : 'badge-corporate'; html += `
WTG

WinTechGuru

${token.tokenNo}
${token.planType} TOKEN

Issue Date: ${token.issueDate}

Name: ${customer.name}

Mobile: ${token.mobile}

WhatsApp: ${token.whatsapp || token.mobile}

${token.aadhar ? `

Aadhar: ${token.aadhar}

` : ''} ${token.pan ? `

PAN: ${token.pan}

` : ''}
Valid after 20,000+ customers
`; tokenCount++; }); }); document.getElementById('printContainer').innerHTML = html; } // Admin Functions (same as before with minor adjustments) function showAdminLogin() { Swal.fire({ title: 'Admin Login', html: `
`, focusConfirm: false, preConfirm: () => { const user = document.getElementById('adminUser').value; const pass = document.getElementById('adminPass').value; if (user === 'admin' && pass === 'admin123') { showAdminPanel(); return true; } else { Swal.showValidationMessage('Invalid credentials'); return false; } } }); } function showAdminPanel() { showSection('admin'); updateAdminStats(); loadCustomerTable(); } function updateAdminStats() { document.getElementById('totalCustomers').textContent = customers.length; document.getElementById('totalTokens').textContent = tokens.length; document.getElementById('goldPlans').textContent = customers.filter(c => c.plan === 'Gold').length; document.getElementById('diamondPlans').textContent = customers.filter(c => c.plan === 'Diamond').length; } function loadCustomerTable() { let html = ''; customers.forEach(customer => { const customerTokens = tokens.filter(t => t.customerId === customer.id); html += ` ${customer.masterId} ${customer.name} ${customer.mobile} ${customer.plan} ${customerTokens.length} `; }); document.getElementById('customerTableBody').innerHTML = html; } function issueSingleToken() { Swal.fire({ title: 'Issue Single Token (SC)', html: `
`, showCancelButton: true, confirmButtonText: 'Issue Token', preConfirm: () => { const name = document.getElementById('scName').value; const mobile = document.getElementById('scMobile').value; const whatsapp = document.getElementById('scWhatsapp').value || mobile; if(!name || !mobile) { Swal.showValidationMessage('Fill all required fields'); return false; } const customer = { id: currentCustomerId++, masterId: 'SC' + (customers.filter(c => c.plan === 'Corporate').length + 1).toString().padStart(8, '0'), name: name, mobile: mobile, whatsapp: whatsapp, plan: 'Corporate', date: new Date().toLocaleDateString('hi-IN') }; customers.push(customer); const tokenNo = generateTokenNumbers(1, 'Corporate')[0]; tokens.push({ tokenNo: tokenNo, customerId: customer.id, customerName: name, planType: 'SC', issueDate: new Date().toLocaleDateString('hi-IN'), mobile: mobile, whatsapp: whatsapp }); localStorage.setItem('wtg_customers', JSON.stringify(customers)); localStorage.setItem('wtg_tokens', JSON.stringify(tokens)); updateAdminStats(); loadCustomerTable(); return { tokenNo, customer }; } }).then(result => { if(result.value) { Swal.fire({ icon: 'success', title: 'Token Issued!', html: `

Token No: ${result.value.tokenNo}

Master ID: ${result.value.customer.masterId}

Customer: ${result.value.customer.name}

` }); } }); } function sendBulkWhatsApp() { if(customers.length === 0) { Swal.fire('No Customers', 'First register some customers', 'info'); return; } let message = encodeURIComponent( "🎉 *WinTechGuru Business Partnership Program* 🎉\n\n" + "Congratulations! Your Token has been issued successfully.\n\n" + "*Important:*\n" + "• Tokens are valid after company reaches 20,000+ customers\n" + "• Non-transferable\n" + "• For any corrections, contact within 7 days\n\n" + "Thank you for being a valued Business Partner!\n\n" + "WinTechGuru Team" ); // For demo, use first customer's number const firstNumber = customers[0].mobile.replace('+', ''); window.open(`https://api.whatsapp.com/send?text=${message}&phone=${firstNumber}`, '_blank'); } function exportData() { const data = { customers: customers, tokens: tokens, exportDate: new Date().toISOString(), totalCustomers: customers.length, totalTokens: tokens.length }; const dataStr = JSON.stringify(data, null, 2); const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr); const link = document.createElement('a'); link.setAttribute('href', dataUri); link.setAttribute('download', `WinTechGuru_Data_${Date.now()}.json`); link.click(); Swal.fire('Exported!', 'Data exported successfully', 'success'); } function editCustomer(id) { const customer = customers.find(c => c.id === id); Swal.fire({ title: 'Edit Customer', html: ` `, showCancelButton: true, confirmButtonText: 'Save Changes', preConfirm: () => { customer.name = document.getElementById('editName').value; customer.mobile = document.getElementById('editMobile').value; customer.whatsapp = document.getElementById('editWhatsapp').value; customer.email = document.getElementById('editEmail').value; localStorage.setItem('wtg_customers', JSON.stringify(customers)); loadCustomerTable(); } }).then(() => { Swal.fire('Updated!', 'Customer details updated', 'success'); }); } function deleteCustomer(id) { Swal.fire({ title: 'Delete Customer?', text: 'This will delete all associated tokens', icon: 'warning', showCancelButton: true, confirmButtonColor: '#d33', confirmButtonText: 'Yes, delete!', cancelButtonText: 'Cancel' }).then((result) => { if (result.isConfirmed) { customers = customers.filter(c => c.id !== id); tokens = tokens.filter(t => t.customerId !== id); localStorage.setItem('wtg_customers', JSON.stringify(customers)); localStorage.setItem('wtg_tokens', JSON.stringify(tokens)); updateAdminStats(); loadCustomerTable(); Swal.fire('Deleted!', 'Customer has been deleted.', 'success'); } }); } function showDisclaimer() { Swal.fire({ title: 'Disclaimer', width: 800, html: `

WinTechGuru Business Partnership Program

Important Terms & Conditions
  1. Validity: Tokens are valid ONLY after company reaches 20,000+ customers
  2. Non-Refundable: No refunds - payment is for services/products already provided
  3. Prizes: Prizes awarded based on random internal criteria
  4. Single Prize Rule: Only one prize per customer if value exceeds ₹1000
  5. Company Decision: Company decision is final and binding
  6. Non-Transferable: Tokens cannot be transferred (only cancellable)
  7. Correction Period: Errors in token information must be corrected within 7 days
  8. Growth Target: This is a promotional program tied to company growth targets
  9. Customer Partner: Company customer is also a profit sharing partner
  10. No Guarantee: No guarantee of prize/cashback distribution
Note: By registering, you agree to all terms and conditions mentioned above.
`, confirmButtonText: 'I Understand & Agree' }); } // Initialize document.addEventListener('DOMContentLoaded', function() { // Show registration by default showSection('register'); // Generate sample tokens for print section generateSampleTokens(); });