feature/survey #56

Merged
swyoo merged 24 commits from feature/survey into dev 2025-06-04 16:31:01 +09:00
10 changed files with 28 additions and 18 deletions
Showing only changes of commit 39645affa6 - Show all commits

View File

@ -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

View File

@ -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

View File

@ -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(),
},
})

View File

@ -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

View File

@ -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<SubmitFormData>({
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 (

View File

@ -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) {

View File

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

View File

@ -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,
}

View File

@ -66,7 +66,7 @@ export function useSurvey(id?: number): {
createSurvey: (survey: SurveyRegistRequest) => Promise<number>
updateSurvey: ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string }) => void
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
getZipCode: (zipCode: string) => Promise<ZipCode[] | null>
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<boolean>(`/api/survey-sales/${id}`, {
targetId,
targetNm,
storeId,
srlNo,
role: session?.role ?? null,

View File

@ -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
}