This commit is contained in:
zadit
2024-11-01 11:33:26 +07:00
parent 5a2b9b2f86
commit 32e8ebd69b
20 changed files with 812 additions and 509 deletions

View File

@@ -80,6 +80,31 @@ const Dashboard = ({ user, setModal }) => {
});
}
};
// function calculateCafeMetrics(cafes) {
// let totalIncomeThisMonth = 0;
// let totalIncomeLastMonth = 0;
// cafes.forEach(cafe => {
// const currentIncome = cafe.totalIncome;
// const growth = cafe.growthIncome / 100;
// // Hitung keuntungan bulan lalu
// const lastMonthIncome = currentIncome / (1 + growth);
// // Tambahkan ke total
// totalIncomeThisMonth += currentIncome;
// totalIncomeLastMonth += lastMonthIncome;
// });
// // Hitung growth total
// const totalGrowth = ((totalIncomeThisMonth - totalIncomeLastMonth) / totalIncomeLastMonth) * 100;
// return {
// totalIncomeThisMonth,
// totalIncomeLastMonth: totalIncomeLastMonth.toFixed(2),
// totalGrowth: totalGrowth.toFixed(2)
// };
// }
return (
<>
@@ -100,7 +125,9 @@ const Dashboard = ({ user, setModal }) => {
onClick={() => navigate("/" + item.cafeId)}
className={styles.rectangle}
>
{item.name || item.username}
<h1>{item.name || item.username}</h1>
<div><h1>{item.report.totalIncome}</h1><h1>{item.report.totalIncome}</h1></div>
</div>
))}
{user && user.roleId < 1 ? (