소스 검색

解約申請承認時に車室情報を同期するように修正

develop
sosuke.iwabuchi 2 년 전
부모
커밋
40e0092e2a
2개의 변경된 파일94개의 추가작업 그리고 50개의 파일을 삭제
  1. +90
    -45
      src/apps/各種申請/index.tsx
  2. +4
    -5
      src/common/app-template.ts

+ 90
- 45
src/apps/各種申請/index.tsx 파일 보기

@@ -1,10 +1,13 @@
import { apptemplate, eventHnalder } from "@/common/app-template";
import { AppID } from "@/common/appids";
import { setHeaderButton } from "@/common/header-button";
import { initMenuBox, setHeaderButton } from "@/common/header-button";
import { KintoneEvent } from "@/common/kintone-event";
import { makeRecordData } from "@/common/rest-api-client";
import { 契約状況同期 } from "@/logic/契約状況同期";
import { 契約情報更新イベント } from "@/event/契約情報更新";
import {
ConfirmDialog,
ErrorDialog,
ShowConfirmDialog,
SuccessDialog,
showLoadingDialog,
} from "@/middleware/swal";
@@ -21,6 +24,7 @@ import {
import { 車室情報管理フィールド名 } from "@/types/車室情報管理";
import { 顧客マスタフィールド名 } from "@/types/顧客マスタ";
import { KintoneRestAPIClient } from "@kintone/rest-api-client";
import { setup } from "..";

const client = new KintoneRestAPIClient();

@@ -253,46 +257,87 @@ const getCallBack車両番号_防犯登録番号変更申請承認 = (record:
};
};

(() => {
console.info("script build at " + process.env.BUILD_TIME);

kintone.events.on("app.record.detail.show", (event) => {
const currentRecord = event.record as 各種申請;

// 各種ボタンの設置
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value === 申請種別Dropdown.口座変更申請
) {
setHeaderButton(
"口座変更申請 承認",
getCallBack口座変更申請承認(currentRecord)
);
}
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value === 申請種別Dropdown.解約申請
) {
setHeaderButton("解約申請 承認", getCallBack解約申請承認(currentRecord));
}
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value === 申請種別Dropdown.利用者情報変更
) {
setHeaderButton(
"利用者情報変更申請 承認",
getCallBack利用者情報変更申請承認(currentRecord)
);
}
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value ===
申請種別Dropdown.車両番号_防犯登録番号変更
) {
setHeaderButton(
"車両番号・防犯登録番号変更申請 承認",
getCallBack車両番号_防犯登録番号変更申請承認(currentRecord)
);
}
});
})();
setup(() => {
kintone.events.on(
[KintoneEvent.詳細.レコード詳細画面を表示した後],
eventHnalder(async (event) => {
const currentRecord = event.record as 各種申請;

await initMenuBox();
// 各種ボタンの設置
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value === 申請種別Dropdown.口座変更申請
) {
setHeaderButton(
"口座変更申請 承認",
apptemplate(getCallBack口座変更申請承認(currentRecord))
);
}
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value === 申請種別Dropdown.解約申請
) {
setHeaderButton(
"解約申請 承認",
apptemplate(async ({ setEvent, needReloadAtEnd }) => {
getCallBack解約申請承認(currentRecord)();

const confirm = await ShowConfirmDialog({ title: "承認しますか" });
if (!confirm.isConfirmed) return;
// 車室情報管理への反映
bulkRequest.update({
app: AppID.車室情報管理,
id: currentRecord.契約情報.value,
record: makeRecordData({
[車室情報管理フィールド名.解約日]:
currentRecord.解約申請_解約希望日.value ?? "",
}),
});

// 申請の完了
await 各種申請完了(currentRecord);

// データ保存
await bulkRequest.save();

// メールの送信
const email = await sendEmail(EmailID.解約承認, {
application_no: currentRecord.申請番号.value,
});
if (!email) {
throw new Error("メール送信失敗");
}

const 契約 = await get車室情報管理(currentRecord.契約情報.value);
setEvent(new 契約情報更新イベント().getEvent(契約));

await SuccessDialog.fire();
needReloadAtEnd(true);
})
);
}
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value === 申請種別Dropdown.利用者情報変更
) {
setHeaderButton(
"利用者情報変更申請 承認",
apptemplate(getCallBack利用者情報変更申請承認(currentRecord))
);
}
if (
currentRecord.状況.value !== 状況Dropdown.完了 &&
currentRecord.申請種別.value ===
申請種別Dropdown.車両番号_防犯登録番号変更
) {
setHeaderButton(
"車両番号・防犯登録番号変更申請 承認",
apptemplate(
getCallBack車両番号_防犯登録番号変更申請承認(currentRecord)
)
);
}
})
);
});

+ 4
- 5
src/common/app-template.ts 파일 보기

@@ -37,11 +37,10 @@ export const apptemplate = (
}
await eventManager.waitEnd();
console.log("イベント処理終了");
}

// 保存処理
if (!bulkRequest.isSaved()) {
await bulkRequest.save();
// 保存処理
if (!bulkRequest.isSaved()) {
await bulkRequest.save();
}
}

// 再読込


Loading…
취소
저장