diff --git a/.env.development b/.env.development index d821f10..c22985f 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 1480c7a..0051309 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/[id]/route.ts b/src/app/api/survey-sales/[id]/route.ts index eb718f4..ad87e4b 100644 --- a/src/app/api/survey-sales/[id]/route.ts +++ b/src/app/api/survey-sales/[id]/route.ts @@ -124,6 +124,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise< SUBMISSION_STATUS: true, SUBMISSION_DATE: new Date(), SUBMISSION_TARGET_ID: body.targetId, + SUBMISSION_TARGET_NM: body.targetNm, UPT_DT: new Date(), }, }) diff --git a/src/app/api/survey-sales/route.ts b/src/app/api/survey-sales/route.ts index 5aee157..ca716b4 100644 --- a/src/app/api/survey-sales/route.ts +++ b/src/app/api/survey-sales/route.ts @@ -112,7 +112,7 @@ const createMemberRoleCondition = (params: SearchParams): WhereCondition => { // 시공점이 있고 STORE_ID 가 시공ID와 같은 매물 where.AND?.push({ // CONSTRUCTION_POINT: { not: null }, - CONSTRUCTION_POINT: { equals: params.builderNo }, + CONSTRUCTION_POINT_ID: { equals: params.builderNo }, }) break diff --git a/src/components/popup/SurveySaleSubmitPopup.tsx b/src/components/popup/SurveySaleSubmitPopup.tsx index 8a22057..39b206d 100644 --- a/src/components/popup/SurveySaleSubmitPopup.tsx +++ b/src/components/popup/SurveySaleSubmitPopup.tsx @@ -11,7 +11,8 @@ import { useSpinnerStore } from '@/store/spinnerStore' interface SubmitFormData { saleBase: string | null - store: string + targetId: string + targetNm: string sender: string receiver: string[] | string reference: string | null @@ -37,7 +38,8 @@ export default function SurveySaleSubmitPopup() { const [submitData, setSubmitData] = useState({ saleBase: null, - store: '', + targetId: '', + targetNm: '', sender: session?.email ?? '', receiver: [], reference: null, @@ -63,7 +65,7 @@ export default function SurveySaleSubmitPopup() { const FORM_FIELDS: FormField[] = [ { id: 'sender', name: '発送者', required: true }, { id: 'saleBase', name: '提出地点選択', required: session?.role === 'Admin' }, - { id: 'store', name: '提出販売店', required: session?.role !== 'Admin' }, + { id: 'targetNm', name: '提出販売店', required: session?.role !== 'Admin' }, { id: 'receiver', name: '受信者', required: true }, { id: 'reference', name: '参考', required: false }, { id: 'title', name: 'タイトル', required: true }, @@ -103,7 +105,7 @@ export default function SurveySaleSubmitPopup() { }) .then(() => { if (!isSubmittingSurvey) { - submitSurvey({ targetId: submitData.store }) + submitSurvey({ targetId: submitData.targetId, targetNm: submitData.targetNm }) alert('提出が完了しました。') popupController.setSurveySaleSubmitPopup(false) } @@ -132,7 +134,7 @@ export default function SurveySaleSubmitPopup() { if (field.id === 'saleBase' && session?.role !== 'Admin') { return null } - if (field.id === 'store' && session?.role === 'Admin') { + if (field.id === 'targetNm' && session?.role === 'Admin') { return null } return ( diff --git a/src/components/survey-sale/detail/BasicForm.tsx b/src/components/survey-sale/detail/BasicForm.tsx index 202d4a2..acfea6b 100644 --- a/src/components/survey-sale/detail/BasicForm.tsx +++ b/src/components/survey-sale/detail/BasicForm.tsx @@ -20,17 +20,17 @@ export default function BasicForm(props: { basicInfo: SurveyBasicRequest; setBas setBasicInfoSelected() }, []) - // 시공권한 user(Builder), Partner 계정은 조사매물 등록 할 때 STORE_ID에 시공점ID가 들어감 - // 권한 별 목록 필터링 시 시공권한 user(Builder), Partner는 시공점ID가 같은 것들만 조회 + // TODO: session 시공점 이름 추가!!!!!!! useEffect(() => { if (session?.isLoggedIn) { setBasicInfo({ ...basicInfo, representative: session.userNm ?? '', representativeId: session.userId ?? null, - store: session.role === 'Partner' ? null : session.storeNm ?? null, - storeId: session.role === 'Partner' ? session.builderNo : session.storeId ?? null, - constructionPoint: session.builderNo ?? null, + store: session.storeNm ?? null, + storeId: session.storeId ?? null, + constructionPoint: null, + constructionPointId: session.builderNo ?? null, }) } if (addressData) { diff --git a/src/components/survey-sale/detail/DataTable.tsx b/src/components/survey-sale/detail/DataTable.tsx index 484fe6a..6a49770 100644 --- a/src/components/survey-sale/detail/DataTable.tsx +++ b/src/components/survey-sale/detail/DataTable.tsx @@ -57,7 +57,7 @@ export default function DataTable() { <>
{new Date(surveyDetail.submissionDate).toLocaleString()}
- ({} - {surveyDetail.submissionTargetId}) + ({surveyDetail.submissionTargetNm} - {surveyDetail.submissionTargetId})
) : ( diff --git a/src/components/survey-sale/detail/DetailForm.tsx b/src/components/survey-sale/detail/DetailForm.tsx index 110b765..d0664fc 100644 --- a/src/components/survey-sale/detail/DetailForm.tsx +++ b/src/components/survey-sale/detail/DetailForm.tsx @@ -52,6 +52,7 @@ const basicInfoForm: SurveyBasicRequest = { store: null, storeId: null, constructionPoint: null, + constructionPointId: null, investigationDate: new Date().toLocaleDateString('en-CA'), buildingName: null, customerName: null, @@ -61,6 +62,7 @@ const basicInfoForm: SurveyBasicRequest = { submissionStatus: false, submissionDate: null, submissionTargetId: null, + submissionTargetNm: null, srlNo: null, } diff --git a/src/hooks/useSurvey.ts b/src/hooks/useSurvey.ts index 1054a2a..f5ed9b7 100644 --- a/src/hooks/useSurvey.ts +++ b/src/hooks/useSurvey.ts @@ -66,7 +66,7 @@ export function useSurvey(id?: number): { createSurvey: (survey: SurveyRegistRequest) => Promise updateSurvey: ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string }) => void deleteSurvey: () => Promise - submitSurvey: (params: { saveId?: number; targetId?: string; storeId?: string; srlNo?: string }) => void + submitSurvey: (params: { saveId?: number; targetId?: string; targetNm?: string; storeId?: string; srlNo?: string }) => void validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string getZipCode: (zipCode: string) => Promise refetchSurveyList: () => void @@ -163,10 +163,11 @@ export function useSurvey(id?: number): { }) const { mutateAsync: submitSurvey, isPending: isSubmittingSurvey } = useMutation({ - mutationFn: async ({ targetId, storeId, srlNo }: { targetId?: string; storeId?: string; srlNo?: string }) => { + mutationFn: async ({ targetId, targetNm, storeId, srlNo }: { targetId?: string; targetNm?: string; storeId?: string; srlNo?: string }) => { if (!id) throw new Error('id is required') const resp = await axiosInstance(null).patch(`/api/survey-sales/${id}`, { targetId, + targetNm, storeId, srlNo, role: session?.role ?? null, diff --git a/src/types/Survey.ts b/src/types/Survey.ts index cd2b7d0..2db1034 100644 --- a/src/types/Survey.ts +++ b/src/types/Survey.ts @@ -5,6 +5,7 @@ export type SurveyBasicInfo = { store: string | null storeId: string | null constructionPoint: string | null + constructionPointId: string | null investigationDate: string | null buildingName: string | null customerName: string | null @@ -17,6 +18,7 @@ export type SurveyBasicInfo = { regDt: Date uptDt: Date submissionTargetId: string | null + submissionTargetNm: string | null srlNo: string | null //판매점IDyyMMdd000 } @@ -68,6 +70,7 @@ export type SurveyBasicRequest = { store: string | null storeId: string | null constructionPoint: string | null + constructionPointId: string | null investigationDate: string | null buildingName: string | null customerName: string | null @@ -77,6 +80,7 @@ export type SurveyBasicRequest = { submissionStatus: boolean submissionDate: string | null submissionTargetId: string | null + submissionTargetNm: string | null srlNo: string | null //판매점IDyyMMdd000 }