Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ee2dd782d | ||
|
|
4bb8c7420c | ||
|
|
b0276f68b3 |
@@ -1,5 +1,7 @@
|
|||||||
# Antigravity Agent Configuration
|
# Antigravity Agent Configuration
|
||||||
# This file provides global rules for the Antigravity agent when working on this repository.
|
# This file provides global rules for the Antigravity agent when working on this repository.
|
||||||
|
|
||||||
- **Git Commits**: When making git commits, always append the following co-author trailer to the end of the commit message to indicate AI assistance:
|
- **Identity**: Antigravity AI (Assistant)
|
||||||
`Co-authored-by: Antigravity <antigravity@deepmind.com>`
|
- **Git Commits**: Always follow [Conventional Commits](https://www.conventionalcommits.org/) and append the co-author trailer:
|
||||||
|
`Co-authored-by: Antigravity <antigravity@google.com>`
|
||||||
|
- **Workflow**: Prefer updating `task.md` and `walkthrough.md` in the `.gemini/antigravity/brain/` directory to track progress and document changes.
|
||||||
|
|||||||
120
app.py
120
app.py
@@ -2,7 +2,11 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import re
|
import re
|
||||||
from flask import Flask, render_template
|
import time
|
||||||
|
import os
|
||||||
|
import io
|
||||||
|
import qrcode
|
||||||
|
from flask import Flask, render_template, g, send_file, request
|
||||||
|
|
||||||
# Add scripts directory to path to allow importing from it
|
# Add scripts directory to path to allow importing from it
|
||||||
scripts_dir = Path(__file__).parent / "scripts"
|
scripts_dir = Path(__file__).parent / "scripts"
|
||||||
@@ -13,6 +17,38 @@ from match_payments import reconcile, fetch_sheet_data, fetch_exceptions, normal
|
|||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
# Bank account for QR code payments (can be overridden by ENV)
|
||||||
|
BANK_ACCOUNT = os.environ.get("BANK_ACCOUNT", "CZ8520100000002800359168")
|
||||||
|
|
||||||
|
@app.before_request
|
||||||
|
def start_timer():
|
||||||
|
g.start_time = time.perf_counter()
|
||||||
|
g.steps = []
|
||||||
|
|
||||||
|
def record_step(name):
|
||||||
|
g.steps.append((name, time.perf_counter()))
|
||||||
|
|
||||||
|
@app.context_processor
|
||||||
|
def inject_render_time():
|
||||||
|
def get_render_time():
|
||||||
|
total = time.perf_counter() - g.start_time
|
||||||
|
breakdown = []
|
||||||
|
last_time = g.start_time
|
||||||
|
for name, timestamp in g.steps:
|
||||||
|
duration = timestamp - last_time
|
||||||
|
breakdown.append(f"{name}:{duration:.3f}s")
|
||||||
|
last_time = timestamp
|
||||||
|
|
||||||
|
# Add remaining time as 'render'
|
||||||
|
render_duration = time.perf_counter() - last_time
|
||||||
|
breakdown.append(f"render:{render_duration:.3f}s")
|
||||||
|
|
||||||
|
return {
|
||||||
|
"total": f"{total:.3f}",
|
||||||
|
"breakdown": " | ".join(breakdown)
|
||||||
|
}
|
||||||
|
return dict(get_render_time=get_render_time)
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def index():
|
def index():
|
||||||
# Redirect root to /fees for convenience while there are no other apps
|
# Redirect root to /fees for convenience while there are no other apps
|
||||||
@@ -24,6 +60,7 @@ def fees():
|
|||||||
payments_url = f"https://docs.google.com/spreadsheets/d/{PAYMENTS_SHEET_ID}/edit"
|
payments_url = f"https://docs.google.com/spreadsheets/d/{PAYMENTS_SHEET_ID}/edit"
|
||||||
|
|
||||||
members, sorted_months = get_members_with_fees()
|
members, sorted_months = get_members_with_fees()
|
||||||
|
record_step("fetch_members")
|
||||||
if not members:
|
if not members:
|
||||||
return "No data."
|
return "No data."
|
||||||
|
|
||||||
@@ -40,6 +77,7 @@ def fees():
|
|||||||
# Get exceptions for formatting
|
# Get exceptions for formatting
|
||||||
credentials_path = ".secret/fuj-management-bot-credentials.json"
|
credentials_path = ".secret/fuj-management-bot-credentials.json"
|
||||||
exceptions = fetch_exceptions(PAYMENTS_SHEET_ID, credentials_path)
|
exceptions = fetch_exceptions(PAYMENTS_SHEET_ID, credentials_path)
|
||||||
|
record_step("fetch_exceptions")
|
||||||
|
|
||||||
formatted_results = []
|
formatted_results = []
|
||||||
for name, month_fees in results:
|
for name, month_fees in results:
|
||||||
@@ -63,6 +101,8 @@ def fees():
|
|||||||
row["months"].append({"cell": cell, "overridden": is_overridden})
|
row["months"].append({"cell": cell, "overridden": is_overridden})
|
||||||
formatted_results.append(row)
|
formatted_results.append(row)
|
||||||
|
|
||||||
|
record_step("process_data")
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"fees.html",
|
"fees.html",
|
||||||
months=[month_labels[m] for m in sorted_months],
|
months=[month_labels[m] for m in sorted_months],
|
||||||
@@ -81,12 +121,16 @@ def reconcile_view():
|
|||||||
credentials_path = ".secret/fuj-management-bot-credentials.json"
|
credentials_path = ".secret/fuj-management-bot-credentials.json"
|
||||||
|
|
||||||
members, sorted_months = get_members_with_fees()
|
members, sorted_months = get_members_with_fees()
|
||||||
|
record_step("fetch_members")
|
||||||
if not members:
|
if not members:
|
||||||
return "No data."
|
return "No data."
|
||||||
|
|
||||||
transactions = fetch_sheet_data(PAYMENTS_SHEET_ID, credentials_path)
|
transactions = fetch_sheet_data(PAYMENTS_SHEET_ID, credentials_path)
|
||||||
|
record_step("fetch_payments")
|
||||||
exceptions = fetch_exceptions(PAYMENTS_SHEET_ID, credentials_path)
|
exceptions = fetch_exceptions(PAYMENTS_SHEET_ID, credentials_path)
|
||||||
|
record_step("fetch_exceptions")
|
||||||
result = reconcile(members, sorted_months, transactions, exceptions)
|
result = reconcile(members, sorted_months, transactions, exceptions)
|
||||||
|
record_step("reconcile")
|
||||||
|
|
||||||
# Format month labels
|
# Format month labels
|
||||||
month_labels = {
|
month_labels = {
|
||||||
@@ -103,20 +147,34 @@ def reconcile_view():
|
|||||||
for m in sorted_months:
|
for m in sorted_months:
|
||||||
mdata = data["months"].get(m, {"expected": 0, "original_expected": 0, "paid": 0})
|
mdata = data["months"].get(m, {"expected": 0, "original_expected": 0, "paid": 0})
|
||||||
expected = mdata["expected"]
|
expected = mdata["expected"]
|
||||||
original = mdata["original_expected"]
|
|
||||||
paid = int(mdata["paid"])
|
paid = int(mdata["paid"])
|
||||||
|
|
||||||
cell_status = ""
|
status = "empty"
|
||||||
if expected == 0 and paid == 0:
|
cell_text = "-"
|
||||||
cell = "-"
|
amount_to_pay = 0
|
||||||
elif paid >= expected and expected > 0:
|
|
||||||
cell = "OK"
|
|
||||||
elif paid > 0:
|
|
||||||
cell = f"{paid}/{expected}"
|
|
||||||
else:
|
|
||||||
cell = f"UNPAID {expected}"
|
|
||||||
|
|
||||||
row["months"].append(cell)
|
if expected > 0:
|
||||||
|
if paid >= expected:
|
||||||
|
status = "ok"
|
||||||
|
cell_text = "OK"
|
||||||
|
elif paid > 0:
|
||||||
|
status = "partial"
|
||||||
|
cell_text = f"{paid}/{expected}"
|
||||||
|
amount_to_pay = expected - paid
|
||||||
|
else:
|
||||||
|
status = "unpaid"
|
||||||
|
cell_text = f"UNPAID {expected}"
|
||||||
|
amount_to_pay = expected
|
||||||
|
elif paid > 0:
|
||||||
|
status = "surplus"
|
||||||
|
cell_text = f"PAID {paid}"
|
||||||
|
|
||||||
|
row["months"].append({
|
||||||
|
"text": cell_text,
|
||||||
|
"status": status,
|
||||||
|
"amount": amount_to_pay,
|
||||||
|
"month": month_labels[m]
|
||||||
|
})
|
||||||
|
|
||||||
row["balance"] = data["total_balance"] # Updated to use total_balance
|
row["balance"] = data["total_balance"] # Updated to use total_balance
|
||||||
formatted_results.append(row)
|
formatted_results.append(row)
|
||||||
@@ -128,6 +186,8 @@ def reconcile_view():
|
|||||||
unmatched = result["unmatched"]
|
unmatched = result["unmatched"]
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
record_step("process_data")
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"reconcile.html",
|
"reconcile.html",
|
||||||
months=[month_labels[m] for m in sorted_months],
|
months=[month_labels[m] for m in sorted_months],
|
||||||
@@ -138,7 +198,8 @@ def reconcile_view():
|
|||||||
debts=debts,
|
debts=debts,
|
||||||
unmatched=unmatched,
|
unmatched=unmatched,
|
||||||
attendance_url=attendance_url,
|
attendance_url=attendance_url,
|
||||||
payments_url=payments_url
|
payments_url=payments_url,
|
||||||
|
bank_account=BANK_ACCOUNT
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/payments")
|
@app.route("/payments")
|
||||||
@@ -148,6 +209,7 @@ def payments():
|
|||||||
credentials_path = ".secret/fuj-management-bot-credentials.json"
|
credentials_path = ".secret/fuj-management-bot-credentials.json"
|
||||||
|
|
||||||
transactions = fetch_sheet_data(PAYMENTS_SHEET_ID, credentials_path)
|
transactions = fetch_sheet_data(PAYMENTS_SHEET_ID, credentials_path)
|
||||||
|
record_step("fetch_payments")
|
||||||
|
|
||||||
# Group transactions by person
|
# Group transactions by person
|
||||||
grouped = {}
|
grouped = {}
|
||||||
@@ -171,6 +233,7 @@ def payments():
|
|||||||
# Sort by date descending
|
# Sort by date descending
|
||||||
grouped[p].sort(key=lambda x: str(x.get("date", "")), reverse=True)
|
grouped[p].sort(key=lambda x: str(x.get("date", "")), reverse=True)
|
||||||
|
|
||||||
|
record_step("process_data")
|
||||||
return render_template(
|
return render_template(
|
||||||
"payments.html",
|
"payments.html",
|
||||||
grouped_payments=grouped,
|
grouped_payments=grouped,
|
||||||
@@ -179,5 +242,36 @@ def payments():
|
|||||||
payments_url=payments_url
|
payments_url=payments_url
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@app.route("/qr")
|
||||||
|
def qr_code():
|
||||||
|
account = request.args.get("account", BANK_ACCOUNT)
|
||||||
|
amount = request.args.get("amount", "0")
|
||||||
|
message = request.args.get("message", "")
|
||||||
|
|
||||||
|
# QR Platba standard: SPD*1.0*ACC:accountNumber*BC:bankCode*AM:amount*CC:CZK*MSG:message
|
||||||
|
acc_parts = account.split('/')
|
||||||
|
if len(acc_parts) == 2:
|
||||||
|
acc_str = f"{acc_parts[0]}*BC:{acc_parts[1]}"
|
||||||
|
else:
|
||||||
|
acc_str = account
|
||||||
|
|
||||||
|
try:
|
||||||
|
amt_val = float(amount)
|
||||||
|
amt_str = f"{amt_val:.2f}"
|
||||||
|
except ValueError:
|
||||||
|
amt_str = "0.00"
|
||||||
|
|
||||||
|
# Message max 60 characters
|
||||||
|
msg_str = message[:60]
|
||||||
|
|
||||||
|
qr_data = f"SPD*1.0*ACC:{acc_str}*AM:{amt_str}*CC:CZK*MSG:{msg_str}"
|
||||||
|
|
||||||
|
img = qrcode.make(qr_data)
|
||||||
|
buf = io.BytesIO()
|
||||||
|
img.save(buf, format='PNG')
|
||||||
|
buf.seek(0)
|
||||||
|
|
||||||
|
return send_file(buf, mimetype='image/png')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True, host='0.0.0.0', port=5001)
|
app.run(debug=True, host='0.0.0.0', port=5001)
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ RUN pip install --no-cache-dir \
|
|||||||
flask \
|
flask \
|
||||||
google-api-python-client \
|
google-api-python-client \
|
||||||
google-auth-httplib2 \
|
google-auth-httplib2 \
|
||||||
google-auth-oauthlib
|
google-auth-oauthlib \
|
||||||
|
qrcode \
|
||||||
|
pillow
|
||||||
|
|
||||||
COPY app.py Makefile ./
|
COPY app.py Makefile ./
|
||||||
COPY scripts/ ./scripts/
|
COPY scripts/ ./scripts/
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "fuj-management"
|
name = "fuj-management"
|
||||||
version = "0.06"
|
version = "0.10"
|
||||||
description = "Management tools for FUJ (Frisbee Ultimate Jablonec)"
|
description = "Management tools for FUJ (Frisbee Ultimate Jablonec)"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flask>=3.1.3",
|
"flask>=3.1.3",
|
||||||
"google-api-python-client>=2.162.0",
|
"google-api-python-client>=2.162.0",
|
||||||
"google-auth-httplib2>=0.2.0",
|
"google-auth-httplib2>=0.2.0",
|
||||||
"google-auth-oauthlib>=1.2.1",
|
"google-auth-oauthlib>=1.2.1",
|
||||||
|
"qrcode[pil]>=8.0",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,23 @@
|
|||||||
.description a:hover {
|
.description a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
margin-top: 50px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #333;
|
||||||
|
font-size: 9px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.perf-breakdown {
|
||||||
|
display: none;
|
||||||
|
margin-top: 5px;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -199,6 +216,14 @@
|
|||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
{% set rt = get_render_time() %}
|
||||||
|
<div class="footer"
|
||||||
|
onclick="document.getElementById('perf-details').style.display = (document.getElementById('perf-details').style.display === 'block' ? 'none' : 'block')">
|
||||||
|
render time: {{ rt.total }}s
|
||||||
|
<div id="perf-details" class="perf-breakdown">
|
||||||
|
{{ rt.breakdown }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -137,6 +137,23 @@
|
|||||||
tr:hover {
|
tr:hover {
|
||||||
background-color: #1a1a1a;
|
background-color: #1a1a1a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
margin-top: 50px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #333;
|
||||||
|
font-size: 9px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.perf-breakdown {
|
||||||
|
display: none;
|
||||||
|
margin-top: 5px;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -183,6 +200,14 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% set rt = get_render_time() %}
|
||||||
|
<div class="footer"
|
||||||
|
onclick="document.getElementById('perf-details').style.display = (document.getElementById('perf-details').style.display === 'block' ? 'none' : 'block')">
|
||||||
|
render time: {{ rt.total }}s
|
||||||
|
<div id="perf-details" class="perf-breakdown">
|
||||||
|
{{ rt.breakdown }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -138,6 +138,28 @@
|
|||||||
|
|
||||||
.cell-unpaid {
|
.cell-unpaid {
|
||||||
color: #ff3333;
|
color: #ff3333;
|
||||||
|
background-color: rgba(255, 51, 51, 0.05);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pay-btn {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
right: 5px;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
background: #ff3333;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 2px 6px;
|
||||||
|
font-size: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.member-row:hover .pay-btn {
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cell-empty {
|
.cell-empty {
|
||||||
@@ -343,6 +365,59 @@
|
|||||||
color: #888;
|
color: #888;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
margin-top: 50px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
color: #333;
|
||||||
|
font-size: 9px;
|
||||||
|
text-align: center;
|
||||||
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.perf-breakdown {
|
||||||
|
display: none;
|
||||||
|
margin-top: 5px;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* QR Modal styles */
|
||||||
|
#qrModal .modal-content {
|
||||||
|
max-width: 400px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-image {
|
||||||
|
background: white;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
margin: 20px 0;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-image img {
|
||||||
|
display: block;
|
||||||
|
width: 250px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-details {
|
||||||
|
text-align: left;
|
||||||
|
margin-top: 15px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-details div {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr-details span {
|
||||||
|
color: #00ff00;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -386,8 +461,12 @@
|
|||||||
</td>
|
</td>
|
||||||
{% for cell in row.months %}
|
{% for cell in row.months %}
|
||||||
<td
|
<td
|
||||||
class="{% if cell == '-' %}cell-empty{% elif 'UNPAID' in cell %}cell-unpaid{% elif cell == 'OK' %}cell-ok{% endif %}">
|
class="{% if cell.status == 'empty' %}cell-empty{% elif cell.status == 'unpaid' or cell.status == 'partial' %}cell-unpaid{% elif cell.status == 'ok' %}cell-ok{% endif %}">
|
||||||
{{ cell }}
|
{{ cell.text }}
|
||||||
|
{% if cell.status == 'unpaid' or cell.status == 'partial' %}
|
||||||
|
<button class="pay-btn"
|
||||||
|
onclick="showPayQR('{{ row.name|e }}', {{ cell.amount }}, '{{ cell.month|e }}')">Pay</button>
|
||||||
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<td class="{% if row.balance > 0 %}balance-pos{% elif row.balance < 0 %}balance-neg{% endif %}">
|
<td class="{% if row.balance > 0 %}balance-pos{% elif row.balance < 0 %}balance-neg{% endif %}">
|
||||||
@@ -443,6 +522,25 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- QR Code Modal -->
|
||||||
|
<div id="qrModal" class="modal"
|
||||||
|
style="display:none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.9); z-index: 9999; justify-content: center; align-items: center;">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="modal-title" id="qrTitle">Payment for ...</div>
|
||||||
|
<div class="close-btn" onclick="closeModal('qrModal')">[close]</div>
|
||||||
|
</div>
|
||||||
|
<div class="qr-image">
|
||||||
|
<img id="qrImg" src="" alt="Payment QR Code">
|
||||||
|
</div>
|
||||||
|
<div class="qr-details">
|
||||||
|
<div>Account: <span id="qrAccount"></span></div>
|
||||||
|
<div>Amount: <span id="qrAmount"></span> CZK</div>
|
||||||
|
<div>Message: <span id="qrMessage"></span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="memberModal">
|
<div id="memberModal">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@@ -485,6 +583,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% set rt = get_render_time() %}
|
||||||
|
<div class="footer"
|
||||||
|
onclick="document.getElementById('perf-details').style.display = (document.getElementById('perf-details').style.display === 'block' ? 'none' : 'block')">
|
||||||
|
render time: {{ rt.total }}s
|
||||||
|
<div id="perf-details" class="perf-breakdown">
|
||||||
|
{{ rt.breakdown }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const memberData = {{ member_data| safe }};
|
const memberData = {{ member_data| safe }};
|
||||||
const sortedMonths = {{ raw_months| tojson }};
|
const sortedMonths = {{ raw_months| tojson }};
|
||||||
@@ -594,9 +701,16 @@
|
|||||||
document.getElementById('memberModal').classList.add('active');
|
document.getElementById('memberModal').classList.add('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeModal() {
|
function closeModal(id) {
|
||||||
|
if (id) {
|
||||||
|
document.getElementById(id).style.display = 'none';
|
||||||
|
if (id === 'qrModal') {
|
||||||
|
document.getElementById(id).style.display = 'none';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
document.getElementById('memberModal').classList.remove('active');
|
document.getElementById('memberModal').classList.remove('active');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Existing filter script
|
// Existing filter script
|
||||||
document.getElementById('nameFilter').addEventListener('input', function (e) {
|
document.getElementById('nameFilter').addEventListener('input', function (e) {
|
||||||
@@ -618,6 +732,33 @@
|
|||||||
document.addEventListener('keydown', function (e) {
|
document.addEventListener('keydown', function (e) {
|
||||||
if (e.key === 'Escape') closeModal();
|
if (e.key === 'Escape') closeModal();
|
||||||
});
|
});
|
||||||
|
function showPayQR(name, amount, month) {
|
||||||
|
const account = "{{ bank_account }}";
|
||||||
|
const message = `${name} / ${month}`;
|
||||||
|
const qrTitle = document.getElementById('qrTitle');
|
||||||
|
const qrImg = document.getElementById('qrImg');
|
||||||
|
const qrAccount = document.getElementById('qrAccount');
|
||||||
|
const qrAmount = document.getElementById('qrAmount');
|
||||||
|
const qrMessage = document.getElementById('qrMessage');
|
||||||
|
|
||||||
|
qrTitle.innerText = `Payment for ${month}`;
|
||||||
|
qrAccount.innerText = account;
|
||||||
|
qrAmount.innerText = amount;
|
||||||
|
qrMessage.innerText = message;
|
||||||
|
|
||||||
|
const encodedMessage = encodeURIComponent(message);
|
||||||
|
const qrUrl = `/qr?account=${encodeURIComponent(account)}&amount=${amount}&message=${encodedMessage}`;
|
||||||
|
|
||||||
|
qrImg.src = qrUrl;
|
||||||
|
document.getElementById('qrModal').style.display = 'block';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close modal when clicking outside
|
||||||
|
window.onclick = function (event) {
|
||||||
|
if (event.target.className === 'modal') {
|
||||||
|
event.target.style.display = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user