feat(est): reorder manual quantity formulas
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user