| @@ -48,6 +48,7 @@ | |||||
| "@kintone/rest-api-client": "^2.0.17", | "@kintone/rest-api-client": "^2.0.17", | ||||
| "@types/lodash": "^4.14.202", | "@types/lodash": "^4.14.202", | ||||
| "@types/sprintf": "^0.1.2", | "@types/sprintf": "^0.1.2", | ||||
| "@types/uuid": "^9.0.8", | |||||
| "core-js": "^3.6.4", | "core-js": "^3.6.4", | ||||
| "date-fns": "^2.30.0", | "date-fns": "^2.30.0", | ||||
| "kintone-ui-component": "^1.14.0", | "kintone-ui-component": "^1.14.0", | ||||
| @@ -56,6 +57,7 @@ | |||||
| "react-dom": "^18.2.0", | "react-dom": "^18.2.0", | ||||
| "sprintf": "^0.1.5", | "sprintf": "^0.1.5", | ||||
| "sweetalert2": "^11.10.1", | "sweetalert2": "^11.10.1", | ||||
| "sweetalert2-react-content": "^5.0.7" | |||||
| "sweetalert2-react-content": "^5.0.7", | |||||
| "uuid": "^9.0.1" | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,104 @@ | |||||
| import { apptemplate } from "@/common/app-template"; | |||||
| import { DEFAULT_DATE_FORMAT, formatToStr, now } from "@/common/datetime"; | |||||
| import { setHeaderButton } from "@/common/header-button"; | |||||
| import { Message } from "@/exception"; | |||||
| import { get入金予定結果一覧 } from "@/rest-api/入金予定結果"; | |||||
| import { 初回入金予定Checkbox, 定期申込予約 } from "@/types/定期申込予約"; | |||||
| import { sprintf } from "sprintf"; | |||||
| import { v4 as uuidV4 } from "uuid"; | |||||
| const 表示判定 = (record: 定期申込予約): boolean => { | |||||
| if (!record.自動承認契約情報.value) { | |||||
| return false; | |||||
| } | |||||
| if (!!record.IC定期駐車場利用方法.value) { | |||||
| return false; | |||||
| } | |||||
| if ( | |||||
| record.初回入金予定_必要分.value.includes(初回入金予定Checkbox.初月分) && | |||||
| !record.初回入金予定_初月分入金予定.value | |||||
| ) { | |||||
| return false; | |||||
| } | |||||
| if ( | |||||
| record.初回入金予定_必要分.value.includes(初回入金予定Checkbox.日割り分) && | |||||
| !record.初回入金予定_日割り分入金予定.value | |||||
| ) { | |||||
| return false; | |||||
| } | |||||
| if ( | |||||
| record.初回入金予定_必要分.value.includes(初回入金予定Checkbox.保証金) && | |||||
| !record.初回入金予定_保証金入金予定.value | |||||
| ) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| }; | |||||
| export default function バンクチェック登録ボタン(record: 定期申込予約) { | |||||
| if (表示判定(record)) { | |||||
| setHeaderButton( | |||||
| "バンクチェック登録", | |||||
| apptemplate(async () => { | |||||
| // 請求金額の取得 | |||||
| const 入金予定結果一覧 = await get入金予定結果一覧({ | |||||
| 申込レコード番号: record.$id.value, | |||||
| }); | |||||
| if (入金予定結果一覧.length === 0) { | |||||
| throw new Message("入金予定結果が登録されていません"); | |||||
| } | |||||
| let totalAmount = 0; | |||||
| 入金予定結果一覧.forEach((ele) => { | |||||
| totalAmount += Number(ele.payment_plan_amount.value); | |||||
| }); | |||||
| if (totalAmount === 0) { | |||||
| throw new Message("請求が0円です"); | |||||
| } | |||||
| const 顧客コード = 入金予定結果一覧[0].customer_code.value; | |||||
| const getInput = (name: string, val: string) => { | |||||
| const input = document.createElement("input"); | |||||
| input.type = "hidden"; | |||||
| input.name = name; | |||||
| input.value = val; | |||||
| return input; | |||||
| }; | |||||
| const metaTag = document.createElement("meta"); | |||||
| metaTag.name = "referrer"; | |||||
| metaTag.content = "origin"; | |||||
| document.head.appendChild(metaTag); | |||||
| const today = formatToStr(now(), DEFAULT_DATE_FORMAT); | |||||
| const shopCode = sprintf("%s-%s", today, uuidV4()); | |||||
| const form = document.createElement("form"); | |||||
| form.target = "_blank"; | |||||
| form.method = "POST"; | |||||
| form.action = "https://credit.j-payment.co.jp/link/bankcheck"; | |||||
| form.appendChild(getInput("aid", "128522")); | |||||
| form.appendChild(getInput("cod", shopCode)); | |||||
| form.appendChild(getInput("jb", "CAPTURE")); | |||||
| form.appendChild(getInput("am", String(totalAmount))); | |||||
| form.appendChild(getInput("tx", "0")); | |||||
| form.appendChild(getInput("sf", "0")); | |||||
| form.appendChild(getInput("customer_code", 顧客コード)); | |||||
| form.appendChild(getInput("token", "Aiurhieyubfiusygy8387gbjkh")); | |||||
| form.appendChild(getInput("entry_record_no", record.$id.value)); | |||||
| document.getElementById("record-gaia")?.appendChild(form); | |||||
| form.submit(); | |||||
| form.remove(); | |||||
| }) | |||||
| ); | |||||
| } | |||||
| } | |||||
| @@ -10,6 +10,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( | ||||
| @@ -26,6 +27,7 @@ setup(() => { | |||||
| 受付メール送信ボタン(record); | 受付メール送信ボタン(record); | ||||
| 承認メール送信ボタン(record); | 承認メール送信ボタン(record); | ||||
| 定期駐車場プラン入力(record); | 定期駐車場プラン入力(record); | ||||
| バンクチェック登録ボタン(record); | |||||
| }) | }) | ||||
| ); | ); | ||||
| }); | }); | ||||
| @@ -14,5 +14,6 @@ export const AppID = { | |||||
| 自動承認グループ: APP_ID.自動承認グループ, | 自動承認グループ: APP_ID.自動承認グループ, | ||||
| 定期駐車場プランマスタ: APP_ID.定期駐車場プランマスタ, | 定期駐車場プランマスタ: APP_ID.定期駐車場プランマスタ, | ||||
| ParkingNavi駐車場プラン: APP_ID.ParkingNavi駐車場プラン, | ParkingNavi駐車場プラン: APP_ID.ParkingNavi駐車場プラン, | ||||
| 入金プール: APP_ID.入金プール, | |||||
| } as const; | } as const; | ||||
| export type AppID = (typeof AppID)[keyof typeof AppID]; | export type AppID = (typeof AppID)[keyof typeof AppID]; | ||||
| @@ -11,6 +11,7 @@ export type KintoneConfig = { | |||||
| 自動承認グループ: number; | 自動承認グループ: number; | ||||
| 定期駐車場プランマスタ: number; | 定期駐車場プランマスタ: number; | ||||
| ParkingNavi駐車場プラン: number; | ParkingNavi駐車場プラン: number; | ||||
| 入金プール: number; | |||||
| }; | }; | ||||
| }; | }; | ||||
| @@ -29,6 +30,7 @@ export const kintoneConfig = (): KintoneConfig => { | |||||
| 自動承認グループ: 286, | 自動承認グループ: 286, | ||||
| 定期駐車場プランマスタ: 257, | 定期駐車場プランマスタ: 257, | ||||
| ParkingNavi駐車場プラン: 297, | ParkingNavi駐車場プラン: 297, | ||||
| 入金プール: 323, | |||||
| }, | }, | ||||
| }; | }; | ||||
| } else if (process.env.NODE_ENV === "production") { | } else if (process.env.NODE_ENV === "production") { | ||||
| @@ -45,6 +47,7 @@ export const kintoneConfig = (): KintoneConfig => { | |||||
| 自動承認グループ: 869, | 自動承認グループ: 869, | ||||
| 定期駐車場プランマスタ: 259, | 定期駐車場プランマスタ: 259, | ||||
| ParkingNavi駐車場プラン: 866, | ParkingNavi駐車場プラン: 866, | ||||
| 入金プール: 870, | |||||
| }, | }, | ||||
| }; | }; | ||||
| } else { | } else { | ||||
| @@ -0,0 +1,27 @@ | |||||
| import { AppID } from "@/common/appids"; | |||||
| import { 入金プール, 入金プールフィールド名 } from "@/types/入金プール"; | |||||
| import { KintoneRestAPIClient } from "@kintone/rest-api-client"; | |||||
| import { QueryBuilder } from "./query"; | |||||
| const client = new KintoneRestAPIClient(); | |||||
| const app = AppID.入金プール; | |||||
| type get入金予定結果オプション = { | |||||
| 顧客コード: number | string; | |||||
| }; | |||||
| export const get入金プール一覧 = async ({ | |||||
| 顧客コード, | |||||
| }: get入金予定結果オプション): Promise<入金プール[]> => { | |||||
| const builder = new QueryBuilder(); | |||||
| if (顧客コード) { | |||||
| builder.where(入金プールフィールド名.顧客コード, 顧客コード); | |||||
| } | |||||
| const { records } = await client.record.getRecords<入金プール>({ | |||||
| app, | |||||
| query: builder.build(), | |||||
| }); | |||||
| return records; | |||||
| }; | |||||
| @@ -0,0 +1,30 @@ | |||||
| import { AppID } from "@/common/appids"; | |||||
| import { 入金予定結果, 入金予定結果フィールド名 } from "@/types/入金予定結果"; | |||||
| import { KintoneRestAPIClient } from "@kintone/rest-api-client"; | |||||
| import { QueryBuilder } from "./query"; | |||||
| const client = new KintoneRestAPIClient(); | |||||
| const app = AppID.入金予定結果; | |||||
| type get入金予定結果オプション = { | |||||
| 申込レコード番号: number | string; | |||||
| }; | |||||
| export const get入金予定結果一覧 = async ({ | |||||
| 申込レコード番号, | |||||
| }: get入金予定結果オプション): Promise<入金予定結果[]> => { | |||||
| const builder = new QueryBuilder(); | |||||
| if (申込レコード番号) { | |||||
| builder.where( | |||||
| 入金予定結果フィールド名.初回振り込み関連申込レコード番号, | |||||
| 申込レコード番号 | |||||
| ); | |||||
| } | |||||
| const { records } = await client.record.getRecords<入金予定結果>({ | |||||
| app, | |||||
| query: builder.build(), | |||||
| }); | |||||
| return records; | |||||
| }; | |||||
| @@ -0,0 +1,18 @@ | |||||
| import { KintoneRecordField } from "@kintone/rest-api-client"; | |||||
| import { AppRecord } from "."; | |||||
| const F = { | |||||
| 顧客コード: "顧客コード", | |||||
| 顧客コード重複チェック: "顧客コード重複チェック", | |||||
| 顧客名: "顧客名", | |||||
| プール金: "プール金", | |||||
| } as const; | |||||
| export const 入金プールフィールド名 = F; | |||||
| export type 入金プール = AppRecord & { | |||||
| [F.顧客コード]: KintoneRecordField.Number; | |||||
| [F.顧客コード重複チェック]: KintoneRecordField.Number; | |||||
| [F.顧客名]: KintoneRecordField.SingleLineText; | |||||
| [F.プール金]: KintoneRecordField.Number; | |||||
| }; | |||||
| @@ -1395,6 +1395,11 @@ | |||||
| resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" | resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.7.tgz#b14cebc75455eeeb160d5fe23c2fcc0c64f724d8" | ||||
| integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== | integrity sha512-WUtIVRUZ9i5dYXefDEAI7sh9/O7jGvHg7Df/5O/gtH3Yabe5odI3UWopVR1qbPXQtvOxWu3mM4XxlYeZtMWF4g== | ||||
| "@types/uuid@^9.0.8": | |||||
| version "9.0.8" | |||||
| resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.8.tgz#7545ba4fc3c003d6c756f651f3bf163d8f0f29ba" | |||||
| integrity sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA== | |||||
| "@types/ws@^8.5.5": | "@types/ws@^8.5.5": | ||||
| version "8.5.10" | version "8.5.10" | ||||
| resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" | resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" | ||||