出欠簿一括作成

This commit is contained in:
2025-02-12 15:47:26 +08:00
parent 4e39a1a680
commit 39bddd4b96
4 changed files with 97 additions and 44 deletions

View File

@@ -18,9 +18,7 @@ const classItems = [
{ label: "ゆり", value: "ゆり" },
]
const errorEl = new Kuc.Notification({
type: 'danger',
});
let errorEl;
let loadingEl;
function getHeaderSpace(className, isDetailPage) {
@@ -123,7 +121,7 @@ function createBtnGroupArea(groupId, btnLabel, btnOnClick, { btnElId = false, ye
});
result[btnElId] = btnEl;
btnEl.addEventListener('click', (e) => {
errorEl.close();
showError(false);
const checkResult = checkInputData(result, { btnLabel, yearElId, monthElId, dateElId, classElId });
if (checkResult) {
btnOnClick(e, checkResult);
@@ -158,8 +156,7 @@ function checkInputData(map, { btnLabel, yearElId, monthElId, dateElId, classElI
errorMsgs.push(' · クラスを選択してください。');
}
if (errorMsgs.length > 0) {
errorEl.text = btnLabel + 'エラー\n' + errorMsgs.join('\n');
errorEl.open();
showError(true, btnLabel + 'エラー\n' + errorMsgs.join('\n'))
return;
}
@@ -249,4 +246,20 @@ function loading(show, text) {
if (show) {
loadingEl.open();
}
}
function showError(show, text) {
if (!errorEl) {
errorEl = new Kuc.Notification({
type: 'danger',
text
});
} else {
errorEl.close();
errorEl.text = text;
}
if (show) {
errorEl.open();
console.error(text);
}
}