-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from khengyun/feat/admin/home-most-sale-compo…
…nent Update with chart
- Loading branch information
Showing
4 changed files
with
117 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/webapp/WEB-INF/jspf/admin/components/todayview.jspf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<%@ page pageEncoding="UTF-8" %> | ||
<div class="container-fluid p-4 shadow rounded-4 bg-white mb-3"> | ||
<h2 class="text-start fs-2">Số liệu hôm nay</h2> | ||
<div class="d-flex flex-row flex-wrap flex-between-center gap-3 mt-3"> | ||
<div> | ||
<p class="fs-4 fw-bold mb-1">20.035.000đ</p> | ||
<h6>Doanh thu bán hàng</h6> | ||
</div> | ||
<div> | ||
<p class="fs-4 fw-bold mb-1" id="order_value">354</p> | ||
<h6>Đơn hàng</h6> | ||
</div> | ||
<div> | ||
<p class="fs-4 fw-bold mb-1">2.138</p> | ||
<h6>Khách thăm</h6> | ||
</div> | ||
<div> | ||
<p class="fs-4 fw-bold mb-1" id="today-vip">21</p> | ||
<h6>khách vip hôm nay</h6> | ||
</div> | ||
<div> | ||
<p class="fs-4 fw-bold mb-1">Cơm gà xối mỡ</p> | ||
<h6>Món bán chạy nhất</h6> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
// Tạo một yêu cầu HTTP đến API | ||
fetch("http://localhost:8001/get_daily_revenue") | ||
.then(function (response) { | ||
return response.json(); // Chuyển đổi phản hồi thành đối tượng JSON | ||
}) | ||
.then(function (data) { | ||
// Cập nhật nội dung trang web với dữ liệu từ API | ||
document.querySelector(".fs-4.fw-bold.mb-1").textContent = | ||
data.daily_revenue + "đ"; | ||
document.querySelector("#order_value").textContent = data.daily_orders; | ||
document.querySelector("#today-vip").textContent = | ||
data.customer_with_most_orders; | ||
}) | ||
.catch(function (error) { | ||
console.log("Lỗi: " + error); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters