Skip to content

Commit 5d88881

Browse files
Merge pull request #24 from GitTimeraider/main
Edit subscription fixes
2 parents fc584e9 + 50d5d97 commit 5d88881

File tree

1 file changed

+18
-24
lines changed

1 file changed

+18
-24
lines changed

app/templates/edit_subscription.html

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,7 @@
33
{% block title %}Edit Subscription - Subscription Tracker{% endblock %}
44

55
{% block content %}
6-
<div cl <div class="col-md-6 mb-3">
7-
{{ form.start_date.label(class="form-label") }}
8-
{{ form.start_date(class="form-control") }}
9-
<small class="form-text text-muted">Dates are displayed in {{ date_format_display }} format</small>
10-
{% if form.start_date.errors %}
11-
<div class="text-danger mt-1">
12-
{% for error in form.start_date.errors %}
13-
<small>{{ error }}</small>
14-
{% endfor %}
15-
</div>
16-
{% endif %}
17-
</div>
18-
19-
<div class="col-md-6 mb-3">
20-
{{ form.end_date.label(class="form-label") }}
21-
{{ form.end_date(class="form-control") }}
22-
<small class="form-text text-muted">Leave blank for infinite subscription • Dates displayed in {{ date_format_display }} format</small>-content-center">
6+
<div class="row justify-content-center">
237
<div class="col-md-8 col-lg-6">
248
<div class="card">
259
<div class="card-header">
@@ -79,7 +63,7 @@ <h2 class="mb-0">
7963
<div class="row">
8064
<div class="col-md-6 mb-3">
8165
{{ form.cost.label(class="form-label") }}
82-
{{ form.cost(class="form-control") }}
66+
{{ form.cost(class="form-control", step="0.01") }}
8367
{% if form.cost.errors %}
8468
<div class="text-danger mt-1">
8569
{% for error in form.cost.errors %}
@@ -149,6 +133,7 @@ <h2 class="mb-0">
149133
<div class="col-md-6 mb-3">
150134
{{ form.start_date.label(class="form-label") }}
151135
{{ form.start_date(class="form-control") }}
136+
<small class="form-text text-muted">Dates are displayed in {{ date_format_display }} format</small>
152137
{% if form.start_date.errors %}
153138
<div class="text-danger mt-1">
154139
{% for error in form.start_date.errors %}
@@ -161,7 +146,7 @@ <h2 class="mb-0">
161146
<div class="col-md-6 mb-3">
162147
{{ form.end_date.label(class="form-label") }}
163148
{{ form.end_date(class="form-control") }}
164-
<small class="form-text text-muted">Leave blank for infinite subscription</small>
149+
<small class="form-text text-muted">Leave blank for infinite subscription • Dates displayed in {{ date_format_display }} format</small>
165150
{% if form.end_date.errors %}
166151
<div class="text-danger mt-1">
167152
{% for error in form.end_date.errors %}
@@ -214,14 +199,23 @@ <h2 class="mb-0">
214199

215200
{% block extra_js %}
216201
<script>
217-
document.getElementById('billing_cycle').addEventListener('change', function() {
218-
const customPeriodFields = document.getElementById('custom_period_fields');
219-
220-
if (this.value === 'custom') {
202+
document.addEventListener('DOMContentLoaded', function() {
203+
const billingCycleField = document.getElementById('billing_cycle');
204+
const customPeriodFields = document.getElementById('custom_period_fields');
205+
206+
function toggleCustomFields() {
207+
if (billingCycleField.value === 'custom') {
221208
customPeriodFields.style.display = 'block';
222209
} else {
223210
customPeriodFields.style.display = 'none';
224211
}
225-
});
212+
}
213+
214+
// Initialize on page load
215+
toggleCustomFields();
216+
217+
// Toggle when selection changes
218+
billingCycleField.addEventListener('change', toggleCustomFields);
219+
});
226220
</script>
227221
{% endblock %}

0 commit comments

Comments
 (0)