ok
This commit is contained in:
@@ -181,7 +181,7 @@ const LinktreePage = ({ user, setModal }) => {
|
||||
"#9C6E5C", // Muted Brown (earthy, grounded tone)
|
||||
"#A1A1A1", // Silver (neutral highlight)
|
||||
];
|
||||
|
||||
console.log(items)
|
||||
|
||||
const selectedItems = items.items?.find(item => (item.userId || item.cafeId) === selectedItemId);
|
||||
|
||||
@@ -191,7 +191,7 @@ const LinktreePage = ({ user, setModal }) => {
|
||||
// 1. Optionally combine all report items from cafes of the selected tenant
|
||||
let allSelectedSubItems = null;
|
||||
if (user.roleId == 1)
|
||||
allSelectedSubItems = selectedSubItems?.flatMap(cafe => cafe.report?.items || selectedItems.report.items || []);
|
||||
allSelectedSubItems = selectedSubItems?.flatMap(cafe => cafe.report?.items || selectedItems.report?.items || []);
|
||||
|
||||
// 2. Retrieve the specific cafe's report items if needed
|
||||
const filteredItems = selectedSubItems?.find(cafe => cafe.cafeId == selectedSubItemId) || { report: { items: [] } };
|
||||
@@ -201,7 +201,7 @@ const LinktreePage = ({ user, setModal }) => {
|
||||
|
||||
if (user.roleId == 1 || user.roleId == 0 && selectedItemId == 0)
|
||||
segments = (selectedItemId != 0 && selectedItemId != -1 && selectedSubItemId == 0 ? allSelectedSubItems : selectedItemId != 0 && selectedItemId != -1 ? filteredItems.report?.items || [] : items?.items || []).map((item, index) => ({
|
||||
percentage: item.percentage || (items.totalIncome / item.totalIncome || items.totalIncome / item.report.totalIncome) * 100,
|
||||
percentage: item.percentage || (items?.totalIncome / item?.totalIncome || items?.totalIncome / item?.report?.totalIncome) * 100,
|
||||
value: item.username || item.name,
|
||||
color: (colors && colors[index]) || "#cccccc", // Safe check for colors array
|
||||
})) || []; // Ensure segments is an empty array if no items are availabled
|
||||
@@ -613,7 +613,7 @@ const sortedMaterials = allMaterials.sort((a, b) => new Date(a.date) - new Date(
|
||||
1 -205 -24 -27 -69 -23 -89 7 -20 31 -17 172 5 198 17 22 59 22 83 0z"/>
|
||||
</g>
|
||||
</svg>
|
||||
<p>{formatIncome(selectedItems?.report.totalIncome)}</p>
|
||||
<p>{formatIncome(selectedItems?.report?.totalIncome)}</p>
|
||||
<p>pemasukan</p>
|
||||
</div>
|
||||
<div className={styles.cardItem} >
|
||||
@@ -657,7 +657,7 @@ const sortedMaterials = allMaterials.sort((a, b) => new Date(a.date) - new Date(
|
||||
1 -205 -24 -27 -69 -23 -89 7 -20 31 -17 172 5 198 17 22 59 22 83 0z"/>
|
||||
</g>
|
||||
</svg>
|
||||
<p>{formatIncome(selectedItems?.report.currentOutcome)}</p>
|
||||
<p>{formatIncome(selectedItems?.report?.currentOutcome)}</p>
|
||||
<p>pengeluaran</p>
|
||||
</div>
|
||||
<div className={styles.cardImg}>
|
||||
|
||||
Reference in New Issue
Block a user