feat: add contructionPointId, submissionTargetNm column in survey_basic model

This commit is contained in:
Dayoung 2025-05-30 17:15:45 +09:00
parent 1022ef7023
commit 39645affa6
10 changed files with 28 additions and 18 deletions

View File

@ -5,8 +5,8 @@ NEXT_PUBLIC_RUN_MODE=development
NEXT_PUBLIC_API_URL=http://localhost:3000 NEXT_PUBLIC_API_URL=http://localhost:3000
#qsp 로그인 api #qsp 로그인 api
NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 # 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=https://jp-dev.qsalesplatform.com
#1:1문의 api #1:1문의 api
NEXT_PUBLIC_INQUIRY_API_URL=https://jp-dev.qsalesplatform.com NEXT_PUBLIC_INQUIRY_API_URL=https://jp-dev.qsalesplatform.com

View File

@ -5,8 +5,8 @@ NEXT_PUBLIC_RUN_MODE=local
NEXT_PUBLIC_API_URL=http://localhost:3000 NEXT_PUBLIC_API_URL=http://localhost:3000
#qsp 로그인 api #qsp 로그인 api
NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120 # 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=https://jp-dev.qsalesplatform.com
#1:1문의 api #1:1문의 api
NEXT_PUBLIC_INQUIRY_API_URL=https://jp-dev.qsalesplatform.com NEXT_PUBLIC_INQUIRY_API_URL=https://jp-dev.qsalesplatform.com

View File

@ -124,6 +124,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
SUBMISSION_STATUS: true, SUBMISSION_STATUS: true,
SUBMISSION_DATE: new Date(), SUBMISSION_DATE: new Date(),
SUBMISSION_TARGET_ID: body.targetId, SUBMISSION_TARGET_ID: body.targetId,
SUBMISSION_TARGET_NM: body.targetNm,
UPT_DT: new Date(), UPT_DT: new Date(),
}, },
}) })

View File

@ -112,7 +112,7 @@ const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
// 시공점이 있고 STORE_ID 가 시공ID와 같은 매물 // 시공점이 있고 STORE_ID 가 시공ID와 같은 매물
where.AND?.push({ where.AND?.push({
// CONSTRUCTION_POINT: { not: null }, // CONSTRUCTION_POINT: { not: null },
CONSTRUCTION_POINT: { equals: params.builderNo }, CONSTRUCTION_POINT_ID: { equals: params.builderNo },
}) })
break break

View File

@ -11,7 +11,8 @@ import { useSpinnerStore } from '@/store/spinnerStore'
interface SubmitFormData { interface SubmitFormData {
saleBase: string | null saleBase: string | null
store: string targetId: string
targetNm: string
sender: string sender: string
receiver: string[] | string receiver: string[] | string
reference: string | null reference: string | null
@ -37,7 +38,8 @@ export default function SurveySaleSubmitPopup() {
const [submitData, setSubmitData] = useState<SubmitFormData>({ const [submitData, setSubmitData] = useState<SubmitFormData>({
saleBase: null, saleBase: null,
store: '', targetId: '',
targetNm: '',
sender: session?.email ?? '', sender: session?.email ?? '',
receiver: [], receiver: [],
reference: null, reference: null,
@ -63,7 +65,7 @@ export default function SurveySaleSubmitPopup() {
const FORM_FIELDS: FormField[] = [ const FORM_FIELDS: FormField[] = [
{ id: 'sender', name: '発送者', required: true }, { id: 'sender', name: '発送者', required: true },
{ id: 'saleBase', name: '提出地点選択', required: session?.role === 'Admin' }, { 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: 'receiver', name: '受信者', required: true },
{ id: 'reference', name: '参考', required: false }, { id: 'reference', name: '参考', required: false },
{ id: 'title', name: 'タイトル', required: true }, { id: 'title', name: 'タイトル', required: true },
@ -103,7 +105,7 @@ export default function SurveySaleSubmitPopup() {
}) })
.then(() => { .then(() => {
if (!isSubmittingSurvey) { if (!isSubmittingSurvey) {
submitSurvey({ targetId: submitData.store }) submitSurvey({ targetId: submitData.targetId, targetNm: submitData.targetNm })
alert('提出が完了しました。') alert('提出が完了しました。')
popupController.setSurveySaleSubmitPopup(false) popupController.setSurveySaleSubmitPopup(false)
} }
@ -132,7 +134,7 @@ export default function SurveySaleSubmitPopup() {
if (field.id === 'saleBase' && session?.role !== 'Admin') { if (field.id === 'saleBase' && session?.role !== 'Admin') {
return null return null
} }
if (field.id === 'store' && session?.role === 'Admin') { if (field.id === 'targetNm' && session?.role === 'Admin') {
return null return null
} }
return ( return (

View File

@ -20,17 +20,17 @@ export default function BasicForm(props: { basicInfo: SurveyBasicRequest; setBas
setBasicInfoSelected() setBasicInfoSelected()
}, []) }, [])
// 시공권한 user(Builder), Partner 계정은 조사매물 등록 할 때 STORE_ID에 시공점ID가 들어감 // TODO: session 시공점 이름 추가!!!!!!!
// 권한 별 목록 필터링 시 시공권한 user(Builder), Partner는 시공점ID가 같은 것들만 조회
useEffect(() => { useEffect(() => {
if (session?.isLoggedIn) { if (session?.isLoggedIn) {
setBasicInfo({ setBasicInfo({
...basicInfo, ...basicInfo,
representative: session.userNm ?? '', representative: session.userNm ?? '',
representativeId: session.userId ?? null, representativeId: session.userId ?? null,
store: session.role === 'Partner' ? null : session.storeNm ?? null, store: session.storeNm ?? null,
storeId: session.role === 'Partner' ? session.builderNo : session.storeId ?? null, storeId: session.storeId ?? null,
constructionPoint: session.builderNo ?? null, constructionPoint: null,
constructionPointId: session.builderNo ?? null,
}) })
} }
if (addressData) { if (addressData) {

View File

@ -57,7 +57,7 @@ export default function DataTable() {
<> <>
<div>{new Date(surveyDetail.submissionDate).toLocaleString()}</div> <div>{new Date(surveyDetail.submissionDate).toLocaleString()}</div>
<div> <div>
({} - {surveyDetail.submissionTargetId}) ({surveyDetail.submissionTargetNm} - {surveyDetail.submissionTargetId})
</div> </div>
</> </>
) : ( ) : (

View File

@ -52,6 +52,7 @@ const basicInfoForm: SurveyBasicRequest = {
store: null, store: null,
storeId: null, storeId: null,
constructionPoint: null, constructionPoint: null,
constructionPointId: null,
investigationDate: new Date().toLocaleDateString('en-CA'), investigationDate: new Date().toLocaleDateString('en-CA'),
buildingName: null, buildingName: null,
customerName: null, customerName: null,
@ -61,6 +62,7 @@ const basicInfoForm: SurveyBasicRequest = {
submissionStatus: false, submissionStatus: false,
submissionDate: null, submissionDate: null,
submissionTargetId: null, submissionTargetId: null,
submissionTargetNm: null,
srlNo: null, srlNo: null,
} }

View File

@ -66,7 +66,7 @@ export function useSurvey(id?: number): {
createSurvey: (survey: SurveyRegistRequest) => Promise<number> createSurvey: (survey: SurveyRegistRequest) => Promise<number>
updateSurvey: ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string }) => void updateSurvey: ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string }) => void
deleteSurvey: () => Promise<boolean> deleteSurvey: () => Promise<boolean>
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 validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string
getZipCode: (zipCode: string) => Promise<ZipCode[] | null> getZipCode: (zipCode: string) => Promise<ZipCode[] | null>
refetchSurveyList: () => void refetchSurveyList: () => void
@ -163,10 +163,11 @@ export function useSurvey(id?: number): {
}) })
const { mutateAsync: submitSurvey, isPending: isSubmittingSurvey } = useMutation({ 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') if (!id) throw new Error('id is required')
const resp = await axiosInstance(null).patch<boolean>(`/api/survey-sales/${id}`, { const resp = await axiosInstance(null).patch<boolean>(`/api/survey-sales/${id}`, {
targetId, targetId,
targetNm,
storeId, storeId,
srlNo, srlNo,
role: session?.role ?? null, role: session?.role ?? null,

View File

@ -5,6 +5,7 @@ export type SurveyBasicInfo = {
store: string | null store: string | null
storeId: string | null storeId: string | null
constructionPoint: string | null constructionPoint: string | null
constructionPointId: string | null
investigationDate: string | null investigationDate: string | null
buildingName: string | null buildingName: string | null
customerName: string | null customerName: string | null
@ -17,6 +18,7 @@ export type SurveyBasicInfo = {
regDt: Date regDt: Date
uptDt: Date uptDt: Date
submissionTargetId: string | null submissionTargetId: string | null
submissionTargetNm: string | null
srlNo: string | null //판매점IDyyMMdd000 srlNo: string | null //판매점IDyyMMdd000
} }
@ -68,6 +70,7 @@ export type SurveyBasicRequest = {
store: string | null store: string | null
storeId: string | null storeId: string | null
constructionPoint: string | null constructionPoint: string | null
constructionPointId: string | null
investigationDate: string | null investigationDate: string | null
buildingName: string | null buildingName: string | null
customerName: string | null customerName: string | null
@ -77,6 +80,7 @@ export type SurveyBasicRequest = {
submissionStatus: boolean submissionStatus: boolean
submissionDate: string | null submissionDate: string | null
submissionTargetId: string | null submissionTargetId: string | null
submissionTargetNm: string | null
srlNo: string | null //판매점IDyyMMdd000 srlNo: string | null //판매점IDyyMMdd000
} }