This commit is contained in:
insvrgent
2025-01-16 14:36:35 +07:00
parent 3d05102199
commit b111195491
3 changed files with 7 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
// src/config.js
const API_BASE_URL = 'https://api.kedaimaster.com';
const API_BASE_URL = 'https://dev.api.kedaimaster.com';
export default API_BASE_URL;

View File

@@ -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?.itemSales || []);
// 2. Retrieve the specific cafe's report items if needed
const filteredItems = selectedSubItems?.find(cafe => cafe.cafeId == selectedSubItemId) || { report: { items: [] } };
@@ -202,13 +202,13 @@ 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,
value: item.username || item.name,
value: item.username || item.itemName || item.name,
color: (colors && colors[index]) || "#cccccc", // Safe check for colors array
})) || []; // Ensure segments is an empty array if no items are availabled
// Function to combine items of all cafes for the selected tenant
console.log(selectedItems)
console.log(selectedItemId)
console.log(segments)
// Check if items and items.items are defined before proceeding
const allMaterials = (items?.items || []).flatMap(item => item.report?.materialsPurchased || []);
@@ -326,7 +326,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> keuntungan</p>
<p> Tagihan</p>
<p>{items?.totalIncome * 0.02}</p>
</div>
</div>
@@ -788,7 +788,7 @@ const sortedMaterials = allMaterials.sort((a, b) => new Date(a.date) - new Date(
>
<h3>{item.username || item.name} &nbsp;</h3>
<h3>
Rp{formatIncome(item.totalIncome || item.report?.totalIncome) || 0}
Rp{formatIncome(item.totalIncome || item.report?.currentTotals.income) || 0}
</h3>
</div>