修正
This commit is contained in:
@@ -184,6 +184,11 @@
|
||||
<option value="">-- すべて --</option>
|
||||
</select>
|
||||
|
||||
<label style="margin-left: 16px">
|
||||
<input type="checkbox" id="searchIncludeHistory" />
|
||||
全検索(修正履歴を含む)
|
||||
</label>
|
||||
|
||||
<button onclick="searchJournals()" style="margin-left: 8px">検索</button>
|
||||
</div>
|
||||
|
||||
@@ -870,6 +875,9 @@
|
||||
const to = document.getElementById("searchToDate").value;
|
||||
const key = document.getElementById("searchKeyword").value;
|
||||
const accountId = document.getElementById("searchAccountId").value;
|
||||
const includeHistory = document.getElementById(
|
||||
"searchIncludeHistory"
|
||||
).checked;
|
||||
|
||||
// 検索条件を保存
|
||||
localStorage.setItem(
|
||||
@@ -879,6 +887,7 @@
|
||||
toDate: to,
|
||||
keyword: key,
|
||||
accountId: accountId,
|
||||
includeHistory: includeHistory,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -887,6 +896,7 @@
|
||||
if (to) qs.append("to_date", to);
|
||||
if (key) qs.append("keyword", key);
|
||||
if (accountId) qs.append("account_id", accountId);
|
||||
if (includeHistory) qs.append("include_history", "true");
|
||||
|
||||
const res = await fetch(`${API}/journal-entries?${qs.toString()}`);
|
||||
const data = await res.json();
|
||||
@@ -896,9 +906,12 @@
|
||||
|
||||
data.forEach((e) => {
|
||||
const tr = document.createElement("tr");
|
||||
// 修正履歴がある場合はバージョン番号を表示
|
||||
const versionInfo =
|
||||
includeHistory && e.version > 1 ? ` (v${e.version})` : "";
|
||||
tr.innerHTML = `
|
||||
<td>${e.entry_date}</td>
|
||||
<td>${e.description}</td>
|
||||
<td>${e.description}${versionInfo}</td>
|
||||
<td style="text-align:right">${e.debit_total.toLocaleString()}</td>
|
||||
<td style="text-align:right">${e.credit_total.toLocaleString()}</td>
|
||||
<td>
|
||||
@@ -1109,6 +1122,9 @@
|
||||
if (conditions.accountId)
|
||||
document.getElementById("searchAccountId").value =
|
||||
conditions.accountId;
|
||||
if (conditions.includeHistory)
|
||||
document.getElementById("searchIncludeHistory").checked =
|
||||
conditions.includeHistory;
|
||||
}
|
||||
|
||||
// ページロード時に自動的に検索を実行して最新データを表示
|
||||
|
||||
Reference in New Issue
Block a user