zmiany w edycji listy przez usera

This commit is contained in:
Mateusz Gruszczyński
2025-08-15 13:01:00 +02:00
parent 5256e9d17b
commit 977b8630fb
2 changed files with 35 additions and 12 deletions

View File

@@ -0,0 +1,10 @@
function updateMoveToMonth() {
const year = document.getElementById('move_to_month_year').value;
const month = document.getElementById('move_to_month_month').value;
document.getElementById('move_to_month').value = `${year}-${month}`;
}
document.getElementById('move_to_month_year').addEventListener('change', updateMoveToMonth);
document.getElementById('move_to_month_month').addEventListener('change', updateMoveToMonth);
updateMoveToMonth();

View File

@@ -55,19 +55,31 @@
</div>
</div>
<!-- Data utworzenia / Przenieś miesiąc -->
<div class="row mb-4">
<div class="col-md-6">
<label class="form-label">📆 Utworzono</label>
<span class="badge bg-success rounded-pill text-dark ms-1">
{{ list.created_at.strftime('%Y-%m-%d') }}
</span>
<div class="row mb-4">
<div class="col-md-6">
<label class="form-label">📆 Utworzono</label>
<span class="badge bg-success rounded-pill text-dark ms-1">
{{ list.created_at.strftime('%Y-%m-%d') }}
</span>
</div>
<div class="col-md-6">
<label class="form-label">📁 Przenieś do miesiąca</label>
<div class="d-flex gap-2">
<select id="move_to_month_year" class="form-select bg-dark text-white border-secondary rounded">
{% for y in range(2022, 2031) %}
<option value="{{ y }}" {% if y == (selected_year or now().year) %}selected{% endif %}>{{ y }}</option>
{% endfor %}
</select>
<select id="move_to_month_month" class="form-select bg-dark text-white border-secondary rounded">
{% for m in range(1, 13) %}
<option value="{{ "%02d"|format(m) }}" {% if m == (selected_month or now().month) %}selected{% endif %}>{{ "%02d"|format(m) }}</option>
{% endfor %}
</select>
</div>
<!-- Ukryte pole, które jest wysyłane do backendu -->
<input type="hidden" id="move_to_month" name="move_to_month" value="{{ list.move_to_month or '' }}">
</div>
</div>
<div class="col-md-6">
<label for="move_to_month" class="form-label">📁 Przenieś do miesiąca</label>
<input type="month" class="form-control bg-dark text-white border-secondary rounded" id="move_to_month" name="move_to_month" style="appearance: auto; -webkit-appearance: auto;">
</div>
</div>
<!-- Kategorie -->
<div class="mb-4">
@@ -197,4 +209,5 @@
<script src="{{ url_for('static_bp.serve_js', filename='user_receipt_crop.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='receipt_crop_logic.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='select.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='move_to_month.js') }}"></script>
{% endblock %}