File size: 3,076 Bytes
0a40ab8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{% extends "base.html" %}

{% block title %}New Draft - PoliSage{% endblock %}

{% block content %}
<div class="container mt-4">
    <h2>Create New Draft</h2>

    {% with messages = get_flashed_messages(with_categories=true) %}
      {% if messages %}
        {% for category, message in messages %}
          <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
            {{ message }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
          </div>
        {% endfor %}
      {% endif %}
    {% endwith %}

    <form method="POST" action="{{ url_for("drafting.create_draft") }}">
        <div class="mb-3">
            <label for="title" class="form-label">Draft Title <span class="text-danger">*</span></label>
            <input type="text" class="form-control" id="title" name="title" value="{{ title or '' }}" required>
        </div>
        
        <div class="mb-3">
            <label for="policy_intent" class="form-label">Policy Intent / Purpose <span class="text-danger">*</span></label>
            <textarea class="form-control" id="policy_intent" name="policy_intent" rows="4" required>{{ policy_intent or '' }}</textarea>
            <div class="form-text">Describe the goal or problem this draft aims to address. This can be used by the AI to help generate content later.</div>
        </div>

        <div class="mb-3">
            <label for="related_legislation_id" class="form-label">Related Legislation (Optional)</label>
            <select class="form-select" id="related_legislation_id" name="related_legislation_id">
                <option value="">None</option>
                {% for leg in legislations %}
                    <option value="{{ leg.id }}" {% if related_legislation_id == leg.id|string %}selected{% endif %}>{{ leg.title }} (ID: {{ leg.id }})</option>
                {% endfor %}
            </select>
            <div class="form-text">Link this draft to an existing piece of legislation if applicable.</div>
        </div>

        <div class="mb-3">
            <label for="initial_content" class="form-label">Initial Content (Optional)</label>
            <textarea class="form-control" id="initial_content" name="initial_content" rows="10">{{ initial_content or '' }}</textarea>
            <div class="form-text">You can provide initial text, or leave this blank and check the box below to use AI generation.</div>
        </div>

        <div class="form-check mb-3">
            <input class="form-check-input" type="checkbox" id="use_ai_generation" name="use_ai_generation" value="true" {% if use_ai_generation %}checked{% endif %}>
            <label class="form-check-label" for="use_ai_generation">
                Generate initial content using AI (if Initial Content field is empty)
            </label>
        </div>

        <button type="submit" class="btn btn-primary">Create Draft</button>
        <a href="{{ url_for("drafting.list_drafts") }}" class="btn btn-secondary">Cancel</a>
    </form>
</div>
{% endblock %}