出欠簿一括作成
This commit is contained in:
25
src/utils.js
25
src/utils.js
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user