login画面追加
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script src="js/auth.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>給与管理 - 設定</title>
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
@@ -651,7 +652,7 @@
|
||||
async function loadStdRemunerationYears() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/standard-remuneration/years`
|
||||
`${API_BASE}/payroll/settings/standard-remuneration/years`,
|
||||
);
|
||||
const years = await response.json();
|
||||
|
||||
@@ -678,7 +679,7 @@
|
||||
<div id="std-table-${year}">読み込み中...</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
`,
|
||||
)
|
||||
.join("");
|
||||
|
||||
@@ -729,7 +730,7 @@
|
||||
|
||||
// セッションストレージからメタデータを取得
|
||||
const metadata = JSON.parse(
|
||||
sessionStorage.getItem("stdRemunMetadata") || "{}"
|
||||
sessionStorage.getItem("stdRemunMetadata") || "{}",
|
||||
);
|
||||
console.log("取得したメタデータ:", metadata);
|
||||
|
||||
@@ -752,9 +753,8 @@
|
||||
document.getElementById(`std-table-${year}`).innerHTML = tablesHtml;
|
||||
} catch (error) {
|
||||
console.error("データ読み込みエラー:", error);
|
||||
document.getElementById(
|
||||
`std-table-${year}`
|
||||
).innerHTML = `<p style="color:red;">データの取得に失敗しました: ${error.message}</p>`;
|
||||
document.getElementById(`std-table-${year}`).innerHTML =
|
||||
`<p style="color:red;">データの取得に失敗しました: ${error.message}</p>`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,7 +768,7 @@
|
||||
console.log("renderStdRemunerationTable - metadata内容:", metadata);
|
||||
console.log(
|
||||
"renderStdRemunerationTable - metadata.source:",
|
||||
metadata.source
|
||||
metadata.source,
|
||||
);
|
||||
if (metadata.source) {
|
||||
sourceHtml = `<p style="margin-bottom: 15px; padding: 10px; background: #f0f8ff; border-left: 3px solid #0066cc; color: #333;"><strong>対象期間:</strong> ${metadata.source}</p>`;
|
||||
@@ -831,7 +831,7 @@
|
||||
step1Data.map((d) => ({
|
||||
grade: d.grade,
|
||||
pension: d.pension_insurance,
|
||||
}))
|
||||
})),
|
||||
);
|
||||
|
||||
// ステップ2: 非ゼロ値を下方へ延続(前の有効値が0以下になったら、前の非ゼロ値を使用)
|
||||
@@ -856,7 +856,7 @@
|
||||
adjustedData.map((d) => ({
|
||||
grade: d.grade,
|
||||
pension: d.pension_insurance,
|
||||
}))
|
||||
})),
|
||||
);
|
||||
|
||||
console.log("調整後のデータ(最初の3件):", adjustedData.slice(0, 3));
|
||||
@@ -927,15 +927,15 @@
|
||||
<td>${Number(row.salary_from ?? 0).toLocaleString()}</td>
|
||||
<td>${Number(row.salary_to ?? 0).toLocaleString()}</td>
|
||||
<td>${Number(
|
||||
row.health_insurance_no_care ?? 0
|
||||
row.health_insurance_no_care ?? 0,
|
||||
).toLocaleString()}</td>
|
||||
<td>${Number(healthNoCareHalf ?? 0).toLocaleString()}</td>
|
||||
<td>${Number(
|
||||
row.health_insurance_with_care ?? 0
|
||||
row.health_insurance_with_care ?? 0,
|
||||
).toLocaleString()}</td>
|
||||
<td>${Number(healthWithCareHalf ?? 0).toLocaleString()}</td>
|
||||
<td>${Number(
|
||||
row.pension_insurance ?? 0
|
||||
row.pension_insurance ?? 0,
|
||||
).toLocaleString()}</td>
|
||||
<td>${Number(pensionHalf ?? 0).toLocaleString()}</td>
|
||||
</tr>
|
||||
@@ -958,7 +958,7 @@
|
||||
|
||||
async function deleteStdRemunerationYear(year) {
|
||||
const confirmed = confirm(
|
||||
`⚠️ 警告\n\n${year}年度の標準報酬月額表データを削除します。\nこの操作は取り消せません。\n\n本当に削除してもよろしいですか?`
|
||||
`⚠️ 警告\n\n${year}年度の標準報酬月額表データを削除します。\nこの操作は取り消せません。\n\n本当に削除してもよろしいですか?`,
|
||||
);
|
||||
if (!confirmed) {
|
||||
console.log(`${year}年度の削除がキャンセルされました`);
|
||||
@@ -970,7 +970,7 @@
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/standard-remuneration/year/${year}`,
|
||||
{ method: "DELETE" }
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
|
||||
console.log("削除レスポンスステータス:", response.status);
|
||||
@@ -979,7 +979,7 @@
|
||||
|
||||
if (response.ok) {
|
||||
alert(
|
||||
`✓ ${year}年度のデータ(${result.deleted_count}件)を削除しました`
|
||||
`✓ ${year}年度のデータ(${result.deleted_count}件)を削除しました`,
|
||||
);
|
||||
console.log(`=== ${year}年度データ削除完了 ===`);
|
||||
|
||||
@@ -987,7 +987,7 @@
|
||||
await loadStdRemunerationYears();
|
||||
} else {
|
||||
alert(
|
||||
"削除に失敗しました:\n" + JSON.stringify(result.detail || result)
|
||||
"削除に失敗しました:\n" + JSON.stringify(result.detail || result),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -998,7 +998,7 @@
|
||||
|
||||
async function clearAllStdRemunerationData() {
|
||||
const confirmed = confirm(
|
||||
"⚠️ 警告\n\n標準報酬月額表のすべてのデータを削除します。\nこの操作は取り消せません。\n\n本当に削除してもよろしいですか?"
|
||||
"⚠️ 警告\n\n標準報酬月額表のすべてのデータを削除します。\nこの操作は取り消せません。\n\n本当に削除してもよろしいですか?",
|
||||
);
|
||||
if (!confirmed) {
|
||||
console.log("削除操作がキャンセルされました");
|
||||
@@ -1010,7 +1010,7 @@
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/standard-remuneration/all`,
|
||||
{ method: "DELETE" }
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
|
||||
console.log("削除レスポンスステータス:", response.status);
|
||||
@@ -1019,7 +1019,7 @@
|
||||
|
||||
if (response.ok) {
|
||||
alert(
|
||||
`✓ ${result.deleted_count}件のデータを削除しました\n\n再度Excelファイルをインポートしてください`
|
||||
`✓ ${result.deleted_count}件のデータを削除しました\n\n再度Excelファイルをインポートしてください`,
|
||||
);
|
||||
console.log("=== 全データ削除完了 ===");
|
||||
|
||||
@@ -1028,7 +1028,7 @@
|
||||
"<p>データが削除されました。Excelファイルを再度インポートしてください。</p>";
|
||||
} else {
|
||||
alert(
|
||||
"削除に失敗しました:\n" + JSON.stringify(result.detail || result)
|
||||
"削除に失敗しました:\n" + JSON.stringify(result.detail || result),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -1150,7 +1150,7 @@
|
||||
async function editInsuranceRate(rateId) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/insurance-rates`
|
||||
`${API_BASE}/payroll/settings/insurance-rates`,
|
||||
);
|
||||
const rates = await response.json();
|
||||
const rate = rates.find((r) => r.rate_id === rateId);
|
||||
@@ -1184,7 +1184,7 @@
|
||||
async function copyInsuranceRate(rateId) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/insurance-rates`
|
||||
`${API_BASE}/payroll/settings/insurance-rates`,
|
||||
);
|
||||
const rates = await response.json();
|
||||
const rate = rates.find((r) => r.rate_id === rateId);
|
||||
@@ -1265,7 +1265,7 @@
|
||||
// 介護保険年齢を数値に変換(空の場合はnull)
|
||||
if (data.care_insurance_age_threshold) {
|
||||
data.care_insurance_age_threshold = parseInt(
|
||||
data.care_insurance_age_threshold
|
||||
data.care_insurance_age_threshold,
|
||||
);
|
||||
} else {
|
||||
data.care_insurance_age_threshold = null;
|
||||
@@ -1278,7 +1278,7 @@
|
||||
"送信するURL:",
|
||||
isEditMode
|
||||
? `${API_BASE}/payroll/settings/insurance-rates/${rateId}`
|
||||
: `${API_BASE}/payroll/settings/insurance-rates`
|
||||
: `${API_BASE}/payroll/settings/insurance-rates`,
|
||||
);
|
||||
console.log("送信するデータ:", JSON.stringify(data, null, 2));
|
||||
|
||||
@@ -1302,7 +1302,7 @@
|
||||
const result = await response.json();
|
||||
console.log("成功レスポンス:", result);
|
||||
alert(
|
||||
isEditMode ? "保険料率を更新しました" : "保険料率を登録しました"
|
||||
isEditMode ? "保険料率を更新しました" : "保険料率を登録しました",
|
||||
);
|
||||
hideInsuranceForm();
|
||||
loadInsuranceRates();
|
||||
@@ -1312,7 +1312,7 @@
|
||||
alert(
|
||||
(isEditMode ? "更新" : "登録") +
|
||||
"に失敗しました: " +
|
||||
JSON.stringify(error.detail)
|
||||
JSON.stringify(error.detail),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -1328,7 +1328,7 @@
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/insurance-rates/${rateId}`,
|
||||
{ method: "DELETE" }
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
@@ -1362,7 +1362,7 @@
|
||||
async function loadChildSupportRates() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/child-support-rates`
|
||||
`${API_BASE}/payroll/settings/child-support-rates`,
|
||||
);
|
||||
const rates = await response.json();
|
||||
|
||||
@@ -1390,10 +1390,10 @@
|
||||
<tr>
|
||||
<td>${rate.rate_year}</td>
|
||||
<td>¥${Number(
|
||||
rate.income_threshold
|
||||
rate.income_threshold,
|
||||
).toLocaleString()}</td>
|
||||
<td>${(parseFloat(rate.contribution_rate) * 100).toFixed(
|
||||
3
|
||||
3,
|
||||
)}%</td>
|
||||
<td>${rate.notes || "-"}</td>
|
||||
<td>
|
||||
@@ -1405,7 +1405,7 @@
|
||||
})">削除</button>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
`,
|
||||
)
|
||||
.join("")}
|
||||
</tbody>
|
||||
@@ -1422,7 +1422,7 @@
|
||||
async function editChildSupportRate(contributionId) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/child-support-rates`
|
||||
`${API_BASE}/payroll/settings/child-support-rates`,
|
||||
);
|
||||
const rates = await response.json();
|
||||
const rate = rates.find((r) => r.contribution_id === contributionId);
|
||||
@@ -1493,7 +1493,7 @@
|
||||
alert(
|
||||
isEditMode
|
||||
? "子ども・子育て拠出金率を更新しました"
|
||||
: "子ども・子育て拠出金率を登録しました"
|
||||
: "子ども・子育て拠出金率を登録しました",
|
||||
);
|
||||
hideChildSupportForm();
|
||||
loadChildSupportRates();
|
||||
@@ -1502,7 +1502,7 @@
|
||||
alert(
|
||||
(isEditMode ? "更新" : "登録") +
|
||||
"に失敗しました: " +
|
||||
JSON.stringify(error.detail)
|
||||
JSON.stringify(error.detail),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -1517,7 +1517,7 @@
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/child-support-rates/${contributionId}`,
|
||||
{ method: "DELETE" }
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
@@ -1550,7 +1550,7 @@
|
||||
async function loadLimitSettings() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/insurance-limits`
|
||||
`${API_BASE}/payroll/settings/insurance-limits`,
|
||||
);
|
||||
const limits = await response.json();
|
||||
|
||||
@@ -1579,8 +1579,8 @@
|
||||
<td>${limit.setting_type}</td>
|
||||
<td>¥${Number(limit.limit_amount).toLocaleString()}</td>
|
||||
<td>${limit.valid_from} ~ ${
|
||||
limit.valid_to || "現在"
|
||||
}</td>
|
||||
limit.valid_to || "現在"
|
||||
}</td>
|
||||
<td>${limit.notes || "-"}</td>
|
||||
<td>
|
||||
<button class="btn btn-primary btn-small" onclick="editLimitSetting(${
|
||||
@@ -1591,7 +1591,7 @@
|
||||
})">削除</button>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
`,
|
||||
)
|
||||
.join("")}
|
||||
</tbody>
|
||||
@@ -1608,7 +1608,7 @@
|
||||
async function editLimitSetting(limitId) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/insurance-limits`
|
||||
`${API_BASE}/payroll/settings/insurance-limits`,
|
||||
);
|
||||
const limits = await response.json();
|
||||
const limit = limits.find((l) => l.limit_id === limitId);
|
||||
@@ -1676,7 +1676,7 @@
|
||||
|
||||
if (response.ok) {
|
||||
alert(
|
||||
isEditMode ? "上限設定を更新しました" : "上限設定を登録しました"
|
||||
isEditMode ? "上限設定を更新しました" : "上限設定を登録しました",
|
||||
);
|
||||
hideLimitForm();
|
||||
loadLimitSettings();
|
||||
@@ -1685,7 +1685,7 @@
|
||||
alert(
|
||||
(isEditMode ? "更新" : "登録") +
|
||||
"に失敗しました: " +
|
||||
JSON.stringify(error.detail)
|
||||
JSON.stringify(error.detail),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -1700,7 +1700,7 @@
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/insurance-limits/${limitId}`,
|
||||
{ method: "DELETE" }
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
@@ -1732,7 +1732,7 @@
|
||||
async function loadIncomeTaxYears() {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/income-tax/years`
|
||||
`${API_BASE}/payroll/settings/income-tax/years`,
|
||||
);
|
||||
const data = await response.json();
|
||||
|
||||
@@ -1772,7 +1772,7 @@
|
||||
<div id="table-${year}">読み込み中...</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
`,
|
||||
)
|
||||
.join("");
|
||||
|
||||
@@ -1785,7 +1785,7 @@
|
||||
|
||||
async function deleteTaxDataYear(year) {
|
||||
const confirmed = confirm(
|
||||
`⚠️ 警告\n\n${year}年度の所得税率表データを削除します。\nこの操作は取り消せません。\n\n本当に削除してもよろしいですか?`
|
||||
`⚠️ 警告\n\n${year}年度の所得税率表データを削除します。\nこの操作は取り消せません。\n\n本当に削除してもよろしいですか?`,
|
||||
);
|
||||
if (!confirmed) {
|
||||
console.log(`${year}年度の削除がキャンセルされました`);
|
||||
@@ -1797,7 +1797,7 @@
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/income-tax/year/${year}`,
|
||||
{ method: "DELETE" }
|
||||
{ method: "DELETE" },
|
||||
);
|
||||
|
||||
console.log("削除レスポンスステータス:", response.status);
|
||||
@@ -1806,7 +1806,7 @@
|
||||
|
||||
if (response.ok) {
|
||||
alert(
|
||||
`✓ ${year}年度のデータ(${result.deleted_count}件)を削除しました`
|
||||
`✓ ${year}年度のデータ(${result.deleted_count}件)を削除しました`,
|
||||
);
|
||||
console.log(`=== ${year}年度所得税データ削除完了 ===`);
|
||||
|
||||
@@ -1814,7 +1814,7 @@
|
||||
await loadIncomeTaxYears();
|
||||
} else {
|
||||
alert(
|
||||
"削除に失敗しました:\n" + JSON.stringify(result.detail || result)
|
||||
"削除に失敗しました:\n" + JSON.stringify(result.detail || result),
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -1851,7 +1851,7 @@
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${API_BASE}/payroll/settings/income-tax?${params}`
|
||||
`${API_BASE}/payroll/settings/income-tax?${params}`,
|
||||
);
|
||||
const taxes = await response.json();
|
||||
|
||||
@@ -1879,13 +1879,13 @@
|
||||
<tr>
|
||||
<td>${tax.dependents_count}人</td>
|
||||
<td>¥${Number(
|
||||
tax.monthly_income_from
|
||||
tax.monthly_income_from,
|
||||
).toLocaleString()}</td>
|
||||
<td>¥${Number(tax.monthly_income_to).toLocaleString()}</td>
|
||||
<td>¥${Number(tax.tax_amount).toLocaleString()}</td>
|
||||
<td>${tax.valid_from} ~ ${tax.valid_to || "現在"}</td>
|
||||
</tr>
|
||||
`
|
||||
`,
|
||||
)
|
||||
.join("")}
|
||||
</tbody>
|
||||
@@ -1908,7 +1908,7 @@
|
||||
|
||||
const taxYear = prompt(
|
||||
"税年度を入力してください(空欄の場合はファイルから自動抽出):",
|
||||
""
|
||||
"",
|
||||
);
|
||||
|
||||
try {
|
||||
@@ -1948,7 +1948,7 @@
|
||||
// 都道府県をプロンプトで取得
|
||||
const prefecture = prompt(
|
||||
"都道府県を入力してください(例: 東京、神奈川):",
|
||||
""
|
||||
"",
|
||||
);
|
||||
if (!prefecture || !prefecture.trim()) {
|
||||
alert("都道府県を入力してください");
|
||||
@@ -1970,7 +1970,7 @@
|
||||
{
|
||||
method: "POST",
|
||||
body: formData,
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
console.log("レスポンスステータス:", response.status);
|
||||
@@ -1990,7 +1990,7 @@
|
||||
console.log("メタデータ保存:", result.metadata);
|
||||
sessionStorage.setItem(
|
||||
"stdRemunMetadata",
|
||||
JSON.stringify(result.metadata)
|
||||
JSON.stringify(result.metadata),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2009,7 +2009,7 @@
|
||||
} else if (typeof errorDetail === "object") {
|
||||
errorMessage += JSON.stringify(errorDetail, null, 2).substring(
|
||||
0,
|
||||
1000
|
||||
1000,
|
||||
);
|
||||
} else {
|
||||
errorMessage += String(errorDetail).substring(0, 500);
|
||||
|
||||
Reference in New Issue
Block a user