From 12950205f60d9118d7e9044e9b864cc747ee68b0 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sat, 7 Nov 2026 10:51:42 +0900 Subject: [PATCH] feat(est): reorder manual quantity formulas --- tools/est-test/native-business-actions.js | 23 +++++++++++++++++++++-- tools/est-test/native-extra.js | 12 +++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tools/est-test/native-business-actions.js b/tools/est-test/native-business-actions.js index 3f9fe3281..20ae840df 100644 --- a/tools/est-test/native-business-actions.js +++ b/tools/est-test/native-business-actions.js @@ -41,11 +41,30 @@ const EstBusinessActions = (() => { } return false; } - async function handle(name) { + async function handle(name, node) { const { state } = EstApp, project = state.project, round = currentRound(); - if (name === "move-estimate-up" || name === "move-estimate-down") { + if (name === "move-quantity") { + const index = Number(node.dataset.row), + direction = Number(node.dataset.direction), + next = index + direction; + if ( + !Number.isInteger(index) || + ![-1, 1].includes(direction) || + index < 0 || + next < 0 || + index >= project.quantities.length || + next >= project.quantities.length + ) + throw Error("수량 수식표 이동 위치 오류"); + EstApp.change(() => { + [project.quantities[index], project.quantities[next]] = [ + project.quantities[next], + project.quantities[index], + ]; + }, false); + } else if (name === "move-estimate-up" || name === "move-estimate-down") { if (state.view !== "EstMainDat") throw Error("내역서에서만 행을 이동할 수 있습니다."); const direction = name === "move-estimate-up" ? -1 : 1; const indices = EstBusiness.moveEstimateRows( diff --git a/tools/est-test/native-extra.js b/tools/est-test/native-extra.js index 03d83d4e0..158fee9af 100644 --- a/tools/est-test/native-extra.js +++ b/tools/est-test/native-extra.js @@ -37,7 +37,17 @@ const EstExtra = (() => { field("quantities", index, "formula", row.formula, "text"), field("quantities", index, "digits", row.digits ?? 2), esc(row.Error || number(row.GN)), - button("delete-extra", "삭제", `data-section="quantities" data-row="${index}"`), + button( + "move-quantity", + "↑", + `data-row="${index}" data-direction="-1" ${index === 0 ? "disabled" : ""}`, + ) + + button( + "move-quantity", + "↓", + `data-row="${index}" data-direction="1" ${index === project.quantities.length - 1 ? "disabled" : ""}`, + ) + + button("delete-extra", "삭제", `data-section="quantities" data-row="${index}"`), ]; }); html =