| @@ -1,15 +1,13 @@ | |||
| import { AppID } from "@/common/appids"; | |||
| import { setHeaderButton } from "@/common/header-button"; | |||
| import { makeRecordData } from "@/common/rest-api-client"; | |||
| import { delay } from "@/common/timer"; | |||
| import { | |||
| ConfirmDialog, | |||
| ErrorDialog, | |||
| LoadingDialog, | |||
| SuccessDialog, | |||
| closeLoading, | |||
| showLoading, | |||
| showLoadingDialog, | |||
| } from "@/middleware/swal"; | |||
| import { EmailID, sendEmail } from "@/mypage/メール"; | |||
| import { get顧客マスタ } from "@/rest-api/顧客マスタ"; | |||
| import { | |||
| 各種申請, | |||
| @@ -17,6 +15,7 @@ import { | |||
| 状況Dropdown, | |||
| 申請種別Dropdown, | |||
| } from "@/types/各種申請"; | |||
| import { 車室契約情報フィールド名 } from "@/types/車室契約情報"; | |||
| import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; | |||
| import { KintoneRestAPIClient } from "@kintone/rest-api-client"; | |||
| @@ -70,12 +69,10 @@ const getCallBack口座変更申請承認 = (record: 各種申請) => { | |||
| if (!confirm.isConfirmed) return; | |||
| try { | |||
| showLoading(); | |||
| await showLoadingDialog(); | |||
| 口座変更申請承認(record); | |||
| closeLoading(); | |||
| } catch (e) { | |||
| console.error(e); | |||
| closeLoading(); | |||
| ErrorDialog.fire(); | |||
| return; | |||
| } | |||
| @@ -87,11 +84,23 @@ const getCallBack口座変更申請承認 = (record: 各種申請) => { | |||
| }; | |||
| const 解約申請承認 = async (record: 各種申請) => { | |||
| const customer = await get顧客マスタ({ | |||
| 顧客コード: Number(record.顧客コード.value), | |||
| // 車室契約情報への反映 | |||
| await client.record.updateRecord({ | |||
| app: AppID.車室契約情報, | |||
| id: record.契約情報.value, | |||
| record: makeRecordData({ | |||
| [車室契約情報フィールド名.解約日]: record.解約申請_解約希望日.value ?? "", | |||
| }), | |||
| }); | |||
| // 車室契約情報への反映 | |||
| // 申請の完了 | |||
| await 各種申請完了(record); | |||
| // メールの送信 | |||
| const email = await sendEmail(EmailID.解約承認, { | |||
| application_no: record.申請番号.value, | |||
| }); | |||
| console.log("メール", email); | |||
| }; | |||
| const getCallBack解約申請承認 = (record: 各種申請) => { | |||
| @@ -102,12 +111,10 @@ const getCallBack解約申請承認 = (record: 各種申請) => { | |||
| if (!confirm.isConfirmed) return; | |||
| try { | |||
| showLoading(); | |||
| 口座変更申請承認(record); | |||
| closeLoading(); | |||
| await showLoadingDialog(); | |||
| 解約申請承認(record); | |||
| } catch (e) { | |||
| console.error(e); | |||
| closeLoading(); | |||
| ErrorDialog.fire(); | |||
| return; | |||
| } | |||
| @@ -1,6 +1,6 @@ | |||
| import { KintoneConfig } from "@/config/kintone"; | |||
| import { kintoneConfig } from "@/config/kintone"; | |||
| const { APP_ID } = KintoneConfig(); | |||
| const { APP_ID } = kintoneConfig(); | |||
| export const AppID = { | |||
| 顧客マスタ: APP_ID.顧客マスタ, | |||
| @@ -9,5 +9,6 @@ export const AppID = { | |||
| 問い合わせ: APP_ID.問い合わせ, | |||
| 入金予定結果: APP_ID.入金予定結果, | |||
| 各種申請: APP_ID.各種申請, | |||
| 車室契約情報: APP_ID.車室契約情報, | |||
| } as const; | |||
| export type AppID = (typeof AppID)[keyof typeof AppID]; | |||
| @@ -6,10 +6,11 @@ export type KintoneConfig = { | |||
| 問い合わせ: number; | |||
| 入金予定結果: number; | |||
| 各種申請: number; | |||
| 車室契約情報: number; | |||
| }; | |||
| }; | |||
| export const KintoneConfig = (): KintoneConfig => { | |||
| export const kintoneConfig = (): KintoneConfig => { | |||
| if (process.env.NODE_ENV === "development") { | |||
| return { | |||
| APP_ID: { | |||
| @@ -19,6 +20,7 @@ export const KintoneConfig = (): KintoneConfig => { | |||
| 問い合わせ: 291, | |||
| 入金予定結果: 272, | |||
| 各種申請: 294, | |||
| 車室契約情報: 253, | |||
| }, | |||
| }; | |||
| } else { | |||
| @@ -31,6 +33,7 @@ export const KintoneConfig = (): KintoneConfig => { | |||
| 問い合わせ: 291, | |||
| 入金予定結果: 272, | |||
| 各種申請: 294, | |||
| 車室契約情報: 253, | |||
| }, | |||
| }; | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| export type MyPageConfig = { | |||
| BASE_URL: string; | |||
| TOKEN: string; | |||
| }; | |||
| export const myPageConfig = (): MyPageConfig => { | |||
| if (process.env.NODE_ENV === "development") { | |||
| return { | |||
| BASE_URL: "http://52.195.184.134", | |||
| TOKEN: "Abfg4Huo9KJU7YHSxaabcvWSSa12", | |||
| }; | |||
| } else { | |||
| throw new Error("MyPageConfig不正"); | |||
| return { | |||
| BASE_URL: "", | |||
| TOKEN: "", | |||
| }; | |||
| } | |||
| }; | |||
| @@ -1,9 +1,11 @@ | |||
| import { delay } from "@/common/timer"; | |||
| import Swal from "sweetalert2"; | |||
| export const SuccessDialog = Swal.mixin({ | |||
| icon: "success", | |||
| timer: 1000, | |||
| title: "成功しました", | |||
| showConfirmButton: false, | |||
| }); | |||
| export const ErrorDialog = Swal.mixin({ | |||
| @@ -24,12 +26,16 @@ export const LoadingDialog = Swal.mixin({ | |||
| allowOutsideClick: false, | |||
| allowEscapeKey: false, | |||
| allowEnterKey: false, | |||
| didOpen() { | |||
| didOpen: () => { | |||
| Swal.showLoading(); | |||
| }, | |||
| }); | |||
| export const showLoading = (timer: number = 5000) => { | |||
| /** | |||
| * 必ずawaitを入れて同期処理にすること | |||
| * @param timer | |||
| */ | |||
| export const showLoadingDialog = async (timer: number = 5000) => { | |||
| LoadingDialog.fire({ | |||
| timer, | |||
| }).then((result) => { | |||
| @@ -38,9 +44,10 @@ export const showLoading = (timer: number = 5000) => { | |||
| title: "処理タイムアウトしました", | |||
| }); | |||
| } | |||
| Swal.hideLoading(); | |||
| }); | |||
| }; | |||
| export const closeLoading = () => { | |||
| Swal.close(); | |||
| // ノータイムで次のダイアログが表示されたりすると | |||
| // hideLoadingが効かなくなるのでdelayを入れる | |||
| await delay(300); | |||
| }; | |||
| @@ -0,0 +1,16 @@ | |||
| import { AppID } from "@/common/appids"; | |||
| import { 車室契約情報 } from "@/types/車室契約情報"; | |||
| import { KintoneRestAPIClient } from "@kintone/rest-api-client"; | |||
| const client = new KintoneRestAPIClient(); | |||
| export const get車室契約情報 = async ( | |||
| レコード番号: number | |||
| ): Promise<車室契約情報> => { | |||
| const { record } = await client.record.getRecord<車室契約情報>({ | |||
| app: AppID.車室契約情報, | |||
| id: レコード番号, | |||
| }); | |||
| return record; | |||
| }; | |||
| @@ -0,0 +1,124 @@ | |||
| import { KintoneRecordField } from "@kintone/rest-api-client"; | |||
| import { AppRecord } from "."; | |||
| const F = { | |||
| 解約日: "解約日", | |||
| } as const; | |||
| // export const 支払種別Dropdown = { | |||
| // 定期料金: "定期料金", | |||
| // 保証金: "保証金", | |||
| // 証明書郵送代: "証明書郵送代", | |||
| // 事務手数料: "事務手数料", | |||
| // 延滞金: "延滞金", | |||
| // 余剰金: "余剰金", | |||
| // } as const; | |||
| // export type 支払種別Dropdown = | |||
| // (typeof 支払種別Dropdown)[keyof typeof 支払種別Dropdown]; | |||
| export const 車室契約情報フィールド名 = F; | |||
| export type 車室契約情報 = AppRecord & { | |||
| 定期券番号_0: KintoneRecordField.SingleLineText; | |||
| 契約駐車場_0: KintoneRecordField.SingleLineText; | |||
| 防犯登録番号: KintoneRecordField.SingleLineText; | |||
| 定額_3月: KintoneRecordField.Number; | |||
| 入金日: KintoneRecordField.Date; | |||
| 定期駐車場名: KintoneRecordField.SingleLineText; | |||
| 担当: KintoneRecordField.SingleLineText; | |||
| 車室番号: KintoneRecordField.SingleLineText; | |||
| 契約日: KintoneRecordField.Date; | |||
| 定額_5月: KintoneRecordField.Number; | |||
| 契約金額: KintoneRecordField.Number; | |||
| 障がい者手帳有効期限: KintoneRecordField.Date; | |||
| 顧客名_表示: KintoneRecordField.SingleLineText; | |||
| 定額_4月: KintoneRecordField.Number; | |||
| 駐車場備考: KintoneRecordField.SingleLineText; | |||
| 障がい者手帳画像更新日時: KintoneRecordField.DateTime; | |||
| 顧客コード: KintoneRecordField.Number; | |||
| 解約減額: KintoneRecordField.Number; | |||
| 顧客名カナ_マスタ: KintoneRecordField.SingleLineText; | |||
| 定額_6月: KintoneRecordField.Number; | |||
| 支払パターン: KintoneRecordField.SingleLineText; | |||
| 備考_解約: KintoneRecordField.SingleLineText; | |||
| 定額_10月: KintoneRecordField.Number; | |||
| パスカード保証金: KintoneRecordField.Number; | |||
| 状態: KintoneRecordField.SingleLineText; | |||
| 定額_7月: KintoneRecordField.Number; | |||
| SMBC契約番号: KintoneRecordField.SingleLineText; | |||
| 駐車場住所: KintoneRecordField.SingleLineText; | |||
| 顧客名カナ_入力用: KintoneRecordField.SingleLineText; | |||
| チェーンゲート保証金: KintoneRecordField.Number; | |||
| 新規処理完了: KintoneRecordField.Dropdown; | |||
| 学生証有効期限: KintoneRecordField.Date; | |||
| 契約者住所: KintoneRecordField.SingleLineText; | |||
| 郵送日: KintoneRecordField.Date; | |||
| 定額_8月: KintoneRecordField.Number; | |||
| 保証金: KintoneRecordField.Number; | |||
| 顧客名_マスタ: KintoneRecordField.SingleLineText; | |||
| [F.解約日]: KintoneRecordField.Date; | |||
| 定額_12月: KintoneRecordField.Number; | |||
| 日割末日: KintoneRecordField.Date; | |||
| 契約者_電話番号: KintoneRecordField.Link; | |||
| 解約状況: KintoneRecordField.Dropdown; | |||
| 初期証明書額: KintoneRecordField.Number; | |||
| 定額_9月: KintoneRecordField.Number; | |||
| 郵便番号: KintoneRecordField.SingleLineText; | |||
| 契約者_電話番号2: KintoneRecordField.Link; | |||
| 顧客名_入力用: KintoneRecordField.SingleLineText; | |||
| 定額_11月: KintoneRecordField.Number; | |||
| 車種: KintoneRecordField.SingleLineText; | |||
| 備考_新規: KintoneRecordField.SingleLineText; | |||
| 車両番号: KintoneRecordField.SingleLineText; | |||
| 数値: KintoneRecordField.Number; | |||
| 支払方法: KintoneRecordField.SingleLineText; | |||
| 契約年度: KintoneRecordField.Number; | |||
| 契約者_メールアドレス: KintoneRecordField.Link; | |||
| 今年度: KintoneRecordField.Number; | |||
| 定額_1月: KintoneRecordField.Number; | |||
| 半年払年払: KintoneRecordField.SingleLineText; | |||
| 解約日_: KintoneRecordField.SingleLineText; | |||
| 承認メール: KintoneRecordField.Date; | |||
| 顧客名カナ: KintoneRecordField.SingleLineText; | |||
| 駐車場名: KintoneRecordField.SingleLineText; | |||
| 解約予定: KintoneRecordField.SingleLineText; | |||
| その他収入: KintoneRecordField.Number; | |||
| TODAY: KintoneRecordField.Date; | |||
| 定額_2月: KintoneRecordField.Number; | |||
| 満空key: KintoneRecordField.SingleLineText; | |||
| 学生証画像更新日時: KintoneRecordField.DateTime; | |||
| プラン: KintoneRecordField.SingleLineText; | |||
| 入金予定日: KintoneRecordField.Date; | |||
| 解約減額分: KintoneRecordField.Calc; | |||
| 解約年: KintoneRecordField.Calc; | |||
| 予定額日付1: KintoneRecordField.Calc; | |||
| 末日: KintoneRecordField.Calc; | |||
| 契約日日数: KintoneRecordField.Calc; | |||
| 初回入金額: KintoneRecordField.Calc; | |||
| 初年度月数: KintoneRecordField.Calc; | |||
| 日割額: KintoneRecordField.Calc; | |||
| 初年度年額: KintoneRecordField.Calc; | |||
| 日割計算用: KintoneRecordField.Calc; | |||
| 契約年: KintoneRecordField.Calc; | |||
| 月額以外合計: KintoneRecordField.Calc; | |||
| 本日の月数: KintoneRecordField.Calc; | |||
| 入金予定額_0: KintoneRecordField.Calc; | |||
| 次年度以降年額: KintoneRecordField.Calc; | |||
| 月数_解約: KintoneRecordField.Calc; | |||
| 解約月: KintoneRecordField.Calc; | |||
| 本日の日数: KintoneRecordField.Calc; | |||
| 初回請求分: KintoneRecordField.Calc; | |||
| 契約年_TODAY: KintoneRecordField.Calc; | |||
| 契約月: KintoneRecordField.Calc; | |||
| 契約月_予想額: KintoneRecordField.Calc; | |||
| 今月_計算用: KintoneRecordField.Calc; | |||
| 契約月_0: KintoneRecordField.Calc; | |||
| 解約フォーム: KintoneRecordField.CheckBox; | |||
| 入金確認表: KintoneRecordField.CheckBox; | |||
| 登録チェック: KintoneRecordField.CheckBox; | |||
| 契約書_0: KintoneRecordField.File; | |||
| "学生証・障がい者手帳": KintoneRecordField.File; | |||
| 学生証画像: KintoneRecordField.File; | |||
| 障がい者手帳画像: KintoneRecordField.File; | |||
| 解約届: KintoneRecordField.File; | |||
| }; | |||