218 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html lang="zh-Hant">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>社區儀表板</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background-color: #f5fafa;
display: flex;
}
.main {
flex: 1;
padding: 20px;
}
.top-banner {
background: url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&w=1470&q=80') no-repeat center/cover;
height: 100px;
border-radius: 10px;
margin-bottom: 20px;
position: relative;
}
.signin-btn {
position: absolute;
right: 20px;
top: 30px;
padding: 5px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.content {
display: flex;
gap: 20px;
}
.left-panel {
flex: 2;
}
.card {
background-color: white;
border-radius: 10px;
padding: 15px;
margin-bottom: 20px;
box-shadow: 0 0 5px rgba(0,0,0,0.05);
}
.table {
width: 100%;
border-collapse: collapse;
}
.table th, .table td {
text-align: center;
padding: 8px;
border-bottom: 1px solid #eee;
}
.table tr:hover {
background-color: #f0f8ff;
}
.right-panel {
flex: 1;
display: flex;
flex-direction: column;
gap: 20px;
}
.weather, .chart {
background-color: white;
padding: 15px;
border-radius: 10px;
box-shadow: 0 0 5px rgba(0,0,0,0.05);
}
.weather {
display: flex;
align-items: center;
justify-content: space-between;
color: #fff;
background-color: #4ea8de;
}
.weather .temp {
font-size: 28px;
font-weight: bold;
}
.bottom-panel {
display: flex;
gap: 20px;
}
.announcement, .schedule {
flex: 1;
}
.title-row {
display: flex;
justify-content: space-between;
font-weight: bold;
margin-bottom: 10px;
}
.list-item {
display: flex;
justify-content: space-between;
padding: 6px 0;
border-bottom: 1px solid #eee;
font-size: 14px;
}
.chart {
position: relative;
height: 500px;
}
.chart canvas {
width: 100% !important;
height: 100% !important;
}
</style>
</head>
<body>
<div class="sidebar-container">
<iframe src="sidebar.html" style="width: 200px; height: 100vh; border: none;"></iframe>
</div>
<div class="main">
<div class="top-banner">
<button class="signin-btn">簽到</button>
</div>
<div class="content">
<div class="left-panel">
<div class="card">
<div style="font-weight: bold; color: #3b8eea; margin-bottom: 10px;">居民進出</div>
<table class="table">
<thead>
<tr>
<th></th>
<th>居民</th>
<th>出入棟</th>
<th>日期</th>
<th>進入時間</th>
<th>出去時間</th>
<th>本日進出次數</th>
<th></th>
</tr>
</thead>
<tbody>
<tr><td></td><td>張XX</td><td>A棟</td><td>2022-06-05</td><td>16:02:18</td><td>11:24:05</td><td>3</td><td><a href="#">查看</a></td></tr>
<tr><td></td><td>李XX</td><td>B棟</td><td>2022-05-30</td><td>11:05:32</td><td>06:17:23</td><td>3</td><td><a href="#">查看</a></td></tr>
<tr><td></td><td>黃XX</td><td>A棟</td><td>2022-05-27</td><td>00:58:52</td><td>16:15:54</td><td>3</td><td><a href="#">查看</a></td></tr>
<tr><td></td><td>張XX</td><td>A棟</td><td>2022-06-13</td><td>18:06:35</td><td>03:08:27</td><td>2</td><td><a href="#">查看</a></td></tr>
</tbody>
</table>
</div>
<div class="bottom-panel">
<div class="announcement card">
<div class="title-row">
<span>公告</span>
<span style="color:#007bff">更多</span>
</div>
<div class="list-item"><span>清潔日請勿倒垃圾</span><span>05/21</span></div>
<div class="list-item"><span>施工注意事項</span><span>05/19</span></div>
<div class="list-item"><span>社區防火演習</span><span>06/08</span></div>
<div class="list-item"><span>電梯保養公告</span><span>05/17</span></div>
</div>
<div class="schedule card">
<div class="title-row">
<span>活動日程</span>
<span style="color:#007bff">更多</span>
</div>
<div class="list-item"><span>社區健走活動</span><span>2022-06-08</span></div>
<div class="list-item"><span>二手市集</span><span>2022-05-20</span></div>
<div class="list-item"><span>兒童故事會</span><span>2022-05-23</span></div>
<div class="list-item"><span>防災講座</span><span>2022-06-09</span></div>
</div>
</div>
</div>
<div class="right-panel">
<div class="weather">
<div>
<div>2022年6月16日</div>
<div>天氣晴,適合外出散步</div>
</div>
<div class="temp">24°C</div>
</div>
<div class="chart">
<div style="font-weight: bold; color: #3b8eea; margin-bottom: 10px;">周進出統計</div>
<canvas id="myChart"></canvas>
</div>
</div>
</div>
</div>
<script>
const ctx = document.getElementById('myChart').getContext('2d');
const myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['4/30', '5/1', '5/2', '5/3', '5/4', '5/5','5/6'],
datasets: [{
label: '進出人數',
data: [12, 19, 3, 5, 2, 8, 10],
backgroundColor: 'rgba(75, 192, 192, 0.5)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
}
}
});
</script>
</body>
</html>