<?php
require_once 'auth.php';
requireAdminLogin();

require_once '../config/database.php';
$pdo = getDBConnection();

try {
    // Enable tatkal
    $stmt = $pdo->prepare("INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = ?");
    $stmt->execute(['tatkal_enabled', '1', '1']);
    
    // Ensure consultation type is active
    $stmt = $pdo->prepare("UPDATE consultation_types SET is_active = 1, base_price = 1500.00 WHERE type_code = 'tatkal_booking'");
    $stmt->execute();
    
    echo "✅ Tatkal enabled successfully!";
    
} catch (Exception $e) {
    echo "❌ Error: " . $e->getMessage();
}

// Redirect back to tatkal management
echo "<br><br><a href='tatkal_management_panel.php'>← Back to Tatkal Management</a>";
?>
