// Real-time data simulation function simulateData() { return { production: Math.floor(Math.random() * 500) + 1000, inventory: Math.floor(Math.random() * 2000) + 4000, revenue: Math.floor(Math.random() * 30000) + 15000, dues: Math.floor(Math.random() * 10000) + 8000 }; } // Update dashboard stats in real-time function updateDashboardStats() { const data = simulateData(); document.querySelectorAll('[data-stat="production"]').forEach(el => el.textContent = data.production.toLocaleString()); document.querySelectorAll('[data-stat="inventory"]').forEach(el => el.textContent = data.inventory.toLocaleString()); document.querySelectorAll('[data-stat="revenue"]').forEach(el => `₹${data.revenue.toLocaleString()}`); document.querySelectorAll('[data-stat="dues"]').forEach(el => `₹${data.dues.toLocaleString()}`); } // Initialize app document.addEventListener('DOMContentLoaded', function() { // Start real-time updates setInterval(updateDashboardStats, 5000); updateDashboardStats(); console.log('BrickMaster Pro initialized'); // Check subscription status (mock function) function checkSubscription() { // In a real app, this would call your backend API const subscriptionStatus = 'active'; // 'trial', 'active', or 'inactive' const trialEndDate = '2024-03-15'; // Only relevant for trial status const planExpiryDate = '2024-12-31'; // Only relevant for active status if (subscriptionStatus === 'inactive') { showPaywall(); } } // Show paywall function function showPaywall() { const paywallHTML = `
Please subscribe to continue managing your factory.
Billed monthly
Billed annually (save 17%)