From 079057ef418fda6463b9bbc6cf96c23ab11d87ff Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 3 Mar 2026 00:01:51 +0900 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/journal-edit.html | 19 ++++++++++++++----- frontend/journal-entry.html | 30 ++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/frontend/journal-edit.html b/frontend/journal-edit.html index e0fddc3..fd367bb 100644 --- a/frontend/journal-edit.html +++ b/frontend/journal-edit.html @@ -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 = `
該当する科目がありません
`; } 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)) diff --git a/frontend/journal-entry.html b/frontend/journal-entry.html index 8c799ea..6298c42 100644 --- a/frontend/journal-entry.html +++ b/frontend/journal-entry.html @@ -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))