
<div class="container">
    <h3 class="mb-4">Create Subscription Plan</h3>

    {{-- Success Message --}}
    @if(session('success'))
        <div class="alert alert-success">
            {{ session('success') }}
        </div>
    @endif

    {{-- Validation Errors --}}
    @if ($errors->any())
        <div class="alert alert-danger">
            <ul class="mb-0">
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <form action="{{ route('admin.plans.store') }}" method="POST">
        @csrf

        {{-- Plan Name --}}
        <div class="mb-3">
            <label class="form-label">Plan Name</label>
            <input type="text" name="plan_name" class="form-control"
                   value="{{ old('plan_name') }}" required>
        </div>

        {{-- Plan Type --}}
        <div class="mb-3">
            <label class="form-label">Plan Type</label>
            <input type="text" name="plan_type" class="form-control"
                   placeholder="e.g. premium, basic"
                   value="{{ old('plan_type') }}" required>
        </div>

        {{-- Billing Interval --}}
        <div class="mb-3">
            <label class="form-label">Billing Interval</label>
            <select name="interval" class="form-select" required>
                <option value="">Select Interval</option>
                <option value="DAY">Daily</option>
                <option value="WEEK">Weekly</option>
                <option value="MONTH">Monthly</option>
                <option value="YEAR">Yearly</option>
            </select>
        </div>

        {{-- Interval Count --}}
        <div class="mb-3">
            <label class="form-label">Interval Count</label>
            <input type="number" name="interval_count" class="form-control"
                   min="1" value="{{ old('interval_count', 1) }}" required>
            <small class="text-muted">Example: 1 Month, 3 Months, 12 Months</small>
        </div>

        {{-- Price --}}
        <div class="mb-3">
            <label class="form-label">Plan Price (USD)</label>
            <input type="number" name="plan_price" class="form-control"
                   step="0.01" min="0" value="{{ old('plan_price') }}" required>
        </div>

        {{-- Description --}}
        <div class="mb-3">
            <label class="form-label">Description (Optional)</label>
            <textarea name="description" class="form-control" rows="3">{{ old('description') }}</textarea>
        </div>

        {{-- Status --}}
        <div class="mb-4">
            <label class="form-label">Status</label>
            <select name="status" class="form-select" required>
                <option value="active">Active</option>
                <option value="inactive">Inactive</option>
            </select>
        </div>

        {{-- Submit --}}
        <button type="submit" class="btn btn-primary">
            Create Subscription Plan
        </button>
    </form>
</div>

