| @@ -0,0 +1,73 @@ | |||||
| import { apptemplate } from "@/common/app-template"; | |||||
| import { AppID } from "@/common/appids"; | |||||
| import { setHeaderButton } from "@/common/header-button"; | |||||
| import { makeRecordData } from "@/common/rest-api-client"; | |||||
| import { Message } from "@/exception"; | |||||
| import { ShowConfirmDialog, SuccessDialog } from "@/middleware/swal"; | |||||
| import bulkRequest from "@/rest-api/bulk"; | |||||
| import { QueryBuilder } from "@/rest-api/query"; | |||||
| import { | |||||
| ParkingNavi駐車場プラン, | |||||
| ParkingNavi駐車場プランフィールド名, | |||||
| } from "@/types/ParkingNavi駐車場プラン"; | |||||
| import { 定期申込予約, 定期申込予約フィールド名 } from "@/types/定期申込予約"; | |||||
| import { KintoneRestAPIClient } from "@kintone/rest-api-client"; | |||||
| import { sprintf } from "sprintf"; | |||||
| const 表示判定 = (record: 定期申込予約): boolean => { | |||||
| return true; | |||||
| }; | |||||
| export default function 定期駐車場プラン入力(record: 定期申込予約) { | |||||
| if (表示判定(record)) { | |||||
| setHeaderButton( | |||||
| "定期駐車場プラン入力", | |||||
| apptemplate(async ({ needReloadAtEnd }) => { | |||||
| const confirmMessage = (() => { | |||||
| if (!!record.承認メール送信日時.value) { | |||||
| return "定期駐車場プラン名を入力しますか?"; | |||||
| } | |||||
| return "送信しますか?"; | |||||
| })(); | |||||
| const confirm = await ShowConfirmDialog({ | |||||
| text: confirmMessage, | |||||
| }); | |||||
| if (!confirm.isConfirmed) return; | |||||
| const client = new KintoneRestAPIClient(); | |||||
| const F = ParkingNavi駐車場プランフィールド名; | |||||
| const builder = new QueryBuilder(); | |||||
| builder.where(F.parkingnavi駐車場名, record.ParkingNavi駐車場.value); | |||||
| builder.where(F.プラン名, record.ParkingNaviプラン.value); | |||||
| const records = await client.record.getRecords<ParkingNavi駐車場プラン>( | |||||
| { | |||||
| app: AppID.ParkingNavi駐車場プラン, | |||||
| query: builder.build(), | |||||
| } | |||||
| ); | |||||
| if (records.records.length === 0) { | |||||
| throw new Message("ParkingNavi駐車場が設定されていません"); | |||||
| } | |||||
| if (records.records.length > 1) { | |||||
| throw new Message("ParkingNavi駐車場が2つ以上設定されています"); | |||||
| } | |||||
| const parkingNavi = records.records[0]; | |||||
| bulkRequest.update({ | |||||
| app: AppID.定期申込予約, | |||||
| id: record.$id.value, | |||||
| record: makeRecordData({ | |||||
| [定期申込予約フィールド名.駐車場名]: parkingNavi.定期駐車場名.value, | |||||
| [定期申込予約フィールド名.定期駐車場プラン]: | |||||
| parkingNavi.定期駐車場プラン.value, | |||||
| }), | |||||
| }); | |||||
| await bulkRequest.save(); | |||||
| await SuccessDialog.fire(); | |||||
| needReloadAtEnd(true); | |||||
| }) | |||||
| ); | |||||
| } | |||||
| } | |||||
| @@ -9,6 +9,7 @@ import 受付メール送信ボタン from "./buttons/受付メール送信ボ | |||||
| import 日割り入金予定作成ボタン from "./buttons/日割り入金予定作成ボタン"; | import 日割り入金予定作成ボタン from "./buttons/日割り入金予定作成ボタン"; | ||||
| import 自動承認ボタン from "./buttons/自動承認ボタン"; | import 自動承認ボタン from "./buttons/自動承認ボタン"; | ||||
| import 承認メール送信ボタン from "./buttons/承認メール送信ボタン"; | import 承認メール送信ボタン from "./buttons/承認メール送信ボタン"; | ||||
| import 定期駐車場プラン入力 from "./buttons/定期駐車場プラン入力"; | |||||
| setup(() => { | setup(() => { | ||||
| kintone.events.on( | kintone.events.on( | ||||
| @@ -24,6 +25,7 @@ setup(() => { | |||||
| 保証金入金予定作成ボタン(record); | 保証金入金予定作成ボタン(record); | ||||
| 受付メール送信ボタン(record); | 受付メール送信ボタン(record); | ||||
| 承認メール送信ボタン(record); | 承認メール送信ボタン(record); | ||||
| 定期駐車場プラン入力(record); | |||||
| }) | }) | ||||
| ); | ); | ||||
| }); | }); | ||||
| @@ -13,5 +13,6 @@ export const AppID = { | |||||
| 車室情報2: APP_ID.車室情報2, | 車室情報2: APP_ID.車室情報2, | ||||
| 自動承認グループ: APP_ID.自動承認グループ, | 自動承認グループ: APP_ID.自動承認グループ, | ||||
| 定期駐車場プランマスタ: APP_ID.定期駐車場プランマスタ, | 定期駐車場プランマスタ: APP_ID.定期駐車場プランマスタ, | ||||
| ParkingNavi駐車場プラン: APP_ID.ParkingNavi駐車場プラン, | |||||
| } as const; | } as const; | ||||
| export type AppID = (typeof AppID)[keyof typeof AppID]; | export type AppID = (typeof AppID)[keyof typeof AppID]; | ||||
| @@ -10,6 +10,7 @@ export type KintoneConfig = { | |||||
| 車室情報2: number; | 車室情報2: number; | ||||
| 自動承認グループ: number; | 自動承認グループ: number; | ||||
| 定期駐車場プランマスタ: number; | 定期駐車場プランマスタ: number; | ||||
| ParkingNavi駐車場プラン: number; | |||||
| }; | }; | ||||
| }; | }; | ||||
| @@ -27,6 +28,7 @@ export const kintoneConfig = (): KintoneConfig => { | |||||
| 車室情報2: 279, | 車室情報2: 279, | ||||
| 自動承認グループ: 286, | 自動承認グループ: 286, | ||||
| 定期駐車場プランマスタ: 257, | 定期駐車場プランマスタ: 257, | ||||
| ParkingNavi駐車場プラン: 297, | |||||
| }, | }, | ||||
| }; | }; | ||||
| } else if (process.env.NODE_ENV === "production") { | } else if (process.env.NODE_ENV === "production") { | ||||
| @@ -42,6 +44,7 @@ export const kintoneConfig = (): KintoneConfig => { | |||||
| 車室情報2: 868, | 車室情報2: 868, | ||||
| 自動承認グループ: 869, | 自動承認グループ: 869, | ||||
| 定期駐車場プランマスタ: 259, | 定期駐車場プランマスタ: 259, | ||||
| ParkingNavi駐車場プラン: 866, | |||||
| }, | }, | ||||
| }; | }; | ||||
| } else { | } else { | ||||
| @@ -0,0 +1,24 @@ | |||||
| import { KintoneRecordField } from "@kintone/rest-api-client"; | |||||
| import { AppRecord } from "."; | |||||
| const F = { | |||||
| parkingnavi駐車場名: "parkingnavi駐車場名", | |||||
| プラン名: "プラン名", | |||||
| 定期駐車場名: "定期駐車場名", | |||||
| 定期駐車場プラン: "定期駐車場プラン", | |||||
| } as const; | |||||
| export const ParkingNavi駐車場プランフィールド名 = F; | |||||
| export type ParkingNavi駐車場プラン = AppRecord & { | |||||
| [F.parkingnavi駐車場名]: KintoneRecordField.SingleLineText; | |||||
| [F.定期駐車場プラン]: KintoneRecordField.SingleLineText; | |||||
| 金額: KintoneRecordField.Number; | |||||
| プランNo: KintoneRecordField.SingleLineText; | |||||
| 車種種別: KintoneRecordField.Dropdown; | |||||
| [F.定期駐車場名]: KintoneRecordField.SingleLineText; | |||||
| 状態: KintoneRecordField.RadioButton; | |||||
| [F.プラン名]: KintoneRecordField.SingleLineText; | |||||
| 割引: KintoneRecordField.CheckBox; | |||||
| }; | |||||
| @@ -21,6 +21,10 @@ const F = { | |||||
| 初回入金予定_日割り分入金予定: "初回入金予定_日割り分入金予定", | 初回入金予定_日割り分入金予定: "初回入金予定_日割り分入金予定", | ||||
| 初回入金予定_保証金入金予定: "初回入金予定_保証金入金予定", | 初回入金予定_保証金入金予定: "初回入金予定_保証金入金予定", | ||||
| 初回入金予定_初回入金充当状態: "初回入金予定_初回入金充当状態", | 初回入金予定_初回入金充当状態: "初回入金予定_初回入金充当状態", | ||||
| ParkingNavi駐車場コード: "ParkingNavi駐車場コード", | |||||
| ParkingNavi駐車場: "ParkingNavi駐車場", | |||||
| ParkingNaviプラン: "ParkingNaviプラン", | |||||
| 定期駐車場プラン: "定期駐車場プラン", | |||||
| } as const; | } as const; | ||||
| export const 状態Dropdown = { | export const 状態Dropdown = { | ||||
| @@ -58,7 +62,7 @@ export type 定期申込予約 = AppRecord & { | |||||
| 受付順: KintoneRecordField.Number; | 受付順: KintoneRecordField.Number; | ||||
| 申込番号: KintoneRecordField.SingleLineText; | 申込番号: KintoneRecordField.SingleLineText; | ||||
| 利用方法: KintoneRecordField.MultiLineText; | 利用方法: KintoneRecordField.MultiLineText; | ||||
| 定期駐車場プラン: KintoneRecordField.SingleLineText; | |||||
| [F.定期駐車場プラン]: KintoneRecordField.SingleLineText; | |||||
| 台数: KintoneRecordField.SingleLineText; | 台数: KintoneRecordField.SingleLineText; | ||||
| 防犯登録番号: KintoneRecordField.SingleLineText; | 防犯登録番号: KintoneRecordField.SingleLineText; | ||||
| 請求対象分_月: KintoneRecordField.Number; | 請求対象分_月: KintoneRecordField.Number; | ||||
| @@ -72,19 +76,19 @@ export type 定期申込予約 = AppRecord & { | |||||
| 住所: KintoneRecordField.SingleLineText; | 住所: KintoneRecordField.SingleLineText; | ||||
| 電話番号: KintoneRecordField.SingleLineText; | 電話番号: KintoneRecordField.SingleLineText; | ||||
| 受付日: KintoneRecordField.Date; | 受付日: KintoneRecordField.Date; | ||||
| ParkingNavi駐車場コード: KintoneRecordField.SingleLineText; | |||||
| [F.ParkingNavi駐車場コード]: KintoneRecordField.SingleLineText; | |||||
| フリガナ: KintoneRecordField.SingleLineText; | フリガナ: KintoneRecordField.SingleLineText; | ||||
| 利用開始希望日: KintoneRecordField.Date; | 利用開始希望日: KintoneRecordField.Date; | ||||
| メモ: KintoneRecordField.MultiLineText; | メモ: KintoneRecordField.MultiLineText; | ||||
| 車室番号: KintoneRecordField.SingleLineText; | 車室番号: KintoneRecordField.SingleLineText; | ||||
| ParkingNavi駐車場: KintoneRecordField.SingleLineText; | |||||
| [F.ParkingNavi駐車場]: KintoneRecordField.SingleLineText; | |||||
| [F.駐車場名]: KintoneRecordField.SingleLineText; | [F.駐車場名]: KintoneRecordField.SingleLineText; | ||||
| [F.振込期日]: KintoneRecordField.Date; | [F.振込期日]: KintoneRecordField.Date; | ||||
| 日割り分_金額: KintoneRecordField.Number; | 日割り分_金額: KintoneRecordField.Number; | ||||
| 自動承認メモ: KintoneRecordField.MultiLineText; | 自動承認メモ: KintoneRecordField.MultiLineText; | ||||
| 車両番号: KintoneRecordField.SingleLineText; | 車両番号: KintoneRecordField.SingleLineText; | ||||
| [F.請求対象分_金額]: KintoneRecordField.Number; | [F.請求対象分_金額]: KintoneRecordField.Number; | ||||
| ParkingNaviプラン: KintoneRecordField.SingleLineText; | |||||
| [F.ParkingNaviプラン]: KintoneRecordField.SingleLineText; | |||||
| [F.日割り分_月]: KintoneRecordField.Number; | [F.日割り分_月]: KintoneRecordField.Number; | ||||
| 支払方法: KintoneRecordField.Dropdown; | 支払方法: KintoneRecordField.Dropdown; | ||||
| [F.自動承認ステータス]: KintoneRecordField.SingleLineText; | [F.自動承認ステータス]: KintoneRecordField.SingleLineText; | ||||