Skip to content

Rcm body scanner app #592

@hdhdjdxizei-cpu

Description

@hdhdjdxizei-cpu
<title>RCM Body Scanner</title> <style> * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
    body {
        background-color: #2112C5;
        color: #000000;
        line-height: 1.6;
        padding: 7px;
        max-width: 800px;
        margin: 0 auto;
    }
    
    .container {
        background-color: white;
        border-radius: 5px;
        box-shadow: 0 5px 20px rgba(0, 0, 150, 0.1);
        overflow: hidden;
        margin-bottom: 20px;
    }
    
    header {
        background: linear-gradient(to right, #2c6fbb, #4a90e2);
        color: white;
        padding: 20px;
        text-align: center;
    }
    
    header h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    header p {
        opacity: 0.9;
        font-size: 14px;
    }
    
    .logo {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .logo i {
        font-size: 29px;
    }
    
    .ai-badge {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        background: rgba(255,255,255,0.2);
        padding: 4px 12px;
        border-radius: 20px;
        font-size: 12px;
        margin-top: 10px;
    }
    
    .tab-container {
        display: flex;
        background-color: #e6f0ff;
        border-bottom: 2px solid #4a90e2;
    }
    
    .tab {
        flex: 1;
        padding: 15px;
        text-align: center;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .tab.active {
        background-color: #4a90e2;
        color: white;
    }
    
    .tab-content {
        display: none;
        padding: 20px;
    }
    
    .tab-content.active {
        display: block;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        color: #2c6fbb;
    }
    
    input, select {
        width: 100%;
        padding: 12px 15px;
        border: 1px solid #ccc;
        border-radius: 8px;
        font-size: 16px;
        transition: border 0.3s;
    }
    
    input:focus, select:focus {
        border-color: #4a90e2;
        outline: none;
    }
    
    .gender-options {
        display: flex;
        gap: 20px;
        margin-top: 10px;
    }
    
    .gender-option {
        flex: 1;
        text-align: center;
        padding: 12px;
        border: 2px solid #ddd;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .gender-option.selected {
        border-color: #4a90e2;
        background-color: #e6f0ff;
    }
    
    .gender-option i {
        font-size: 24px;
        margin-bottom: 5px;
        display: block;
    }
    
    .btn {
        display: block;
        width: 100%;
        padding: 15px;
        background-color: #4a90e2;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 18px;
        font-weight: 600;
        cursor: pointer;
        transition: background-color 0.3s;
        margin-top: 20px;
    }
    
    .btn:hover {
        background-color: #2c6fbb;
    }
    
    .btn-share {
        background-color: #2ecc71;
        margin-top: 10px;
    }
    
    .btn-share:hover {
        background-color: #27ae60;
    }
    
    .btn-madison {
        background-color: #e74c3c;
        margin-top: 10px;
    }
    
    .btn-madison:hover {
        background-color: #c0392b;
    }
    
    .report-section {
        background-color: #f9f9f9;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .report-section h3 {
        color: #2c6fbb;
        margin-bottom: 15px;
        padding-bottom: 8px;
        border-bottom: 1px solid #ddd;
    }
    
    .metric {
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        padding: 8px;
        background-color: white;
        border-radius: 6px;
    }
    
    .metric-value {
        font-weight: 600;
    }
    
    .metric.normal .metric-value {
        color: #2ecc71;
    }
    
    .metric.warning .metric-value {
        color: #e74c3c;
    }
    
    .product-list {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-card {
        background-color: white;
        border-radius: 10px;
        padding: 15px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
        border-left: 5px solid #4a90e2;
        position: relative;
    }
    
    .madison-badge {
        position: absolute;
        top: 10px;
        right: 10px;
        background: linear-gradient(45deg, #e74c3c, #c0392b);
        color: white;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 10px;
        font-weight: 600;
    }
    
    .product-card h4 {
        color: #2c6fbb;
        margin-bottom: 8px;
    }
    
    .product-card p {
        font-size: 14px;
        color: #666;
        margin-bottom: 10px;
    }
    
    .priority {
        display: inline-block;
        padding: 3px 8px;
        background-color: #ff9900;
        color: white;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 600;
        margin-top: 5px;
    }
    
    .priority.critical {
        background-color: #e74c3c;
    }
    
    .priority.high {
        background-color: #f39c12;
    }
    
    .priority.medium {
        background-color: #3498db;
    }
    
    .priority.low {
        background-color: #95a5a6;
    }
    
    .deficiency-section {
        background-color: #fff3cd;
        border-left: 4px solid #ffc107;
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 6px;
    }
    
    .footer {
        text-align: center;
        padding: 20px;
        color: #777;
        font-size: 14px;
        border-top: 1px solid #eee;
        margin-top: 20px;
    }
    
    .chart-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-top: 15px;
    }
    
    .chart {
        background-color: white;
        border-radius: 10px;
        padding: 15px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    }
    
    .chart-title {
        font-weight: 600;
        margin-bottom: 10px;
        color: #2c6fbb;
        font-size: 14px;
    }
    
    .chart-bar {
        height: 20px;
        background-color: #e6f0ff;
        border-radius: 10px;
        overflow: hidden;
        position: relative;
        margin-bottom: 5px;
    }
    
    .chart-fill {
        height: 100%;
        background-color: #4a90e2;
        border-radius: 10px;
        transition: width 1s ease-in-out;
    }
    
    .chart-value {
        position: absolute;
        right: 10px;
        top: 0;
        height: 100%;
        display: flex;
        align-items: center;
        font-weight: 600;
        font-size: 12px;
        color: #333;
    }
    
    .chart-info {
        font-size: 12px;
        color: #666;
        text-align: center;
        margin-top: 5px;
    }
    
    .no-deficiencies {
        text-align: center;
        padding: 40px;
        color: #28a745;
        font-size: 18px;
    }
    
    .ai-powered {
        background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
        color: white;
        padding: 15px;
        border-radius: 10px;
        margin-bottom: 20px;
        text-align: center;
    }
    
    @media (max-width: 600px) {
        .chart-container {
            grid-template-columns: 1fr;
        }
        .gender-options {
            flex-direction: column;
            gap: 10px;
        }
    }
    
    .hidden {
        display: none !important;
    }
    
    .share-options {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 1px;
        margin-top: 15px;
    }
    
    .share-btn {
        background: #f8f9fa;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .share-btn:hover {
        background: #e9ecef;
        transform: translateY(-2px);
    }
    
    .share-btn i {
        font-size: 0px;
    }
    
    .share-btn.whatsapp {
        color: #25D366;
    }
    
    .share-btn.facebook {
        color: #1877F2;
    }
    
    .share-btn.telegram {
        color: #0088cc;
    }
    
    .share-btn.email {
        color: #EA4335;
    }
    
    .share-btn.print {
        color: #4285F4;
    }
    
    .share-btn.download {
        color: #34A853;
    }
    
    .modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
        align-items: center;
        justify-content: center;
    }
    
    .modal.active {
        display: flex;
    }
    
    .modal-content {
        background: white;
        border-radius: 15px;
        padding: 25px;
        width: 90%;
        max-width: 500px;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }
    
    .modal-header h3 {
        color: #2c6fbb;
    }
    
    .close-modal {
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #666;
    }
    
    .report-format {
        background: #f8f9fa;
        border-radius: 10px;
        padding: 15px;
        margin-bottom: 15px;
        border: 1px solid #ddd;
    }
    
    .report-format h4 {
        margin-bottom: 10px;
        color: #2c6fbb;
    }
    
    .format-options {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }
    
    .format-btn {
        padding: 8px 15px;
        background: white;
        border: 1px solid #4a90e2;
        border-radius: 5px;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .format-btn.active {
        background: #4a90e2;
        color: white;
    }
</style>

RCM Body Scanner Health Report

Powered by Google AI • Real Report Assistance • RCM Health Care Products

    <div class="tab-container">
        <div class="tab active" data-tab="input">Health Data Input</div>
        <div class="tab " data-tab="report">AI Health Report</div>
        <div class="tab" data-tab="products">RCM Health Care</div>
        <div class="tab" data-tab="share">Share Report</div>
    </div>
    
    <!-- Input Tab -->
    <div class="tab-content active" id="input">
        <div class="ai-powered">
            <i class="fas fa-brain"></i> Google AI analyzes your body composition data in real-time
        </div>
        <form id="health-form">
            <div class="form-group">
                <label for="name">Full Name</label>
                <input type="text" id="name" placeholder="Enter your full name" required>
            </div>
            
            <div class="form-group">
                <label>Gender</label>
                <div class="gender-options">
                    <div class="gender-option selected" data-gender="male">
                        <i class="fas fa-male"></i>
                        <div>Male</div>
                    </div>
                    <div class="gender-option" data-gender="female">
                        <i class="fas fa-female"></i>
                        <div>Female</div>
                    </div>
                </div>
                <input type="hidden" id="gender" value="male" required>
            </div>
            
            <div class="form-group">
                <label for="age">Age (Years)</label>
                <input type="number" id="age" min="1" max="120" placeholder="Enter your age" required>
            </div>
            
            <div class="form-group">
                <label for="height">Height (cm)</label>
                <input type="number" id="height" min="50" max="250" placeholder="Height in centimeters" required>
            </div>
            
            <div class="form-group">
                <label for="weight">Weight (kg)</label>
                <input type="number" id="weight" min="10" max="300" step="0.1" placeholder="Weight in kilograms" required>
            </div>
            
            <div class="form-group">
                <label for="body-fat">Body Fat Percentage (%)</label>
                <input type="number" id="body-fat" min="1" max="60" step="0.1" placeholder="Body fat percentage" required>
            </div>
            
            <div class="form-group">
                <label for="water">Water Percentage (%)</label>
                <input type="number" id="water" min="20" max="80" step="0.1" placeholder="Body water percentage" required>
            </div>
            
            <div class="form-group">
                <label for="muscle-mass">Muscle Mass (kg)</label>
                <input type="number" id="muscle-mass" min="10" max="150" step="0.1" placeholder="Muscle mass in kg" required>
            </div>
            
            <div class="form-group">
                <label for="bone-mass">Bone Mass (kg)</label>
                <input type="number" id="bone-mass" min="0.5" max="20" step="0.1" placeholder="Bone mass in kg" required>
            </div>
            
            <div class="form-group">
                <label for="visceral-fat">Visceral Fat Level</label>
                <input type="number" id="visceral-fat" min="1" max="30" placeholder="Visceral fat level (1-30)" required>
            </div>
            
            <div class="form-group">
                <label for="bmr">BMR (Basal Metabolic Rate)</label>
                <input type="number" id="bmr" min="500" max="5000" placeholder="Calories per day" required>
            </div>
            
            <div class="form-group">
                <label for="metabolic-age">Metabolic Age</label>
                <input type="number" id="metabolic-age" min="10" max="120" placeholder="Metabolic age in years" required>
            </div>
            
            <div class="form-group">
                <label for="smr">Skeletal Muscle Ratio (%)</label>
                <input type="number" id="smr" min="10" max="60" step="0.1" placeholder="Skeletal muscle ratio" required>
            </div>
            
            <button type="submit" class="btn">
                <i class="fas fa-magic"></i> Generate AI Health Report
            </button>
        </form>
    </div>
    
    <!-- Report Tab -->
    <div class="tab-content" id="report">
        <div class="ai-powered">
            <i class="fas fa-chart-line"></i> Google AI Real Report Assistance - Comprehensive Analysis
        </div>
        <div class="report-section">
            <h3>Personal Information</h3>
            <div class="metric">
                <span>Name:</span>
                <span class="metric-value" id="report-name">-</span>
            </div>
            <div class="metric">
                <span>Gender:</span>
                <span class="metric-value" id="report-gender">-</span>
            </div>
            <div class="metric">
                <span>Age:</span>
                <span class="metric-value" id="report-age">-</span>
            </div>
        </div>
        
        <div class="report-section">
            <h3>AI Body Scanner Analysis</h3>
            <div class="chart-container" id="chart-container">
                <!-- Charts will be generated here -->
            </div>
        </div>
        
        <button class="btn btn-share" id="share-report-btn">
            <i class="fas fa-share-alt"></i> SHARE AI REPORT
        </button>
    </div>
    
    <!-- Products Tab -->
    <div class="tab-content" id="products">
        <div class="ai-powered">
            <i class="fas fa-capsules"></i> Nutricharge Health Care Products - AI Selected Recommendations
        </div>
        <div class="report-section">
            <h3>Nutricharge Personalized Recommendations</h3>
            <p id="products-subtitle">AI-powered supplement selection from Nutricharge Health Care Products:</p>
        </div>
        
        <div class="product-list" id="product-recommendations">
            <!-- Product cards will be generated here -->
        </div>
        
        <button class="btn btn-madison" id="order-btn">
            <i class="fas fa-shopping-cart"></i> Order Nutricharge Products
        </button>
        <button class="btn btn-share" id="share-products-btn">
            <i class="fas fa-share-alt"></i> Share Recommendations
        </button>
    </div>
    
    <!-- Share Tab -->
    <div class="tab-content" id="share">
        <div class="ai-powered">
            <i class="fas fa-share-square"></i> Share Your Health Report
        </div>
        
        <div class="report-section">
            <h3>Share Complete Report</h3>
            <p>Share your complete health analysis and product recommendations:</p>
            
            <div class="share-options">
                <div class="share-btn whatsapp" data-share="whatsapp">
                    <i class="fab fa-whatsapp"></i>
                    <span>WhatsApp</span>
                </div>
                <div class="share-btn facebook" data-share="facebook">
                    <i class="fab fa-facebook"></i>
                    <span>Facebook</span>
                </div>
                <div class="share-btn telegram" data-share="telegram">
                    <i class="fab fa-telegram"></i>
                    <span>Telegram</span>
                </div>
                <div class="share-btn email" data-share="email">
                    <i class="fas fa-envelope"></i>
                    <span>Email</span>
                </div>
                <div class="share-btn print" data-share="print">
                    <i class="fas fa-print"></i>
                    <span>Print</span>
                </div>
                <div class="share-btn download" data-share="download">
                    <i class="fas fa-download"></i>
                    <span>Download</span>
                </div>
            </div>
        </div>
        
        <div class="report-section">
            <h3>Advanced Sharing Options</h3>
            <div class="format-options">
                <button class="format-btn " data-format="summary">Summary Report</button>
                <button class="format-btn active" data-format="detailed">Detailed Report</button>
                <button class="format-btn" data-format="products">Product Recommendations</button>
                <button class="format-btn" data-format="all">Complete Package</button>
            </div>
            
            <div class="report-format">
                <h4>Generate Shareable Link</h4>
                <div class="form-group">
                    <input type="text" id="share-link" readonly placeholder="Your shareable link will appear here">
                </div>
                <button class="btn" id="generate-link-btn">
                    <i class="fas fa-link"></i> Generate Share Link
                </button>
            </div>
            
            <div class="report-format">
                <h4>Export Report</h4>
                <p>Export your health report in different formats:</p>
                <div class="share-options">
                    <div class="share-btn" data-export="pdf">
                        <i class="fas fa-file-pdf"></i>
                        <span>PDF</span>
                    </div>
                    <div class="share-btn" data-export="image">
                        <i class="fas fa-image"></i>
                        <span>Image</span>
                    </div>
                    <div class="share-btn" data-export="excel">
                        <i class="fas fa-file-excel"></i>
                        <span>Excel</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    
    <div class="footer">
        <p>Powered by Google AI • Real Report Assistance • rcm<strong> <a href="https://www.rcmworld.com/" >  OPEN RCM APP </a> </strong></p>
        <p>© 2026 RCM Health Solutions. All rights reserved. Consult healthcare professional.</p>
        
    </div>
</div>

<!-- Share Modal -->
<div class="modal" id="share-modal">
    <div class="modal-content">
        <div class="modal-header">
            <h3>Share Report</h3>
            <button class="close-modal" id="close-modal">&times;</button>
        </div>
        <div id="modal-content">
            <!-- Dynamic content will be loaded here -->
        </div>
    </div>
</div>

<script>
    // Database Structure (Using your SQL data)
    const database = {
        products: [
            { product_id: 1, product_name: 'Nutricharge BJ' },
            { product_id: 2, product_name: 'Nutricharge Man' },
            { product_id: 3, product_name: 'Nutricharge Woman' },
            { product_id: 4, product_name: 'Health Guard (Gamma Oryzanol)' },
            { product_id: 5, product_name: 'Nutricharge S5' },
            { product_id: 6, product_name: 'Nutricharge BioAge' },
            { product_id: 7, product_name: 'Nutricharge Veg Omega' },
            { product_id: 8, product_name: 'Nutricharge DHA 200' },
            { product_id: 9, product_name: 'Nutricharge Glycem' },
            { product_id: 10, product_name: 'Nutricharge View' },
            { product_id: 11, product_name: 'Nutricharge ProDiet Shake Coffee Hazelnut' },
            { product_id: 12, product_name: 'Nutricharge Slim & Fit' },
            { product_id: 13, product_name: 'Nutricharge Kids Nutrition' },
            { product_id: 14, product_name: 'Nutricharge All Pro Plant Protein' },
            { product_id: 15, product_name: 'Nutricharge Kesar Pista ProDiet' },
            { product_id: 16, product_name: 'Nutricharge Cocoa ProDiet' },
            { product_id: 17, product_name: 'Nutricharge Strawberry ProDiet' },
            { product_id: 18, product_name: 'Nutricharge Gainer' },
            { product_id: 19, product_name: 'Giloy Tulsi Navras Trikara' },
            { product_id: 20, product_name: 'Nutricharge Immunity Plus' }
        ],
        
        health_categories: [
            { category_id: 1, category_name: 'Immunity' },
            { category_id: 2, category_name: 'Iron Supplement for Women' },
            { category_id: 3, category_name: 'Brain Health' },
            { category_id: 4, category_name: 'Eye Health' },
            { category_id: 5, category_name: 'Skin & Beauty' },
            { category_id: 6, category_name: 'Heart Health' },
            { category_id: 7, category_name: 'High Blood Sugar' },
            { category_id: 8, category_name: 'Liver & Gut Health' },
            { category_id: 9, category_name: 'Bone & Joint Health' },
            { category_id: 10, category_name: 'Weight Management' },
            { category_id: 11, category_name: 'Weight Gain' },
            { category_id: 12, category_name: 'Digestion & Detoxification' },
            { category_id: 13, category_name: 'Men Health' },
            { category_id: 14, category_name: 'Kids Nutrition' }
        ],
        
        product_category_map: [
            { map_id: 1, product_id: 5, category_id: 1 },
            { map_id: 2, product_id: 20, category_id: 1 },
            { map_id: 3, product_id: 19, category_id: 1 },
            { map_id: 4, product_id: 3, category_id: 2 },
            { map_id: 5, product_id: 8, category_id: 3 },
            { map_id: 6, product_id: 14, category_id: 3 },
            { map_id: 7, product_id: 10, category_id: 4 },
            { map_id: 8, product_id: 5, category_id: 5 },
            { map_id: 9, product_id: 7, category_id: 5 },
            { map_id: 10, product_id: 7, category_id: 6 },
            { map_id: 11, product_id: 4, category_id: 6 },
            { map_id: 12, product_id: 9, category_id: 7 },
            { map_id: 13, product_id: 6, category_id: 8 },
            { map_id: 14, product_id: 1, category_id: 9 },
            { map_id: 15, product_id: 12, category_id: 10 },
            { map_id: 16, product_id: 11, category_id: 10 },
            { map_id: 17, product_id: 15, category_id: 10 },
            { map_id: 18, product_id: 16, category_id: 10 },
            { map_id: 19, product_id: 17, category_id: 10 },
            { map_id: 20, product_id: 18, category_id: 11 },
            { map_id: 21, product_id: 6, category_id: 12 },
            { map_id: 22, product_id: 2, category_id: 13 },
            { map_id: 23, product_id: 13, category_id: 14 }
        ]
    };

    // Extended product information
    const productDetails = {
        1: { description: "Premium bone & joint support formula", priority: 'high' },
        2: { description: "Advanced men's health & vitality formula", priority: 'medium', gender: "male" },
        3: { description: "Premium women's health formula", priority: 'medium', gender: "female" },
        4: { description: "Premium antioxidant & stress defense - GAMMA ORYZANOL", priority: 'high' },
        5: { description: "Elite stress relief & hydration support", priority: 'medium' },
        6: { description: "AI-recommended metabolic optimizer", priority: 'high' },
        7: { description: "Plant-based heart health essential", priority: 'medium' },
        8: { description: "High-potency brain & cognitive support", priority: 'medium' },
        9: { description: "Blood sugar management & glycemic control", priority: 'critical' },
        10: { description: "Advanced eye health & vision support", priority: 'medium' },
        11: { description: "Premium weight management shake - Coffee Hazelnut flavor", priority: 'critical' },
        12: { description: "Advanced fat burning & metabolism booster", priority: 'critical' },
        13: { description: "Complete nutrition for children's growth", priority: 'medium' },
        14: { description: "Elite plant protein for muscle growth & recovery", priority: 'high' },
        15: { description: "Weight management shake - Kesar Pista flavor", priority: 'critical' },
        16: { description: "Weight management shake - Cocoa flavor", priority: 'critical' },
        17: { description: "Weight management shake - Strawberry flavor", priority: 'critical' },
        18: { description: "Mass gainer for healthy weight gain", priority: 'high' },
        19: { description: "Traditional immunity booster with 9 herbs", priority: 'medium' },
        20: { description: "Advanced immunity support with vitamins & minerals", priority: 'medium' }
    };

    // DOM elements
    const tabs = document.querySelectorAll('.tab');
    const tabContents = document.querySelectorAll('.tab-content');
    const genderOptions = document.querySelectorAll('.gender-option');
    const healthForm = document.getElementById('health-form');
    const genderInput = document.getElementById('gender');
    const shareModal = document.getElementById('share-modal');
    const closeModal = document.getElementById('close-modal');
    let reportData = null;
    let deficiencies = [];
    let recommendedProducts = [];
    
    // Tab switching
    tabs.forEach(tab => {
        tab.addEventListener('click', () => {
            const tabId = tab.getAttribute('data-tab');
            tabs.forEach(t => t.classList.remove('active'));
            tab.classList.add('active');
            tabContents.forEach(content => {
                content.classList.remove('active');
                if (content.id === tabId) {
                    content.classList.add('active');
                }
            });
        });
    });
    
    // Gender selection
    genderOptions.forEach(option => {
        option.addEventListener('click', () => {
            genderOptions.forEach(opt => opt.classList.remove('selected'));
            option.classList.add('selected');
            genderInput.value = option.getAttribute('data-gender');
        });
    });
    
    // Form submission
    healthForm.addEventListener('submit', function(e) {
        e.preventDefault();
        
        if (!genderInput.value) {
            alert('Please select your gender');
            return;
        }
        
        // Get form values
        reportData = {
            name: document.getElementById('name').value || 'User',
            gender: genderInput.value,
            age: parseInt(document.getElementById('age').value) || 30,
            height: parseInt(document.getElementById('height').value) || 170,
            weight: parseFloat(document.getElementById('weight').value) || 70,
            bodyFat: parseFloat(document.getElementById('body-fat').value) || 22,
            water: parseFloat(document.getElementById('water').value) || 60,
            muscleMass: parseFloat(document.getElementById('muscle-mass').value) || 35,
            boneMass: parseFloat(document.getElementById('bone-mass').value) || 3.2,
            visceralFat: parseInt(document.getElementById('visceral-fat').value) || 5,
            bmr: parseInt(document.getElementById('bmr').value) || 1800,
            metabolicAge: parseInt(document.getElementById('metabolic-age').value) || 35,
            smr: parseFloat(document.getElementById('smr').value) || 42
        };
        
        // Calculate BMI
        const heightM = reportData.height / 100;
        reportData.bmi = (reportData.weight / (heightM * heightM)).toFixed(1);
        
        // Analyze deficiencies
        analyzeDeficiencies();
        
        // Update report tab
        document.getElementById('report-name').textContent = reportData.name;
        document.getElementById('report-gender').textContent = reportData.gender === 'male' ? 'Male' : 'Female';
        document.getElementById('report-age').textContent = reportData.age + ' years';
        
        // Update charts
        generateCharts();
        
        // Generate product recommendations
        generateProductRecommendations();
        
        // Switch to report tab
        document.querySelector('[data-tab="report"]').click();
    });
    
    // Deficiency Analysis
    function analyzeDeficiencies() {
        deficiencies = [];
        
        const idealWeightMin = (reportData.height - 100) - 3;
        const idealWeightMax = (reportData.height - 100) + 3;
        
        // Weight-related deficiencies
        if (reportData.weight < idealWeightMin) deficiencies.push('weight-low');
        if (reportData.weight > idealWeightMax) deficiencies.push('weight-high');
        
        // BMI deficiencies
        if (parseFloat(reportData.bmi) < 18.5) deficiencies.push('bmi-low');
        if (parseFloat(reportData.bmi) > 25) {
            deficiencies.push('bmi-high');
            deficiencies.push('weight-loss');
        }
        
        // Body fat deficiencies
        const idealFat = reportData.gender === 'male' ? 20 : 25;
        if (reportData.bodyFat > idealFat) deficiencies.push('fat-high');
        
        // Hydration deficiency
        if (reportData.water < 55) deficiencies.push('water-low');
        
        // Muscle mass deficiency
        const idealMusclePercentage = reportData.gender === 'male' ? 0.45 : 0.36;
        const currentMusclePercentage = reportData.muscleMass / reportData.weight;
        if (currentMusclePercentage < idealMusclePercentage) {
            deficiencies.push('muscle-low');
        }
        
        // Bone mass deficiency
        if (reportData.boneMass < 3) deficiencies.push('bone-low');
        
        // Visceral fat deficiency
        if (reportData.visceralFat > 3) deficiencies.push('visceral-high');
        
        // BMR deficiency
        const idealBmrMin = reportData.gender === 'male' ? 1700 : 1500;
        if (reportData.bmr < idealBmrMin) deficiencies.push('bmr-low');
        
        // Metabolic age deficiency
        if (reportData.metabolicAge > reportData.age) {
            deficiencies.push('metabolic-age');
        }
        
        // Age-related deficiencies
        if (reportData.age > 40) {
            deficiencies.push('age-40plus');
        }
        
        return deficiencies;
    }
    
    // Generate Charts
    function generateCharts() {
        const chartContainer = document.getElementById('chart-container');
        chartContainer.innerHTML = '';
        
        const charts = [
            { 
                id: 'weight', 
                title: 'Weight / वजन', 
                value: reportData.weight, 
                min: (reportData.height - 100) - 3, 
                max: (reportData.height - 100) + 3, 
                unit: 'kg',
                info: 'Height in Cms -100 ±3 Kg'
            },
            { 
                id: 'bmi', 
                title: 'BMI / बॉडी मास इंडेक्स', 
                value: parseFloat(reportData.bmi), 
                min: 18.5, 
                max: 25, 
                unit: '',
                info: 'Normal: 20-25'
            },
            { 
                id: 'fat', 
                title: 'Body Fat % / शारीरिक वसा %', 
                value: reportData.bodyFat, 
                min: 0, 
                max: reportData.gender === 'male' ? 20 : 25, 
                unit: '%',
                info: reportData.gender === 'male' ? 'Male: 20% or less' : 'Female: 25% or less'
            },
            { 
                id: 'water', 
                title: 'Water % / शारीरिक जल%', 
                value: reportData.water, 
                min: 55, 
                max: 80, 
                unit: '%',
                info: 'Normal: 55% or more'
            },
            { 
                id: 'muscle', 
                title: 'Muscle Mass / मांसपेशियों का वजन', 
                value: reportData.muscleMass, 
                min: 0, 
                max: reportData.weight * 0.45, 
                unit: 'kg',
                info: ''
            },
            { 
                id: 'bone', 
                title: 'Bone Mass / हड्डी का वजन', 
                value: reportData.boneMass, 
                min: 3, 
                max: 5, 
                unit: 'kg',
                info: 'Normal: 3 KG or More'
            },
            { 
                id: 'visceral', 
                title: 'Visceral Fat / विसरल वसा', 
                value: reportData.visceralFat, 
                min: 1, 
                max: 3, 
                unit: '',
                info: 'Normal: 3 Or Less'
            },
            { 
                id: 'bmr', 
                title: 'BMR / शारीरिक चयापचय दर', 
                value: reportData.bmr, 
                min: reportData.gender === 'male' ? 1700 : 1500, 
                max: reportData.gender === 'male' ? 2000 : 1800, 
                unit: 'cal',
                info: reportData.gender === 'male' ? 'Male: 1700-2000 Calories' : 'Female: 1500-1800 Calories'
            },
            { 
                id: 'metabolic-age', 
                title: 'Metabolic Age / मेटाबोलिक उम्र', 
                value: reportData.metabolicAge, 
                min: 0, 
                max: reportData.age, 
                unit: 'years',
                info: 'Should be same or less than physical age'
            },
            { 
                id: 'smr', 
                title: 'SMR / स्केलेटल मसल रेशियो', 
                value: reportData.smr, 
                min: reportData.gender === 'male' ? 45 : 36, 
                max: 60, 
                unit: '%',
                info: reportData.gender === 'male' ? 'Male: 45% or more' : 'Female: 36% or more'
            }
        ];
        
        charts.forEach(chart => {
            const percentage = Math.min(100, Math.max(0, ((chart.value - chart.min) / (chart.max - chart.min)) * 100));
            const color = chart.value >= chart.min && chart.value <= chart.max ? '#2ecc71' : 
                         chart.value < chart.min ? '#3498db' : '#e74c3c';
            
            const chartElement = document.createElement('div');
            chartElement.className = 'chart';
            chartElement.innerHTML = `
                <div class="chart-title">${chart.title}</div>
                <div class="chart-bar">
                    <div class="chart-fill" style="width: ${percentage}%; background-color: ${color};"></div>
                    <div class="chart-value">${chart.value.toFixed(1)}${chart.unit}</div>
                </div>
                <div class="chart-info">${chart.info}</div>
            `;
            chartContainer.appendChild(chartElement);
        });
    }
    
    // Generate Product Recommendations
    function generateProductRecommendations() {
        const productContainer = document.getElementById('product-recommendations');
        const subtitle = document.getElementById('products-subtitle');
        productContainer.innerHTML = '';
        recommendedProducts = [];
        
        // Map deficiencies to health categories
        const deficiencyToCategory = {
            'weight-low': [11], // Weight Gain
            'weight-high': [10], // Weight Management
            'bmi-low': [11], // Weight Gain
            'bmi-high': [10], // Weight Management
            'fat-high': [10], // Weight Management
            'water-low': [1, 5, 12], // Immunity, Skin & Beauty, Digestion & Detoxification
            'muscle-low': [2, 14], // Men Health, Plant Protein
            'bone-low': [9], // Bone & Joint Health
            'visceral-high': [10], // Weight Management
            'bmr-low': [7, 10], // High Blood Sugar, Weight Management
            'metabolic-age': [6, 8], // Heart Health, Liver & Gut Health
            'age-40plus': [1, 3, 4, 6, 9] // Immunity, Brain, Eye, Heart, Bone & Joint
        };
        
        // Get relevant categories based on deficiencies
        const relevantCategories = new Set();
        deficiencies.forEach(def => {
            if (deficiencyToCategory[def]) {
                deficiencyToCategory[def].forEach(cat => relevantCategories.add(cat));
            }
        });
        
        // Add gender-specific categories
        if (reportData.gender === 'male') relevantCategories.add(13);
        if (reportData.gender === 'female') relevantCategories.add(2);
        
        // If no specific deficiencies, recommend general health products
        if (relevantCategories.size === 0) {
            relevantCategories.add(1); // Immunity
            relevantCategories.add(12); // Digestion & Detoxification
        }
        
        // Get products for relevant categories
        const categoryArray = Array.from(relevantCategories);
        const productScores = {};
        
        categoryArray.forEach(categoryId => {
            const productMappings = database.product_category_map.filter(m => m.category_id === categoryId);
            
            productMappings.forEach(mapping => {
                const product = database.products.find(p => p.product_id === mapping.product_id);
                if (product) {
                    if (!productScores[product.product_id]) {
                        productScores[product.product_id] = {
                            product: product,
                            score: 0,
                            categories: new Set()
                        };
                    }
                    productScores[product.product_id].score += 10;
                    productScores[product.product_id].categories.add(categoryId);
                }
            });
        });
        
        // Sort by score
        const sortedProducts = Object.values(productScores)
.filter(item => {
    const details = productDetails[item.product.product_id];

    // Agar product Male ya Female ke liye hai
    if (details && details.gender) {
        return details.gender === reportData.gender;
    }

    // Jo product common hai (gender nahi likha)
    return true;
})
.sort((a, b) => b.score - a.score);

        
        // Select top products
        const topProducts = sortedProducts.slice(0, 6);
        
        // Update subtitle
        const defCount = deficiencies.length;
        if (defCount === 0) {
            subtitle.textContent = "Excellent Health! Nutricharge Maintenance Program:";
        } else if (defCount <= 3) {
            subtitle.textContent = `Good Health! Nutricharge Optimization (${defCount} areas to improve):`;
        } else {
            subtitle.textContent = `Priority Health Support! Nutricharge Program (${defCount} areas to address):`;
        }
        
        // Generate product cards
        topProducts.forEach((item, index) => {
            const product = item.product;
            const details = productDetails[product.product_id] || {};
            const categories = Array.from(item.categories).map(catId => 
                database.health_categories.find(c => c.category_id === catId)?.category_name || ''
            ).filter(Boolean);
            
            const priorityClass = `priority ${details.priority || 'medium'}`;
            
            const productCard = document.createElement('div');
            productCard.className = 'product-card';
            productCard.innerHTML = `
                <div class="madison-badge">NUTRICHARGE</div>
                <h4>${product.product_name}</h4>
                <p>${details.description || 'Health supplement'}</p>
                <div class="deficiency-tags">Benefits: ${categories.join(', ')}</div>
                <div class="${priorityClass}">${(details.priority || 'medium').toUpperCase()} PRIORITY • Score: ${item.score}</div>
            `;
            productContainer.appendChild(productCard);
            
            recommendedProducts.push({
                name: product.product_name,
                description: details.description,
                categories: categories,
                priority: details.priority
            });
        });
    }
    
    // Share functionality
    document.getElementById('share-report-btn').addEventListener('click', () => {
        document.querySelector('[data-tab="share"]').click();
    });
    
    document.getElementById('share-products-btn').addEventListener('click', () => {
        showShareModal('products');
    });
    
    document.getElementById('order-btn').addEventListener('click', () => {
        window.open('https://www.nutricharge.in', '_blank');
    });
    
    // Share options
    document.querySelectorAll('.share-btn').forEach(btn => {
        btn.addEventListener('click', function() {
            const platform = this.getAttribute('data-share');
            const exportType = this.getAttribute('data-export');
            
            if (exportType) {
                handleExport(exportType);
            } else {
                shareReport(platform);
            }
        });
    });
    
    // Format options
    document.querySelectorAll('.format-btn').forEach(btn => {
        btn.addEventListener('click', function() {
            document.querySelectorAll('.format-btn').forEach(b => b.classList.remove('active'));
            this.classList.add('active');
        });
    });
    
    // Generate share link
    document.getElementById('generate-link-btn').addEventListener('click', generateShareLink);
    
    // Close modal
    closeModal.addEventListener('click', () => {
        shareModal.classList.remove('active');
    });
    
    // Share functions
    function showShareModal(type) {
        const modalContent = document.getElementById('modal-content');
        let content = '';
        
        if (type === 'products') {
            content = `
                <h4>Share Product Recommendations</h4>
                <p>Share these personalized Nutricharge recommendations:</p>
                <div class="product-list">
                    ${recommendedProducts.map((product, index) => `
                        <div class="product-card">
                            <h5>${product.name}</h5>
                            <p>${product.description}</p>
                            <small>Categories: ${product.categories.join(', ')}</small>
                        </div>
                    `).join('')}
                </div>
                <div class="share-options" style="margin-top: 20px;">
                    <div class="share-btn whatsapp" onclick="shareProducts('whatsapp')">
                        <i class="fab fa-whatsapp"></i> WhatsApp
                    </div>
                    <div class="share-btn email" onclick="shareProducts('email')">
                        <i class="fas fa-envelope"></i> Email
                    </div>
                </div>
            `;
        }
        
        modalContent.innerHTML = content;
        shareModal.classList.add('active');
    }
    
    function shareReport(platform) {
        if (!reportData) {
            alert('Please generate a report first');
            return;
        }
        
        const format = document.querySelector('.format-btn.active').getAttribute('data-format');
        let message = '';
        
        switch(format) {
            case 'summary':
                message = `Health Report Summary for ${reportData.name}:\n`;
                message += `Age: ${reportData.age}, Gender: ${reportData.gender}\n`;
                message += `BMI: ${reportData.bmi}, Body Fat: ${reportData.bodyFat}%\n`;
                message += `Metabolic Age: ${reportData.metabolicAge}\n`;
                message += `Deficiencies: ${deficiencies.length} areas identified`;
                break;
                
            case 'detailed':
                message = `Detailed Health Report - ${reportData.name}\n\n`;
                message += `Personal Information:\n`;
                message += `- Age: ${reportData.age} years\n`;
                message += `- Gender: ${reportData.gender}\n`;
                message += `- Height: ${reportData.height} cm\n`;
                message += `- Weight: ${reportData.weight} kg\n\n`;
                message += `Body Composition:\n`;
                message += `- BMI: ${reportData.bmi}\n`;
                message += `- Body Fat: ${reportData.bodyFat}%\n`;
                message += `- Muscle Mass: ${reportData.muscleMass} kg\n`;
                message += `- Bone Mass: ${reportData.boneMass} kg\n`;
                message += `- Water: ${reportData.water}%\n`;
                message += `- Visceral Fat: ${reportData.visceralFat}\n`;
                message += `- BMR: ${reportData.bmr} cal\n`;
                message += `- Metabolic Age: ${reportData.metabolicAge}\n`;
                message += `- SMR: ${reportData.smr}%\n\n`;
                message += `Health Areas to Improve: ${deficiencies.join(', ')}`;
                break;
                
            case 'products':
                message = `Nutricharge Product Recommendations for ${reportData.name}:\n\n`;
                recommendedProducts.forEach((product, index) => {
                    message += `${index + 1}. ${product.name}\n`;
                    message += `   ${product.description}\n`;
                    message += `   Categories: ${product.categories.join(', ')}\n\n`;
                });
                break;
                
            case 'all':
                message = `Complete Health Package - ${reportData.name}\n\n`;
                message += `Health Summary:\n`;
                message += `BMI: ${reportData.bmi}, Metabolic Age: ${reportData.metabolicAge}\n`;
                message += `Key Areas: ${deficiencies.slice(0, 3).join(', ')}\n\n`;
                message += `Recommended Products:\n`;
                recommendedProducts.slice(0, 3).forEach((product, index) => {
                    message += `${index + 1}. ${product.name}\n`;
                });
                message += `\nView full report: ${generateReportLink()}`;
                break;
        }
        
        switch(platform) {
            case 'whatsapp':
                window.open(`https://wa.me/?text=${encodeURIComponent(message)}`, '_blank');
                break;
            case 'facebook':
                window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(generateReportLink())}&quote=${encodeURIComponent(message)}`, '_blank');
                break;
            case 'telegram':
                window.open(`https://t.me/share/url?url=${encodeURIComponent(generateReportLink())}&text=${encodeURIComponent(message)}`, '_blank');
                break;
            case 'email':
                window.open(`mailto:?subject=Health Report - ${reportData.name}&body=${encodeURIComponent(message)}`);
                break;
            case 'print':
                window.print();
                break;
            case 'download':
                downloadReport();
                break;
        }
    }
    
    function generateShareLink() {
        if (!reportData) {
            alert('Please generate a report first');
            return;
        }
        
        // Create a unique ID for the report
        const reportId = 'report_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);
        
        // In a real application, you would save the report data to a database
        // and generate a link to retrieve it
        
        const link = `https://rcmhealth.com/report/${reportId}`;
        document.getElementById('share-link').value = link;
        
        // Copy to clipboard
        navigator.clipboard.writeText(link).then(() => {
            alert('Shareable link copied to clipboard!');
        });
    }
    
    function generateReportLink() {
        return window.location.href + '#report=' + btoa(JSON.stringify({
            name: reportData.name,
            timestamp: Date.now()
        }));
    }
    
    function handleExport(type) {
        if (!reportData) {
            alert('Please generate a report first');
            return;
        }
        
        switch(type) {
            case 'pdf':
                alert('PDF export would be generated here. In production, this would create a downloadable PDF.');
                break;
            case 'image':
                alert('Image export would be generated here. In production, this would create a downloadable image.');
                break;
            case 'excel':
                alert('Excel export would be generated here. In production, this would create a downloadable Excel file.');
                break;
        }
    }
    
    function downloadReport() {
        if (!reportData) {
            alert('Please generate a report first');
            return;
        }
        
        const report = {
            title: 'RCM Body Scanner Health Report',
            date: new Date().toISOString(),
            personalInfo: {
                name: reportData.name,
                gender: reportData.gender,
                age: reportData.age
            },
            bodyComposition: {
                height: reportData.height,
                weight: reportData.weight,
                bmi: reportData.bmi,
                bodyFat: reportData.bodyFat,
                muscleMass: reportData.muscleMass,
                boneMass: reportData.boneMass,
                water: reportData.water,
                visceralFat: reportData.visceralFat,
                bmr: reportData.bmr,
                metabolicAge: reportData.metabolicAge,
                smr: reportData.smr
            },
            deficiencies: deficiencies,
            recommendations: recommendedProducts
        };
        
        const dataStr = JSON.stringify(report, null, 2);
        const dataUri = 'data:application/json;charset=utf-8,'+ encodeURIComponent(dataStr);
        
        const exportFileDefaultName = `rcm-health-report-${reportData.name}-${Date.now()}.json`;
        
        const linkElement = document.createElement('a');
        linkElement.setAttribute('href', dataUri);
        linkElement.setAttribute('download', exportFileDefaultName);
        linkElement.click();
    }
    
    // Global functions for modal
    window.shareProducts = function(platform) {
        let message = `Nutricharge Product Recommendations for ${reportData.name}:\n\n`;
        recommendedProducts.forEach((product, index) => {
            message += `${index + 1}. ${product.name}\n`;
            message += `   ${product.description}\n\n`;
        });
        
        if (platform === 'whatsapp') {
            window.open(`https://wa.me/?text=${encodeURIComponent(message)}`, '_blank');
        } else if (platform === 'email') {
            window.open(`mailto:?subject=Nutricharge Recommendations&body=${encodeURIComponent(message)}`);
        }
        
        shareModal.classList.remove('active');
    };
    
    console.log('RCM Body Scanner loaded with complete sharing features');
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions