This commit is contained in:
admin
2026-03-03 00:01:51 +09:00
parent 068903b933
commit 079057ef41
2 changed files with 36 additions and 13 deletions

View File

@@ -760,7 +760,8 @@
function makeSectionLabel(text) {
const lbl = document.createElement("div");
lbl.style.cssText = "padding:3px 12px;font-size:11px;color:#888;background:#f5f5f5;font-weight:bold;border-bottom:1px solid #e0e0e0;";
lbl.style.cssText =
"padding:3px 12px;font-size:11px;color:#888;background:#f5f5f5;font-weight:bold;border-bottom:1px solid #e0e0e0;";
lbl.textContent = text;
return lbl;
}
@@ -776,12 +777,18 @@
if (isFiltered) {
// 検索中 → コード順で表示
const sorted = list.slice().sort((a, b) => a.account_code.localeCompare(b.account_code));
const sorted = list
.slice()
.sort((a, b) => a.account_code.localeCompare(b.account_code));
sorted.slice(0, 50).forEach((acc) => appendAccountOption(acc));
} else {
// 未入力 → 最近使った科目を先頭に、残りはコード順
const recentIds = JSON.parse(localStorage.getItem("recentAccounts") || "[]");
const recentItems = recentIds.map((id) => list.find((a) => a.account_id === id)).filter(Boolean);
const recentIds = JSON.parse(
localStorage.getItem("recentAccounts") || "[]",
);
const recentItems = recentIds
.map((id) => list.find((a) => a.account_id === id))
.filter(Boolean);
const recentSet = new Set(recentIds);
const otherItems = list
.filter((a) => !recentSet.has(a.account_id))
@@ -925,7 +932,8 @@
function makeSearchSectionLabel(text) {
const lbl = document.createElement("div");
lbl.style.cssText = "padding:3px 12px;font-size:11px;color:#888;background:#f5f5f5;font-weight:bold;border-bottom:1px solid #e0e0e0;";
lbl.style.cssText =
"padding:3px 12px;font-size:11px;color:#888;background:#f5f5f5;font-weight:bold;border-bottom:1px solid #e0e0e0;";
lbl.textContent = text;
return lbl;
}
@@ -956,11 +964,17 @@
}
if (isFiltered) {
const sorted = list.slice().sort((a, b) => a.account_code.localeCompare(b.account_code));
const sorted = list
.slice()
.sort((a, b) => a.account_code.localeCompare(b.account_code));
sorted.slice(0, 50).forEach(appendSearchOption);
} else {
const recentIds = JSON.parse(localStorage.getItem("recentAccounts") || "[]");
const recentItems = recentIds.map((id) => list.find((a) => a.account_id === id)).filter(Boolean);
const recentIds = JSON.parse(
localStorage.getItem("recentAccounts") || "[]",
);
const recentItems = recentIds
.map((id) => list.find((a) => a.account_id === id))
.filter(Boolean);
const recentSet = new Set(recentIds);
const otherItems = list
.filter((a) => !recentSet.has(a.account_id))