Fix 伝達事項

This commit is contained in:
2025-04-08 11:23:14 +08:00
parent 80cbf5227e
commit 2a6fa741e1
3 changed files with 23 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
// ------------------- 詳細画面表示時の処理 -------------------
kintone.events.on('app.record.detail.show', function (event) {
// 「登園/帰園」ボタン
const area = kintone.app.record.getSpaceElement('header-clocking-btn-area');
const clockIn = createBtn('clock-in', '登園', dateToFieldInDetail('登園時刻'));
@@ -12,9 +13,19 @@
area.appendChild(clockOut);
hideSpaceField(['clock-in-btn-area', 'clock-out-btn-area']);
// 「伝達事項」
if (!isBaby(event.record['学年'].value)) {
kintone.app.record.setFieldShown('伝達事項', false);
}
return event;
});
function isBaby(grade) {
return grade === "0歳児" || grade === "1歳児";
}
function dateToFieldInDetail(fieldCode) {
return async function (e) {
await new KintoneRestAPIClient().record.updateRecord({
@@ -32,16 +43,28 @@
// ------------------- 印刷画面表示時の処理 -------------------
kintone.events.on('app.record.print.show', (event) => {
// 「登園/帰園」ボタン
hideSpaceField(['clock-in-btn-area', 'clock-out-btn-area']);
// 「伝達事項」
if (!isBaby(event.record['学年'].value)) {
kintone.app.record.setFieldShown('伝達事項', false);
}
return event;
});
// ------------------- 編集画面表示時の処理 -------------------
kintone.events.on(['app.record.create.show', 'app.record.edit.show'], function (event) {
// 「登園/帰園」ボタン
const clockIn = createBtn('clock-in', '登園', dateToFieldInEdit('登園時刻'));
kintone.app.record.getSpaceElement('clock-in-btn-area').appendChild(clockIn);
const clockOut = createBtn('clock-out', '帰園', dateToFieldInEdit('帰園時刻'));
kintone.app.record.getSpaceElement('clock-out-btn-area').appendChild(clockOut);
// 「伝達事項」
if (!isBaby(event.record['学年'].value)) {
kintone.app.record.setFieldShown('伝達事項', false);
}
return event;
});