<?php
// Include session check for admin protection
include('session_check.php');

// Include database configuration
include('../../config/database.php');

if (isset($_GET['id'])) {
    $id = intval($_GET['id']);

    // Fetch proposal details
    $sql = "SELECT * FROM proposals WHERE id = $id";
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        $row = $result->fetch_assoc();
        echo "<div class='personal-details'>";
        echo "<p>" . $row["full_name"] . "</p>";
        echo "<p>" . $row["programme_of_study"] . "</p>";
        echo "<p>" . $row["level"] . "</p>";
        echo "<p>" . $row["contact"] . "</p>";
        echo "<p>" . $row["email"] . "</p>";
        echo "</div>";
        echo "<hr>";
        echo "<div class='business-details'>";
        echo "<h5>Business Idea Title: " . $row["business_idea_title"] . "</h5>";
        echo "<p><strong>Brief Description:</strong> " . $row["brief_description"] . "</p>";
        echo "<p><strong>Target Market:</strong> " . $row["target_market"] . "</p>";
        echo "<p><strong>Competitors:</strong> " . $row["competitors"] . "</p>";
        echo "<p><strong>Market Trends:</strong> " . $row["market_trends"] . "</p>";
        echo "<p><strong>Initial Capital:</strong> " . $row["initial_capital"] . "</p>";
        echo "<p><strong>Required Resources:</strong> " . $row["required_resources"] . "</p>";
        echo "<p><strong>Skills Needed:</strong> " . $row["skills_needed"] . "</p>";
        echo "<p><strong>Potential Partnerships:</strong> " . $row["potential_partnerships"] . "</p>";
        echo "<p><strong>Social Impact:</strong> " . $row["social_impact"] . "</p>";
        echo "<p><strong>Technological Elements:</strong> " . $row["technological_elements"] . "</p>";
        echo "</div>";
    } else {
        echo "<p>Proposal not found.</p>";
    }
} else {
    echo "<p>Invalid request.</p>";
}

$conn->close();
?>
