chore: remove project amount detail-view button
This commit is contained in:
@@ -5391,60 +5391,7 @@
|
||||
|
||||
<div style={{ display: "grid", gap: 18, marginTop: 18 }}>
|
||||
<section className="panel" style={{ padding: 16 }}>
|
||||
<div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", gap: 12 }}>
|
||||
<div style={{ fontSize: 16, fontWeight: 700 }}>프로젝트별 금액</div>
|
||||
<button
|
||||
type="button"
|
||||
className="button-muted"
|
||||
style={{ height: 30, padding: "0 10px", borderRadius: 9, fontSize: 12 }}
|
||||
onClick={() => {
|
||||
const accounts = Array.isArray(lifecycleBreakdownModal.accounts) ? lifecycleBreakdownModal.accounts : [];
|
||||
const allocationMode =
|
||||
(accounts.find((acc) => (acc.allocation_mode || "").trim()) || {}).allocation_mode || "";
|
||||
const aggregatedByYearMonth = {};
|
||||
accounts.forEach((acc) => {
|
||||
const rows = Array.isArray(acc.allocation_details) ? acc.allocation_details : [];
|
||||
rows.forEach((row) => {
|
||||
const key = String(row.year_month || "");
|
||||
if (!aggregatedByYearMonth[key]) {
|
||||
aggregatedByYearMonth[key] = {
|
||||
year_month: key,
|
||||
source_amount: 0,
|
||||
project_basis_amount: Number(row.project_basis_amount || 0),
|
||||
total_basis_amount: Number(row.total_basis_amount || 0),
|
||||
display_project_basis_amount: Number(row.display_project_basis_amount ?? row.project_basis_amount ?? 0),
|
||||
display_total_basis_amount: Number(row.display_total_basis_amount ?? row.total_basis_amount ?? 0),
|
||||
allocated_amount: 0,
|
||||
};
|
||||
}
|
||||
aggregatedByYearMonth[key].source_amount += Number(row.source_amount || 0);
|
||||
aggregatedByYearMonth[key].allocated_amount += Number(row.allocated_amount || 0);
|
||||
});
|
||||
});
|
||||
const aggregatedAllocationDetails = Object.values(aggregatedByYearMonth).sort((a, b) =>
|
||||
String(a.year_month || "").localeCompare(String(b.year_month || ""))
|
||||
);
|
||||
const sharedProjects = (Array.isArray(lifecycleBreakdownModal.projects) ? lifecycleBreakdownModal.projects : [])
|
||||
.map((project) => ({ ...project }))
|
||||
.filter((project) => Number(project.shared_expense_supply || 0) > 0);
|
||||
const directTotal = sharedProjects.reduce((sum, project) => sum + Number(project.direct_expense_supply || 0), 0);
|
||||
const sharedTotal = sharedProjects.reduce((sum, project) => sum + Number(project.shared_expense_supply || 0), 0);
|
||||
setLifecycleProjectTotalModal({
|
||||
label: lifecycleBreakdownModal.label || "",
|
||||
total_amount: directTotal + sharedTotal,
|
||||
direct_total: directTotal,
|
||||
shared_total: sharedTotal,
|
||||
projects: sharedProjects,
|
||||
accounts: Array.isArray(lifecycleBreakdownModal.accounts) ? lifecycleBreakdownModal.accounts.map((account) => ({ ...account })) : [],
|
||||
allocation_mode: allocationMode,
|
||||
allocation_details: aggregatedAllocationDetails,
|
||||
});
|
||||
setLifecycleProjectTotalGroup("공통배분분");
|
||||
}}
|
||||
>
|
||||
상세보기
|
||||
</button>
|
||||
</div>
|
||||
<div className="subtle" style={{ marginTop: 6 }}>연결된 프로젝트들 중 이 항목에 반영된 지출 금액입니다.</div>
|
||||
<div style={{ display: "grid", gap: 10, marginTop: 12 }}>
|
||||
{(lifecycleBreakdownModal.projects || []).length ? (
|
||||
|
||||
Reference in New Issue
Block a user