diff --git a/.env.development b/.env.development index 8890f8d4..87c2ba14 100644 --- a/.env.development +++ b/.env.development @@ -1,8 +1,10 @@ +NEXT_PUBLIC_RUN_MODE="development" + NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" -NEXT_PUBLIC_API_HOST_URL="http://1.248.227.176:5000" +NEXT_PUBLIC_API_HOST_URL="https://dev.hanasys.jp" SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" @@ -25,4 +27,6 @@ AWS_REGION="ap-northeast-1" AMPLIFY_BUCKET="files.hanasys.jp" AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="dev" \ No newline at end of file diff --git a/.env.local.dev b/.env.local.dev new file mode 100644 index 00000000..ab789dbf --- /dev/null +++ b/.env.local.dev @@ -0,0 +1,32 @@ +NEXT_PUBLIC_RUN_MODE="local.dev" + +NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" + +NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" + +NEXT_PUBLIC_API_HOST_URL="http://1.248.227.176:5000" + +SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" + +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" +NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" + +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" + +# 테스트용 +# AWS_REGION="ap-northeast-2" +# AMPLIFY_BUCKET="interplug" +# AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" +# AWS_SECRET_ACCESS_KEY="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" +# NEXT_PUBLIC_AWS_S3_BASE_URL="https://interplug.s3.ap-northeast-2.amazonaws.com" + +# 실제 일본 서버 +AWS_REGION="ap-northeast-1" +AMPLIFY_BUCKET="files.hanasys.jp" +AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" +AWS_SECRET_ACCESS_KEY="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" +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="dev" \ No newline at end of file diff --git a/.env.localhost b/.env.localhost new file mode 100644 index 00000000..8617d87c --- /dev/null +++ b/.env.localhost @@ -0,0 +1,32 @@ +NEXT_PUBLIC_RUN_MODE="local" + +NEXT_PUBLIC_API_SERVER_PATH="https://dev-api.hanasys.jp" + +NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" + +NEXT_PUBLIC_API_HOST_URL="http://localhost:3000" + +SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" + +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" +# NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" +NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" + +NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" +NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" + +# 테스트용 +# AWS_REGION="ap-northeast-2" +# AMPLIFY_BUCKET="interplug" +# AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" +# AWS_SECRET_ACCESS_KEY="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" +# NEXT_PUBLIC_AWS_S3_BASE_URL="https://interplug.s3.ap-northeast-2.amazonaws.com" + +# 실제 일본 서버 +AWS_REGION="ap-northeast-1" +AMPLIFY_BUCKET="files.hanasys.jp" +AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" +AWS_SECRET_ACCESS_KEY="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" +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="dev" \ No newline at end of file diff --git a/.env.production b/.env.production index a68a4305..bb3dfbf0 100644 --- a/.env.production +++ b/.env.production @@ -1,8 +1,10 @@ +NEXT_PUBLIC_RUN_MODE="production" + NEXT_PUBLIC_API_SERVER_PATH="https://api.hanasys.jp/" NEXT_PUBLIC_HOST_URL="//1.248.227.176:4000" -NEXT_PUBLIC_API_HOST_URL="https://www.hanasys.jp/" +NEXT_PUBLIC_API_HOST_URL="https://www.hanasys.jp" SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" @@ -15,8 +17,17 @@ NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secr NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" -AWS_REGION="ap-northeast-2" -AMPLIFY_BUCKET="interplug" -AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" -AWS_SECRET_ACCESS_KEY="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" -NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" \ No newline at end of file +# AWS_REGION="ap-northeast-2" +# AMPLIFY_BUCKET="interplug" +# AWS_ACCESS_KEY_ID="AKIAVWMWJCUXFHEAZ4FR" +# AWS_SECRET_ACCESS_KEY="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" +# NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +# 실제 일본 서버 +AWS_REGION="ap-northeast-1" +AMPLIFY_BUCKET="files.hanasys.jp" +AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" +AWS_SECRET_ACCESS_KEY="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" +NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" + +S3_PROFILE="prd" \ No newline at end of file diff --git a/dev.ecosystem.config.js b/dev.ecosystem.config.js index 6a38ad34..3bd3ffde 100644 --- a/dev.ecosystem.config.js +++ b/dev.ecosystem.config.js @@ -6,7 +6,7 @@ module.exports = { instances: 1, exec_mode: 'fork', env: { - NODE_ENV: 'development', + PORT: 5010, }, }, ], diff --git a/dev.local.ecosystem.config.js b/dev.local.ecosystem.config.js new file mode 100644 index 00000000..f508bdcc --- /dev/null +++ b/dev.local.ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-local-development', + script: 'node_modules/next/dist/bin/next', + instances: 1, + exec_mode: 'fork', + env: { + PORT: 5000, + }, + }, + ], +} diff --git a/package.json b/package.json index bbddf9ad..14b1299b 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,14 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev", - "build": "next build", - "start:cluster1": "next start -p 5000", - "start:cluster2": "next start -p 5001", - "start:dev": "next start -p 5010", + "dev": "env-cmd -f .env.localhost next dev", + "local:dev": "env-cmd -f .env.local.dev next dev", + "build": "env-cmd -f .env.production next build", + "build:dev": "env-cmd -f .env.development next build", + "build:local.dev": "env-cmd -f .env.local.dev next build", + "start:cluster1": "env-cmd -f .env.production next start -p 5000", + "start:cluster2": "env-cmd -f .env.production next start -p 5001", + "start:dev": "env-cmd -f .env.development next start -p 5010", "lint": "next lint", "serve": "node server.js" }, @@ -18,10 +21,12 @@ "big.js": "^6.2.2", "chart.js": "^4.4.6", "dayjs": "^1.11.13", + "env-cmd": "^10.1.0", "fabric": "^5.3.0", "framer-motion": "^11.2.13", "fs": "^0.0.1-security", "iron-session": "^8.0.2", + "jimp": "^1.6.0", "js-cookie": "^3.0.5", "mathjs": "^13.0.2", "mssql": "^11.0.1", diff --git a/prd1.ecosystem.config.js b/prd1.ecosystem.config.js new file mode 100644 index 00000000..6a85f59b --- /dev/null +++ b/prd1.ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-production-1', + script: 'node_modules/next/dist/bin/next', + instances: 1, + exec_mode: 'fork', + env: { + PORT: 5000, + }, + }, + ], +} diff --git a/prd2.ecosystem.config.js b/prd2.ecosystem.config.js new file mode 100644 index 00000000..0083d8e3 --- /dev/null +++ b/prd2.ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: 'qcast-front-production-2', + script: 'node_modules/next/dist/bin/next', + instances: 1, + exec_mode: 'fork', + env: { + PORT: 5001, + }, + }, + ], +} diff --git a/public/static/images/canvas/roof_warning_correct.png b/public/static/images/canvas/roof_warning_correct.png new file mode 100644 index 00000000..4f9741a5 Binary files /dev/null and b/public/static/images/canvas/roof_warning_correct.png differ diff --git a/public/static/images/canvas/roof_warning_wrong.png b/public/static/images/canvas/roof_warning_wrong.png new file mode 100644 index 00000000..3a245d51 Binary files /dev/null and b/public/static/images/canvas/roof_warning_wrong.png differ diff --git a/src/app/api/image/cad/route.js b/src/app/api/image/cad/route.js index b7d64a50..a0e60a4c 100644 --- a/src/app/api/image/cad/route.js +++ b/src/app/api/image/cad/route.js @@ -11,9 +11,10 @@ const s3 = new S3Client({ }) const uploadImage = async (file) => { + console.log('🚀 ~ uploadImage ~ file:', file) const Body = Buffer.from(await file.arrayBuffer()) const Key = `cads/${file.name}` - const ContentType = file.ContentType + const ContentType = 'image/png' await s3.send( new PutObjectCommand({ diff --git a/src/app/api/image/canvas/route.js b/src/app/api/image/canvas/route.js index 0a4d0be2..2a20da92 100644 --- a/src/app/api/image/canvas/route.js +++ b/src/app/api/image/canvas/route.js @@ -1,7 +1,8 @@ import { NextResponse } from 'next/server' -import { S3Client, PutObjectCommand, DeleteObjectCommand, GetObjectCommand } from '@aws-sdk/client-s3' -import sharp from 'sharp' +import { DeleteObjectCommand, GetObjectCommand, PutObjectCommand, S3Client } from '@aws-sdk/client-s3' import { v4 as uuidv4 } from 'uuid' +import { Jimp } from 'jimp' + const Bucket = process.env.AMPLIFY_BUCKET const s3 = new S3Client({ region: process.env.AWS_REGION, @@ -23,8 +24,6 @@ const checkArea = (obj) => { const cropImage = async (Key, width, height, left, top) => { try { - const checkResult = checkArea({ width, height, left, top }) - // Get the image from S3 const { Body } = await s3.send( new GetObjectCommand({ @@ -33,28 +32,45 @@ const cropImage = async (Key, width, height, left, top) => { }), ) - // Convert stream to buffer const chunks = [] for await (const chunk of Body) { chunks.push(chunk) } - const imageBuffer = Buffer.concat(chunks) + const buffer = Buffer.concat(chunks) - let processedImage - if (!checkResult) { - processedImage = await sharp(imageBuffer).toBuffer() - } else { - processedImage = await sharp(imageBuffer) - .extract({ - width: parseInt(width), - height: parseInt(height), - left: parseInt(left), - top: parseInt(top), - }) - .png() - .toBuffer() - } - return processedImage + const image = await Jimp.read(buffer) + + image.autocrop({ tolerance: 0.0002, leaveBorder: 10 }) + return await image.getBuffer('image/png') + + // Convert stream to buffer + // const chunks = [] + // for await (const chunk of Body) { + // chunks.push(chunk) + // } + // const imageBuffer = Buffer.concat(chunks) + + // const image = await Jimp.read(Body) + + // if (!checkResult) { + // processedImage = await image.toBuffer() + // } + + //let processedImage + // if (!checkResult) { + // processedImage = await sharp(imageBuffer).toBuffer() + // } else { + // processedImage = await sharp(imageBuffer) + // .extract({ + // width: parseInt(width), + // height: parseInt(height), + // left: parseInt(left), + // top: parseInt(top), + // }) + // .png() + // .toBuffer() + // } + // return processedImage } catch (error) { console.error('Error processing image:', error) throw error @@ -96,7 +112,7 @@ export async function POST(req) { /** * 크롭 이미지 이름을 결정한다. */ - const Key = `Drawing/${objectNo}_${planNo}_${type}.png` + const Key = `Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_${type}.png` /** * 크롭이 완료된 이미지를 업로드한다. diff --git a/src/app/api/image/estimate-image-copy/route.js b/src/app/api/image/estimate-image-copy/route.js new file mode 100644 index 00000000..81e5c13c --- /dev/null +++ b/src/app/api/image/estimate-image-copy/route.js @@ -0,0 +1,59 @@ +import { NextResponse } from 'next/server' +import { S3Client, CopyObjectCommand, GetObjectCommand } from '@aws-sdk/client-s3' +import sharp from 'sharp' +import { v4 as uuidv4 } from 'uuid' +const Bucket = process.env.AMPLIFY_BUCKET +const s3 = new S3Client({ + region: process.env.AWS_REGION, + credentials: { + accessKeyId: process.env.AWS_ACCESS_KEY_ID, + secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, + }, +}) + +export async function POST(req) { + const { objectNo, planNo, newObjectNo, newPlanNo } = await req.json() + + const responseArray = [] + + //견적서1 번 이미지 + const isExistImage1 = await s3.send( + new GetObjectCommand({ + Bucket, + Key: `Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_1.png`, + }), + ) + + //견적서2 번 이미지 + const isExistImage2 = await s3.send( + new GetObjectCommand({ + Bucket, + Key: `Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_2.png`, + }), + ) + + //견적서1,2 번 이미지 둘다 있어야함 + if (isExistImage1.$metadata.httpStatusCode === 200 && isExistImage2.$metadata.httpStatusCode === 200) { + //견적서1 번 이미지 복사 + const copyCommand = new CopyObjectCommand({ + Bucket, + CopySource: encodeURI(`${Bucket}/Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_1.png`), + Key: `Drawing/${process.env.S3_PROFILE}/${newObjectNo}_${newPlanNo}_1.png`, + }) + + const response = await s3.send(copyCommand) + + const copyCommand2 = new CopyObjectCommand({ + Bucket, + CopySource: encodeURI(`${Bucket}/Drawing/${process.env.S3_PROFILE}/${objectNo}_${planNo}_2.png`), + Key: `Drawing/${process.env.S3_PROFILE}/${newObjectNo}_${newPlanNo}_2.png`, + }) + + const response2 = await s3.send(copyCommand2) + + responseArray.push(response, response2) + return NextResponse.json({ message: '견적서 이미지 복사 성공', responseArray }, { status: 200 }) + } else { + return NextResponse.json({ message: '견적서 이미지 복사 실패(존재하지 않는 이미지)', responseArray }, { status: 400 }) + } +} diff --git a/src/app/floor-plan/FloorPlanProvider.js b/src/app/floor-plan/FloorPlanProvider.js index 5019e8a4..1e5c536d 100644 --- a/src/app/floor-plan/FloorPlanProvider.js +++ b/src/app/floor-plan/FloorPlanProvider.js @@ -45,8 +45,19 @@ const FloorPlanProvider = ({ children }) => { // const pathname = usePathname() // const setCorrentObjectNo = useSetRecoilState(correntObjectNoState) const searchParams = useSearchParams() + const path = usePathname() const objectNo = searchParams.get('objectNo') const pid = searchParams.get('pid') + + useEffect(() => { + setFloorPlanState((prev) => { + return { + ...prev, + objectNo, + pid, + } + }) + }, [path]) // useEffect(() => { // console.log('🚀 ~ useEffect ~ objectNo:') // if (pathname === '/floor-plan') { diff --git a/src/common/common.js b/src/common/common.js index 0fe0a002..0982ba6b 100644 --- a/src/common/common.js +++ b/src/common/common.js @@ -210,6 +210,7 @@ export const SAVE_KEY = [ 'toFixed', 'startPoint', 'endPoint', + 'editable', 'isSortedPoints', ] diff --git a/src/components/Main.jsx b/src/components/Main.jsx index 520014b1..9afadca7 100644 --- a/src/components/Main.jsx +++ b/src/components/Main.jsx @@ -14,6 +14,7 @@ import { sessionStore } from '@/store/commonAtom' import { isObjectNotEmpty } from '@/util/common-utils' import BoardDetailModal from './community/modal/BoardDetailModal' +import Config from '@/config/config.export' export default function MainPage() { const [sessionState, setSessionState] = useRecoilState(sessionStore) diff --git a/src/components/community/Qna.jsx b/src/components/community/Qna.jsx index ed65637f..033f7424 100644 --- a/src/components/community/Qna.jsx +++ b/src/components/community/Qna.jsx @@ -195,9 +195,7 @@ export default function Qna() { )) ) : ( - - {getMessage('common.message.no.data')} - + {getMessage('common.message.no.data')} )} diff --git a/src/components/community/modal/QnaDetailModal.jsx b/src/components/community/modal/QnaDetailModal.jsx index 5db51cc3..0e25d3a8 100644 --- a/src/components/community/modal/QnaDetailModal.jsx +++ b/src/components/community/modal/QnaDetailModal.jsx @@ -73,7 +73,7 @@ export default function QnaDetailModal({ qnaNo, setOpen, qnaType }) {
{getMessage('qna.detail.sub.fileList')}
{boardDetail.listFile.map((boardFile) => (
-
diff --git a/src/components/community/modal/QnaRegModal.jsx b/src/components/community/modal/QnaRegModal.jsx index ef40457b..d04f00fa 100644 --- a/src/components/community/modal/QnaRegModal.jsx +++ b/src/components/community/modal/QnaRegModal.jsx @@ -13,6 +13,7 @@ import { QcastContext } from '@/app/QcastProvider' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' import { e } from 'mathjs' +import { set } from 'react-hook-form' export default function QnaRegModal({ setOpen, setReload, searchValue, selectPageBlock }) { @@ -24,9 +25,11 @@ export default function QnaRegModal({ setOpen, setReload, searchValue, selectPag const [qnaData, setQnaData] = useState([]) const [closeMdFlg, setCloseMdFlg] = useState(true) const [closeSmFlg, setCloseSmFlg] = useState(true) + const [hideSmFlg, setHideSmFlg] = useState(false) const qnaTypeLgCodeRef = useRef(null) const qnaTypeMdCodeRef = useRef(null) const qnaTypeSmCodeRef = useRef(null) + const qstMail = useRef(null); const regUserNmRef = useRef(null) const regUserTelNoRef = useRef(null) const titleRef = useRef(null) @@ -65,11 +68,12 @@ let fileCheck = false; const initQnaReg = async () => { + qstMail.current.value = '' regUserNmRef.current.value = '' regUserTelNoRef.current.value = '' qnaTypeLgCodeRef.current.setValue(); qnaTypeMdCodeRef.current.setValue(); - qnaTypeSmCodeRef.current.setValue(); + qnaTypeSmCodeRef.current?.setValue(); titleRef.current.value = '' contentsRef.current.value = '' @@ -110,7 +114,7 @@ let fileCheck = false; setQnaData({ ...qnaData, qnaClsLrgCd:e.clCode}) setCloseMdFlg(false) qnaTypeMdCodeRef.current.setValue(); - qnaTypeSmCodeRef.current.setValue(); + qnaTypeSmCodeRef.current?.setValue(); } } @@ -129,10 +133,20 @@ let fileCheck = false; } }) - setQnaTypeSmCodeList(codeList) + + setQnaData({ ...qnaData, qnaClsMidCd: e.clCode }) setCloseSmFlg(false) - qnaTypeSmCodeRef.current.setValue(); + setQnaTypeSmCodeList(codeList) + qnaTypeSmCodeRef.current?.setValue(); + + if(codeList.length > 0) { + setHideSmFlg(false) + }else{ + setHideSmFlg(true) + } + + } @@ -148,7 +162,7 @@ let fileCheck = false; if(!fileCheck) return; fileUploadProps.uploadFiles.forEach((file) => { - console.log("file::::::::",file) + //console.log("file::::::::",file) formData.push(file) }) @@ -156,6 +170,16 @@ let fileCheck = false; fileCheck = false; } + const isValidEmail = (email) => { + const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; + return emailRegex.test(email); + }; + + const isEmpty = (value) => { + return value === null || value === undefined || value.trim() === ""; + }; + + const handleQnaSubmit = async () => { //필수 체크 @@ -164,13 +188,22 @@ let fileCheck = false; let regUserNm = qnaData?.regUserNm??''; - if (regUserNm.trim().length === 0) { + if (!isValidEmail(qnaData.qstMail)) { + qstMail.current.focus(); + swalFire({ + title: getMessage('qna.reg.alert.require.qstMail'), + icon: 'warning', + }); + return; + } - regUserNmRef.current.value = ''; + + if (isEmpty(regUserNm)) { + regUserNmRef.current.value = ''; regUserNmRef.current.focus() swalFire({ - text: getMessage('qna.reg.alert.require.regUserNm'), - type: 'alert', + title: getMessage('qna.reg.alert.require.regUserNm'), + icon: 'warning', }) return false } @@ -178,35 +211,35 @@ let fileCheck = false; let qnaClsLrgCd = qnaData?.qnaClsLrgCd??''; let qnaClsMidCd = qnaData?.qnaClsMidCd??''; - if (qnaClsLrgCd.trim().length === 0 || qnaClsMidCd.trim().length === 0 ) { - (qnaClsLrgCd.trim().length === 0)?qnaTypeLgCodeRef.current.focus():qnaTypeMdCodeRef.current.focus() + if (isEmpty(qnaClsLrgCd) || isEmpty(qnaClsMidCd) ) { + (isEmpty(qnaClsLrgCd))?qnaTypeLgCodeRef.current.focus():qnaTypeMdCodeRef.current.focus() swalFire({ - text: getMessage('qna.reg.alert.select.type'), - type: 'alert', + title: getMessage('qna.reg.alert.select.type'), + icon: 'warning', }) return false } let title = qnaData?.title??''; - if (title.trim().length === 0) { + if (isEmpty(title)) { titleRef.current.value = ''; titleRef.current.focus() swalFire({ - text: getMessage('qna.reg.alert.require.title'), - type: 'alert', + title: getMessage('qna.reg.alert.require.title'), + icon: 'warning', }) return false } //console.log("5::::",qnaData) let contents = qnaData?.contents??''; - if (contents.trim().length === 0) { + if (isEmpty(contents)) { contentsRef.current.value = ''; contentsRef.current.focus() swalFire({ - text: getMessage('qna.reg.alert.require.contents'), - type: 'alert', + title: getMessage('qna.reg.alert.require.contents'), + icon: 'warning', }) return false } @@ -310,7 +343,13 @@ let fileCheck = false; {getMessage('qna.list.header.regNm')} E-Mail* - + setQnaData({...qnaData, qstMail: e.target.value })} + onBlur={(e) => setQnaData({ ...qnaData, qstMail: e.target.value })} /> + + {getMessage('qna.reg.header.regDt')} {dayjs(new Date()).format('YYYY-MM-DD')} @@ -366,6 +405,7 @@ let fileCheck = false; />
+ {!hideSmFlg && (