|
|
|
@@ -1,7 +1,7 @@ |
|
|
|
import { AppID } from "@/common/appids"; |
|
|
|
import { setHeaderButton } from "@/common/header-button"; |
|
|
|
import { makeRecordData } from "@/common/rest-api-client"; |
|
|
|
import { noticeToCandidates } from "@/mypage/定期予約選考"; |
|
|
|
import { fillCandidates, noticeToCandidates } from "@/mypage/定期予約選考"; |
|
|
|
import { |
|
|
|
定期予約選考, |
|
|
|
定期予約選考フィールド名, |
|
|
|
@@ -10,6 +10,46 @@ import { |
|
|
|
import { 定期申込予約フィールド名, 状態Dropdown } from "@/types/定期申込予約"; |
|
|
|
import { KintoneRestAPIClient } from "@kintone/rest-api-client"; |
|
|
|
|
|
|
|
// 検索用文字列をセットする |
|
|
|
const setSearchCondition = (currentRecord: 定期予約選考) => { |
|
|
|
const candidates = currentRecord.申込者一覧.value |
|
|
|
.filter((row) => !!row.value.申込者一覧_申込レコード番号.value) |
|
|
|
.map((row) => { |
|
|
|
return "c" + row.value.申込者一覧_申込レコード番号.value + "c"; |
|
|
|
}); |
|
|
|
const entries = currentRecord.契約希望者一覧.value |
|
|
|
.filter((row) => !!row.value.契約希望者一覧_申込レコード番号.value) |
|
|
|
.map((row) => { |
|
|
|
return "e" + row.value.契約希望者一覧_申込レコード番号.value + "e"; |
|
|
|
}); |
|
|
|
const results = currentRecord.選考結果一覧.value |
|
|
|
.filter((row) => !!row.value.選考結果一覧_申込番号.value) |
|
|
|
.map((row) => { |
|
|
|
return "r" + row.value.選考結果一覧_申込レコード番号.value + "r"; |
|
|
|
}); |
|
|
|
|
|
|
|
currentRecord.検索用_申込一覧_レコード番号.value = candidates.join(","); |
|
|
|
currentRecord.検索用_契約希望者_レコード番号.value = entries.join(","); |
|
|
|
currentRecord.検索用_選考結果_レコード番号.value = results.join(","); |
|
|
|
}; |
|
|
|
|
|
|
|
const getCallBackHandleFillcandidates = (currentRecord: 定期予約選考) => { |
|
|
|
return async () => { |
|
|
|
const confirm = window.confirm("候補者を設定しますか?"); |
|
|
|
if (!confirm || !currentRecord) return; |
|
|
|
|
|
|
|
const result = await fillCandidates( |
|
|
|
Number(currentRecord.レコード番号.value) |
|
|
|
); |
|
|
|
if (result) { |
|
|
|
window.alert("設定しました"); |
|
|
|
location.reload(); |
|
|
|
} else { |
|
|
|
window.alert("失敗しました"); |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
const getCallBackHandleNoticeTocandidates = (currentRecord: 定期予約選考) => { |
|
|
|
return async () => { |
|
|
|
const confirm = window.confirm("対象者へメール送信しますか?"); |
|
|
|
@@ -33,7 +73,6 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => { |
|
|
|
if (!confirm || !currentRecord) return; |
|
|
|
|
|
|
|
const client = new KintoneRestAPIClient(); |
|
|
|
|
|
|
|
// 選考のステータスを終了にする |
|
|
|
const param = { |
|
|
|
app: AppID.定期予約選考, |
|
|
|
@@ -80,6 +119,12 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => { |
|
|
|
const currentRecord: 定期予約選考 = event.record; |
|
|
|
|
|
|
|
// 各種ボタンの設置 |
|
|
|
if (currentRecord.選考ステータス.value === 選考ステータスDropdown.起票) { |
|
|
|
setHeaderButton( |
|
|
|
"候補者設定", |
|
|
|
getCallBackHandleFillcandidates(currentRecord) |
|
|
|
); |
|
|
|
} |
|
|
|
if ( |
|
|
|
currentRecord.選考ステータス.value === 選考ステータスDropdown.通知者選択中 |
|
|
|
) { |
|
|
|
@@ -94,4 +139,11 @@ const getCallBackHandleFinish = (currentRecord: 定期予約選考) => { |
|
|
|
setHeaderButton("当選者確定", getCallBackHandleFinish(currentRecord)); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
kintone.events.on("app.record.edit.submit", (event) => { |
|
|
|
const currentRecord: 定期予約選考 = event.record; |
|
|
|
setSearchCondition(currentRecord); |
|
|
|
|
|
|
|
return event; |
|
|
|
}); |
|
|
|
})(); |