From 446f17f21afea76ae9e65268120d126885858ecd Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 13 Dec 2025 23:27:38 +0900 Subject: [PATCH] feat: add minimal frontend (accounts, trial balance) --- frontend/README.md | 0 frontend/accounts.html | 25 ++++++++++++++++++++++++ frontend/css/style.css | 14 ++++++++++++++ frontend/index.html | 16 ++++++++++++++++ frontend/js/accounts.js | 18 ++++++++++++++++++ frontend/js/api.js | 10 ++++++++++ frontend/js/trial-balance.js | 29 ++++++++++++++++++++++++++++ frontend/pages/index.html | 0 frontend/pages/journals.html | 0 frontend/pages/reports.html | 0 frontend/trial-balance.html | 37 ++++++++++++++++++++++++++++++++++++ 11 files changed, 149 insertions(+) create mode 100644 frontend/README.md create mode 100644 frontend/accounts.html create mode 100644 frontend/css/style.css create mode 100644 frontend/index.html create mode 100644 frontend/js/accounts.js create mode 100644 frontend/js/api.js create mode 100644 frontend/js/trial-balance.js create mode 100644 frontend/pages/index.html create mode 100644 frontend/pages/journals.html create mode 100644 frontend/pages/reports.html create mode 100644 frontend/trial-balance.html diff --git a/frontend/README.md b/frontend/README.md new file mode 100644 index 0000000..e69de29 diff --git a/frontend/accounts.html b/frontend/accounts.html new file mode 100644 index 0000000..0b43cfb --- /dev/null +++ b/frontend/accounts.html @@ -0,0 +1,25 @@ + + + + + 科目マスタ + + + +

科目マスタ

+ + + + + + + + + + +
コード科目名種別
+ + + + + diff --git a/frontend/css/style.css b/frontend/css/style.css new file mode 100644 index 0000000..32eb461 --- /dev/null +++ b/frontend/css/style.css @@ -0,0 +1,14 @@ +body { + font-family: system-ui, -apple-system, BlinkMacSystemFont; + margin: 20px; +} + +table { + margin-top: 10px; + border-collapse: collapse; +} + +th, +td { + padding: 6px 10px; +} diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..3047479 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,16 @@ + + + + + NJTS 会計システム + + + +

NJTS 会計システム

+ + + + diff --git a/frontend/js/accounts.js b/frontend/js/accounts.js new file mode 100644 index 0000000..e4772be --- /dev/null +++ b/frontend/js/accounts.js @@ -0,0 +1,18 @@ +(async () => { + try { + const data = await apiGet("/accounts/"); + const tbody = document.getElementById("accounts-body"); + + data.forEach((a) => { + const tr = document.createElement("tr"); + tr.innerHTML = ` + ${a.account_code} + ${a.account_name} + ${a.account_type} + `; + tbody.appendChild(tr); + }); + } catch (e) { + alert(e.message); + } +})(); diff --git a/frontend/js/api.js b/frontend/js/api.js new file mode 100644 index 0000000..f37f727 --- /dev/null +++ b/frontend/js/api.js @@ -0,0 +1,10 @@ +const API_BASE = "http://localhost:18080"; + +async function apiGet(path) { + const res = await fetch(`${API_BASE}${path}`); + if (!res.ok) { + const text = await res.text(); + throw new Error(text || "APIエラー"); + } + return res.json(); +} diff --git a/frontend/js/trial-balance.js b/frontend/js/trial-balance.js new file mode 100644 index 0000000..b785ba8 --- /dev/null +++ b/frontend/js/trial-balance.js @@ -0,0 +1,29 @@ +document.getElementById("load").onclick = async () => { + const from = document.getElementById("from").value; + const to = document.getElementById("to").value; + + if (!from || !to) { + alert("期間を指定してください"); + return; + } + + try { + const data = await apiGet(`/trial-balance?date_from=${from}&date_to=${to}`); + const tbody = document.getElementById("tb-body"); + tbody.innerHTML = ""; + + data.accounts.forEach((a) => { + const tr = document.createElement("tr"); + tr.innerHTML = ` + ${a.account_name} + ${a.opening_balance} + ${a.debit} + ${a.credit} + ${a.closing_balance} + `; + tbody.appendChild(tr); + }); + } catch (e) { + alert(e.message); + } +}; diff --git a/frontend/pages/index.html b/frontend/pages/index.html new file mode 100644 index 0000000..e69de29 diff --git a/frontend/pages/journals.html b/frontend/pages/journals.html new file mode 100644 index 0000000..e69de29 diff --git a/frontend/pages/reports.html b/frontend/pages/reports.html new file mode 100644 index 0000000..e69de29 diff --git a/frontend/trial-balance.html b/frontend/trial-balance.html new file mode 100644 index 0000000..3e24c0c --- /dev/null +++ b/frontend/trial-balance.html @@ -0,0 +1,37 @@ + + + + + 試算表 + + + +

試算表

+ + + + + + + + + + + + + + + + +
科目期首借方貸方期末
+ + + + +