(function () {
    "use strict";

    const statusFieldMap = {
        '指導教諭確認中': '担任',
        '主幹確認中': '指導',
        '園長確認中': '主幹',
        '完了': '園長'
    }

    kintone.events.on("app.record.detail.process.proceed", (event) => {
        const field = statusFieldMap[event.nextStatus.value];
        if (field) {
            event.record[field].value = kintone.getLoginUser().name;
        }
        return event;
    });

})();