From c4101b42394cd2f165e3e55154d7ec03e8b527bc Mon Sep 17 00:00:00 2001 From: JJIIIINN Date: Thu, 28 Dec 2023 01:10:04 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A0=95=EA=B7=9C=EC=8B=9D=20=EC=B2=B4?= =?UTF-8?q?=ED=81=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ExcelCashPaymentTabBody.tsx | 14 ++++ .../main/ExcelPaymentStoppedTabBody.tsx | 25 ++++++ .../main/ExcelPaymentTargetTabBody.tsx | 24 ++++++ src/components/main/ExcelValue.tsx | 16 ++-- .../NewComerHonorableAllowanceTabBody.tsx | 27 +++++++ .../main/NewComerWarVeteranSpouseTabBody.tsx | 26 +++++++ .../main/NewComerWarVeteranTabBody.tsx | 25 +++++- src/utils/api/Auth.ts | 2 +- src/utils/functions/regex.ts | 78 +++++++++++++++++++ 9 files changed, 229 insertions(+), 8 deletions(-) create mode 100644 src/utils/functions/regex.ts diff --git a/src/components/main/ExcelCashPaymentTabBody.tsx b/src/components/main/ExcelCashPaymentTabBody.tsx index 3e02e68..e253963 100644 --- a/src/components/main/ExcelCashPaymentTabBody.tsx +++ b/src/components/main/ExcelCashPaymentTabBody.tsx @@ -4,6 +4,7 @@ import { cashPaymentTabType } from "../../models/response"; import ExcelValue from "./ExcelValue"; import { useEditExcelCash } from "../../utils/api/Allowance"; import { debounce } from "lodash"; +import { regex } from "../../utils/functions/regex"; const ExcelCashPaymentTabBody = ({ data, @@ -68,6 +69,7 @@ const ExcelCashPaymentTabBody = ({ handleChange(e); editExcelForm(); }} + error={!regex.serialNumber.test(serialNumber)} /> ); diff --git a/src/components/main/ExcelPaymentTargetTabBody.tsx b/src/components/main/ExcelPaymentTargetTabBody.tsx index 5607c3f..20c31c5 100644 --- a/src/components/main/ExcelPaymentTargetTabBody.tsx +++ b/src/components/main/ExcelPaymentTargetTabBody.tsx @@ -4,6 +4,7 @@ import { paymentTargetTabType } from "../../models/response"; import ExcelValue from "./ExcelValue"; import { useEditExcelTarget } from "../../utils/api/Allowance"; import { debounce } from "lodash"; +import { regex } from "../../utils/functions/regex"; const ExcelPaymentTargetTabBody = ({ data, @@ -74,6 +75,7 @@ const ExcelPaymentTargetTabBody = ({ handleChange(e); editExcelForm(); }} + error={!regex.serialNumber.test(serialNumber)} /> ` - border: 1px solid - ${({ theme, error }) => - error ? theme.colors.red : theme.colors.gray200}; + border: 1px solid ${({ theme }) => theme.colors.gray200}; height: 56px; - background: ${({ theme, disabled }) => - disabled ? theme.colors.gray100 : theme.colors.WHITE}; - cursor: ${({ disabled }) => (disabled ? "not-allowed" : "text")}; + background-color: ${({ theme, error }) => + error ? "#FFB5B5" : theme.colors.WHITE}; + cursor: "text"; + &:disabled { + background: ${({ theme }) => theme.colors.gray100}; + cursor: not-allowed; + } > input { max-width: 500px; height: 100%; @@ -66,6 +68,8 @@ const Wrapper = styled.td<{ disabled: boolean; error: boolean }>` min-width: 150px; padding: 0 20px; color: ${({ theme }) => theme.colors.gray900}; + background-color: ${({ theme, error }) => + error ? "#FFB5B5" : theme.colors.WHITE}; &:disabled { background: ${({ theme, disabled }) => disabled ? theme.colors.gray100 : theme.colors.WHITE}; diff --git a/src/components/main/NewComerHonorableAllowanceTabBody.tsx b/src/components/main/NewComerHonorableAllowanceTabBody.tsx index 541f43a..ee6b411 100644 --- a/src/components/main/NewComerHonorableAllowanceTabBody.tsx +++ b/src/components/main/NewComerHonorableAllowanceTabBody.tsx @@ -4,6 +4,7 @@ import ExcelValue from "./ExcelValue"; import { debounce } from "lodash"; import { newComerTabType } from "../../models/response"; import { useEditExcelNewcomer } from "../../utils/api/Allowance"; +import { regex } from "../../utils/functions/regex"; const NewComerHonorableAllowanceTabBody = ({ data, @@ -110,6 +111,7 @@ const NewComerHonorableAllowanceTabBody = ({ handleChange(e); editExcelForm(); }} + error={!regex.serialNumber.test(serialNumber)} /> { + switch (bankCode) { + case "071": // 우체국 + return /^\d{6}-\d{2}-\d{6}$/; + case "012": // 농협지역은행 + return /^(\d{3}-(51|52|56)-\d{6})$/; + case "011": // 농협중앙회 + return /^\d{6}-(01|02|12)-\d{6}$/; + case "004": // 국민은행 + return /^\d{3}-\d{2}-\d{4}-\d{3}$/; + case "048": // 신협 + return /^\d{6}-\d{2}-\d{6}$/; + case "020": // 우리은행 + return /^\d{4}-\d{3}-\d{6}$/; + case "081": // 하나은행 + return /^\d{3}-\d{6}-\d{5}$/; + case "003": // 중소기업은행 + return /^\d{3}-\d{2}-\d{6}-\d{1}$/; + case "045": // 새마을금고 + return /^\d{4}-\d{2,3}-\d{6}-\d{1}$/; + case "088": // 신한은행 + return /^\d{3}-\d{3}-\d{6}$/; + case "023": // SC제일은행, 스탠다드차타드은행 + return /^\d{3}-\d{2}-\d{6}$/; + case "034": // 광주은행 + return /^\d{4}-\d{3}-\d{6}$/; + default: + return /^\d{3}-\d{3}-\d{6}$/; + } + }, + newBankAccountNumber: (bankCode: string) => { + switch (bankCode) { + case "071": // 우체국 + return /^\d{6}-\d{2}-\d{6}$/; + case "012": // 농협지역은행 + return /^(3(51|52|56)-\d{4}-\d{4}-\d{2})$/; + case "011": // 농협중앙회 + return /^(3(01|02|12)-\d{4}-\d{4}-\d{2})$/; + case "004": // 국민은행 + return /^\d{6}-\d{2}-\d{6}$/; + case "048": // 신협 + return /^\d{3}-\d{3}-\d{6}$/; + case "020": // 우리은행 + return /^\d{4}-\d{3}-\d{6}$/; + case "081": // 하나은행 + return /^\d{3}-\d{6}-\d{5}$/; + case "003": // 중소기업은행 + return /^\d{3}-\d{6}-\d{2}-\d{2}$/; + case "045": // 새마을금고 + return /^\d{4}-\d{4}-\d{4}-\d{1}$/; + case "088": // 신한은행 + return /^\d{3}-\d{2}-\d{6}$/; + case "023": // SC제일은행, 스탠다드차타드은행 + return /^\d{3}-\d{2}-\d{6}$/; + case "034": // 광주은행 + return /^\d{4}-\d{3}-\d{6}$/; + case "032": // 부산은행 + return /^\d{4}-\d{3}-\d{6}$/; + case "005": // 한국외환은행 + return /^\d{4}-\d{3}-\d{6}$/; + default: + return /^\d{6}-(01|02|12)-\d{6}$/; + } + }, + reason: /^[가-힣]*$/, + date: /^\d{4}-\d{2}-\d{2}$/, + phoneNumber: /^\d{2,3}-\d{3,4}-\d{4}$/, + postalCode: /(\d{3}-\d{3}|\d{5})/, +};