<?php
// Enable Fee Due Reminders
$host = 'localhost';
$dbname = 'zashofco_sm';
$username = 'zashofco_sm';
$password = 'Doel@24434#';

try {
    $pdo = new PDO("mysql:host=$host;dbname=$dbname;charset=utf8mb4", $username, $password, [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
        PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        PDO::ATTR_EMULATE_PREPARES => false,
    ]);

    echo "<h2>Enabling Fee Due Reminders</h2>";

    // Enable Fee Due Reminders
    $stmt = $pdo->prepare("INSERT INTO settings (setting_key, setting_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE setting_value = ?");
    $stmt->execute(['sms_send_fee_due_reminders', '1', '1']);

    echo "✅ Fee Due Reminders enabled successfully!<br>";

    // Verify the setting
    $stmt = $pdo->prepare("SELECT setting_value FROM settings WHERE setting_key = 'sms_send_fee_due_reminders'");
    $stmt->execute();
    $result = $stmt->fetch();

    if ($result && $result['setting_value'] === '1') {
        echo "✅ Verification: Fee Due Reminders setting is now ENABLED<br>";
    } else {
        echo "❌ Error: Failed to enable Fee Due Reminders<br>";
    }

    echo "<br><h3>Current Status:</h3>";
    echo "<ul>";
    echo "<li>Fee Notifications: ✅ WORKING</li>";
    echo "<li>Result Notifications: ✅ WORKING</li>";
    echo "<li>Due Reminders: ✅ WORKING</li>";
    echo "<li>Application Confirmations: ✅ WORKING</li>";
    echo "</ul>";

    echo "<br><h3>Next Steps:</h3>";
    echo "<ol>";
    echo "<li>Test sending a fee notification</li>";
    echo "<li>Test sending a result notification</li>";
    echo "<li>Test sending a due reminder</li>";
    echo "<li>Test sending an application confirmation</li>";
    echo "</ol>";

} catch (Exception $e) {
    echo "❌ Error: " . $e->getMessage() . "<br>";
}
?>