2025-05-12 17:29:54 +08:00
|
|
|
<!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>
|
|
|
|
/* 這些樣式是從原 main.html 複製過來,專用於儀表板內容 */
|
|
|
|
body { font-family: Arial, sans-serif; padding: 20px; background-color: #f5fafa; margin:0; }
|
|
|
|
.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; }
|
|
|
|
.dashboard-content-grid { display: flex; gap: 20px; flex-wrap: wrap; /* Allow wrapping for responsiveness */ }
|
|
|
|
.left-panel { flex: 2; min-width: 300px; /* Ensure left panel has some width */ }
|
|
|
|
.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; font-size: 14px; } /* Adjusted font size */
|
|
|
|
.table tr:hover { background-color: #f0f8ff; }
|
|
|
|
.right-panel { flex: 1; min-width: 250px; /* Ensure right panel has some width */ display: flex; flex-direction: column; gap: 20px; }
|
|
|
|
.weather, .chart-container { 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; flex-wrap: wrap; /* Allow wrapping */ }
|
|
|
|
.announcement, .schedule { flex: 1; min-width: 200px; /* Ensure min width */ }
|
|
|
|
.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-container { position: relative; height: 350px; /* Adjusted height */ } /* Ensure chart container has dimensions */
|
|
|
|
.chart-container canvas { width: 100% !important; height: 100% !important; }
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2025-06-10 12:56:31 +08:00
|
|
|
<div class="top-banner"></div>
|
2025-05-12 17:29:54 +08:00
|
|
|
<div class="dashboard-content-grid">
|
|
|
|
<div class="left-panel">
|
|
|
|
<div class="card">
|
|
|
|
<div style="font-weight: bold; color: #3b8eea; margin-bottom: 10px;">居民進出</div>
|
|
|
|
<table class="table">
|
2025-06-10 12:56:31 +08:00
|
|
|
<thead><tr><th></th><th>居民</th><th>日期</th><th>最後進入時間</th><th>最後出去時間</th><th>本日進出次數</th><th></th></tr></thead>
|
2025-05-12 17:29:54 +08:00
|
|
|
<tbody>
|
2025-06-10 12:56:31 +08:00
|
|
|
<tr><td></td><td>張XX</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>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>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>2022-06-13</td><td>18:06:35</td><td>03:08:27</td><td>2</td><td><a href="#">查看</a></td></tr>
|
2025-05-12 17:29:54 +08:00
|
|
|
</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-container">
|
|
|
|
<div style="font-weight: bold; color: #3b8eea; margin-bottom: 10px;">周進出統計</div>
|
|
|
|
<canvas id="myChart"></canvas>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const canvasElement = document.getElementById('myChart');
|
|
|
|
if (canvasElement) {
|
|
|
|
const ctx = canvasElement.getContext('2d');
|
|
|
|
if (ctx) { // Ensure context is valid
|
|
|
|
new Chart(ctx, {
|
|
|
|
type: 'bar',
|
|
|
|
data: {
|
|
|
|
labels: ['4/30', '5/1', '5/2', '5/3', '5/4', '5/5', '5/6'],
|
|
|
|
datasets: [{
|
2025-06-10 12:56:31 +08:00
|
|
|
label: '進出人次',
|
2025-05-12 17:29:54 +08:00
|
|
|
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 } }
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
console.error("無法取得 'myChart' canvas 的 2D context。");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// console.log("'myChart' canvas element 未找到。");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|