修正
This commit is contained in:
@@ -252,7 +252,9 @@
|
||||
// 科目選択履歴を保存(journal-entry.htmlと共通のlocalStorageキー)
|
||||
function saveAccountToRecentEdit(accountId) {
|
||||
if (!accountId) return;
|
||||
let recent = JSON.parse(localStorage.getItem("recentAccounts") || "[]");
|
||||
let recent = JSON.parse(
|
||||
localStorage.getItem("recentAccounts") || "[]",
|
||||
);
|
||||
recent = recent.filter((id) => id !== accountId);
|
||||
recent.unshift(accountId);
|
||||
if (recent.length > 20) recent = recent.slice(0, 20);
|
||||
@@ -261,7 +263,8 @@
|
||||
|
||||
function makeLbl(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;
|
||||
}
|
||||
@@ -296,11 +299,17 @@
|
||||
if (filtered.length === 0) {
|
||||
dropdown.innerHTML = `<div style="padding: 8px 12px; color: #999;">該当する科目がありません</div>`;
|
||||
} else if (isFiltered) {
|
||||
const sorted = filtered.slice().sort((a, b) => a.account_code.localeCompare(b.account_code));
|
||||
const sorted = filtered
|
||||
.slice()
|
||||
.sort((a, b) => a.account_code.localeCompare(b.account_code));
|
||||
sorted.slice(0, 50).forEach(appendOpt);
|
||||
} else {
|
||||
const recentIds = JSON.parse(localStorage.getItem("recentAccounts") || "[]");
|
||||
const recentItems = recentIds.map((id) => filtered.find((a) => a.account_id === id)).filter(Boolean);
|
||||
const recentIds = JSON.parse(
|
||||
localStorage.getItem("recentAccounts") || "[]",
|
||||
);
|
||||
const recentItems = recentIds
|
||||
.map((id) => filtered.find((a) => a.account_id === id))
|
||||
.filter(Boolean);
|
||||
const recentSet = new Set(recentIds);
|
||||
const otherItems = filtered
|
||||
.filter((a) => !recentSet.has(a.account_id))
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user