diff --git a/.env.development b/.env.development index 20b3528..d4d77fb 100644 --- a/.env.development +++ b/.env.development @@ -5,8 +5,8 @@ NEXT_PUBLIC_RUN_MODE=development NEXT_PUBLIC_API_URL=http://localhost:3000 #qsp 로그인 api -# NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 -NEXT_PUBLIC_QSP_API_URL=https://jp-dev.qsalesplatform.com +NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 +# NEXT_PUBLIC_QSP_API_URL=https://jp-dev.qsalesplatform.com #1:1문의 api NEXT_PUBLIC_INQUIRY_API_URL=https://jp-dev.qsalesplatform.com diff --git a/.env.localhost b/.env.localhost index 3f62085..eb993b5 100644 --- a/.env.localhost +++ b/.env.localhost @@ -5,8 +5,8 @@ NEXT_PUBLIC_RUN_MODE=local NEXT_PUBLIC_API_URL=http://localhost:3000 #qsp 로그인 api -# NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 -NEXT_PUBLIC_QSP_API_URL=https://jp-dev.qsalesplatform.com +NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 +# NEXT_PUBLIC_QSP_API_URL=https://jp-dev.qsalesplatform.com #1:1문의 api NEXT_PUBLIC_INQUIRY_API_URL=https://jp-dev.qsalesplatform.com diff --git a/src/app/api/survey-sales/route.ts b/src/app/api/survey-sales/route.ts index 3d536c9..49db086 100644 --- a/src/app/api/survey-sales/route.ts +++ b/src/app/api/survey-sales/route.ts @@ -25,8 +25,10 @@ type WhereCondition = { const SEARCH_OPTIONS = [ 'BUILDING_NAME', // 건물명 'REPRESENTATIVE', // 담당자 - 'STORE', // 판매점 - 'CONSTRUCTION_POINT', // 시공점 + 'STORE', // 판매점명 + 'STORE_ID', // 판매점ID + 'CONSTRUCTION_POINT', // 시공점명 + 'CONSTRUCTION_POINT_ID', // 시공점ID 'CUSTOMER_NAME', // 고객명 'POST_CODE', // 우편번호 'ADDRESS', // 주소 diff --git a/src/components/popup/SurveySaleSubmitPopup.tsx b/src/components/popup/SurveySaleSubmitPopup.tsx index 99f003d..e064628 100644 --- a/src/components/popup/SurveySaleSubmitPopup.tsx +++ b/src/components/popup/SurveySaleSubmitPopup.tsx @@ -96,6 +96,7 @@ export default function SurveySaleSubmitPopup() { return true } + // TODO: Admin_Sub 계정 매핑된 submit target id 추가!!!! && 메일 테스트트 const handleSubmit = () => { if (validateData(submitData)) { window.neoConfirm('送信しますか? 送信後は変更・修正することはできません。', () => { diff --git a/src/components/survey-sale/detail/ButtonForm.tsx b/src/components/survey-sale/detail/ButtonForm.tsx index c7e78df..d6125b0 100644 --- a/src/components/survey-sale/detail/ButtonForm.tsx +++ b/src/components/survey-sale/detail/ButtonForm.tsx @@ -175,6 +175,7 @@ export default function ButtonForm(props: { // ------------------------------------------------------------ + // 제출 완료 된 매물의 경우 제출 권한 있으면 수정/삭제 불가능 if (mode === 'READ' && isSubmit && isSubmiter) { return ( <> @@ -186,9 +187,7 @@ export default function ButtonForm(props: { ) } - - //TODO: 추가확인 필요 (T01 계정이 어떤 조사매물을 수정/삭제 할 수 있는지) - if (mode === 'READ' && session?.role === 'T01' && (!isSubmit || props.data.basic.submissionTargetId !== session.storeId)) { + if (mode === 'READ' && session?.role === 'T01' && (!isSubmit || (props.data.basic.submissionTargetId && props.data.basic.submissionTargetNm))) { return ( <>
diff --git a/src/components/survey-sale/detail/DetailForm.tsx b/src/components/survey-sale/detail/DetailForm.tsx index d0664fc..28419db 100644 --- a/src/components/survey-sale/detail/DetailForm.tsx +++ b/src/components/survey-sale/detail/DetailForm.tsx @@ -80,11 +80,10 @@ export default function DetailForm() { const [roofInfoData, setRoofInfoData] = useState(roofInfoForm) useEffect(() => { - if (Number(idParam) !== 0 && surveyDetail === null) { + if (Number(idParam) !== 0 || surveyDetail === null) { alert('データが見つかりません。') window.location.href = '/survey-sale' } - if (surveyDetail && (mode === 'EDIT' || mode === 'READ')) { const { id, uptDt, regDt, detailInfo, ...rest } = surveyDetail setBasicInfoData(rest) diff --git a/src/components/survey-sale/detail/RoofForm.tsx b/src/components/survey-sale/detail/RoofForm.tsx index 9816ba6..f30fc0a 100644 --- a/src/components/survey-sale/detail/RoofForm.tsx +++ b/src/components/survey-sale/detail/RoofForm.tsx @@ -537,6 +537,7 @@ const SelectedBox = ({
{ - const etcFields = [ - 'installationSystem', - 'constructionYear', - 'rafterSize', - 'rafterPitch', - 'waterproofMaterial', - 'structureOrder', - 'insulationPresence', - ] as const + // 상수 정의 + const ETC_FIELDS = ['installationSystem', 'rafterSize', 'rafterPitch', 'waterproofMaterial', 'structureOrder'] as const - const emptyField = requiredFields.find((field) => { - if (etcFields.includes(field.field as (typeof etcFields)[number])) { - return ( - surveyDetail[field.field as keyof SurveyDetailRequest] === null && - (surveyDetail[`${field.field}Etc` as keyof SurveyDetailRequest] === null || - surveyDetail[`${field.field}Etc` as keyof SurveyDetailRequest]?.toString().trim() === '') - ) - } else { - return surveyDetail[field.field as keyof SurveyDetailRequest] === null - } - }) + const SPECIAL_CONDITIONS = ['constructionYear', 'insulationPresence'] as const - const contractCapacity = surveyDetail.contractCapacity - if (contractCapacity && contractCapacity.trim() !== '' && contractCapacity.split(' ')?.length === 1) { - return 'contractCapacityUnit' + // 유틸리티 함수들 + const isEmptyValue = (value: any): boolean => { + return value === null || value?.toString().trim() === '' } - return emptyField?.field || '' + const checkRequiredField = (field: string): string => { + if (ETC_FIELDS.includes(field as (typeof ETC_FIELDS)[number])) { + if ( + isEmptyValue(surveyDetail[field as keyof SurveyDetailRequest]) && + isEmptyValue(surveyDetail[`${field}Etc` as keyof SurveyDetailRequest]) + ) { + return field + } + } else if (SPECIAL_CONDITIONS.includes(field as (typeof SPECIAL_CONDITIONS)[number])) { + if (surveyDetail[field as keyof SurveyDetailRequest] === '2' && isEmptyValue(surveyDetail[`${field}Etc` as keyof SurveyDetailRequest])) { + return `${field}Etc` + } else if (isEmptyValue(surveyDetail[field as keyof SurveyDetailRequest])) { + return field + } + } + return '' + } + + // 필수 필드 체크 + const emptyField = requiredFields.find((field) => checkRequiredField(field.field)) + if (emptyField) return emptyField.field + + // 계약 용량 단위 체크 + const contractCapacity = surveyDetail.contractCapacity + if (contractCapacity?.trim() && contractCapacity.split(' ').length === 1) { + return 'contractCapacityUnit' + } + return '' } const getZipCode = async (zipCode: string): Promise => { diff --git a/src/store/surveyFilterStore.ts b/src/store/surveyFilterStore.ts index a27f2fc..1442ad3 100644 --- a/src/store/surveyFilterStore.ts +++ b/src/store/surveyFilterStore.ts @@ -21,18 +21,18 @@ export const SEARCH_OPTIONS = [ id: 'store', label: '販売店名', }, - // { - // id: 'store_id', - // label: '販売店ID', - // }, + { + id: 'store_id', + label: '販売店ID', + }, { id: 'construction_point', label: '施工店名', }, - // { - // id: 'construction_id', - // label: '施工店ID', - // }, + { + id: 'construction_point_id', + label: '施工店ID', + }, ] export const SEARCH_OPTIONS_PARTNERS = [