웹페이지 형식으로 데이터를 추출할 수 있는 기능

This commit is contained in:
2025-07-21 17:37:35 +09:00
parent 1e0ddf6280
commit f22e5922a2
4 changed files with 481 additions and 0 deletions

61
app/templates/2weeks.html Normal file
View File

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<title>월별 입장객 현황</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body class="p-4">
<section class="2weeks_visitor_detail">
<h2>직전 2주간 방문객 현황 상세 내역</h2>
<table class="table table-bordered text-center align-middle">
<thead>
<tr>
<th colspan="2">구분</th>
<th colspan="{{ dates|length }}">방문현황</th>
<th rowspan="2">합계/평균</th>
<th colspan="3">예상</th>
</tr>
<tr>
<th>년도</th>
<th>항목</th>
{% for d in dates %}
<th>{{ d.strftime('%-m/%-d') }}</th>
{% endfor %}
<th>1일</th>
<th>2일</th>
<th>3일</th>
</tr>
</thead>
<tbody>
{% for year_label, data_by_item in data.items() %}
{% set rowspan_val = data_by_item|length %}
{% for item_name, row in data_by_item.items() %}
<tr>
{% if loop.first %}
<th rowspan="{{ rowspan_val }}">{{ year_label }}</th>
{% endif %}
<th>{{ item_name }}</th>
{% for val in row.values_list %}
<td>{{ val }}</td>
{% endfor %}
<td>{{ row.total or '' }}</td>
{% if row.expected %}
{% for ex_val in row.expected %}
<td>{{ ex_val }}</td>
{% endfor %}
{% else %}
<td colspan="3"></td>
{% endif %}
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</section>
</body>
</html>