<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>Pricing Plan Management</h2>
</div>

<div class="card" style="max-width: 500px;">
    <div class="card-body">
        <form id="pricingForm">
            <div class="mb-3">
                <label class="form-label">Premium Plan Price (₹)</label>
                <input type="number" class="form-control" id="price" value="{{currentPrice}}" required min="1">
            </div>
            <button type="submit" class="btn btn-primary">Update Price</button>
        </form>
    </div>
</div>

<script>
document.getElementById('pricingForm').addEventListener('submit', async (e) => {
    e.preventDefault();
    const price = document.getElementById('price').value;
    const res = await fetch('/admin/settings/pricing', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ price })
    });
    const json = await res.json();
    if (json.success) {
        alert(json.message);
        window.location.reload();
    } else {
        alert(json.message);
    }
});
</script>
