zmiany w serwowaniu js

This commit is contained in:
Mateusz Gruszczyński
2025-07-05 00:23:12 +02:00
parent 74244fd877
commit 17bd643fe0
5 changed files with 51 additions and 46 deletions

View File

@ -9,18 +9,18 @@
<form method="post">
<div class="mb-3">
<label for="title" class="form-label">Nowy tytuł</label>
<label for="title" class="form-label">Ustaw tytuł</label>
<input type="text" class="form-control" id="title" name="title" value="{{ list.title }}" required>
</div>
<div class="mb-3">
<label for="amount" class="form-label">Nowa kwota wydatku (PLN)</label>
<label for="amount" class="form-label">Ustaw kwotę wydatku (PLN)</label>
<input type="number" step="0.01" min="0" class="form-control" id="amount" name="amount" value="{{ '%.2f'|format(total_expense) }}">
<small class="form-text text-muted">Jeśli nie chcesz zmieniać kwoty, zostaw to pole bez zmian.</small>
</div>
<div class="mb-3">
<label for="owner_id" class="form-label">Nowy właściciel</label>
<label for="owner_id" class="form-label">Zmień właściciela</label>
<select class="form-select" id="owner_id" name="owner_id">
{% for user in users %}
<option value="{{ user.id }}" {% if list.owner_id == user.id %}selected{% endif %}>
@ -30,13 +30,14 @@
</select>
</div>
<div class="form-check mb-3">
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" id="archived" name="archived" {% if list.is_archived %}checked{% endif %}>
<label class="form-check-label" for="archived">
Archiwalna
Lista archiwalna
</label>
</div>
<button type="submit" class="btn btn-success">💾 Zapisz</button>
<a href="{{ url_for('admin_panel') }}" class="btn btn-secondary">Anuluj</a>
</form>

View File

@ -10,7 +10,7 @@
<script src="https://cdn.socket.io/4.6.1/socket.io.min.js"></script>
<script src="{{ url_for('static_bp.serve_js', filename='live.js') }}"></script>
<script src="{{ url_for('static_bp.serve_live_js') }}?v={{ time.time() | int }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='toasts.js') }}"></script>
<script src="{{ url_for('static_bp.serve_js', filename='hide_list.js') }}"></script>
@ -50,6 +50,7 @@
<div class="container px-2">
{% block content %}{% endblock %}
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
{% with messages = get_flashed_messages(with_categories=true) %}

View File

@ -1,12 +1,14 @@
{% extends 'base.html' %}
{% block content %}
<h2>Edytuj listę: {{ list.title }}</h2>
<form method="post">
<div class="mb-3">
<label for="title" class="form-label">Nowy tytuł</label>
<label for="title" class="form-label">Ustaw nazwe</label>
<input type="text" name="title" id="title" class="form-control" value="{{ list.title }}" required>
</div>
<button type="submit" class="btn btn-success">Zapisz</button>
<a href="{{ url_for('index_guest') }}" class="btn btn-secondary">Anuluj</a>
</form>
{% endblock %}

View File

@ -2,6 +2,15 @@
{% block title %}Lista: {{ list.title }}{% endblock %}
{% block content %}
<style>
.bg-success {
background-color: #1e7e34 !important;
}
.bg-light {
background-color: #2c2f33 !important;
}
</style>
<div class="d-flex justify-content-between align-items-center mb-3 flex-wrap">
<h2 class="mb-2">
Lista: <strong>{{ list.title }}</strong>
@ -103,7 +112,7 @@ Lista: <strong>{{ list.title }}</strong>
{% if not list.is_archived %}
<div class="input-group mb-3">
<input type="text" id="newItem" name="name" class="form-control" placeholder="Nowy produkt" required>
<input type="text" id="newItem" name="name" class="form-control" placeholder="Dodaj produkt" required>
<input type="number" id="newQuantity" name="quantity" class="form-control" placeholder="Ilość" min="1" value="1" style="max-width: 80px;">
<button type="button" class="btn btn-success" onclick="addItem({{ list.id }})"> Dodaj</button>
</div>
@ -126,8 +135,7 @@ Lista: <strong>{{ list.title }}</strong>
{% else %}
<hr>
<p><span class="badge bg-secondary">Brak wgranych paragonów do tej listy.</span></p>
{% endif %}
{% endif %}
<div id="toast-container" class="toast-container position-fixed bottom-0 end-0 p-3"></div>
@ -135,12 +143,4 @@ Lista: <strong>{{ list.title }}</strong>
setupList({{ list.id }}, '{{ current_user.username if current_user.is_authenticated else 'Gość' }}');
</script>
<style>
.bg-success {
background-color: #1e7e34 !important;
}
.bg-light {
background-color: #2c2f33 !important;
}
</style>
{% endblock %}

View File

@ -2,6 +2,34 @@
{% block title %}Lista: {{ list.title }}{% endblock %}
{% block content %}
<style>
.large-checkbox {
width: 1.5em;
height: 1.5em;
}
.clickable-item {
cursor: pointer;
}
.bg-success {
background-color: #1e7e34 !important;
}
.bg-light {
background-color: #2c2f33 !important;
}
input[type="file"]::file-selector-button {
background-color: #127429;
color: #fff;
border: none;
padding: 0.5em 1em;
border-radius: 4px;
font-weight: bold;
cursor: pointer;
transition: background 0.2s;
}
</style>
<h2 class="mb-2">
🛍️ {{ list.title }}
{% if list.is_archived %}
@ -44,7 +72,7 @@
{% if not list.is_archived %}
<div class="input-group mb-2">
<input id="newItem" class="form-control" placeholder="Nowy produkt">
<input id="newItem" class="form-control" placeholder="Dodaj produkt">
<input id="newQuantity" type="number" class="form-control" placeholder="Ilość" min="1" value="1" style="max-width: 90px;">
<button onclick="addItem({{ list.id }})" class="btn btn-success"> Dodaj</button>
</div>
@ -120,31 +148,4 @@
<script src="{{ url_for('static_bp.serve_js', filename='list_guest.js') }}"></script>
<style>
.large-checkbox {
width: 1.5em;
height: 1.5em;
}
.clickable-item {
cursor: pointer;
}
.bg-success {
background-color: #1e7e34 !important;
}
.bg-light {
background-color: #2c2f33 !important;
}
input[type="file"]::file-selector-button {
background-color: #127429;
color: #fff;
border: none;
padding: 0.5em 1em;
border-radius: 4px;
font-weight: bold;
cursor: pointer;
transition: background 0.2s;
}
</style>
{% endblock %}