Compare commits
No commits in common. "d357355641a4da02128ab8cc9beeac0909691dbc" and "19ff53ae505b0041f3d4ec1afd2702c12f878bac" have entirely different histories.
d357355641
...
19ff53ae50
@ -9,8 +9,7 @@ NEXT_PUBLIC_QSP_API_URL=http://121.168.9.37:8080
|
|||||||
# 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
|
||||||
NEXT_PUBLIC_INQUIRY_API_URL=http://1.248.227.176:8120
|
|
||||||
|
|
||||||
EMAIL_TITLE_PREFIX=(System Test)
|
EMAIL_TITLE_PREFIX=(System Test)
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,7 @@ 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
|
||||||
NEXT_PUBLIC_INQUIRY_API_URL=http://1.248.227.176:8120
|
|
||||||
|
|
||||||
EMAIL_TITLE_PREFIX=
|
EMAIL_TITLE_PREFIX=
|
||||||
|
|
||||||
|
|||||||
@ -13,6 +13,7 @@ model SD_SURVEY_SALES_BASIC_INFO {
|
|||||||
REPRESENTATIVE String @db.NVarChar(200)
|
REPRESENTATIVE String @db.NVarChar(200)
|
||||||
STORE String? @db.NVarChar(200)
|
STORE String? @db.NVarChar(200)
|
||||||
CONSTRUCTION_POINT String? @db.NVarChar(200)
|
CONSTRUCTION_POINT String? @db.NVarChar(200)
|
||||||
|
CONSTRUCTION_POINT_ID String? @db.NVarChar(200)
|
||||||
INVESTIGATION_DATE String? @db.NVarChar(10)
|
INVESTIGATION_DATE String? @db.NVarChar(10)
|
||||||
BUILDING_NAME String? @db.NVarChar(200)
|
BUILDING_NAME String? @db.NVarChar(200)
|
||||||
CUSTOMER_NAME String? @db.NVarChar(200)
|
CUSTOMER_NAME String? @db.NVarChar(200)
|
||||||
@ -22,12 +23,11 @@ model SD_SURVEY_SALES_BASIC_INFO {
|
|||||||
SUBMISSION_STATUS Boolean @default(false)
|
SUBMISSION_STATUS Boolean @default(false)
|
||||||
SUBMISSION_DATE DateTime? @db.Date
|
SUBMISSION_DATE DateTime? @db.Date
|
||||||
SUBMISSION_TARGET_ID String? @db.NVarChar(200)
|
SUBMISSION_TARGET_ID String? @db.NVarChar(200)
|
||||||
|
SUBMISSION_TARGET_NM String? @db.NVarChar(200)
|
||||||
REG_DT DateTime @default(now())
|
REG_DT DateTime @default(now())
|
||||||
UPT_DT DateTime @updatedAt
|
UPT_DT DateTime @updatedAt
|
||||||
REPRESENTATIVE_ID String? @db.NVarChar(100)
|
REPRESENTATIVE_ID String? @db.NVarChar(100)
|
||||||
STORE_ID String? @db.NVarChar(100)
|
STORE_ID String? @db.NVarChar(100)
|
||||||
CONSTRUCTION_POINT_ID String? @db.NVarChar(200)
|
|
||||||
SUBMISSION_TARGET_NM String? @db.NVarChar(200)
|
|
||||||
DETAIL_INFO SD_SURVEY_SALES_DETAIL_INFO?
|
DETAIL_INFO SD_SURVEY_SALES_DETAIL_INFO?
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,304 +179,3 @@ model MS_USR_TRK {
|
|||||||
REG_DT DateTime @default(now())
|
REG_DT DateTime @default(now())
|
||||||
DATA String? @db.NVarChar(200)
|
DATA String? @db.NVarChar(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
model BC_QM_BUILDER {
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
BUILDER_NO String @db.NVarChar(50)
|
|
||||||
AGENCY_STORE_ID String @db.NVarChar(100)
|
|
||||||
BUILDER_NM String @db.NVarChar(100)
|
|
||||||
BUILDER_ID String? @db.NVarChar(100)
|
|
||||||
ZIP_NO String? @db.NVarChar(7)
|
|
||||||
PRFT_JP String? @db.NVarChar(100)
|
|
||||||
MNCP_NM String? @db.NVarChar(100)
|
|
||||||
ADDR_NM String? @db.NVarChar(200)
|
|
||||||
ADDR_DTL String? @db.NVarChar(200)
|
|
||||||
RECEIVER_NM String? @db.NVarChar(100)
|
|
||||||
RECEIVER_CONTACT_NO String? @db.NVarChar(100)
|
|
||||||
USE_YN String? @db.NVarChar(1)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
BC_QM_USER BC_QM_USER[]
|
|
||||||
|
|
||||||
@@id([COMP_CD, BUILDER_NO], map: "PK_BC_QM_BUILDER")
|
|
||||||
}
|
|
||||||
|
|
||||||
model BC_QM_TERMS {
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
TERMS_NO Decimal @db.Decimal(18, 0)
|
|
||||||
VER_NO String @db.NVarChar(3)
|
|
||||||
VER_SUB_NO String @db.NVarChar(3)
|
|
||||||
OPERTN_DT DateTime @db.Date
|
|
||||||
TERMS_CTNT String @db.NVarChar(Max)
|
|
||||||
DEL_YN String? @db.NVarChar(1)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
BC_QM_USER BC_QM_USER[]
|
|
||||||
|
|
||||||
@@id([TERMS_NO, COMP_CD], map: "PK_BC_QM_TERMS")
|
|
||||||
}
|
|
||||||
|
|
||||||
model BC_QM_USER {
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
USER_ID String @db.NVarChar(50)
|
|
||||||
AGENCY_STORE_ID String @db.NVarChar(100)
|
|
||||||
USER_NM String @db.NVarChar(100)
|
|
||||||
USER_AUTH_CD String @db.NVarChar(10)
|
|
||||||
EMAIL String? @db.NVarChar(100)
|
|
||||||
PSTN_NM String? @db.NVarChar(100)
|
|
||||||
TEL_NO String? @db.NVarChar(100)
|
|
||||||
MOBILE_NO String? @db.NVarChar(100)
|
|
||||||
FAX_NO String? @db.NVarChar(100)
|
|
||||||
LAST_LOGIN_DT DateTime? @db.DateTime
|
|
||||||
PWD String @db.NVarChar(100)
|
|
||||||
PWD_INIT_YN String? @default("N", map: "DF__BC_QM_USE__PWD_I__42E1EEFE") @db.NVarChar(1)
|
|
||||||
LOGIN_FAIL_CNT Decimal? @default(0, map: "DF__BC_QM_USE__LOGIN__43D61337") @db.Decimal(18, 0)
|
|
||||||
LAST_LOGIN_FAIL_DT DateTime? @db.DateTime
|
|
||||||
LAST_PWD_UPT_DT DateTime? @db.DateTime
|
|
||||||
BUILDER_NO String? @db.NVarChar(50)
|
|
||||||
ZIP_NO String? @db.NVarChar(7)
|
|
||||||
PRFT_JP String? @db.NVarChar(100)
|
|
||||||
MNCP_NM String? @db.NVarChar(100)
|
|
||||||
ADDR_NM String? @db.NVarChar(200)
|
|
||||||
TERMS_AGREE_YN String? @default("N", map: "DF__BC_QM_USE__TERMS__44CA3770") @db.NVarChar(1)
|
|
||||||
TERMS_AGREE_DT DateTime? @db.DateTime
|
|
||||||
AGREE_TERMS_NO Decimal? @db.Decimal(18, 0)
|
|
||||||
STAT_CD String? @db.NVarChar(1)
|
|
||||||
DEL_YN String? @db.NVarChar(1)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
USER_NM_KANA String? @db.NVarChar(50)
|
|
||||||
BC_QM_BUILDER BC_QM_BUILDER? @relation(fields: [COMP_CD, BUILDER_NO], references: [COMP_CD, BUILDER_NO], onUpdate: NoAction, map: "FK_BC_QM_USER_01")
|
|
||||||
BC_QM_TERMS BC_QM_TERMS? @relation(fields: [AGREE_TERMS_NO, COMP_CD], references: [TERMS_NO, COMP_CD], onUpdate: NoAction, map: "FK_BC_QM_USER_02")
|
|
||||||
|
|
||||||
@@id([COMP_CD, USER_ID], map: "PK_BC_QM_USER")
|
|
||||||
}
|
|
||||||
|
|
||||||
model IF_PERSON_OFFICE_MAPPING {
|
|
||||||
IF_SEQ Decimal @id(map: "PK_IF_PERSON_OFFICE_MAPPING") @db.Decimal(22, 0)
|
|
||||||
SEQ Int?
|
|
||||||
LIFNR String? @db.NVarChar(10)
|
|
||||||
VKBUR String? @db.NVarChar(4)
|
|
||||||
IF_DT DateTime? @db.DateTime
|
|
||||||
IF_STS String? @db.NVarChar(1)
|
|
||||||
IF_MSG String? @db.NVarChar(200)
|
|
||||||
}
|
|
||||||
|
|
||||||
model MS_CUST_AGENCY_STOREID {
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
STORE_ID String @db.NVarChar(100)
|
|
||||||
AGENCY_STORE_ID String @db.NVarChar(100)
|
|
||||||
AGENCY_QCAST_NM String? @db.NVarChar(100)
|
|
||||||
PLAN_REQ_SUBMIT_YN String? @default("N", map: "DF__MS_CUST_A__PLAN___3B40CD36") @db.NVarChar(1)
|
|
||||||
DEL_YN String? @default("N", map: "DF__MS_CUST_A__DEL_Y__3C34F16F") @db.NVarChar(1)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
EMAIL String? @db.NVarChar(100)
|
|
||||||
REMARK String? @db.NVarChar(Max)
|
|
||||||
BDL_TP_CD String? @db.NVarChar(10)
|
|
||||||
|
|
||||||
@@id([COMP_CD, AGENCY_STORE_ID], map: "PK_MS_CUST_AGENCY_STOREID")
|
|
||||||
}
|
|
||||||
|
|
||||||
model MS_CUST_H {
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
CUST_CD String @db.NVarChar(10)
|
|
||||||
ACCOUNT_GR String? @db.NVarChar(4)
|
|
||||||
CUST_NM String? @db.NVarChar(70)
|
|
||||||
HAUS_NO String? @db.NVarChar(10)
|
|
||||||
POST_CD String? @db.NVarChar(10)
|
|
||||||
CITY_CD String? @db.NVarChar(12)
|
|
||||||
CITY_NM String? @db.NVarChar(40)
|
|
||||||
COUNTRY_CD String? @db.NVarChar(4)
|
|
||||||
REGION_CD String? @db.NVarChar(4)
|
|
||||||
STREET_NM String? @db.NVarChar(60)
|
|
||||||
STREET_NM2 String? @db.NVarChar(60)
|
|
||||||
STREET_NM3 String? @db.NVarChar(60)
|
|
||||||
STREET_NM4 String? @db.NVarChar(60)
|
|
||||||
STREET_NM5 String? @db.NVarChar(60)
|
|
||||||
TIME_ZONE String? @db.NVarChar(10)
|
|
||||||
TRANSP_ZONE String? @db.NVarChar(10)
|
|
||||||
LANG_CD String? @db.NVarChar(2)
|
|
||||||
TEL_NO String? @db.NVarChar(30)
|
|
||||||
TEL_NO_EXT String? @db.NVarChar(10)
|
|
||||||
MOBILE_NO String? @db.NVarChar(30)
|
|
||||||
FAX_NO String? @db.NVarChar(30)
|
|
||||||
FAX_NO_EXT String? @db.NVarChar(10)
|
|
||||||
EMAIL String? @db.NVarChar(100)
|
|
||||||
INDUSTRY_CD String? @db.NVarChar(4)
|
|
||||||
VAT_REG_NO String? @db.NVarChar(20)
|
|
||||||
LOCAT_NO1 Decimal? @db.Decimal(7, 0)
|
|
||||||
LOCAT_NO2 Decimal? @db.Decimal(5, 0)
|
|
||||||
RESI_CD String? @db.NVarChar(4)
|
|
||||||
UTIL_CD String? @db.NVarChar(4)
|
|
||||||
MARK_PF String? @db.NVarChar(4)
|
|
||||||
INVS_CD String? @db.NVarChar(4)
|
|
||||||
PRMT_CD String? @db.NVarChar(4)
|
|
||||||
SVC_PR_CD String? @db.NVarChar(4)
|
|
||||||
ENG_CNSL_CD String? @db.NVarChar(4)
|
|
||||||
RECON_ACC_CD String? @db.NVarChar(20)
|
|
||||||
SORT_KEY String? @db.NVarChar(12)
|
|
||||||
CASH_MGMT_GR String? @db.NVarChar(12)
|
|
||||||
INTEREST_IND_CD String? @db.NVarChar(12)
|
|
||||||
TERM_PAY_CD String? @db.NVarChar(12)
|
|
||||||
PAY_HIST_YN String? @db.NVarChar(2)
|
|
||||||
DUN_PROC_CD String? @db.NVarChar(4)
|
|
||||||
DUN_BLOCK_CD String? @db.NVarChar(1)
|
|
||||||
DUN_LEVEL_CD Decimal? @db.Decimal(1, 0)
|
|
||||||
POLICY_NO String? @db.NVarChar(20)
|
|
||||||
INSURED_AMT Decimal? @db.Decimal(13, 3)
|
|
||||||
VAL_TO_DATE DateTime? @db.Date
|
|
||||||
DEDUCT_RATE Decimal? @db.Decimal(9, 0)
|
|
||||||
APPLIED_INSURA Decimal? @db.Decimal(13, 3)
|
|
||||||
EASY_NO String? @db.NVarChar(20)
|
|
||||||
APPLY_DATE DateTime? @db.Date
|
|
||||||
EXPIRE_DATE DateTime? @db.Date
|
|
||||||
ADD_TXT1 String? @db.NVarChar(400)
|
|
||||||
ADD_TXT2 String? @db.NVarChar(400)
|
|
||||||
REF_PS_ID String? @db.NVarChar(20)
|
|
||||||
CUST_COMP_CD String? @db.NVarChar(4)
|
|
||||||
CUST_TEXT String? @db.NVarChar(Max)
|
|
||||||
CUST_GRADE String? @db.NVarChar(2)
|
|
||||||
INCOME_TAX_NO String? @db.NVarChar(20)
|
|
||||||
STAT_CD String? @db.NVarChar(2)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
QSP_ACCOUNT_GR String? @db.NVarChar(4)
|
|
||||||
BDL_TP_CD String? @db.NVarChar(10)
|
|
||||||
BDL_SUB_TP_CD String? @db.NVarChar(100)
|
|
||||||
MS_CUST_STOREID MS_CUST_STOREID[]
|
|
||||||
|
|
||||||
@@id([COMP_CD, CUST_CD], map: "PK_MS_CUST_H")
|
|
||||||
}
|
|
||||||
|
|
||||||
model MS_CUST_PERSON {
|
|
||||||
SEQ Decimal @db.Decimal(22, 0)
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
CUST_CD String @db.NVarChar(10)
|
|
||||||
EOS_LOGIN_ID String? @db.NVarChar(100)
|
|
||||||
EOS_PWD String? @db.NVarChar(100)
|
|
||||||
NAME String? @db.NVarChar(50)
|
|
||||||
PSTN_NM String? @db.NVarChar(50)
|
|
||||||
EMAIL String? @db.NVarChar(100)
|
|
||||||
TEL_NO String? @db.NVarChar(100)
|
|
||||||
AUTHORITY String @db.NVarChar(1)
|
|
||||||
DEL_YN String? @default("N", map: "DF__MS_CUST_P__DEL_Y__339FAB6E") @db.NVarChar(1)
|
|
||||||
LOGIN_DT DateTime? @db.DateTime
|
|
||||||
PWD_INIT_YN String? @db.NVarChar(1)
|
|
||||||
LOGIN_FAIL_CNT Decimal? @db.Decimal(18, 0)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
LOGIN_FAIL_DT DateTime? @db.DateTime
|
|
||||||
PLAN_REQ_AUTH String? @default("N", map: "DF__MS_CUST_P__PLAN___3493CFA7") @db.NVarChar(1)
|
|
||||||
PRICE_VIEW_STAT_CD String? @default("S", map: "DF__MS_CUST_P__PRICE__3587F3E0") @db.NVarChar(10)
|
|
||||||
SD_SUBMIT_YN String? @default("N", map: "DF__MS_CUST_P__SD_SU__367C1819") @db.NVarChar(1)
|
|
||||||
STORE_ID String? @db.NVarChar(100)
|
|
||||||
USER_NM_KANA String? @db.NVarChar(50)
|
|
||||||
FAX String? @db.NVarChar(100)
|
|
||||||
PLAN_MAIL_RCV_YN String? @default("Y", map: "DF__MS_CUST_P__PLAN___37703C52") @db.NVarChar(1)
|
|
||||||
SD_MAIL_RCV_YN String? @default("Y", map: "DF__MS_CUST_P__SD_MA__3864608B") @db.NVarChar(1)
|
|
||||||
|
|
||||||
@@id([SEQ, COMP_CD, CUST_CD], map: "PK_MS_CUST_PERSON")
|
|
||||||
}
|
|
||||||
|
|
||||||
model MS_CUST_STOREID {
|
|
||||||
COMP_CD String @db.NVarChar(4)
|
|
||||||
STORE_ID String @db.NVarChar(100)
|
|
||||||
CUST_CD String @db.NVarChar(10)
|
|
||||||
REPRESENTATIVE_STORE_YN String? @db.NVarChar(1)
|
|
||||||
SP_MODULE_PRICE_SEQ Decimal? @db.Decimal(20, 0)
|
|
||||||
SP_MODULE_PRICE_EXP_FR_DT DateTime? @db.Date
|
|
||||||
SP_MODULE_PRICE_EXP_TO_DT DateTime? @db.Date
|
|
||||||
SP_BOS_PRICE_SEQ Decimal? @db.Decimal(20, 0)
|
|
||||||
SP_BOS_PRICE_EXP_FR_DT DateTime? @db.Date
|
|
||||||
SP_BOS_PRICE_EXP_TO_DT DateTime? @db.Date
|
|
||||||
PKG_PRICE_RANK String? @default("C", map: "DF__MS_CUST_S__PKG_P__29221CFB") @db.NVarChar(3)
|
|
||||||
SP_PKG_PRICE Decimal? @db.Decimal(13, 1)
|
|
||||||
SP_PKG_PRICE_EXP_FR_DT DateTime? @db.Date
|
|
||||||
SP_PKG_PRICE_EXP_TO_DT DateTime? @db.Date
|
|
||||||
DEL_YN String? @default("N", map: "DF__MS_CUST_S__DEL_Y__2A164134") @db.NVarChar(1)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
MOVE_DT DateTime? @db.DateTime
|
|
||||||
MOVE_ID String? @db.NVarChar(50)
|
|
||||||
STORE_QCAST_NM String? @db.NVarChar(100)
|
|
||||||
PLAN_REQ_AUTH String? @default("N", map: "DF__MS_CUST_S__PLAN___2B0A656D") @db.NVarChar(1)
|
|
||||||
PKG_EXCEPT_YN String? @default("N", map: "DF__MS_CUST_S__PKG_E__2BFE89A6") @db.NVarChar(1)
|
|
||||||
MODULE_PRICE_RANK String? @default("C", map: "DF__MS_CUST_S__MODUL__2CF2ADDF") @db.NVarChar(20)
|
|
||||||
BOS_PRICE_RANK String? @default("A", map: "DF__MS_CUST_S__BOS_P__2DE6D218") @db.NVarChar(20)
|
|
||||||
PLAN_REQ_SUBMIT_YN String? @default("N", map: "DF__MS_CUST_S__PLAN___2EDAF651") @db.NVarChar(1)
|
|
||||||
QSP_SUBAL_YN String? @default("N", map: "DF__MS_CUST_S__QSP_S__2FCF1A8A") @db.NVarChar(1)
|
|
||||||
MS_CUST_H MS_CUST_H @relation(fields: [COMP_CD, CUST_CD], references: [COMP_CD, CUST_CD], onUpdate: NoAction, map: "MS_CUST_STOREID_FK")
|
|
||||||
|
|
||||||
@@id([COMP_CD, STORE_ID], map: "PK_MS_CUST_STOREID")
|
|
||||||
@@index([COMP_CD, CUST_CD], map: "IDX_MS_CUST_STOREID_COMP_CD_01")
|
|
||||||
}
|
|
||||||
|
|
||||||
model MS_CUST_STOREID_ADDITNL {
|
|
||||||
COMP_CD String @db.NVarChar(20)
|
|
||||||
STORE_ID String @db.NVarChar(100)
|
|
||||||
REQ_CUST_CD String? @db.NVarChar(10)
|
|
||||||
REQ_STORE_QCAST_NM String? @db.NVarChar(100)
|
|
||||||
STORE_QCAST_NM_KANA String? @db.NVarChar(100)
|
|
||||||
BIZ_NO String? @db.NVarChar(20)
|
|
||||||
POST_CD String? @db.NVarChar(10)
|
|
||||||
ADDR String? @db.NVarChar(255)
|
|
||||||
TEL_NO String? @db.NVarChar(100)
|
|
||||||
FAX String? @db.NVarChar(100)
|
|
||||||
APPR_DT DateTime? @db.DateTime
|
|
||||||
APPR_ID String? @db.NVarChar(50)
|
|
||||||
APPR_STAT_CD String? @db.NVarChar(10)
|
|
||||||
APPR_REMARKS String? @db.NVarChar(300)
|
|
||||||
REQ_APPR_DT DateTime? @db.DateTime
|
|
||||||
PAY_TERMS_CD String? @db.NVarChar(10)
|
|
||||||
FIRST_STORE_ID String? @db.NVarChar(100)
|
|
||||||
PARENT_STORE_ID String? @db.NVarChar(100)
|
|
||||||
STORE_LVL Int?
|
|
||||||
KAM_ID String? @db.NVarChar(50)
|
|
||||||
QT_COMP_NM String? @db.NVarChar(100)
|
|
||||||
QT_POST_CD String? @db.NVarChar(10)
|
|
||||||
QT_ADDR String? @db.NVarChar(255)
|
|
||||||
QT_TEL_NO String? @db.NVarChar(100)
|
|
||||||
QT_FAX String? @db.NVarChar(100)
|
|
||||||
QT_E_MAIL String? @db.NVarChar(100)
|
|
||||||
ORD_DELI_TARGET String? @db.NVarChar(100)
|
|
||||||
ORD_DELI_COMP_NM String? @db.NVarChar(100)
|
|
||||||
ORD_DELI_COMP_USER_NM String? @db.NVarChar(40)
|
|
||||||
ORD_DELI_TEL_NO String? @db.NVarChar(100)
|
|
||||||
ORD_DELI_POST_CD String? @db.NVarChar(10)
|
|
||||||
ORD_DELI_REMARKS String? @db.NVarChar(200)
|
|
||||||
GUAR_STORE_NM String? @db.NVarChar(100)
|
|
||||||
GUAR_STORE_POST_CD String? @db.NVarChar(10)
|
|
||||||
GUAR_STORE_ADDR String? @db.NVarChar(255)
|
|
||||||
GUAR_TEL_NO String? @db.NVarChar(100)
|
|
||||||
NORTH_MODULE_YN String? @default("N", map: "DF__MS_CUST_S__NORTH__17036CC0") @db.NVarChar(1)
|
|
||||||
DEL_YN String? @default("N", map: "DF__MS_CUST_S__DEL_Y__17F790F9") @db.NVarChar(1)
|
|
||||||
REG_DT DateTime? @db.DateTime
|
|
||||||
REG_ID String? @db.NVarChar(50)
|
|
||||||
UPT_DT DateTime? @db.DateTime
|
|
||||||
UPT_ID String? @db.NVarChar(50)
|
|
||||||
REQ_MODULE_PRICE_RANK String? @db.NVarChar(20)
|
|
||||||
REQ_BOS_PRICE_RANK String? @db.NVarChar(20)
|
|
||||||
REQ_PKG_PRICE_RANK String? @db.NVarChar(3)
|
|
||||||
REQ_BDL_TP_CD String? @db.NVarChar(10)
|
|
||||||
REQ_BDL_SUB_TP_CD String? @db.NVarChar(100)
|
|
||||||
REMARK String? @db.NVarChar(500)
|
|
||||||
NORTH_MODULE_UPT_DT DateTime? @db.DateTime
|
|
||||||
NORTH_MODULE_UPT_ID String? @db.NVarChar(50)
|
|
||||||
|
|
||||||
@@id([COMP_CD, STORE_ID], map: "PK_MS_CUST_STOREID_ADDITNL")
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,19 +1,8 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import { queryStringFormatter } from '@/utils/common-utils'
|
import { queryStringFormatter } from '@/utils/common-utils'
|
||||||
import { getIronSession } from 'iron-session'
|
|
||||||
import { cookies } from 'next/headers'
|
|
||||||
import { sessionOptions } from '@/libs/session'
|
|
||||||
import { SessionData } from '@/types/Auth'
|
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
const cookieStore = await cookies()
|
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
|
||||||
|
|
||||||
if (!session.isLoggedIn) {
|
|
||||||
return NextResponse.json({ error: 'ログインしていません。' }, { status: 401 })
|
|
||||||
}
|
|
||||||
|
|
||||||
const { searchParams } = new URL(request.url)
|
const { searchParams } = new URL(request.url)
|
||||||
|
|
||||||
const params: Record<string, string> = {}
|
const params: Record<string, string> = {}
|
||||||
|
|||||||
@ -1,42 +0,0 @@
|
|||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
import { NextRequest, NextResponse } from 'next/server'
|
|
||||||
|
|
||||||
type AdminSubPerson = {
|
|
||||||
storeId: string
|
|
||||||
userId: string
|
|
||||||
eMail: string
|
|
||||||
authority: string
|
|
||||||
}
|
|
||||||
// 2차점이 자신에게 매핑 된 1차 판매점과 관리자 정보 조회
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
try {
|
|
||||||
const { searchParams } = new URL(request.url)
|
|
||||||
const id = searchParams.get('id')
|
|
||||||
|
|
||||||
const query = `
|
|
||||||
OPEN SYMMETRIC KEY SYMMETRICKEY DECRYPTION BY CERTIFICATE CERTI_QSPJP;
|
|
||||||
SELECT
|
|
||||||
MCS.STORE_ID AS targetStoreId
|
|
||||||
, MCS.STORE_QCAST_NM AS targetStoreNm
|
|
||||||
, MCP.EOS_LOGIN_ID AS repUserId
|
|
||||||
, CONVERT(NVARCHAR(100), DecryptByKey(MCP.EMAIL)) AS repUserEmail
|
|
||||||
, MCP.AUTHORITY AS auth
|
|
||||||
FROM MS_CUST_STOREID MCS WITH(NOLOCK)
|
|
||||||
LEFT OUTER JOIN MS_CUST_PERSON MCP WITH(NOLOCK)
|
|
||||||
ON MCS.COMP_CD = MCP.COMP_CD
|
|
||||||
AND MCS.STORE_ID = MCP.STORE_ID
|
|
||||||
AND MCP.DEL_YN = 'N'
|
|
||||||
WHERE MCS.COMP_CD = '5200'
|
|
||||||
AND MCS.STORE_ID = (SELECT STORE_ID FROM MS_CUST_AGENCY_STOREID WHERE AGENCY_STORE_ID = '${id}' AND DEL_YN = 'N')
|
|
||||||
AND MCP.EMAIL IS NOT NULL
|
|
||||||
AND MCS.DEL_YN = 'N';
|
|
||||||
CLOSE SYMMETRIC KEY SYMMETRICKEY;
|
|
||||||
`
|
|
||||||
const suitable: AdminSubPerson[] = await prisma.$queryRawUnsafe(query)
|
|
||||||
|
|
||||||
return NextResponse.json({ message: 'Hello, world!' })
|
|
||||||
} catch (error) {
|
|
||||||
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
|
||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
import { NextRequest, NextResponse } from 'next/server'
|
|
||||||
|
|
||||||
type SuperPerson = {
|
|
||||||
storeId: string
|
|
||||||
salesOfficeCd: string
|
|
||||||
fromEmail: string
|
|
||||||
toEmail: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
try {
|
|
||||||
const { searchParams } = new URL(request.url)
|
|
||||||
const id = searchParams.get('id')
|
|
||||||
|
|
||||||
const query = `
|
|
||||||
OPEN SYMMETRIC KEY SYMMETRICKEY DECRYPTION BY CERTIFICATE CERTI_QSPJP;
|
|
||||||
SELECT
|
|
||||||
MCSA.STORE_ID
|
|
||||||
, BCL.CODE AS SALES_OFFICE_CD
|
|
||||||
, REF_CHR1 AS FROM_E_MAIL
|
|
||||||
, REF_CHR2 AS TO_E_MAIL
|
|
||||||
FROM MS_CUST_STOREID_ADDITNL MCSA WITH(NOLOCK)
|
|
||||||
LEFT OUTER JOIN IF_PERSON_OFFICE_MAPPING IPOM WITH(NOLOCK)
|
|
||||||
ON MCSA.KAM_ID = IPOM.LIFNR
|
|
||||||
AND IF_STS = 'R'
|
|
||||||
AND VKBUR IS NOT NULL
|
|
||||||
AND VKBUR != ''
|
|
||||||
INNER JOIN BC_COMM_L BCL WITH(NOLOCK)
|
|
||||||
ON BCL.CODE = IPOM.VKBUR
|
|
||||||
AND BCL.HEAD_CD = '103200'
|
|
||||||
AND BCL.DEL_YN = 'N'
|
|
||||||
WHERE MCSA.COMP_CD = '5200'
|
|
||||||
AND MCSA.STORE_ID = 'A03'
|
|
||||||
AND MCSA.DEL_YN = 'N'
|
|
||||||
;
|
|
||||||
CLOSE SYMMETRIC KEY SYMMETRICKEY;
|
|
||||||
`
|
|
||||||
const suitable: SuperPerson[] = await prisma.$queryRawUnsafe(query)
|
|
||||||
|
|
||||||
return NextResponse.json({ message: 'Hello, world!' })
|
|
||||||
} catch (error) {
|
|
||||||
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
|
||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
import { SubmitTargetResponse } from '@/types/Survey'
|
|
||||||
import { NextRequest, NextResponse } from 'next/server'
|
|
||||||
|
|
||||||
type BuilderPerson = {
|
|
||||||
agencyStoreId: string
|
|
||||||
userId: string
|
|
||||||
eMail: string
|
|
||||||
userAuthCd: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// 2차점의 시공권한 user가 해당 판매점의 관리자 정보 조회
|
|
||||||
// N == 일반유저, S == 수퍼유저, B == 시공권한유저
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
try {
|
|
||||||
const { searchParams } = new URL(request.url)
|
|
||||||
const id = searchParams.get('id')
|
|
||||||
|
|
||||||
const query = `
|
|
||||||
OPEN SYMMETRIC KEY SYMMETRICKEY DECRYPTION BY CERTIFICATE CERTI_QSPJP;
|
|
||||||
SELECT
|
|
||||||
MCAS.AGENCY_STORE_ID AS targetStoreId
|
|
||||||
, MCAS.AGENCY_QCAST_NM AS targetStoreNm
|
|
||||||
, BQU.USER_ID AS repUserId
|
|
||||||
, CONVERT(NVARCHAR(100), DecryptByKey(BQU.EMAIL)) AS repUserEmail
|
|
||||||
, BQU.USER_AUTH_CD AS auth
|
|
||||||
FROM MS_CUST_AGENCY_STOREID MCAS WITH(NOLOCK)
|
|
||||||
LEFT OUTER JOIN BC_QM_USER BQU WITH(NOLOCK)
|
|
||||||
ON MCAS.COMP_CD = BQU.COMP_CD
|
|
||||||
AND MCAS.AGENCY_STORE_ID = BQU.AGENCY_STORE_ID
|
|
||||||
AND MCAS.DEL_YN = 'N'
|
|
||||||
WHERE MCAS.COMP_CD = '5200'
|
|
||||||
AND MCAS.AGENCY_STORE_ID = '${id}'
|
|
||||||
AND BQU.EMAIL IS NOT NULL
|
|
||||||
AND BQU.USER_AUTH_CD != 'B'
|
|
||||||
AND MCAS.DEL_YN = 'N';
|
|
||||||
CLOSE SYMMETRIC KEY SYMMETRICKEY;
|
|
||||||
`
|
|
||||||
// const suitable: BuilderPerson[] = await prisma.$queryRawUnsafe(query)
|
|
||||||
|
|
||||||
// return NextResponse.json({ message: 'Hello, world!' })
|
|
||||||
const data: SubmitTargetResponse[] = await prisma.$queryRawUnsafe(query)
|
|
||||||
return NextResponse.json(data)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
|
||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
import { NextRequest, NextResponse } from 'next/server'
|
|
||||||
|
|
||||||
type SuperPerson = {
|
|
||||||
storeId: string
|
|
||||||
userId: string
|
|
||||||
eMail: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function GET(request: NextRequest) {
|
|
||||||
try {
|
|
||||||
const { searchParams } = new URL(request.url)
|
|
||||||
const id = searchParams.get('id')
|
|
||||||
|
|
||||||
const query = `
|
|
||||||
OPEN SYMMETRIC KEY SYMMETRICKEY DECRYPTION BY CERTIFICATE CERTI_QSPJP;
|
|
||||||
SELECT
|
|
||||||
MCSA.STORE_ID
|
|
||||||
, BU.USER_ID
|
|
||||||
, CONVERT(NVARCHAR(100), DecryptByKey(BU.E_MAIL)) AS E_MAIL
|
|
||||||
FROM MS_CUST_STOREID_ADDITNL MCSA WITH(NOLOCK)
|
|
||||||
LEFT OUTER JOIN BC_USER bu WITH(NOLOCK)
|
|
||||||
ON MCSA.COMP_CD = BU.COMP_CD
|
|
||||||
AND MCSA.KAM_ID = BU.KAM_ID
|
|
||||||
AND BU.STAT_CD = 'A'
|
|
||||||
AND BU.DEL_YN = 'N'
|
|
||||||
WHERE MCSA.COMP_CD = '5200'
|
|
||||||
AND MCSA.STORE_ID = 'A03'
|
|
||||||
AND MCSA.DEL_YN = 'N';
|
|
||||||
CLOSE SYMMETRIC KEY SYMMETRICKEY;
|
|
||||||
`
|
|
||||||
const suitable: SuperPerson[] = await prisma.$queryRawUnsafe(query)
|
|
||||||
|
|
||||||
return NextResponse.json({ message: 'Hello, world!' })
|
|
||||||
} catch (error) {
|
|
||||||
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
|
||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,170 +1,100 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server'
|
import { NextRequest, NextResponse } from 'next/server'
|
||||||
import { prisma } from '@/libs/prisma'
|
import { prisma } from '@/libs/prisma'
|
||||||
import { convertToSnakeCase } from '@/utils/common-utils'
|
import { convertToSnakeCase } from '@/utils/common-utils'
|
||||||
import { getIronSession } from 'iron-session'
|
|
||||||
import { sessionOptions } from '@/libs/session'
|
|
||||||
import { cookies } from 'next/headers'
|
|
||||||
import type { SessionData } from '@/types/Auth'
|
|
||||||
|
|
||||||
/**
|
interface Survey {
|
||||||
* @description 조사 매물 조회 에러 메시지
|
SRL_NO: string
|
||||||
*/
|
SUBMISSION_STATUS: boolean
|
||||||
const ERROR_MESSAGES = {
|
SUBMISSION_TARGET_ID: string | null
|
||||||
NOT_FOUND: 'データが見つかりません。',
|
STORE_ID: string | null
|
||||||
UNAUTHORIZED: 'Unauthorized',
|
CONSTRUCTION_POINT_ID: string | null
|
||||||
NO_PERMISSION: '該当物件の照会権限がありません。',
|
|
||||||
FETCH_ERROR: 'データの取得に失敗しました。',
|
|
||||||
} as const
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description T01 조회 권한 체크
|
|
||||||
* @param {any} survey 조사 매물 데이터
|
|
||||||
* @returns {boolean} 조사 매물 임시 저장 여부
|
|
||||||
*/
|
|
||||||
const checkT01Role = (survey: any): boolean => survey.SRL_NO !== '一時保存'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description Admin (1차 판매점) 권한 체크
|
|
||||||
* @param {any} survey 조사 매물 데이터
|
|
||||||
* @param {string | null} storeId 판매점 ID
|
|
||||||
* @returns {boolean} 권한 존재 여부
|
|
||||||
*/
|
|
||||||
const checkAdminRole = (survey: any, storeId: string | null): boolean => {
|
|
||||||
if (!storeId) return false
|
|
||||||
return survey.SUBMISSION_STATUS ? survey.SUBMISSION_TARGET_ID === storeId || survey.STORE_ID === storeId : survey.STORE_ID === storeId
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
interface SessionParams {
|
||||||
* @description Admin_Sub (2차 판매점) 권한 체크
|
role: string | null
|
||||||
* @param {any} survey 조사 매물 데이터
|
storeId: string | null
|
||||||
* @param {string | null} storeId 판매점 ID
|
builderId: string | null
|
||||||
* @returns {boolean} 권한 존재 여부
|
isLoggedIn: string | null
|
||||||
*/
|
|
||||||
const checkAdminSubRole = (survey: any, storeId: string | null): boolean => {
|
|
||||||
if (!storeId) return false
|
|
||||||
return survey.SUBMISSION_STATUS
|
|
||||||
? survey.SUBMISSION_TARGET_ID === storeId || (survey.STORE_ID === storeId && !survey.CONSTRUCTION_POINT_ID)
|
|
||||||
: survey.STORE_ID === storeId && !survey.CONSTRUCTION_POINT_ID
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const checkT01Role = (survey: Survey): boolean => survey.SRL_NO !== '一時保存'
|
||||||
* @description Partner (파트너) 또는 Builder (2차 판매점의 시공권한 회원) 권한 체크
|
|
||||||
* @param {any} survey 조사 매물 데이터
|
const checkAdminRole = (survey: Survey, storeId: string | null): boolean => {
|
||||||
* @param {string | null} builderId 시공점 ID
|
if (!storeId) return false
|
||||||
* @returns {boolean} 권한 존재 여부
|
|
||||||
*/
|
if (survey.SUBMISSION_STATUS) {
|
||||||
const checkPartnerOrBuilderRole = (survey: any, builderId: string | null): boolean => {
|
return survey.SUBMISSION_TARGET_ID === storeId || survey.STORE_ID === storeId
|
||||||
|
}
|
||||||
|
return survey.STORE_ID === storeId
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkAdminSubRole = (survey: Survey, storeId: string | null): boolean => {
|
||||||
|
if (!storeId) return false
|
||||||
|
|
||||||
|
if (survey.SUBMISSION_STATUS) {
|
||||||
|
return survey.SUBMISSION_TARGET_ID === storeId || (survey.STORE_ID === storeId && survey.CONSTRUCTION_POINT_ID === null)
|
||||||
|
}
|
||||||
|
return survey.STORE_ID === storeId && survey.CONSTRUCTION_POINT_ID === null
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkPartnerOrBuilderRole = (survey: Survey, builderId: string | null): boolean => {
|
||||||
if (!builderId) return false
|
if (!builderId) return false
|
||||||
return survey.CONSTRUCTION_POINT_ID === builderId
|
return survey.CONSTRUCTION_POINT_ID === builderId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
const checkRole = (survey: Survey, sessionParams: SessionParams): boolean => {
|
||||||
* @description 권한 체크
|
if (!survey || !sessionParams.role) return false
|
||||||
* @param {any} survey 조사 매물 데이터
|
|
||||||
* @param {any} session 세션 데이터
|
|
||||||
* @returns {boolean} 권한 존재 여부
|
|
||||||
*/
|
|
||||||
const checkRole = (survey: any, session: any): boolean => {
|
|
||||||
if (!survey || !session.isLoggedIn) return false
|
|
||||||
|
|
||||||
const roleChecks = {
|
switch (sessionParams.role) {
|
||||||
T01: () => checkT01Role(survey),
|
case 'T01':
|
||||||
Admin: () => checkAdminRole(survey, session.storeId),
|
return checkT01Role(survey)
|
||||||
Admin_Sub: () => checkAdminSubRole(survey, session.storeId),
|
// T01 이외 1차점
|
||||||
Partner: () => checkPartnerOrBuilderRole(survey, session.builderId),
|
case 'Admin':
|
||||||
Builder: () => checkPartnerOrBuilderRole(survey, session.builderId),
|
return checkAdminRole(survey, sessionParams.storeId)
|
||||||
|
// 2차점
|
||||||
|
case 'Admin_Sub':
|
||||||
|
return checkAdminSubRole(survey, sessionParams.storeId)
|
||||||
|
// partner
|
||||||
|
case 'Partner':
|
||||||
|
// 2차점 시공권한 user
|
||||||
|
case 'Builder':
|
||||||
|
return checkPartnerOrBuilderRole(survey, sessionParams.builderId)
|
||||||
|
default:
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return roleChecks[session.role as keyof typeof roleChecks]?.() ?? false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 조회
|
|
||||||
* @param {number} id 조사 매물 ID
|
|
||||||
* @returns {Promise<any>} 조사 매물 데이터
|
|
||||||
*/
|
|
||||||
const fetchSurvey = async (id: number) => {
|
|
||||||
// @ts-ignore
|
|
||||||
return await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
|
|
||||||
where: { ID: id },
|
|
||||||
include: { DETAIL_INFO: true },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @api {GET} /api/survey-sales/:id 조사 매물 조회 API
|
|
||||||
* @apiName GET /api/survey-sales/:id
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 조사 매물 조회 API
|
|
||||||
*
|
|
||||||
* @apiParam {Number} id 조사 매물 PRIMARY KEY ID (required)
|
|
||||||
* @apiParam {Boolean} isPdf pdf 데이터 조회 여부 (optional, default: false)
|
|
||||||
*
|
|
||||||
* @apiSuccess {Object} SurveySaleBasicInfo 조사 매물 기본 정보
|
|
||||||
*
|
|
||||||
* @apiError {Number} 401 세션 정보 없음 (로그인 필요)
|
|
||||||
* @apiError {Number} 403 권한 없음
|
|
||||||
* @apiError {Number} 404 조사 매물 없음
|
|
||||||
* @apiError {Number} 500 서버 오류
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X GET \
|
|
||||||
* -G "isPdf=true" \
|
|
||||||
* http://localhost:3000/api/survey-sales/1
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "id": 1,
|
|
||||||
* "srlNo": "1234567890",
|
|
||||||
* "storeId": "1234567890",
|
|
||||||
* "detailInfo": {
|
|
||||||
* "id": 1,
|
|
||||||
* "trestleMfpcCd": "1234567890",
|
|
||||||
* "trestleManufacturerProductName": "1234567890",
|
|
||||||
* "memo": "1234567890"
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
||||||
try {
|
try {
|
||||||
const cookieStore = await cookies()
|
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
|
||||||
const { id } = await params
|
const { id } = await params
|
||||||
const { searchParams } = new URL(request.url)
|
const { searchParams } = new URL(request.url)
|
||||||
const isPdf = searchParams.get('isPdf') === 'true'
|
|
||||||
|
|
||||||
const survey = await fetchSurvey(Number(id))
|
const sessionParams: SessionParams = {
|
||||||
if (!survey) {
|
role: searchParams.get('role'),
|
||||||
return NextResponse.json({ error: ERROR_MESSAGES.NOT_FOUND }, { status: 404 })
|
storeId: searchParams.get('storeId'),
|
||||||
|
builderId: searchParams.get('builderId'),
|
||||||
|
isLoggedIn: searchParams.get('isLoggedIn'),
|
||||||
}
|
}
|
||||||
|
// @ts-ignore
|
||||||
/** pdf 데이터 요청 여부, 권한 여부 확인 */
|
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
|
||||||
if (isPdf || checkRole(survey, session)) {
|
where: {
|
||||||
|
ID: Number(id),
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
DETAIL_INFO: true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (checkRole(survey, sessionParams)) {
|
||||||
return NextResponse.json(survey)
|
return NextResponse.json(survey)
|
||||||
|
} else {
|
||||||
|
return NextResponse.json({ error: '該当物件の照会権限がありません。' }, { status: 403 })
|
||||||
}
|
}
|
||||||
|
} catch (error: any) {
|
||||||
/** 로그인 여부 확인 */
|
|
||||||
if (!session?.isLoggedIn || session?.role === null) {
|
|
||||||
return NextResponse.json({ error: ERROR_MESSAGES.UNAUTHORIZED }, { status: 401 })
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 권한 없음 */
|
|
||||||
return NextResponse.json({ error: ERROR_MESSAGES.NO_PERMISSION }, { status: 403 })
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching survey:', error)
|
console.error('Error fetching survey:', error)
|
||||||
return NextResponse.json({ error: ERROR_MESSAGES.FETCH_ERROR }, { status: 500 })
|
return NextResponse.json({ error: 'データの取得に失敗しました。' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 새로운 SRL_NO 생성
|
|
||||||
* @param {string} srlNo 기존 SRL_NO
|
|
||||||
* @param {string} storeId 판매점 ID
|
|
||||||
* @param {string} role 권한
|
|
||||||
* @returns {Promise<string>} 새로운 SRL_NO
|
|
||||||
*/
|
|
||||||
const getNewSrlNo = async (srlNo: string, storeId: string, role: string) => {
|
const getNewSrlNo = async (srlNo: string, storeId: string, role: string) => {
|
||||||
const srlRole = role === 'T01' || role === 'Admin' ? 'HO' : role === 'Admin_Sub' || role === 'Builder' ? 'HM' : ''
|
const srlRole = role === 'T01' || role === 'Admin' ? 'HO' : role === 'Admin_Sub' || role === 'Builder' ? 'HM' : ''
|
||||||
|
|
||||||
@ -174,7 +104,7 @@ const getNewSrlNo = async (srlNo: string, storeId: string, role: string) => {
|
|||||||
const lastSurvey = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
|
const lastSurvey = await prisma.SD_SURVEY_SALES_BASIC_INFO.findFirst({
|
||||||
where: {
|
where: {
|
||||||
SRL_NO: {
|
SRL_NO: {
|
||||||
startsWith: srlRole,
|
startsWith: srlRole + storeId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
orderBy: {
|
orderBy: {
|
||||||
@ -194,39 +124,6 @@ const getNewSrlNo = async (srlNo: string, storeId: string, role: string) => {
|
|||||||
return newSrlNo
|
return newSrlNo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @api {PUT} /api/survey-sales/:id 조사 매물 수정 API
|
|
||||||
* @apiName PUT /api/survey-sales/:id
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 조사 매물 수정 API
|
|
||||||
*
|
|
||||||
* @apiParam {Number} id 조사 매물 PRIMARY KEY ID (required)
|
|
||||||
* @apiBody {Object} survey 조사 매물 데이터 (required)
|
|
||||||
* @apiBody {Boolean} isTemporary 임시 저장 여부 (optional, default: false)
|
|
||||||
* @apiBody {String} storeId 판매점 ID (optional)
|
|
||||||
* @apiBody {String} role 권한 (optional)
|
|
||||||
*
|
|
||||||
* @apiSuccess {Object} SurveySaleBasicInfo 수정된 조사 매물 기본 정보
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X PUT \
|
|
||||||
* -H "Content-Type: application/json" \
|
|
||||||
* -d '{"survey": {"detailInfo": {"id": 1, "memo": "1234567890", ...}, "srlNo": "1234567890", ...},"storeId": "1234567890", "role": "T01", "isTemporary": false}' \
|
|
||||||
* http://localhost:3000/api/survey-sales/1
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "id": 1,
|
|
||||||
* "srlNo": "1234567890",
|
|
||||||
* "storeId": "1234567890",
|
|
||||||
* "detailInfo": {
|
|
||||||
* "id": 1,
|
|
||||||
* "memo": "1234567890",
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* */
|
|
||||||
export async function PUT(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
export async function PUT(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
||||||
try {
|
try {
|
||||||
const { id } = await params
|
const { id } = await params
|
||||||
@ -253,27 +150,10 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
|
|||||||
return NextResponse.json(survey)
|
return NextResponse.json(survey)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating survey:', error)
|
console.error('Error updating survey:', error)
|
||||||
return NextResponse.json({ error: 'データ保存に失敗しました。' }, { status: 500 })
|
return NextResponse.json({ error: 'Failed to update survey' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @api {DELETE} /api/survey-sales/:id 조사 매물 삭제 API
|
|
||||||
* @apiName DELETE /api/survey-sales/:id
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 조사 매물 삭제 API
|
|
||||||
*
|
|
||||||
* @apiParam {Number} id 조사 매물 PRIMARY KEY ID (required)
|
|
||||||
*
|
|
||||||
* @apiSuccess {String} message 삭제 성공 메시지
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X DELETE \
|
|
||||||
* http://localhost:3000/api/survey-sales/1
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "message": "success"
|
|
||||||
*/
|
|
||||||
export async function DELETE(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
export async function DELETE(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
||||||
try {
|
try {
|
||||||
const { id } = await params
|
const { id } = await params
|
||||||
@ -300,48 +180,13 @@ export async function DELETE(request: NextRequest, { params }: { params: Promise
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ message: 'success' })
|
return NextResponse.json({ message: 'Survey deleted successfully' })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting survey:', error)
|
console.error('Error deleting survey:', error)
|
||||||
return NextResponse.json({ error: 'データ削除に失敗しました。' }, { status: 500 })
|
return NextResponse.json({ error: 'Failed to delete survey' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @api {PATCH} /api/survey-sales/:id 조사 매물 제출 API
|
|
||||||
* @apiName PATCH /api/survey-sales/:id
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 조사 매물 제출 API
|
|
||||||
*
|
|
||||||
* @apiParam {Number} id 조사 매물 PRIMARY KEY ID (required)
|
|
||||||
* @apiBody {String} targetId 제출 대상 ID (required)
|
|
||||||
* @apiBody {String} targetNm 제출 대상 이름 (required)
|
|
||||||
*
|
|
||||||
* @apiSuccess {String} message 제출 성공 메시지
|
|
||||||
* @apiSuccess {Object} data 제출된 조사 매물 기본 정보
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X PATCH \
|
|
||||||
* -H "Content-Type: application/json" \
|
|
||||||
* -d '{"targetId": "1234567890", "targetNm": "1234567890"}' \
|
|
||||||
* http://localhost:3000/api/survey-sales/1
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "message": "success",
|
|
||||||
* "data": {
|
|
||||||
* "id": 1,
|
|
||||||
* "srlNo": "1234567890",
|
|
||||||
* "storeId": "1234567890",
|
|
||||||
* "detailInfo": {
|
|
||||||
* "id": 1,
|
|
||||||
* "memo": "1234567890",
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export async function PATCH(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
export async function PATCH(request: NextRequest, { params }: { params: Promise<{ id: string }> }) {
|
||||||
try {
|
try {
|
||||||
const { id } = await params
|
const { id } = await params
|
||||||
@ -360,6 +205,6 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise<
|
|||||||
return NextResponse.json({ message: 'Survey confirmed successfully', data: survey })
|
return NextResponse.json({ message: 'Survey confirmed successfully', data: survey })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating survey:', error)
|
console.error('Error updating survey:', error)
|
||||||
return NextResponse.json({ error: 'データ保存に失敗しました。' }, { status: 500 })
|
return NextResponse.json({ error: 'Failed to update survey' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,17 +2,17 @@ import { NextResponse } from 'next/server'
|
|||||||
import { prisma } from '@/libs/prisma'
|
import { prisma } from '@/libs/prisma'
|
||||||
import { convertToSnakeCase } from '@/utils/common-utils'
|
import { convertToSnakeCase } from '@/utils/common-utils'
|
||||||
/**
|
/**
|
||||||
* @description 검색 파라미터 타입
|
* 검색 파라미터
|
||||||
*/
|
*/
|
||||||
type SearchParams = {
|
type SearchParams = {
|
||||||
keyword?: string | null
|
keyword?: string | null // 검색어
|
||||||
searchOption?: string | null
|
searchOption?: string | null // 검색 옵션 (select 옵션)
|
||||||
isMySurvey?: string | null
|
isMySurvey?: string | null // 내가 작성한 매물
|
||||||
sort?: string | null
|
sort?: string | null // 정렬 방식
|
||||||
offset?: string | null
|
offset?: string | null
|
||||||
role?: string | null
|
role?: string | null // 회원권한한
|
||||||
storeId?: string | null
|
storeId?: string | null // 판매점ID
|
||||||
builderId?: string | null
|
builderId?: string | null // 시공ID
|
||||||
}
|
}
|
||||||
|
|
||||||
type WhereCondition = {
|
type WhereCondition = {
|
||||||
@ -21,35 +21,35 @@ type WhereCondition = {
|
|||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 검색 가능한 필드 옵션 */
|
// 검색 가능한 필드 옵션
|
||||||
const SEARCH_OPTIONS = [
|
const SEARCH_OPTIONS = [
|
||||||
'BUILDING_NAME',
|
'BUILDING_NAME', // 건물명
|
||||||
'REPRESENTATIVE',
|
'REPRESENTATIVE', // 담당자
|
||||||
'STORE',
|
'STORE', // 판매점명
|
||||||
'STORE_ID',
|
'STORE_ID', // 판매점ID
|
||||||
'CONSTRUCTION_POINT',
|
'CONSTRUCTION_POINT', // 시공점명
|
||||||
'CONSTRUCTION_POINT_ID',
|
'CONSTRUCTION_POINT_ID', // 시공점ID
|
||||||
'CUSTOMER_NAME',
|
'CUSTOMER_NAME', // 고객명
|
||||||
'POST_CODE',
|
'POST_CODE', // 우편번호
|
||||||
'ADDRESS',
|
'ADDRESS', // 주소
|
||||||
'ADDRESS_DETAIL',
|
'ADDRESS_DETAIL', // 상세주소
|
||||||
'SRL_NO',
|
'SRL_NO', // 등록번호
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
/** 페이지당 기본 항목 수 */
|
// 페이지당 항목 수
|
||||||
const ITEMS_PER_PAGE = 10
|
const ITEMS_PER_PAGE = 10
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 키워드 검색 조건 생성 함수
|
* 키워드 검색 조건 생성 함수
|
||||||
* @param {string} keyword 검색 키워드
|
* @param keyword 검색 키워드
|
||||||
* @param {string} searchOption 검색 옵션
|
* @param searchOption 검색 옵션
|
||||||
* @returns {WhereCondition} 검색 조건 객체
|
* @returns 검색 조건 객체
|
||||||
*/
|
*/
|
||||||
const createKeywordSearchCondition = (keyword: string, searchOption: string): WhereCondition => {
|
const createKeywordSearchCondition = (keyword: string, searchOption: string): WhereCondition => {
|
||||||
const where: WhereCondition = { AND: [] }
|
const where: WhereCondition = { AND: [] }
|
||||||
|
|
||||||
if (searchOption === 'all') {
|
if (searchOption === 'all') {
|
||||||
/** 모든 필드 검색 시 OR 조건 사용 */
|
// 모든 필드 검색 시 OR 조건 사용
|
||||||
where.OR = []
|
where.OR = []
|
||||||
|
|
||||||
where.OR.push(
|
where.OR.push(
|
||||||
@ -58,38 +58,42 @@ const createKeywordSearchCondition = (keyword: string, searchOption: string): Wh
|
|||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
} else if (SEARCH_OPTIONS.includes(searchOption.toUpperCase() as any)) {
|
} else if (SEARCH_OPTIONS.includes(searchOption.toUpperCase() as any)) {
|
||||||
/** 특정 필드 검색 */
|
// 특정 필드 검색
|
||||||
where[searchOption.toUpperCase()] = { contains: keyword }
|
where[searchOption.toUpperCase()] = { contains: keyword }
|
||||||
}
|
}
|
||||||
return where
|
return where
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 회원 역할별 검색 조건 생성 함수
|
* 회원 역할별 검색 조건 생성 함수
|
||||||
* @param {SearchParams} params 검색 파라미터
|
* @param params 검색 파라미터
|
||||||
* @returns {WhereCondition} 검색 조건 객체
|
* @returns 검색 조건 객체
|
||||||
*/
|
*/
|
||||||
const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
|
const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
|
||||||
const where: WhereCondition = { AND: [] }
|
const where: WhereCondition = { AND: [] }
|
||||||
|
|
||||||
switch (params.role) {
|
switch (params.role) {
|
||||||
case 'Admin':
|
case 'Admin': // 1차점
|
||||||
where.OR = [
|
where.OR = [
|
||||||
{
|
{
|
||||||
|
// 같은 판매점에서 작성한 제출/제출되지 않은 매물
|
||||||
AND: [{ STORE_ID: { equals: params.storeId } }],
|
AND: [{ STORE_ID: { equals: params.storeId } }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
// MUSUBI (시공권한 X) 가 ORDER 에 제출한 매물
|
||||||
AND: [{ SUBMISSION_TARGET_ID: { equals: params.storeId } }, { SUBMISSION_STATUS: { equals: true } }],
|
AND: [{ SUBMISSION_TARGET_ID: { equals: params.storeId } }, { SUBMISSION_STATUS: { equals: true } }],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'Admin_Sub':
|
case 'Admin_Sub': // 2차점
|
||||||
where.OR = [
|
where.OR = [
|
||||||
{
|
{
|
||||||
|
// MUSUBI (시공권한 X) 같은 판매점에서 작성한 제출/제출되지 않은 매물
|
||||||
AND: [{ STORE_ID: { equals: params.storeId } }, { CONSTRUCTION_POINT_ID: { equals: params.builderId } }],
|
AND: [{ STORE_ID: { equals: params.storeId } }, { CONSTRUCTION_POINT_ID: { equals: params.builderId } }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
// MUSUBI (시공권한 O) 가 MUSUBI 에 제출한 매물 + PARTNER 가 제출한 매물
|
||||||
AND: [
|
AND: [
|
||||||
{ SUBMISSION_TARGET_ID: { equals: params.storeId } },
|
{ SUBMISSION_TARGET_ID: { equals: params.storeId } },
|
||||||
{ CONSTRUCTION_POINT_ID: { not: null } },
|
{ CONSTRUCTION_POINT_ID: { not: null } },
|
||||||
@ -100,8 +104,9 @@ const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
|
|||||||
]
|
]
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'Builder':
|
case 'Builder': // MUSUBI (시공권한 O)
|
||||||
case 'Partner':
|
case 'Partner': // PARTNER
|
||||||
|
// 시공ID 같은 매물
|
||||||
where.AND?.push({
|
where.AND?.push({
|
||||||
CONSTRUCTION_POINT_ID: { equals: params.builderId },
|
CONSTRUCTION_POINT_ID: { equals: params.builderId },
|
||||||
})
|
})
|
||||||
@ -124,77 +129,19 @@ const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
|
|||||||
]
|
]
|
||||||
break
|
break
|
||||||
case 'User':
|
case 'User':
|
||||||
|
// 모든 매물 조회 가능 (추가 조건 없음)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return where
|
return where
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @description 권한 별 필수 값 존재 여부 확인, 없을 시 빈 데이터 반환
|
|
||||||
* @param {SearchParams} params 검색 파라미터
|
|
||||||
* @returns {NextResponse} 세션 체크 결과
|
|
||||||
*/
|
|
||||||
const checkSession = (params: SearchParams) => {
|
|
||||||
if (params.role === null) {
|
|
||||||
return NextResponse.json({ data: [], count: 0 })
|
|
||||||
}
|
|
||||||
if (params.role === 'Builder' || params.role === 'Partner') {
|
|
||||||
if (params.builderId === null) {
|
|
||||||
return NextResponse.json({ data: [], count: 0 })
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (params.storeId === null) {
|
|
||||||
return NextResponse.json({ data: [], count: 0 })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {GET} /api/survey-sales 설문 목록 조회 API
|
* GET 핸들러 - 설문 목록 조회
|
||||||
* @apiName GET /api/survey-sales
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 설문 목록 조회 API
|
|
||||||
*
|
|
||||||
* @apiParam {String} keyword 검색어 (optional)
|
|
||||||
* @apiParam {String} searchOption 검색 옵션 (optional)
|
|
||||||
* @apiParam {String} isMySurvey 내가 작성한 매물 (optional)
|
|
||||||
* @apiParam {String} sort 정렬 방식 (optional)
|
|
||||||
* @apiParam {String} offset 페이지 오프셋 (optional)
|
|
||||||
* @apiParam {String} role 회원권한 (optional)
|
|
||||||
* @apiParam {String} storeId 판매점ID (optional)
|
|
||||||
* @apiParam {String} builderId 시공점ID (optional)
|
|
||||||
*
|
|
||||||
* @apiSuccess {Object[]} data 설문 목록 데이터
|
|
||||||
* @apiSuccess {Number} data.count 설문 목록 개수
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X GET \
|
|
||||||
* -G "keyword=test&searchOption=all&isMySurvey=true&sort=created&offset=0&role=Admin&storeId=1234567890&builderId=1234567890" \
|
|
||||||
* http://localhost:3000/api/survey-sales
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "data": [
|
|
||||||
* {
|
|
||||||
* "id": 1,
|
|
||||||
* "srlNo": "1234567890",
|
|
||||||
* "storeId": "1234567890",
|
|
||||||
* "detailInfo": {
|
|
||||||
* "id": 1,
|
|
||||||
* "memo": "1234567890",
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ],
|
|
||||||
* "count": 1
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
/** URL 파라미터 파싱 */
|
// URL 파라미터 파싱
|
||||||
const { searchParams } = new URL(request.url)
|
const { searchParams } = new URL(request.url)
|
||||||
const params: SearchParams = {
|
const params: SearchParams = {
|
||||||
keyword: searchParams.get('keyword'),
|
keyword: searchParams.get('keyword'),
|
||||||
@ -207,31 +154,25 @@ export async function GET(request: Request) {
|
|||||||
builderId: searchParams.get('builderId'),
|
builderId: searchParams.get('builderId'),
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 세션 체크 결과 처리 */
|
// 검색 조건 구성
|
||||||
const sessionCheckResult = checkSession(params)
|
|
||||||
if (sessionCheckResult) {
|
|
||||||
return sessionCheckResult
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 검색 조건 구성 */
|
|
||||||
const where: WhereCondition = { AND: [] }
|
const where: WhereCondition = { AND: [] }
|
||||||
|
|
||||||
/** 내가 작성한 매물 조건 적용 */
|
// 내가 작성한 매물 조건 적용
|
||||||
if (params.isMySurvey) {
|
if (params.isMySurvey) {
|
||||||
where.AND.push({ REPRESENTATIVE_ID: params.isMySurvey })
|
where.AND.push({ REPRESENTATIVE_ID: params.isMySurvey })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 키워드 검색 조건 적용 */
|
// 키워드 검색 조건 적용
|
||||||
if (params.keyword && params.searchOption) {
|
if (params.keyword && params.searchOption) {
|
||||||
where.AND.push(createKeywordSearchCondition(params.keyword, params.searchOption))
|
where.AND.push(createKeywordSearchCondition(params.keyword, params.searchOption))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 회원 유형 조건 적용 */
|
// 회원 유형 조건 적용
|
||||||
const roleCondition = createMemberRoleCondition(params)
|
const roleCondition = createMemberRoleCondition(params)
|
||||||
if (Object.keys(roleCondition).length > 0) {
|
if (Object.keys(roleCondition).length > 0) {
|
||||||
where.AND.push(roleCondition)
|
where.AND.push(roleCondition)
|
||||||
}
|
}
|
||||||
/** 페이지네이션 데이터 조회 */
|
// 페이지네이션 데이터 조회
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const surveys = await prisma.SD_SURVEY_SALES_BASIC_INFO.findMany({
|
const surveys = await prisma.SD_SURVEY_SALES_BASIC_INFO.findMany({
|
||||||
where,
|
where,
|
||||||
@ -239,52 +180,30 @@ export async function GET(request: Request) {
|
|||||||
skip: Number(params.offset),
|
skip: Number(params.offset),
|
||||||
take: ITEMS_PER_PAGE,
|
take: ITEMS_PER_PAGE,
|
||||||
})
|
})
|
||||||
/** 전체 개수만 조회 */
|
// 전체 개수만 조회
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const count = await prisma.SD_SURVEY_SALES_BASIC_INFO.count({ where })
|
const count = await prisma.SD_SURVEY_SALES_BASIC_INFO.count({ where })
|
||||||
return NextResponse.json({ data: { data: surveys, count: count } })
|
return NextResponse.json({ data: { data: surveys, count: count } })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
return NextResponse.json({ error: 'データ照会に失敗しました。' }, { status: 500 })
|
return NextResponse.json({ error: 'Fail Read Survey' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {PUT} /api/survey-sales 설문 상세 정보 추가 API
|
* PUT 핸들러 - 상세 정보 추가
|
||||||
* @apiName PUT /api/survey-sales
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 설문 상세 정보 추가 API
|
|
||||||
*
|
|
||||||
* @apiParam {Number} id 설문 목록 ID (required)
|
|
||||||
* @apiBody {Object} detail_info 상세 정보 (required)
|
|
||||||
*
|
|
||||||
* @apiSuccess {String} message 성공 메시지
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X PUT \
|
|
||||||
* -H "Content-Type: application/json" \
|
|
||||||
* -d '{"id": 1, "detail_info": {"memo": "1234567890"}}' \
|
|
||||||
* http://localhost:3000/api/survey-sales
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "message": "Success Update Survey"
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @apiError {Number} 500 서버 오류
|
|
||||||
*/
|
*/
|
||||||
export async function PUT(request: Request) {
|
export async function PUT(request: Request) {
|
||||||
try {
|
try {
|
||||||
/** 요청 바디 파싱 */
|
|
||||||
const body = await request.json()
|
const body = await request.json()
|
||||||
|
|
||||||
/** 상세 정보 생성을 위한 데이터 구성 */
|
// 상세 정보 생성을 위한 데이터 구성
|
||||||
const detailInfo = {
|
const detailInfo = {
|
||||||
...body.detail_info,
|
...body.detail_info,
|
||||||
BASIC_INFO_ID: body.id,
|
BASIC_INFO_ID: body.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 상세 정보 생성 */
|
// 상세 정보 생성
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
await prisma.SD_SURVEY_SALES_DETAIL_INFO.create({
|
await prisma.SD_SURVEY_SALES_DETAIL_INFO.create({
|
||||||
data: detailInfo,
|
data: detailInfo,
|
||||||
@ -299,42 +218,6 @@ export async function PUT(request: Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @api {POST} /api/survey-sales 설문 상세 정보 추가 API
|
|
||||||
* @apiName POST /api/survey-sales
|
|
||||||
* @apiGroup SurveySales
|
|
||||||
* @apiDescription 설문 상세 정보 추가 API
|
|
||||||
*
|
|
||||||
* @apiParam {Object} survey 설문 목록 데이터 (required)
|
|
||||||
* @apiParam {String} role 회원권한 (required)
|
|
||||||
* @apiParam {String} storeId 판매점ID (required)
|
|
||||||
* @returns
|
|
||||||
*
|
|
||||||
* @apiSuccess {Object} data 설문 목록 데이터
|
|
||||||
*
|
|
||||||
* @apiExample {curl} Example usage:
|
|
||||||
* curl -X POST \
|
|
||||||
* -H "Content-Type: application/json" \
|
|
||||||
* -d '{"survey": {"srlNo": "1234567890", "storeId": "1234567890", "role": "T01", "detail_info": {"memo": "1234567890"}}}' \
|
|
||||||
* http://localhost:3000/api/survey-sales
|
|
||||||
*
|
|
||||||
* @apiSuccessExample {json} Success-Response:
|
|
||||||
* {
|
|
||||||
* "data": {
|
|
||||||
* "id": 1,
|
|
||||||
* "srlNo": "1234567890",
|
|
||||||
* "storeId": "1234567890",
|
|
||||||
* "detailInfo": {
|
|
||||||
* "id": 1,
|
|
||||||
* "memo": "1234567890",
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @apiError {Number} 500 서버 오류
|
|
||||||
*/
|
|
||||||
export async function POST(request: Request) {
|
export async function POST(request: Request) {
|
||||||
try {
|
try {
|
||||||
const body = await request.json()
|
const body = await request.json()
|
||||||
@ -348,8 +231,8 @@ export async function POST(request: Request) {
|
|||||||
? ''
|
? ''
|
||||||
: null
|
: null
|
||||||
|
|
||||||
/** 임시 저장 시 임시저장으로 저장 */
|
// 임시 저장 시 임시저장으로 저장
|
||||||
/** 기본 저장 시 (HO/HM) + 판매점ID + yyMMdd + 000 으로 저장 */
|
// 기본 저장 시 (HO/HM) + 판매점ID + yyMMdd + 000 으로 저장
|
||||||
const baseSrlNo =
|
const baseSrlNo =
|
||||||
body.survey.srlNo ??
|
body.survey.srlNo ??
|
||||||
role +
|
role +
|
||||||
@ -370,10 +253,10 @@ export async function POST(request: Request) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 마지막 번호 추출 */
|
// 마지막 번호 추출
|
||||||
const lastNumber = lastSurvey ? parseInt(lastSurvey.SRL_NO.slice(-3)) : 0
|
const lastNumber = lastSurvey ? parseInt(lastSurvey.SRL_NO.slice(-3)) : 0
|
||||||
|
|
||||||
/** 새로운 srlNo 생성 - 임시저장일 경우 '임시저장' 으로 저장 */
|
// 새로운 srlNo 생성 - 임시저장일 경우 '임시저장' 으로 저장
|
||||||
const newSrlNo = baseSrlNo.startsWith('一時保存') ? baseSrlNo : baseSrlNo + (lastNumber + 1).toString().padStart(3, '0')
|
const newSrlNo = baseSrlNo.startsWith('一時保存') ? baseSrlNo : baseSrlNo + (lastNumber + 1).toString().padStart(3, '0')
|
||||||
|
|
||||||
const { detailInfo, ...basicInfo } = body.survey
|
const { detailInfo, ...basicInfo } = body.survey
|
||||||
@ -390,6 +273,6 @@ export async function POST(request: Request) {
|
|||||||
return NextResponse.json(result)
|
return NextResponse.json(result)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
return NextResponse.json({ error: 'データ保存に失敗しました。' }, { status: 500 })
|
return NextResponse.json({ error: 'Fail Create Survey' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
src/app/survey-sale/@navTab/default.tsx
Normal file
5
src/app/survey-sale/@navTab/default.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import NavTab from '@/components/survey-sale/common/NavTab'
|
||||||
|
|
||||||
|
export default function page() {
|
||||||
|
return <NavTab />
|
||||||
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import DetailForm from '@/components/survey-sale/detail/DetailForm'
|
import DataTable from '@/components/survey-sale/detail/DataTable'
|
||||||
|
|
||||||
export default function page() {
|
export default function page() {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DetailForm />
|
<DataTable />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,10 @@ import type { ReactNode } from 'react'
|
|||||||
|
|
||||||
interface SurveySaleLayoutProps {
|
interface SurveySaleLayoutProps {
|
||||||
children: ReactNode
|
children: ReactNode
|
||||||
|
navTab: ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function layout({ children }: SurveySaleLayoutProps) {
|
export default function layout({ children, navTab }: SurveySaleLayoutProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
|
|||||||
@ -50,7 +50,6 @@ export default function RegistForm() {
|
|||||||
|
|
||||||
const [attachedFiles, setAttachedFiles] = useState<File[]>([])
|
const [attachedFiles, setAttachedFiles] = useState<File[]>([])
|
||||||
|
|
||||||
/** 파일 첨부 처리 */
|
|
||||||
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const files = e.target.files
|
const files = e.target.files
|
||||||
if (files && files.length > 0) {
|
if (files && files.length > 0) {
|
||||||
@ -59,18 +58,15 @@ export default function RegistForm() {
|
|||||||
e.target.value = ''
|
e.target.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 파일 삭제 처리 */
|
|
||||||
const handleRemoveFile = (index: number) => {
|
const handleRemoveFile = (index: number) => {
|
||||||
setAttachedFiles(attachedFiles.filter((_, i) => i !== index))
|
setAttachedFiles(attachedFiles.filter((_, i) => i !== index))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 필수 필드 포커스 처리 */
|
|
||||||
const focusOnRequiredField = (fieldId: string) => {
|
const focusOnRequiredField = (fieldId: string) => {
|
||||||
const element = document.getElementById(fieldId)
|
const element = document.getElementById(fieldId)
|
||||||
if (element) element.focus()
|
if (element) element.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 제출 처리 */
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const emptyField = requiredFieldNames.find((field) => inquiryRequest[field.id as keyof InquiryRequest] === '')
|
const emptyField = requiredFieldNames.find((field) => inquiryRequest[field.id as keyof InquiryRequest] === '')
|
||||||
if (emptyField) {
|
if (emptyField) {
|
||||||
|
|||||||
@ -57,7 +57,6 @@ export default function ListTable() {
|
|||||||
}
|
}
|
||||||
}, [session, inquiryList])
|
}, [session, inquiryList])
|
||||||
|
|
||||||
/** 내 문의 필터 처리 - 체크 시 자신의 문의 목록만 조회 */
|
|
||||||
const handleMyInquiry = () => {
|
const handleMyInquiry = () => {
|
||||||
setOffset(1)
|
setOffset(1)
|
||||||
setInquiryListRequest({
|
setInquiryListRequest({
|
||||||
@ -66,7 +65,6 @@ export default function ListTable() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 답변 여부 필터 처리리 */
|
|
||||||
const handleFilter = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleFilter = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
switch (e.target.value) {
|
switch (e.target.value) {
|
||||||
case 'N':
|
case 'N':
|
||||||
|
|||||||
@ -6,28 +6,20 @@ import { useParams, useRouter } from 'next/navigation'
|
|||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useSurvey } from '@/hooks/useSurvey'
|
||||||
import { radioEtcData, roofMaterial, selectBoxOptions, supplementaryFacilities } from '../survey-sale/detail/RoofForm'
|
import { radioEtcData, roofMaterial, selectBoxOptions, supplementaryFacilities } from '../survey-sale/detail/RoofForm'
|
||||||
import { useSpinnerStore } from '@/store/spinnerStore'
|
import { useSpinnerStore } from '@/store/spinnerStore'
|
||||||
import { useSessionStore } from '@/store/session'
|
|
||||||
|
|
||||||
export default function SurveySaleDownloadPdf() {
|
export default function SurveySaleDownloadPdf() {
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const id = params.id
|
const id = params.id
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id), true)
|
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
||||||
const { setIsShow } = useSpinnerStore()
|
const { setIsShow } = useSpinnerStore()
|
||||||
const { session } = useSessionStore()
|
|
||||||
|
|
||||||
const targetRef = useRef<HTMLDivElement>(null)
|
const targetRef = useRef<HTMLDivElement>(null)
|
||||||
const isGeneratedRef = useRef(false)
|
const isGeneratedRef = useRef(false)
|
||||||
|
|
||||||
/** 페이지 랜더링 이후 PDF 생성 */
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLoadingSurveyDetail || isGeneratedRef.current) return
|
if (isLoadingSurveyDetail || !surveyDetail || isGeneratedRef.current) return
|
||||||
if (surveyDetail === null) {
|
|
||||||
alert('データが見つかりません。')
|
|
||||||
router.replace('/')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
isGeneratedRef.current = true
|
isGeneratedRef.current = true
|
||||||
handleDownPdf()
|
handleDownPdf()
|
||||||
}, [surveyDetail?.id, isLoadingSurveyDetail])
|
}, [surveyDetail?.id, isLoadingSurveyDetail])
|
||||||
@ -56,20 +48,11 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PDF 생성 이후 세션 여부에 따른 라우팅 처리 */
|
generatePDF(targetRef, options).then(() => {
|
||||||
generatePDF(targetRef, options)
|
|
||||||
.then(() => {
|
|
||||||
setIsShow(false)
|
setIsShow(false)
|
||||||
if (session?.isLoggedIn) {
|
|
||||||
router.replace(`/survey-sale/${id}`)
|
router.replace(`/survey-sale/${id}`)
|
||||||
} else {
|
|
||||||
router.replace('/')
|
|
||||||
}
|
|
||||||
alert('PDFの生成が完了しました。 ポップアップウィンドウからダウンロードしてください。')
|
alert('PDFの生成が完了しました。 ポップアップウィンドウからダウンロードしてください。')
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
|
||||||
console.error('error', error)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -77,8 +60,8 @@ export default function SurveySaleDownloadPdf() {
|
|||||||
<div
|
<div
|
||||||
ref={targetRef}
|
ref={targetRef}
|
||||||
style={{
|
style={{
|
||||||
width: '794px',
|
width: '794px', // A4 너비
|
||||||
minHeight: '1123px',
|
minHeight: '1123px', // A4 높이
|
||||||
transform: 'scale(1.0)',
|
transform: 'scale(1.0)',
|
||||||
transformOrigin: 'top left',
|
transformOrigin: 'top left',
|
||||||
padding: '20px',
|
padding: '20px',
|
||||||
|
|||||||
@ -15,7 +15,7 @@ interface SubmitFormData {
|
|||||||
targetNm: string | null
|
targetNm: string | null
|
||||||
sender: string
|
sender: string
|
||||||
receiver: string[] | string
|
receiver: string[] | string
|
||||||
reference: string[] | null
|
reference: string | null
|
||||||
title: string
|
title: string
|
||||||
contents: string | null
|
contents: string | null
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
|
|
||||||
const { setIsShow } = useSpinnerStore()
|
const { setIsShow } = useSpinnerStore()
|
||||||
const { getCommCode } = useCommCode()
|
const { getCommCode } = useCommCode()
|
||||||
const { surveyDetail, getSubmitTarget } = useSurvey(Number(routeId))
|
const { surveyDetail } = useSurvey(Number(routeId))
|
||||||
|
|
||||||
const [submitData, setSubmitData] = useState<SubmitFormData>({
|
const [submitData, setSubmitData] = useState<SubmitFormData>({
|
||||||
saleBase: null,
|
saleBase: null,
|
||||||
@ -54,25 +54,11 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
getCommCode('SALES_OFFICE_CD').then((codes) => {
|
getCommCode('SALES_OFFICE_CD').then((codes) => {
|
||||||
setCommCodeList(codes)
|
setCommCodeList(codes)
|
||||||
})
|
})
|
||||||
} else if (session?.role === 'Builder' || session?.role === 'Admin_Sub') {
|
|
||||||
getSubmitTarget({ storeId: surveyDetail?.storeId ?? '', role: session?.role ?? '' }).then((data) => {
|
|
||||||
if (data) {
|
|
||||||
setSubmitData({
|
|
||||||
...submitData,
|
|
||||||
targetId: data[0].targetStoreId,
|
|
||||||
targetNm: data[0].targetStoreNm,
|
|
||||||
})
|
|
||||||
data.length > 1 &&
|
|
||||||
setSubmitData({
|
|
||||||
...submitData,
|
|
||||||
receiver: data.filter((item) => item.auth === 'S').map((item) => item.repUserEmail),
|
|
||||||
reference: data.filter((item) => item.auth === 'N').map((item) => item.repUserEmail),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
setSubmitData({
|
setSubmitData({
|
||||||
...submitData,
|
...submitData,
|
||||||
|
targetId: session?.role === 'Builder' ? surveyDetail?.storeId ?? null : null,
|
||||||
|
targetNm: session?.role === 'Builder' ? surveyDetail?.store ?? null : null,
|
||||||
sender: session?.email ?? '',
|
sender: session?.email ?? '',
|
||||||
title: '[HANASYS現地調査] 調査物件が提出. (' + surveyDetail?.srlNo + ')',
|
title: '[HANASYS現地調査] 調査物件が提出. (' + surveyDetail?.srlNo + ')',
|
||||||
})
|
})
|
||||||
@ -94,7 +80,6 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
setSubmitData((prev) => ({ ...prev, [field]: value }))
|
setSubmitData((prev) => ({ ...prev, [field]: value }))
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 필수값 검증 */
|
|
||||||
const validateData = (data: SubmitFormData): boolean => {
|
const validateData = (data: SubmitFormData): boolean => {
|
||||||
const requiredFields = FORM_FIELDS.filter((field) => field.required)
|
const requiredFields = FORM_FIELDS.filter((field) => field.required)
|
||||||
|
|
||||||
@ -111,7 +96,7 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 제출 처리 - 데이터 검증 이후 메일 전송 완료되면 데이터 저장 */
|
// TODO: Admin_Sub 계정 매핑된 submit target id 추가!!!! && 메일 테스트트
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
if (validateData(submitData)) {
|
if (validateData(submitData)) {
|
||||||
window.neoConfirm('送信しますか? 送信後は変更・修正することはできません。', () => {
|
window.neoConfirm('送信しますか? 送信後は変更・修正することはできません。', () => {
|
||||||
@ -124,7 +109,7 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
if (!isSubmittingSurvey) {
|
if (!isSubmittingSurvey) {
|
||||||
alert('提出が完了しました。')
|
alert('提出が完了しました。')
|
||||||
submitSurvey({ targetId: submitData.targetId, targetNm: submitData.targetNm })
|
// submitSurvey({ targetId: submitData.targetId, targetNm: submitData.targetNm })
|
||||||
popupController.setSurveySaleSubmitPopup(false)
|
popupController.setSurveySaleSubmitPopup(false)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -133,6 +118,7 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
alert('メール送信に失敗しました。 再度送信してください。')
|
alert('メール送信に失敗しました。 再度送信してください。')
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
submitSurvey({ targetId: submitData.targetId, targetNm: submitData.targetNm })
|
||||||
setIsShow(false)
|
setIsShow(false)
|
||||||
popupController.setSurveySaleSubmitPopup(false)
|
popupController.setSurveySaleSubmitPopup(false)
|
||||||
})
|
})
|
||||||
@ -146,7 +132,6 @@ export default function SurveySaleSubmitPopup() {
|
|||||||
popupController.setSurveySaleSubmitPopup(false)
|
popupController.setSurveySaleSubmitPopup(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 권한 별 폼 필드 렌더링 */
|
|
||||||
const renderFormField = (field: FormField) => {
|
const renderFormField = (field: FormField) => {
|
||||||
const isReadOnly = false
|
const isReadOnly = false
|
||||||
|
|
||||||
|
|||||||
90
src/components/survey-sale/common/NavTab.tsx
Normal file
90
src/components/survey-sale/common/NavTab.tsx
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { useSurveySaleTabState } from '@/store/surveySaleTabState'
|
||||||
|
import { usePathname, useRouter, useSearchParams, useParams } from 'next/navigation'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
|
||||||
|
export default function NavTab() {
|
||||||
|
const router = useRouter()
|
||||||
|
const pathname = usePathname()
|
||||||
|
|
||||||
|
const searchParams = useSearchParams()
|
||||||
|
const id = searchParams.get('id')
|
||||||
|
const isTemp = searchParams.get('isTemp')
|
||||||
|
|
||||||
|
const params = useParams()
|
||||||
|
const detailId = params.id
|
||||||
|
|
||||||
|
const { basicInfoSelected, roofInfoSelected, reset, setBasicInfoSelected, setRoofInfoSelected } = useSurveySaleTabState()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
}, [reset])
|
||||||
|
|
||||||
|
if (pathname === '/survey-sale') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const scrollSection = (section: string) => {
|
||||||
|
const sectionElement = document.getElementById(section)
|
||||||
|
if (sectionElement) {
|
||||||
|
sectionElement.scrollIntoView({ behavior: 'smooth' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleBasicInfoClick = () => {
|
||||||
|
// if (id) {
|
||||||
|
// router.push(`/survey-sale/basic-info?id=${id}`)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
if (detailId) {
|
||||||
|
router.push(`/survey-sale/${detailId}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
scrollSection('basic-form-section')
|
||||||
|
|
||||||
|
setBasicInfoSelected()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleRoofInfoClick = () => {
|
||||||
|
// if (id) {
|
||||||
|
// if (isTemp === 'true') {
|
||||||
|
// alert('基本情報が一時保存された状態です。')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
// router.push(`/survey-sale/roof-info?id=${id}`)
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
if (detailId) {
|
||||||
|
router.push(`/survey-sale/${detailId}?tab=roof-info`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (pathname === '/survey-sale/basic-info') {
|
||||||
|
alert('基本情報を先に保存してください。')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
// if (pathname === '/survey-sale/regist') {
|
||||||
|
scrollSection('roof-form-section')
|
||||||
|
// }
|
||||||
|
setRoofInfoSelected()
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="sale-detail-tab-relative">
|
||||||
|
<div className="sale-detail-tab-wrap">
|
||||||
|
<div className="sale-detail-tab-inner">
|
||||||
|
<button className={`sale-detail-tab ${basicInfoSelected ? 'act' : ''}`} onClick={handleBasicInfoClick}>
|
||||||
|
基本情報
|
||||||
|
</button>
|
||||||
|
<button className={`sale-detail-tab ${roofInfoSelected ? 'act' : ''}`} onClick={handleRoofInfoClick}>
|
||||||
|
電気 / 屋根情報
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
import { useSurveySaleTabState } from '@/store/surveySaleTabState'
|
||||||
import type { SurveyBasicRequest } from '@/types/Survey'
|
import type { SurveyBasicRequest } from '@/types/Survey'
|
||||||
import type { Mode } from 'fs'
|
import type { Mode } from 'fs'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
@ -15,19 +16,25 @@ interface BasicFormProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function BasicForm({ basicInfo, setBasicInfo, mode, session }: BasicFormProps) {
|
export default function BasicForm({ basicInfo, setBasicInfo, mode, session }: BasicFormProps) {
|
||||||
|
const { setBasicInfoSelected } = useSurveySaleTabState()
|
||||||
const [isFlip, setIsFlip] = useState<boolean>(true)
|
const [isFlip, setIsFlip] = useState<boolean>(true)
|
||||||
const { addressData, resetAddressData } = useAddressStore()
|
const { addressData } = useAddressStore()
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setBasicInfoSelected()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
// 주소 데이터가 변경될 때만 업데이트
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!addressData) return
|
if (!addressData) return
|
||||||
|
|
||||||
setBasicInfo({
|
setBasicInfo({
|
||||||
...basicInfo,
|
...basicInfo,
|
||||||
postCode: addressData.post_code.slice(0, 3) + '-' + addressData.post_code.slice(3),
|
postCode: addressData.post_code,
|
||||||
address: addressData.address,
|
address: addressData.address,
|
||||||
addressDetail: addressData.address_detail,
|
addressDetail: addressData.address_detail,
|
||||||
})
|
})
|
||||||
resetAddressData()
|
|
||||||
}, [addressData])
|
}, [addressData])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -52,7 +59,6 @@ export default function BasicForm({ basicInfo, setBasicInfo, mode, session }: Ba
|
|||||||
onChange={(e) => setBasicInfo({ ...basicInfo, representative: e.target.value })}
|
onChange={(e) => setBasicInfo({ ...basicInfo, representative: e.target.value })}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/* 페이지 모드 별, 권한 별 판매점, 시공점 입력 여부 처리 */}
|
|
||||||
{mode === 'READ' || session?.role === 'Builder' ? (
|
{mode === 'READ' || session?.role === 'Builder' ? (
|
||||||
<>
|
<>
|
||||||
{storeInput(basicInfo, setBasicInfo, mode)}
|
{storeInput(basicInfo, setBasicInfo, mode)}
|
||||||
@ -142,7 +148,6 @@ export default function BasicForm({ basicInfo, setBasicInfo, mode, session }: Ba
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 판매점 입력 창 */
|
|
||||||
const storeInput = (basicInfo: SurveyBasicRequest, setBasicInfo: (basicInfo: SurveyBasicRequest) => void, mode: Mode) => {
|
const storeInput = (basicInfo: SurveyBasicRequest, setBasicInfo: (basicInfo: SurveyBasicRequest) => void, mode: Mode) => {
|
||||||
return (
|
return (
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
@ -158,7 +163,6 @@ const storeInput = (basicInfo: SurveyBasicRequest, setBasicInfo: (basicInfo: Sur
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 시공점 입력 창 */
|
|
||||||
const builderInput = (basicInfo: SurveyBasicRequest, setBasicInfo: (basicInfo: SurveyBasicRequest) => void, mode: Mode) => {
|
const builderInput = (basicInfo: SurveyBasicRequest, setBasicInfo: (basicInfo: SurveyBasicRequest) => void, mode: Mode) => {
|
||||||
return (
|
return (
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
import type { Mode, SurveyBasicRequest, SurveyDetailInfo, SurveyDetailRequest } from '@/types/Survey'
|
import type { Mode, SurveyBasicRequest, SurveyDetailInfo, SurveyDetailRequest } from '@/types/Survey'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { useParams, useRouter } from 'next/navigation'
|
import { useParams, useRouter, useSearchParams } from 'next/navigation'
|
||||||
import { requiredFields, useSurvey } from '@/hooks/useSurvey'
|
import { requiredFields, useSurvey } from '@/hooks/useSurvey'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
|
|
||||||
@ -29,9 +29,10 @@ interface SaveData extends SurveyBasicRequest {
|
|||||||
export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
|
const searchParams = useSearchParams()
|
||||||
|
const idParam = searchParams.get('id')
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
const id = Number(params.id)
|
const routeId = params.id
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
|
|
||||||
const [saveData, setSaveData] = useState<SaveData>({
|
const [saveData, setSaveData] = useState<SaveData>({
|
||||||
@ -46,6 +47,7 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const isSubmit = data.basic.submissionStatus
|
const isSubmit = data.basic.submissionStatus
|
||||||
|
const id = Number(routeId) ? Number(routeId) : Number(idParam)
|
||||||
|
|
||||||
const { deleteSurvey, updateSurvey, isDeletingSurvey, isUpdatingSurvey } = useSurvey(id)
|
const { deleteSurvey, updateSurvey, isDeletingSurvey, isUpdatingSurvey } = useSurvey(id)
|
||||||
const { validateSurveyDetail, createSurvey, isCreatingSurvey } = useSurvey()
|
const { validateSurveyDetail, createSurvey, isCreatingSurvey } = useSurvey()
|
||||||
@ -62,16 +64,14 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
})
|
})
|
||||||
}, [session, data])
|
}, [session, data])
|
||||||
|
|
||||||
/** 권한 정리 로직 - 작성자(담당자), 제출 권한자, 제출 수신자*/
|
|
||||||
const calculatePermissions = (session: any, basicData: SurveyBasicRequest): PermissionState => {
|
const calculatePermissions = (session: any, basicData: SurveyBasicRequest): PermissionState => {
|
||||||
const isSubmiter = calculateSubmitPermission(session, basicData)
|
const isSubmiter = calculateSubmitPermission(session, basicData)
|
||||||
const isWriter = session.userId === basicData.representativeId
|
const isWriter = session.userNm === basicData.representative
|
||||||
const isReceiver = session?.storeId === basicData.submissionTargetId
|
const isReceiver = session?.storeId === basicData.submissionTargetId
|
||||||
|
|
||||||
return { isSubmiter, isWriter, isReceiver }
|
return { isSubmiter, isWriter, isReceiver }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 제출 권한 체크 */
|
|
||||||
const calculateSubmitPermission = (session: any, basicData: SurveyBasicRequest): boolean => {
|
const calculateSubmitPermission = (session: any, basicData: SurveyBasicRequest): boolean => {
|
||||||
switch (session?.role) {
|
switch (session?.role) {
|
||||||
case 'T01':
|
case 'T01':
|
||||||
@ -87,7 +87,6 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 저장 로직 */
|
|
||||||
const handleSave = (isTemporary: boolean, isSubmitProcess: boolean) => {
|
const handleSave = (isTemporary: boolean, isSubmitProcess: boolean) => {
|
||||||
const emptyField = validateSurveyDetail(data.roof)
|
const emptyField = validateSurveyDetail(data.roof)
|
||||||
const hasEmptyField = emptyField?.trim() !== ''
|
const hasEmptyField = emptyField?.trim() !== ''
|
||||||
@ -99,34 +98,30 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 임시 저장 로직 */
|
|
||||||
const tempSaveProcess = async () => {
|
const tempSaveProcess = async () => {
|
||||||
/**route 에 id 가 있는 경우 업데이트, 없는 경우 생성 */
|
if (idParam) {
|
||||||
if (!Number.isNaN(id)) {
|
|
||||||
await updateSurvey({ survey: saveData, isTemporary: true })
|
await updateSurvey({ survey: saveData, isTemporary: true })
|
||||||
if (!isUpdatingSurvey) {
|
if (!isUpdatingSurvey) {
|
||||||
setMode('READ')
|
router.push(`/survey-sale/${idParam}`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const updatedData = {
|
const updatedData = {
|
||||||
...saveData,
|
...saveData,
|
||||||
srlNo: '一時保存',
|
srlNo: '一時保存',
|
||||||
}
|
}
|
||||||
const savedId = await createSurvey(updatedData)
|
const id = await createSurvey(updatedData)
|
||||||
if (!isCreatingSurvey) {
|
if (!isCreatingSurvey) {
|
||||||
router.push(`/survey-sale/${savedId}`)
|
router.push(`/survey-sale/${id}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
alert('一時保存されました。')
|
alert('一時保存されました。')
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 입력 필드 포커스 처리 */
|
|
||||||
const focusInput = (field: keyof SurveyDetailInfo) => {
|
const focusInput = (field: keyof SurveyDetailInfo) => {
|
||||||
const input = document.getElementById(field)
|
const input = document.getElementById(field)
|
||||||
input?.focus()
|
input?.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 저장 로직 */
|
|
||||||
const saveProcess = async (emptyField: string | null, isSubmitProcess?: boolean) => {
|
const saveProcess = async (emptyField: string | null, isSubmitProcess?: boolean) => {
|
||||||
if (emptyField?.trim() === '') {
|
if (emptyField?.trim() === '') {
|
||||||
await handleSuccessfulSave(isSubmitProcess)
|
await handleSuccessfulSave(isSubmitProcess)
|
||||||
@ -135,31 +130,28 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 저장 성공 로직 */
|
|
||||||
const handleSuccessfulSave = async (isSubmitProcess?: boolean) => {
|
const handleSuccessfulSave = async (isSubmitProcess?: boolean) => {
|
||||||
/** route 에 id 가 있는 경우 업데이트, 없는 경우 생성 */
|
if (idParam) {
|
||||||
if (!Number.isNaN(id)) {
|
await updateSurvey({ survey: saveData, isTemporary: false, storeId: session.storeId ?? '' })
|
||||||
await updateSurvey({
|
|
||||||
survey: saveData,
|
|
||||||
isTemporary: false,
|
|
||||||
storeId: session?.role === 'Partner' ? session?.builderId ?? null : session?.storeId ?? null,
|
|
||||||
})
|
|
||||||
if (!isUpdatingSurvey) {
|
if (!isUpdatingSurvey) {
|
||||||
setMode('READ')
|
router.push(`/survey-sale/${idParam}`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/** 제출 로직인 경우 search param 추가 */
|
const id = await createSurvey(saveData)
|
||||||
const savedId = await createSurvey(saveData)
|
if (!isCreatingSurvey) {
|
||||||
if (isSubmitProcess) {
|
router.push(`/survey-sale/${id}`)
|
||||||
await router.push(`/survey-sale/${savedId}?show=true`)
|
}
|
||||||
} else {
|
}
|
||||||
await router.push(`/survey-sale/${savedId}`)
|
|
||||||
alert('保存されました。')
|
if (isSubmitProcess) {
|
||||||
}
|
if (!isCreatingSurvey && !isUpdatingSurvey) {
|
||||||
|
await popupController.setSurveySaleSubmitPopup(true)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
alert('保存されました。')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 필수값 미입력 처리 */
|
|
||||||
const handleFailedSave = (emptyField: string | null) => {
|
const handleFailedSave = (emptyField: string | null) => {
|
||||||
if (emptyField?.includes('Unit')) {
|
if (emptyField?.includes('Unit')) {
|
||||||
alert('電気契約容量の単位を入力してください。')
|
alert('電気契約容量の単位を入力してください。')
|
||||||
@ -169,9 +161,8 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
focusInput(emptyField as keyof SurveyDetailInfo)
|
focusInput(emptyField as keyof SurveyDetailInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 삭제 로직 */
|
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
if (!Number.isNaN(id)) {
|
if (routeId) {
|
||||||
window.neoConfirm('削除しますか?', async () => {
|
window.neoConfirm('削除しますか?', async () => {
|
||||||
await deleteSurvey()
|
await deleteSurvey()
|
||||||
if (!isDeletingSurvey) {
|
if (!isDeletingSurvey) {
|
||||||
@ -182,14 +173,13 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 제출 로직 */
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (data.basic.srlNo?.startsWith('一時保存') && Number.isNaN(id)) {
|
if (data.basic.srlNo?.startsWith('一時保存') && Number(routeId)) {
|
||||||
alert('一時保存されたデータは提出できません。')
|
alert('一時保存されたデータは提出できません。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode === 'READ') {
|
if (Number(routeId)) {
|
||||||
window.neoConfirm('提出しますか?', async () => {
|
window.neoConfirm('提出しますか?', async () => {
|
||||||
popupController.setSurveySaleSubmitPopup(true)
|
popupController.setSurveySaleSubmitPopup(true)
|
||||||
})
|
})
|
||||||
@ -200,10 +190,8 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 로그인 여부 체크 */
|
|
||||||
if (!session?.isLoggedIn) return null
|
if (!session?.isLoggedIn) return null
|
||||||
|
|
||||||
/** 읽기 모드, 제출 된 데이터, 제출 권한자는 리스트 버튼만 표시 */
|
|
||||||
if (mode === 'READ' && isSubmit && permissions.isSubmiter) {
|
if (mode === 'READ' && isSubmit && permissions.isSubmiter) {
|
||||||
return (
|
return (
|
||||||
<div className="sale-form-btn-wrap">
|
<div className="sale-form-btn-wrap">
|
||||||
@ -216,25 +204,19 @@ export default function ButtonForm({ mode, setMode, data }: ButtonFormProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{/* 읽기 모드 버튼 처리 */}
|
|
||||||
{/* 작성자 - 수정, 삭제, 제출(미제출인 매물) 버튼 표시 */}
|
|
||||||
{/* 제출권한자 - 수정, 제출(미제출인 매물) 버튼 표시 */}
|
|
||||||
{/* 제출수신자 - 수정, 삭제 버튼 표시 */}
|
|
||||||
{mode === 'READ' && (
|
{mode === 'READ' && (
|
||||||
<div className="sale-form-btn-wrap">
|
<div className="sale-form-btn-wrap">
|
||||||
<div className="btn-flex-wrap">
|
<div className="btn-flex-wrap">
|
||||||
<ListButton />
|
<ListButton />
|
||||||
{(permissions.isWriter || permissions.isSubmiter || (permissions.isReceiver && isSubmit)) && <EditButton setMode={setMode} />}
|
{(permissions.isWriter || permissions.isSubmiter || (permissions.isReceiver && isSubmit)) && (
|
||||||
|
<EditButton setMode={setMode} id={id.toString()} />
|
||||||
|
)}
|
||||||
{(permissions.isWriter || (permissions.isReceiver && isSubmit)) && <DeleteButton handleDelete={handleDelete} />}
|
{(permissions.isWriter || (permissions.isReceiver && isSubmit)) && <DeleteButton handleDelete={handleDelete} />}
|
||||||
{!isSubmit && permissions.isSubmiter && <SubmitButton handleSubmit={handleSubmit} />}
|
{!isSubmit && permissions.isSubmiter && <SubmitButton handleSubmit={handleSubmit} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 수정, 작성 모드 */}
|
|
||||||
{/* 작성자 - 임시저장, 저장, 제출(미제출인 매물) 버튼 표시 */}
|
|
||||||
{/* 제출권한자 - 임시저장, 저장, 제출(미제출인 매물) 버튼 표시 */}
|
|
||||||
{/* 제출수신자 - 임시저장, 저장 버튼 표시 */}
|
|
||||||
{(mode === 'CREATE' || mode === 'EDIT') && (
|
{(mode === 'CREATE' || mode === 'EDIT') && (
|
||||||
<div className="sale-form-btn-wrap">
|
<div className="sale-form-btn-wrap">
|
||||||
<div className="btn-flex-wrap">
|
<div className="btn-flex-wrap">
|
||||||
@ -261,12 +243,14 @@ const ListButton = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const EditButton = ({ setMode }: { setMode: (mode: Mode) => void }) => {
|
const EditButton = ({ setMode, id }: { setMode: (mode: Mode) => void; id: string }) => {
|
||||||
|
const router = useRouter()
|
||||||
return (
|
return (
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button
|
<button
|
||||||
className="btn-frame n-blue icon"
|
className="btn-frame n-blue icon"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
router.push(`/survey-sale/regist?id=${id}`)
|
||||||
setMode('EDIT')
|
setMode('EDIT')
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,12 +1,31 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useRouter } from 'next/navigation'
|
import { useSurvey } from '@/hooks/useSurvey'
|
||||||
import { SurveyBasicInfo } from '@/types/Survey'
|
import { useParams, useRouter } from 'next/navigation'
|
||||||
|
import { useEffect } from 'react'
|
||||||
|
import DetailForm from './DetailForm'
|
||||||
|
import { useSessionStore } from '@/store/session'
|
||||||
|
|
||||||
export default function DataTable({ surveyDetail }: { surveyDetail: SurveyBasicInfo }) {
|
export default function DataTable() {
|
||||||
|
const params = useParams()
|
||||||
|
const id = params.id
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
/** 제출 상태 처리 */
|
const { session } = useSessionStore()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (Number.isNaN(Number(id))) {
|
||||||
|
alert('間違ったアプローチです。')
|
||||||
|
window.location.href = '/survey-sale'
|
||||||
|
}
|
||||||
|
}, [id])
|
||||||
|
|
||||||
|
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
||||||
|
|
||||||
|
if (isLoadingSurveyDetail) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
const submitStatus = () => {
|
const submitStatus = () => {
|
||||||
const { submissionTargetNm, submissionTargetId } = surveyDetail ?? {}
|
const { submissionTargetNm, submissionTargetId } = surveyDetail ?? {}
|
||||||
|
|
||||||
@ -68,7 +87,7 @@ export default function DataTable({ surveyDetail }: { surveyDetail: SurveyBasicI
|
|||||||
<tr>
|
<tr>
|
||||||
<th>ダウンロード</th>
|
<th>ダウンロード</th>
|
||||||
<td>
|
<td>
|
||||||
<button className="data-down" onClick={() => router.push(`/pdf/survey-sale/${surveyDetail.id}`)}>
|
<button className="data-down" onClick={() => router.push(`/pdf/survey-sale/${id}`)}>
|
||||||
HWJ現地調査票確認<i className="down-icon"></i>
|
HWJ現地調査票確認<i className="down-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@ -76,6 +95,7 @@ export default function DataTable({ surveyDetail }: { surveyDetail: SurveyBasicI
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<DetailForm />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,9 @@ import { useEffect, useState } from 'react'
|
|||||||
import ButtonForm from './ButtonForm'
|
import ButtonForm from './ButtonForm'
|
||||||
import BasicForm from './BasicForm'
|
import BasicForm from './BasicForm'
|
||||||
import RoofForm from './RoofForm'
|
import RoofForm from './RoofForm'
|
||||||
import { useParams, useRouter, useSearchParams, usePathname } from 'next/navigation'
|
import { useParams, useSearchParams } from 'next/navigation'
|
||||||
import { useSurvey } from '@/hooks/useSurvey'
|
import { useSurvey } from '@/hooks/useSurvey'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import DataTable from './DataTable'
|
|
||||||
import { usePopupController } from '@/store/popupController'
|
|
||||||
|
|
||||||
const roofInfoForm: SurveyDetailRequest = {
|
const roofInfoForm: SurveyDetailRequest = {
|
||||||
contractCapacity: null,
|
contractCapacity: null,
|
||||||
@ -70,19 +68,16 @@ const basicInfoForm: SurveyBasicRequest = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function DetailForm() {
|
export default function DetailForm() {
|
||||||
const id = useParams().id
|
const idParam = useSearchParams().get('id')
|
||||||
|
const routeId = useParams().id
|
||||||
|
|
||||||
const modeset = !Number.isNaN(Number(id)) ? 'READ' : 'CREATE'
|
const modeset = Number(routeId) ? 'READ' : idParam ? 'EDIT' : 'CREATE'
|
||||||
|
const id = Number(routeId) ? Number(routeId) : Number(idParam)
|
||||||
|
|
||||||
const { surveyDetail, isLoadingSurveyDetail } = useSurvey(Number(id))
|
const { surveyDetail, isLoadingSurveyDetail, validateSurveyDetail } = useSurvey(Number(id))
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
const searchParams = useSearchParams()
|
|
||||||
const popupController = usePopupController()
|
|
||||||
const router = useRouter()
|
|
||||||
const pathname = usePathname()
|
|
||||||
|
|
||||||
const [mode, setMode] = useState<Mode>(modeset)
|
const [mode, setMode] = useState<Mode>(modeset)
|
||||||
|
|
||||||
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(() => ({
|
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(() => ({
|
||||||
...basicInfoForm,
|
...basicInfoForm,
|
||||||
representative: session?.userNm ?? '',
|
representative: session?.userNm ?? '',
|
||||||
@ -94,16 +89,7 @@ export default function DetailForm() {
|
|||||||
}))
|
}))
|
||||||
const [roofInfoData, setRoofInfoData] = useState<SurveyDetailRequest>(roofInfoForm)
|
const [roofInfoData, setRoofInfoData] = useState<SurveyDetailRequest>(roofInfoForm)
|
||||||
|
|
||||||
/** 제출 팝업 처리 - createSurvey 이후 popup 처리 시 노드 삽입 오류로 인해 별도 처리 */
|
// 세션 데이터가 변경될 때 기본 정보 업데이트
|
||||||
useEffect(() => {
|
|
||||||
const show = searchParams.get('show')
|
|
||||||
if (show === 'true') {
|
|
||||||
popupController.setSurveySaleSubmitPopup(true)
|
|
||||||
router.replace(pathname)
|
|
||||||
}
|
|
||||||
}, [searchParams, pathname])
|
|
||||||
|
|
||||||
/** 세션 데이터가 변경될 때 기본 정보 업데이트 */
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!session?.isLoggedIn) return
|
if (!session?.isLoggedIn) return
|
||||||
setBasicInfoData((prev) => ({
|
setBasicInfoData((prev) => ({
|
||||||
@ -117,9 +103,10 @@ export default function DetailForm() {
|
|||||||
}))
|
}))
|
||||||
}, [session?.isLoggedIn])
|
}, [session?.isLoggedIn])
|
||||||
|
|
||||||
/** 조사매물 상세 데이터 업데이트 */
|
// 설문 데이터 로딩 및 업데이트
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!isLoadingSurveyDetail && surveyDetail && (mode === 'EDIT' || mode === 'READ')) {
|
if (isLoadingSurveyDetail || !session?.isLoggedIn) return
|
||||||
|
if (surveyDetail && (mode === 'EDIT' || mode === 'READ')) {
|
||||||
const { id, uptDt, regDt, detailInfo, ...rest } = surveyDetail
|
const { id, uptDt, regDt, detailInfo, ...rest } = surveyDetail
|
||||||
setBasicInfoData((prev) => ({
|
setBasicInfoData((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
@ -129,9 +116,12 @@ export default function DetailForm() {
|
|||||||
if (detailInfo) {
|
if (detailInfo) {
|
||||||
const { id, uptDt, regDt, basicInfoId, ...rest } = detailInfo
|
const { id, uptDt, regDt, basicInfoId, ...rest } = detailInfo
|
||||||
setRoofInfoData(rest)
|
setRoofInfoData(rest)
|
||||||
|
if (validateSurveyDetail(rest).trim() !== '') {
|
||||||
|
// validation logic here if needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [mode, isLoadingSurveyDetail, surveyDetail])
|
}
|
||||||
|
}, [mode, session?.isLoggedIn, isLoadingSurveyDetail])
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
basic: basicInfoData,
|
basic: basicInfoData,
|
||||||
@ -142,7 +132,6 @@ export default function DetailForm() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{mode === 'READ' && surveyDetail && <DataTable surveyDetail={surveyDetail} />}
|
|
||||||
<div className="sale-detail-toggle-wrap">
|
<div className="sale-detail-toggle-wrap">
|
||||||
<BasicForm basicInfo={basicInfoData} setBasicInfo={setBasicInfoData} mode={mode} session={session} />
|
<BasicForm basicInfo={basicInfoData} setBasicInfo={setBasicInfoData} mode={mode} session={session} />
|
||||||
<RoofForm roofInfo={roofInfoData} setRoofInfo={setRoofInfoData} mode={mode} />
|
<RoofForm roofInfo={roofInfoData} setRoofInfo={setRoofInfoData} mode={mode} />
|
||||||
|
|||||||
@ -19,145 +19,116 @@ type SelectBoxKeys =
|
|||||||
| 'installationAvailability'
|
| 'installationAvailability'
|
||||||
|
|
||||||
export const supplementaryFacilities = [
|
export const supplementaryFacilities = [
|
||||||
/** 에코큐트 */
|
{ id: 1, name: 'エコキュート' }, //에코큐트
|
||||||
{ id: 1, name: 'エコキュート' },
|
{ id: 2, name: 'エネパーム' }, //에네팜
|
||||||
/** 에네팜 */
|
{ id: 3, name: '蓄電池システム' }, //축전지시스템
|
||||||
{ id: 2, name: 'エネパーム' },
|
{ id: 4, name: '太陽光発電' }, //태양광발전
|
||||||
/** 축전지시스템 */
|
|
||||||
{ id: 3, name: '蓄電池システム' },
|
|
||||||
/** 태양광발전 */
|
|
||||||
{ id: 4, name: '太陽光発電' },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export const roofMaterial = [
|
export const roofMaterial = [
|
||||||
/** 슬레이트 */
|
{ id: 1, name: 'スレート' }, //슬레이트
|
||||||
{ id: 1, name: 'スレート' },
|
{ id: 2, name: 'アスファルトシングル' }, //아스팔트 싱글
|
||||||
/** 아스팔트 싱글 */
|
{ id: 3, name: '瓦' }, //기와
|
||||||
{ id: 2, name: 'アスファルトシングル' },
|
{ id: 4, name: '金属屋根' }, //금속지붕
|
||||||
/** 기와 */
|
|
||||||
{ id: 3, name: '瓦' },
|
|
||||||
/** 금속지붕 */
|
|
||||||
{ id: 4, name: '金属屋根' },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export const selectBoxOptions: Record<SelectBoxKeys, { id: number; name: string }[]> = {
|
export const selectBoxOptions: Record<SelectBoxKeys, { id: number; name: string }[]> = {
|
||||||
installationSystem: [
|
installationSystem: [
|
||||||
{
|
{
|
||||||
/** 태양광발전 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '太陽光発電',
|
name: '太陽光発電', //태양광발전
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 하이브리드축전지시스템 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'ハイブリッド蓄電システム',
|
name: 'ハイブリッド蓄電システム', //하이브리드축전지시스템
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 축전지시스템 */
|
|
||||||
id: 3,
|
id: 3,
|
||||||
name: '蓄電池システム',
|
name: '蓄電池システム', //축전지시스템
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
constructionYear: [
|
constructionYear: [
|
||||||
{
|
{
|
||||||
/** 신축 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '新築',
|
name: '新築', //신축
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 기축 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: '既築',
|
name: '既築', //기존
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
roofShape: [
|
roofShape: [
|
||||||
{
|
{
|
||||||
/** 박공지붕 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '切妻',
|
name: '切妻', //박공지붕
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 기동 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: '寄棟',
|
name: '寄棟', //기동
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 한쪽흐름 */
|
|
||||||
id: 3,
|
id: 3,
|
||||||
name: '片流れ',
|
name: '片流れ', //한쪽흐름
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
rafterSize: [
|
rafterSize: [
|
||||||
{
|
{
|
||||||
/** 35mm 이상×48mm 이상 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '幅35mm以上×高さ48mm以上',
|
name: '幅35mm以上×高さ48mm以上',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 36mm 이상×46mm 이상 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: '幅36mm以上×高さ46mm以上',
|
name: '幅36mm以上×高さ46mm以上',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 37mm 이상×43mm 이상 */
|
|
||||||
id: 3,
|
id: 3,
|
||||||
name: '幅37mm以上×高さ43mm以上',
|
name: '幅37mm以上×高さ43mm以上',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 38mm 이상×40mm 이상 */
|
|
||||||
id: 4,
|
id: 4,
|
||||||
name: '幅38mm以上×高さ40mm以上',
|
name: '幅38mm以上×高さ40mm以上',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
rafterPitch: [
|
rafterPitch: [
|
||||||
{
|
{
|
||||||
/** 455mm 이하 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '455mm以下',
|
name: '455mm以下',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 500mm 이하 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: '500mm以下',
|
name: '500mm以下',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 606mm 이하 */
|
|
||||||
id: 3,
|
id: 3,
|
||||||
name: '606mm以下',
|
name: '606mm以下',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
openFieldPlateKind: [
|
openFieldPlateKind: [
|
||||||
{
|
{
|
||||||
/** 구조용합판 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '構造用合板',
|
name: '構造用合板', //구조용합판
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** OSB */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: 'OSB',
|
name: 'OSB', //OSB
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 파티클보드 */
|
|
||||||
id: 3,
|
id: 3,
|
||||||
name: 'パーティクルボード',
|
name: 'パーティクルボード', //파티클보드
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 소판 */
|
|
||||||
id: 4,
|
id: 4,
|
||||||
name: '小幅板',
|
name: '小幅板', //소판
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
installationAvailability: [
|
installationAvailability: [
|
||||||
{
|
{
|
||||||
/** 확인완료 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
name: '確認済み',
|
name: '確認済み', //확인완료
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 미확인 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
name: '未確認',
|
name: '未確認', //미확인
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@ -165,69 +136,58 @@ export const selectBoxOptions: Record<SelectBoxKeys, { id: number; name: string
|
|||||||
export const radioEtcData: Record<RadioEtcKeys, { id: number; label: string }[]> = {
|
export const radioEtcData: Record<RadioEtcKeys, { id: number; label: string }[]> = {
|
||||||
structureOrder: [
|
structureOrder: [
|
||||||
{
|
{
|
||||||
/** 지붕재 - 방수재 - 지붕의기초 - 서까래 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: '屋根材 > 防水材 > 屋根の基礎 > 垂木',
|
label: '屋根材 > 防水材 > 屋根の基礎 > 垂木', //지붕재 방수재 지붕의기초 서까래
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
houseStructure: [
|
houseStructure: [
|
||||||
{
|
{
|
||||||
/** 목재 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: '木製',
|
label: '木製',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
rafterMaterial: [
|
rafterMaterial: [
|
||||||
{
|
{
|
||||||
/** 목재 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: '木製',
|
label: '木製',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 강재 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
label: '強制',
|
label: '強制',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
waterproofMaterial: [
|
waterproofMaterial: [
|
||||||
{
|
{
|
||||||
/** 아스팔트 지붕 940(22kg 이상) */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: 'アスファルト屋根940(22kg以上)',
|
label: 'アスファルト屋根940(22kg以上)',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
insulationPresence: [
|
insulationPresence: [
|
||||||
{
|
{
|
||||||
/** 없음 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: 'なし',
|
label: 'なし',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 있음 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
label: 'あり',
|
label: 'あり',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
rafterDirection: [
|
rafterDirection: [
|
||||||
{
|
{
|
||||||
/** 수직 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: '垂直垂木',
|
label: '垂直垂木',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 수평 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
label: '水平垂木',
|
label: '水平垂木',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
leakTrace: [
|
leakTrace: [
|
||||||
{
|
{
|
||||||
/** 있음 */
|
|
||||||
id: 1,
|
id: 1,
|
||||||
label: 'あり',
|
label: 'あり',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
/** 없음 */
|
|
||||||
id: 2,
|
id: 2,
|
||||||
label: 'なし',
|
label: 'なし',
|
||||||
},
|
},
|
||||||
@ -250,7 +210,6 @@ export default function RoofForm(props: {
|
|||||||
const [isFlip, setIsFlip] = useState<boolean>(true)
|
const [isFlip, setIsFlip] = useState<boolean>(true)
|
||||||
|
|
||||||
const handleNumberInput = (key: keyof SurveyDetailRequest, value: number | string) => {
|
const handleNumberInput = (key: keyof SurveyDetailRequest, value: number | string) => {
|
||||||
/** 지붕 경사도, 노지판 두께 처리 - 최대 5자리, 소수점 1자리 처리 */
|
|
||||||
if (key === 'roofSlope' || key === 'openFieldPlateThickness') {
|
if (key === 'roofSlope' || key === 'openFieldPlateThickness') {
|
||||||
const stringValue = value.toString()
|
const stringValue = value.toString()
|
||||||
if (stringValue.length > 5) {
|
if (stringValue.length > 5) {
|
||||||
@ -265,7 +224,6 @@ export default function RoofForm(props: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** 전기 계약 용량 처리 - 단위 붙여서 저장*/
|
|
||||||
if (key === 'contractCapacity') {
|
if (key === 'contractCapacity') {
|
||||||
const remainValue = roofInfo.contractCapacity?.split(' ')[1] ?? roofInfo.contractCapacity
|
const remainValue = roofInfo.contractCapacity?.split(' ')[1] ?? roofInfo.contractCapacity
|
||||||
if (Number.isNaN(Number(remainValue))) {
|
if (Number.isNaN(Number(remainValue))) {
|
||||||
@ -277,7 +235,6 @@ export default function RoofForm(props: {
|
|||||||
setRoofInfo({ ...roofInfo, [key]: value.toString() })
|
setRoofInfo({ ...roofInfo, [key]: value.toString() })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 전기 계약 용량 단위 처리 */
|
|
||||||
const handleUnitInput = (value: string) => {
|
const handleUnitInput = (value: string) => {
|
||||||
const numericValue = roofInfo.contractCapacity?.replace(/[^0-9.]/g, '') || ''
|
const numericValue = roofInfo.contractCapacity?.replace(/[^0-9.]/g, '') || ''
|
||||||
setRoofInfo({
|
setRoofInfo({
|
||||||
@ -504,7 +461,6 @@ export default function RoofForm(props: {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** SelectBox 처리 */
|
|
||||||
const SelectedBox = ({
|
const SelectedBox = ({
|
||||||
mode,
|
mode,
|
||||||
column,
|
column,
|
||||||
@ -523,7 +479,6 @@ const SelectedBox = ({
|
|||||||
const isSpecialCase = column === 'constructionYear' || column === 'installationAvailability'
|
const isSpecialCase = column === 'constructionYear' || column === 'installationAvailability'
|
||||||
const showEtcOption = !isSpecialCase
|
const showEtcOption = !isSpecialCase
|
||||||
|
|
||||||
/** SelectBox 값 변경 처리 */
|
|
||||||
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
const value = e.target.value
|
const value = e.target.value
|
||||||
const isEtc = value === 'etc'
|
const isEtc = value === 'etc'
|
||||||
@ -543,16 +498,10 @@ const SelectedBox = ({
|
|||||||
setRoofInfo(updatedData)
|
setRoofInfo(updatedData)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 기타 입력 처리 */
|
|
||||||
const handleEtcInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleEtcInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setRoofInfo({ ...detailInfoData, [`${column}Etc`]: e.target.value })
|
setRoofInfo({ ...detailInfoData, [`${column}Etc`]: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Input box 비활성화 처리
|
|
||||||
* - 읽기 모드 : 비활성화
|
|
||||||
* - 설치 가능 여부 : 기타 입력 창 항상 활성화
|
|
||||||
* - 건축 연수 : 신축(1) 체크 시 비활성화
|
|
||||||
* */
|
|
||||||
const isInputDisabled = () => {
|
const isInputDisabled = () => {
|
||||||
if (mode === 'READ') return true
|
if (mode === 'READ') return true
|
||||||
if (column === 'installationAvailability') return false
|
if (column === 'installationAvailability') return false
|
||||||
@ -603,7 +552,6 @@ const SelectedBox = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RadioBox 선택 처리 */
|
|
||||||
const RadioSelected = ({
|
const RadioSelected = ({
|
||||||
mode,
|
mode,
|
||||||
column,
|
column,
|
||||||
@ -624,26 +572,20 @@ const RadioSelected = ({
|
|||||||
const isSpecialColumn = column === 'rafterDirection' || column === 'leakTrace' || column === 'insulationPresence'
|
const isSpecialColumn = column === 'rafterDirection' || column === 'leakTrace' || column === 'insulationPresence'
|
||||||
const showEtcOption = !isSpecialColumn
|
const showEtcOption = !isSpecialColumn
|
||||||
|
|
||||||
/** RadioBox 값 변경 처리 */
|
|
||||||
const handleRadioChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleRadioChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const value = e.target.value
|
const value = e.target.value
|
||||||
|
|
||||||
/** 누수 흔적 처리 - boolean 타입이므로 별도 처리 */
|
|
||||||
if (column === 'leakTrace') {
|
if (column === 'leakTrace') {
|
||||||
setRoofInfo({ ...detailInfoData, leakTrace: value === '1' })
|
setRoofInfo({ ...detailInfoData, leakTrace: value === '1' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 기타 체크 처리 */
|
|
||||||
if (value === 'etc') {
|
if (value === 'etc') {
|
||||||
setEtcChecked(true)
|
setEtcChecked(true)
|
||||||
setRoofInfo({ ...detailInfoData, [column]: null, [`${column}Etc`]: '' })
|
setRoofInfo({ ...detailInfoData, [column]: null, [`${column}Etc`]: '' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 단열재 유무 - 있음(1) 선택 시 기타 체크 처리
|
|
||||||
* 서까래 방향 - 기타 입력 칸 없음
|
|
||||||
* */
|
|
||||||
const isInsulationPresence = column === 'insulationPresence'
|
const isInsulationPresence = column === 'insulationPresence'
|
||||||
const isRafterDirection = column === 'rafterDirection'
|
const isRafterDirection = column === 'rafterDirection'
|
||||||
|
|
||||||
@ -656,15 +598,10 @@ const RadioSelected = ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 기타 입력 처리 */
|
|
||||||
const handleEtcInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleEtcInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setRoofInfo({ ...detailInfoData, [`${column}Etc`]: e.target.value })
|
setRoofInfo({ ...detailInfoData, [`${column}Etc`]: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Input box 비활성화 처리
|
|
||||||
* - 읽기 모드 : 비활성화
|
|
||||||
* - 단열재 유무 : 단열재 없음(1) 체크 시 비활성화
|
|
||||||
* */
|
|
||||||
const isInputDisabled = () => {
|
const isInputDisabled = () => {
|
||||||
if (mode === 'READ') return true
|
if (mode === 'READ') return true
|
||||||
if (column === 'insulationPresence') {
|
if (column === 'insulationPresence') {
|
||||||
@ -720,7 +657,6 @@ const RadioSelected = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 다중 선택 처리 */
|
|
||||||
const MultiCheck = ({
|
const MultiCheck = ({
|
||||||
mode,
|
mode,
|
||||||
column,
|
column,
|
||||||
@ -739,7 +675,6 @@ const MultiCheck = ({
|
|||||||
const isRoofMaterial = column === 'roofMaterial'
|
const isRoofMaterial = column === 'roofMaterial'
|
||||||
const selectedValues = makeNumArr(String(roofInfo[column as keyof SurveyDetailInfo] ?? ''))
|
const selectedValues = makeNumArr(String(roofInfo[column as keyof SurveyDetailInfo] ?? ''))
|
||||||
|
|
||||||
/** 다중 선택 처리 */
|
|
||||||
const handleCheckbox = (id: number) => {
|
const handleCheckbox = (id: number) => {
|
||||||
const isOtherSelected = Boolean(etcValue)
|
const isOtherSelected = Boolean(etcValue)
|
||||||
let newValue: string[]
|
let newValue: string[]
|
||||||
@ -747,7 +682,6 @@ const MultiCheck = ({
|
|||||||
if (selectedValues.includes(String(id))) {
|
if (selectedValues.includes(String(id))) {
|
||||||
newValue = selectedValues.filter((v) => v !== String(id))
|
newValue = selectedValues.filter((v) => v !== String(id))
|
||||||
} else {
|
} else {
|
||||||
/** 지붕 재료 처리 - 최대 2개 선택 처리 */
|
|
||||||
if (isRoofMaterial) {
|
if (isRoofMaterial) {
|
||||||
const totalSelected = selectedValues.length + (isOtherSelected || isOtherCheck ? 1 : 0)
|
const totalSelected = selectedValues.length + (isOtherSelected || isOtherCheck ? 1 : 0)
|
||||||
if (totalSelected >= 2) {
|
if (totalSelected >= 2) {
|
||||||
@ -760,7 +694,6 @@ const MultiCheck = ({
|
|||||||
setRoofInfo({ ...roofInfo, [column]: newValue.join(',') })
|
setRoofInfo({ ...roofInfo, [column]: newValue.join(',') })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 기타 선택 처리 */
|
|
||||||
const handleOtherCheckbox = () => {
|
const handleOtherCheckbox = () => {
|
||||||
if (isRoofMaterial) {
|
if (isRoofMaterial) {
|
||||||
const currentSelected = selectedValues.length
|
const currentSelected = selectedValues.length
|
||||||
@ -773,19 +706,17 @@ const MultiCheck = ({
|
|||||||
const newIsOtherCheck = !isOtherCheck
|
const newIsOtherCheck = !isOtherCheck
|
||||||
setIsOtherCheck(newIsOtherCheck)
|
setIsOtherCheck(newIsOtherCheck)
|
||||||
|
|
||||||
/** 기타 선택 해제 시 값도 null로 설정 */
|
// 기타 선택 해제 시 값도 null로 설정
|
||||||
setRoofInfo({
|
setRoofInfo({
|
||||||
...roofInfo,
|
...roofInfo,
|
||||||
[`${column}Etc`]: newIsOtherCheck ? '' : null,
|
[`${column}Etc`]: newIsOtherCheck ? '' : null,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 기타 입력 처리 */
|
|
||||||
const handleOtherInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
const handleOtherInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setRoofInfo({ ...roofInfo, [`${column}Etc`]: e.target.value })
|
setRoofInfo({ ...roofInfo, [`${column}Etc`]: e.target.value })
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Input box 비활성화 처리 */
|
|
||||||
const isInputDisabled = () => {
|
const isInputDisabled = () => {
|
||||||
return mode === 'READ' || (!isOtherCheck && !etcValue)
|
return mode === 'READ' || (!isOtherCheck && !etcValue)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,12 @@ export default function ListTable() {
|
|||||||
}, [pathname])
|
}, [pathname])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isLoadingSurveyList) return
|
if (!session.isLoggedIn || isLoadingSurveyList) return
|
||||||
|
// if ('status' in surveyList && surveyList.status === 403) {
|
||||||
|
// alert('権限がありません。')
|
||||||
|
// router.push('/survey-sale')
|
||||||
|
// return
|
||||||
|
// }
|
||||||
if ('count' in surveyList && surveyList.count > 0) {
|
if ('count' in surveyList && surveyList.count > 0) {
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
setHeldSurveyList((prev) => [...prev, ...surveyList.data])
|
setHeldSurveyList((prev) => [...prev, ...surveyList.data])
|
||||||
@ -39,7 +44,7 @@ export default function ListTable() {
|
|||||||
setHeldSurveyList([])
|
setHeldSurveyList([])
|
||||||
setHasMore(false)
|
setHasMore(false)
|
||||||
}
|
}
|
||||||
}, [surveyList, offset, isLoadingSurveyList])
|
}, [surveyList, offset, session.isLoggedIn])
|
||||||
|
|
||||||
const handleDetailClick = (id: number) => {
|
const handleDetailClick = (id: number) => {
|
||||||
router.push(`/survey-sale/${id}`)
|
router.push(`/survey-sale/${id}`)
|
||||||
|
|||||||
@ -19,7 +19,6 @@ export default function SearchForm({ memberRole, userId }: { memberRole: string;
|
|||||||
setKeyword(searchKeyword)
|
setKeyword(searchKeyword)
|
||||||
setSearchOption(option)
|
setSearchOption(option)
|
||||||
}
|
}
|
||||||
/** 권한 별 검색 옵션 목록 처리 */
|
|
||||||
const searchOptions = memberRole === 'Partner' ? SEARCH_OPTIONS_PARTNERS : SEARCH_OPTIONS
|
const searchOptions = memberRole === 'Partner' ? SEARCH_OPTIONS_PARTNERS : SEARCH_OPTIONS
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -4,23 +4,7 @@ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
|||||||
import { useInquiryFilterStore } from '@/store/inquiryFilterStore'
|
import { useInquiryFilterStore } from '@/store/inquiryFilterStore'
|
||||||
import { useMemo } from 'react'
|
import { useMemo } from 'react'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { useRouter } from 'next/navigation'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의사항 관련 기능을 제공하는 커스텀 훅
|
|
||||||
*
|
|
||||||
* @param {number} [qnoNo] 문의사항 번호
|
|
||||||
* @param {string} [compCd] 회사 코드
|
|
||||||
* @returns {Object} 문의사항 관련 기능과 데이터
|
|
||||||
* @returns {InquiryList[]} inquiryList - 문의사항 목록
|
|
||||||
* @returns {boolean} isLoadingInquiryList - 문의사항 목록 로딩 상태
|
|
||||||
* @returns {Inquiry|null} inquiryDetail - 문의사항 상세 정보
|
|
||||||
* @returns {boolean} isLoadingInquiryDetail - 문의사항 상세 정보 로딩 상태
|
|
||||||
* @returns {boolean} isSavingInquiry - 문의사항 저장 중 상태
|
|
||||||
* @returns {Function} saveInquiry - 문의사항 저장 함수
|
|
||||||
* @returns {Function} downloadFile - 파일 다운로드 함수
|
|
||||||
* @returns {CommonCode[]} commonCodeList - 공통 코드 목록
|
|
||||||
*/
|
|
||||||
export function useInquiry(
|
export function useInquiry(
|
||||||
qnoNo?: number,
|
qnoNo?: number,
|
||||||
compCd?: string,
|
compCd?: string,
|
||||||
@ -38,46 +22,7 @@ export function useInquiry(
|
|||||||
const { inquiryListRequest, offset } = useInquiryFilterStore()
|
const { inquiryListRequest, offset } = useInquiryFilterStore()
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
const { axiosInstance } = useAxios()
|
const { axiosInstance } = useAxios()
|
||||||
const router = useRouter()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description API 에러 처리 및 라우팅
|
|
||||||
*
|
|
||||||
* @param {any} error 에러 객체
|
|
||||||
* @returns {void} 라우팅 처리
|
|
||||||
*/
|
|
||||||
const errorRouter = (error: any) => {
|
|
||||||
const status = error.response?.status
|
|
||||||
alert(error.response?.data.error)
|
|
||||||
switch (status) {
|
|
||||||
// session 없는 경우
|
|
||||||
case 401:
|
|
||||||
router.replace('/login')
|
|
||||||
break
|
|
||||||
// 조회 권한 없는 경우
|
|
||||||
case 403:
|
|
||||||
router.replace('/inquiry/list')
|
|
||||||
break
|
|
||||||
// 데이터 DB상 존재하지 않는 경우
|
|
||||||
case 404:
|
|
||||||
router.replace('/inquiry/list')
|
|
||||||
break
|
|
||||||
// 서버 오류
|
|
||||||
case 500:
|
|
||||||
router.back()
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의사항 목록 조회
|
|
||||||
*
|
|
||||||
* @returns {Object} 문의사항 목록 데이터
|
|
||||||
* @returns {InquiryList[]} data - 문의사항 목록
|
|
||||||
* @returns {boolean} isLoading - 문의사항 목록 로딩 상태
|
|
||||||
*/
|
|
||||||
const { data: inquiryList, isLoading: isLoadingInquiryList } = useQuery({
|
const { data: inquiryList, isLoading: isLoadingInquiryList } = useQuery({
|
||||||
queryKey: ['inquiryList', inquiryListRequest, offset],
|
queryKey: ['inquiryList', inquiryListRequest, offset],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
@ -87,19 +32,13 @@ export function useInquiry(
|
|||||||
})
|
})
|
||||||
return resp.data.data
|
return resp.data.data
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
errorRouter(error)
|
console.error(error.response.data)
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: !!inquiryListRequest,
|
enabled: !!inquiryListRequest,
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의사항 목록 데이터 메모이제이션
|
|
||||||
*
|
|
||||||
* @returns {Object} 메모이제이션된 문의사항 목록 데이터
|
|
||||||
* @returns {InquiryList[]} inquiryList - 문의사항 목록
|
|
||||||
*/
|
|
||||||
const inquriyListData = useMemo(() => {
|
const inquriyListData = useMemo(() => {
|
||||||
if (isLoadingInquiryList) {
|
if (isLoadingInquiryList) {
|
||||||
return { inquiryList: [] }
|
return { inquiryList: [] }
|
||||||
@ -109,13 +48,6 @@ export function useInquiry(
|
|||||||
}
|
}
|
||||||
}, [inquiryList, isLoadingInquiryList])
|
}, [inquiryList, isLoadingInquiryList])
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의사항 상세 정보 조회
|
|
||||||
*
|
|
||||||
* @returns {Object} 문의사항 상세 정보 데이터
|
|
||||||
* @returns {Inquiry|null} data - 문의사항 상세 정보
|
|
||||||
* @returns {boolean} isLoading - 문의사항 상세 정보 로딩 상태
|
|
||||||
*/
|
|
||||||
const { data: inquiryDetail, isLoading: isLoadingInquiryDetail } = useQuery({
|
const { data: inquiryDetail, isLoading: isLoadingInquiryDetail } = useQuery({
|
||||||
queryKey: ['inquiryDetail', qnoNo, compCd, session?.userId],
|
queryKey: ['inquiryDetail', qnoNo, compCd, session?.userId],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
@ -125,19 +57,13 @@ export function useInquiry(
|
|||||||
})
|
})
|
||||||
return resp.data.data
|
return resp.data.data
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
errorRouter(error)
|
console.error(error.response)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: qnoNo !== undefined && compCd !== undefined,
|
enabled: qnoNo !== undefined && compCd !== undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의사항 저장
|
|
||||||
*
|
|
||||||
* @param {FormData} formData 저장할 문의사항 데이터
|
|
||||||
* @returns {Promise<InquirySaveResponse>} 저장된 문의사항 응답 데이터
|
|
||||||
*/
|
|
||||||
const { mutateAsync: saveInquiry, isPending: isSavingInquiry } = useMutation({
|
const { mutateAsync: saveInquiry, isPending: isSavingInquiry } = useMutation({
|
||||||
mutationFn: async (formData: FormData) => {
|
mutationFn: async (formData: FormData) => {
|
||||||
const resp = await axiosInstance(null).post<{ data: InquirySaveResponse }>('/api/qna/save', formData)
|
const resp = await axiosInstance(null).post<{ data: InquirySaveResponse }>('/api/qna/save', formData)
|
||||||
@ -146,18 +72,8 @@ export function useInquiry(
|
|||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['inquiryList'] })
|
queryClient.invalidateQueries({ queryKey: ['inquiryList'] })
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
|
||||||
errorRouter(error)
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 파일 다운로드
|
|
||||||
*
|
|
||||||
* @param {number} encodeFileNo 인코딩된 파일 번호
|
|
||||||
* @param {string} srcFileNm 원본 파일명
|
|
||||||
* @returns {Promise<Blob|null>} 다운로드된 파일 데이터 또는 null
|
|
||||||
*/
|
|
||||||
const downloadFile = async (encodeFileNo: number, srcFileNm: string) => {
|
const downloadFile = async (encodeFileNo: number, srcFileNm: string) => {
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(`/api/qna/file?encodeFileNo=${encodeFileNo}&srcFileNm=${srcFileNm}`)
|
const resp = await fetch(`/api/qna/file?encodeFileNo=${encodeFileNo}&srcFileNm=${srcFileNm}`)
|
||||||
@ -174,18 +90,12 @@ export function useInquiry(
|
|||||||
|
|
||||||
return blob
|
return blob
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.error('File download error:', error)
|
||||||
alert('ファイルのダウンロードに失敗しました')
|
alert('ファイルのダウンロードに失敗しました')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 공통 코드 목록 조회
|
|
||||||
*
|
|
||||||
* @returns {Object} 공통 코드 목록 데이터
|
|
||||||
* @returns {CommonCode[]} data - 공통 코드 목록
|
|
||||||
* @returns {boolean} isLoading - 공통 코드 목록 로딩 상태
|
|
||||||
*/
|
|
||||||
const { data: commonCodeList, isLoading: isLoadingCommonCodeList } = useQuery({
|
const { data: commonCodeList, isLoading: isLoadingCommonCodeList } = useQuery({
|
||||||
queryKey: ['commonCodeList'],
|
queryKey: ['commonCodeList'],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import type { SubmitTargetResponse, SurveyBasicInfo, SurveyDetailRequest, SurveyRegistRequest } from '@/types/Survey'
|
import type { SurveyBasicInfo, SurveyDetailRequest, SurveyRegistRequest } from '@/types/Survey'
|
||||||
import { useMemo } from 'react'
|
import { useMemo, useEffect } from 'react'
|
||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
@ -54,28 +54,8 @@ type ZipCode = {
|
|||||||
kana2: string
|
kana2: string
|
||||||
kana3: string
|
kana3: string
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @description 조사 매물 관련 기능을 제공하는 커스텀 훅
|
export function useSurvey(id?: number): {
|
||||||
*
|
|
||||||
* @param {number} [id] 조사 매물 ID
|
|
||||||
* @param {boolean} [isPdf] PDF 뷰 여부
|
|
||||||
* @returns {Object} 조사 매물 관련 기능과 데이터
|
|
||||||
* @returns {SurveyBasicInfo[]} surveyList - 조사 매물 목록 데이터
|
|
||||||
* @returns {SurveyBasicInfo} surveyDetail - 조사 매물 상세 데이터
|
|
||||||
* @returns {boolean} isLoadingSurveyList - 조사 매물 목록 로딩 상태
|
|
||||||
* @returns {boolean} isLoadingSurveyDetail - 조사 매물 상세 데이터 로딩 상태
|
|
||||||
* @returns {boolean} isCreatingSurvey - 조사 매물 생성 중 상태
|
|
||||||
* @returns {boolean} isUpdatingSurvey - 조사 매물 수정 중 상태
|
|
||||||
* @returns {boolean} isDeletingSurvey - 조사 매물 삭제 중 상태
|
|
||||||
* @returns {boolean} isSubmittingSurvey - 조사 매물 제출 중 상태
|
|
||||||
* @returns {Function} createSurvey - 조사 매물 생성 함수
|
|
||||||
* @returns {Function} updateSurvey - 조사 매물 수정 함수
|
|
||||||
* @returns {Function} deleteSurvey - 조사 매물 삭제 함수
|
|
||||||
*/
|
|
||||||
export function useSurvey(
|
|
||||||
id?: number,
|
|
||||||
isPdf?: boolean,
|
|
||||||
): {
|
|
||||||
surveyList: { data: SurveyBasicInfo[]; count: number } | {}
|
surveyList: { data: SurveyBasicInfo[]; count: number } | {}
|
||||||
surveyDetail: SurveyBasicInfo | null
|
surveyDetail: SurveyBasicInfo | null
|
||||||
isLoadingSurveyList: boolean
|
isLoadingSurveyList: boolean
|
||||||
@ -85,14 +65,12 @@ export function useSurvey(
|
|||||||
isDeletingSurvey: boolean
|
isDeletingSurvey: boolean
|
||||||
isSubmittingSurvey: boolean
|
isSubmittingSurvey: boolean
|
||||||
createSurvey: (survey: SurveyRegistRequest) => Promise<number>
|
createSurvey: (survey: SurveyRegistRequest) => Promise<number>
|
||||||
updateSurvey: ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string | null }) => void
|
updateSurvey: ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string }) => void
|
||||||
deleteSurvey: () => Promise<boolean>
|
deleteSurvey: () => Promise<boolean>
|
||||||
submitSurvey: (params: { targetId?: string | null; targetNm?: string | null }) => void
|
submitSurvey: (params: { targetId?: string | null; targetNm?: string | null }) => 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
|
||||||
refetchSurveyDetail: () => void
|
|
||||||
getSubmitTarget: (params: { storeId: string; role: string }) => Promise<SubmitTargetResponse[] | null>
|
|
||||||
} {
|
} {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const { keyword, searchOption, isMySurvey, sort, offset } = useSurveyFilterStore()
|
const { keyword, searchOption, isMySurvey, sort, offset } = useSurveyFilterStore()
|
||||||
@ -100,46 +78,33 @@ export function useSurvey(
|
|||||||
const { axiosInstance } = useAxios()
|
const { axiosInstance } = useAxios()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
/**
|
const checkSession = () => {
|
||||||
* @description 조사 매물 목록, 상세 데이터 조회 에러 처리
|
if (session?.isLoggedIn) {
|
||||||
*
|
switch (session?.role) {
|
||||||
* @param {any} error 에러 객체
|
case 'T01':
|
||||||
* @returns {void} 라우팅 처리
|
case 'Admin':
|
||||||
*/
|
case 'Admin_Sub':
|
||||||
const errorRouter = (error: any) => {
|
if (session?.storeId === null) {
|
||||||
const status = error.response?.status
|
alert('販売店IDがありません。')
|
||||||
alert(error.response?.data.error)
|
return false
|
||||||
switch (status) {
|
|
||||||
// session 없는 경우
|
|
||||||
case 401:
|
|
||||||
router.replace('/login')
|
|
||||||
break
|
|
||||||
// 조회 권한 없는 경우
|
|
||||||
case 403:
|
|
||||||
router.replace('/survey-sale')
|
|
||||||
break
|
|
||||||
// 데이터 DB상 존재하지 않는 경우
|
|
||||||
case 404:
|
|
||||||
router.replace('/survey-sale')
|
|
||||||
break
|
|
||||||
// 서버 오류
|
|
||||||
case 500:
|
|
||||||
router.back()
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
|
case 'Builder':
|
||||||
|
case 'Partner':
|
||||||
|
if (session?.builderId === null) {
|
||||||
|
alert('施工店IDがありません。')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
alert('権限が間違っています。')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alert('ログインしていません。')
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 목록 조회
|
|
||||||
*
|
|
||||||
* @returns {Object} 조사 매물 목록 데이터
|
|
||||||
* @returns {SurveyBasicInfo[]} 조사 매물 목록 데이터
|
|
||||||
* @returns {number} 조건에 맞는 조사 매물 총 개수
|
|
||||||
* @returns {() => void} 조사 매물 목록 데이터 새로고침 함수
|
|
||||||
* @returns {boolean} 조사 매물 목록 로딩 상태
|
|
||||||
*/
|
|
||||||
const {
|
const {
|
||||||
data: surveyListData,
|
data: surveyListData,
|
||||||
isLoading: isLoadingSurveyList,
|
isLoading: isLoadingSurveyList,
|
||||||
@ -147,7 +112,10 @@ export function useSurvey(
|
|||||||
} = useQuery({
|
} = useQuery({
|
||||||
queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, offset, session?.storeNm, session?.builderId, session?.role],
|
queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, offset, session?.storeNm, session?.builderId, session?.role],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
try {
|
if (!checkSession()) {
|
||||||
|
router.replace('/')
|
||||||
|
return { data: [], count: 0 }
|
||||||
|
}
|
||||||
const resp = await axiosInstance(null).get<{ data: SurveyBasicInfo[]; count: number }>('/api/survey-sales', {
|
const resp = await axiosInstance(null).get<{ data: SurveyBasicInfo[]; count: number }>('/api/survey-sales', {
|
||||||
params: {
|
params: {
|
||||||
keyword,
|
keyword,
|
||||||
@ -161,20 +129,9 @@ export function useSurvey(
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
return resp.data
|
return resp.data
|
||||||
} catch (error: any) {
|
|
||||||
errorRouter(error)
|
|
||||||
return { data: [], count: 0 }
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
enabled: session?.isLoggedIn,
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 목록 데이터 메모이제이션
|
|
||||||
*
|
|
||||||
* @returns {Object} 메모이제이션된 조사 매물 목록 데이터
|
|
||||||
* @returns {number} count - 조건에 맞는 조사 매물 총 개수
|
|
||||||
* @returns {SurveyBasicInfo[]} data - 조사 매물 목록 데이터
|
|
||||||
*/
|
|
||||||
const surveyData = useMemo(() => {
|
const surveyData = useMemo(() => {
|
||||||
if (!surveyListData) return { count: 0, data: [] }
|
if (!surveyListData) return { count: 0, data: [] }
|
||||||
return {
|
return {
|
||||||
@ -182,48 +139,38 @@ export function useSurvey(
|
|||||||
}
|
}
|
||||||
}, [surveyListData])
|
}, [surveyListData])
|
||||||
|
|
||||||
/**
|
const { data: surveyDetail, isLoading: isLoadingSurveyDetail } = useQuery({
|
||||||
* @description 조사 매물 상세 데이터 조회
|
|
||||||
*
|
|
||||||
* @returns {Object} 조사 매물 상세 데이터
|
|
||||||
* @returns {SurveyBasicInfo} surveyDetail - 조사 매물 상세 데이터
|
|
||||||
* @returns {boolean} isLoadingSurveyDetail - 조사 매물 상세 데이터 로딩 상태
|
|
||||||
* @returns {() => void} refetchSurveyDetail - 조사 매물 상세 데이터 새로고침 함수
|
|
||||||
*/
|
|
||||||
const {
|
|
||||||
data: surveyDetail,
|
|
||||||
isLoading: isLoadingSurveyDetail,
|
|
||||||
refetch: refetchSurveyDetail,
|
|
||||||
} = useQuery({
|
|
||||||
queryKey: ['survey', id],
|
queryKey: ['survey', id],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (Number.isNaN(id) || id === undefined || id === 0) return null
|
if (!checkSession()) {
|
||||||
|
router.replace('/survey-sale')
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
if (id === 0 || id === undefined) return null
|
||||||
try {
|
try {
|
||||||
const resp = await axiosInstance(null).get<SurveyBasicInfo>(`/api/survey-sales/${id}`, {
|
const resp = await axiosInstance(null).get<SurveyBasicInfo>(`/api/survey-sales/${id}`, {
|
||||||
params: {
|
params: {
|
||||||
isPdf: isPdf,
|
role: session?.role,
|
||||||
|
storeId: session?.storeId,
|
||||||
|
builderId: session?.builderId,
|
||||||
|
isLoggedIn: session?.isLoggedIn,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return resp.data
|
return resp.data
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
errorRouter(error)
|
alert(error.response?.data.error)
|
||||||
|
router.replace('/survey-sale')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: id !== 0 && id !== undefined && id !== null,
|
enabled: id !== 0 && id !== undefined && session?.isLoggedIn,
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 생성
|
|
||||||
*
|
|
||||||
* @param {SurveyRegistRequest} survey 생성할 조사 매물 데이터
|
|
||||||
* @returns {Promise<number>} 생성된 조사 매물 ID
|
|
||||||
*/
|
|
||||||
const { mutateAsync: createSurvey, isPending: isCreatingSurvey } = useMutation({
|
const { mutateAsync: createSurvey, isPending: isCreatingSurvey } = useMutation({
|
||||||
mutationFn: async (survey: SurveyRegistRequest) => {
|
mutationFn: async (survey: SurveyRegistRequest) => {
|
||||||
const resp = await axiosInstance(null).post<{ id: number }>('/api/survey-sales', {
|
const resp = await axiosInstance(null).post<SurveyBasicInfo>('/api/survey-sales', {
|
||||||
survey: survey,
|
survey: survey,
|
||||||
storeId: session?.role === 'Partner' ? session?.builderId ?? null : session?.storeId ?? null,
|
storeId: session?.storeId ?? null,
|
||||||
role: session?.role ?? null,
|
role: session?.role ?? null,
|
||||||
})
|
})
|
||||||
return resp.data.id ?? 0
|
return resp.data.id ?? 0
|
||||||
@ -234,18 +181,8 @@ export function useSurvey(
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 수정
|
|
||||||
*
|
|
||||||
* @param {Object} params 수정할 데이터
|
|
||||||
* @param {SurveyRegistRequest} params.survey 수정할 조사 매물 데이터
|
|
||||||
* @param {boolean} params.isTemporary 임시 저장 여부
|
|
||||||
* @param {string|null} [params.storeId] 판매점 ID
|
|
||||||
* @returns {Promise<SurveyRegistRequest>} 수정된 조사 매물 데이터
|
|
||||||
* @throws {Error} id가 없는 경우 에러 발생
|
|
||||||
*/
|
|
||||||
const { mutate: updateSurvey, isPending: isUpdatingSurvey } = useMutation({
|
const { mutate: updateSurvey, isPending: isUpdatingSurvey } = useMutation({
|
||||||
mutationFn: async ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string | null }) => {
|
mutationFn: async ({ survey, isTemporary, storeId }: { survey: SurveyRegistRequest; isTemporary: boolean; storeId?: string }) => {
|
||||||
if (id === undefined) throw new Error('id is required')
|
if (id === undefined) throw new Error('id is required')
|
||||||
const resp = await axiosInstance(null).put<SurveyRegistRequest>(`/api/survey-sales/${id}`, {
|
const resp = await axiosInstance(null).put<SurveyRegistRequest>(`/api/survey-sales/${id}`, {
|
||||||
survey: survey,
|
survey: survey,
|
||||||
@ -261,16 +198,6 @@ export function useSurvey(
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 삭제
|
|
||||||
*
|
|
||||||
* @returns {Promise<boolean>} 삭제 성공 여부
|
|
||||||
* @throws {Error} id가 없는 경우 에러 발생
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* // 삭제 성공 시 목록 데이터만 갱신하고, 상세 데이터는 갱신하지 않음
|
|
||||||
* // 상세 데이터를 갱신하면 404 에러가 발생할 수 있음
|
|
||||||
*/
|
|
||||||
const { mutateAsync: deleteSurvey, isPending: isDeletingSurvey } = useMutation({
|
const { mutateAsync: deleteSurvey, isPending: isDeletingSurvey } = useMutation({
|
||||||
mutationFn: async () => {
|
mutationFn: async () => {
|
||||||
if (id === null) throw new Error('id is required')
|
if (id === null) throw new Error('id is required')
|
||||||
@ -279,21 +206,10 @@ export function useSurvey(
|
|||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
queryClient.invalidateQueries({ queryKey: ['survey', 'list'] })
|
queryClient.invalidateQueries({ queryKey: ['survey', 'list'] })
|
||||||
},
|
queryClient.invalidateQueries({ queryKey: ['survey', id] })
|
||||||
onError: (error: any) => {
|
|
||||||
alert(error.response?.data.error)
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 제출
|
|
||||||
*
|
|
||||||
* @param {Object} params 제출할 데이터
|
|
||||||
* @param {string|null} [params.targetId] 제출 대상 ID
|
|
||||||
* @param {string|null} [params.targetNm] 제출 대상 이름
|
|
||||||
* @returns {Promise<boolean>} 제출 성공 여부
|
|
||||||
* @throws {Error} id가 없는 경우 에러 발생
|
|
||||||
*/
|
|
||||||
const { mutateAsync: submitSurvey, isPending: isSubmittingSurvey } = useMutation({
|
const { mutateAsync: submitSurvey, isPending: isSubmittingSurvey } = useMutation({
|
||||||
mutationFn: async ({ targetId, targetNm }: { targetId?: string | null; targetNm?: string | null }) => {
|
mutationFn: async ({ targetId, targetNm }: { targetId?: string | null; targetNm?: string | null }) => {
|
||||||
if (!id) throw new Error('id is required')
|
if (!id) throw new Error('id is required')
|
||||||
@ -307,22 +223,15 @@ export function useSurvey(
|
|||||||
queryClient.invalidateQueries({ queryKey: ['survey', 'list'] })
|
queryClient.invalidateQueries({ queryKey: ['survey', 'list'] })
|
||||||
queryClient.invalidateQueries({ queryKey: ['survey', id] })
|
queryClient.invalidateQueries({ queryKey: ['survey', id] })
|
||||||
},
|
},
|
||||||
onError: (error: any) => {
|
|
||||||
alert(error.response?.data.error)
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 상세 데이터 유효성 검사
|
|
||||||
*
|
|
||||||
* @param {SurveyDetailRequest} surveyDetail 검사할 조사 매물 상세 데이터
|
|
||||||
* @returns {string} 빈 필드 이름 또는 빈 문자열
|
|
||||||
*/
|
|
||||||
const validateSurveyDetail = (surveyDetail: SurveyDetailRequest) => {
|
const validateSurveyDetail = (surveyDetail: SurveyDetailRequest) => {
|
||||||
|
// 상수 정의
|
||||||
const ETC_FIELDS = ['installationSystem', 'rafterSize', 'rafterPitch', 'waterproofMaterial', 'structureOrder'] as const
|
const ETC_FIELDS = ['installationSystem', 'rafterSize', 'rafterPitch', 'waterproofMaterial', 'structureOrder'] as const
|
||||||
|
|
||||||
const SPECIAL_CONDITIONS = ['constructionYear', 'insulationPresence'] as const
|
const SPECIAL_CONDITIONS = ['constructionYear', 'insulationPresence'] as const
|
||||||
|
|
||||||
|
// 유틸리티 함수들
|
||||||
const isEmptyValue = (value: any): boolean => {
|
const isEmptyValue = (value: any): boolean => {
|
||||||
return value === null || value?.toString().trim() === ''
|
return value === null || value?.toString().trim() === ''
|
||||||
}
|
}
|
||||||
@ -357,13 +266,6 @@ export function useSurvey(
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 우편번호 검색
|
|
||||||
*
|
|
||||||
* @param {string} zipCode 검색할 우편번호
|
|
||||||
* @returns {Promise<ZipCode[]|null>} 우편번호 검색 결과
|
|
||||||
* @throws {Error} 우편번호 검색 실패 시 에러 발생
|
|
||||||
*/
|
|
||||||
const getZipCode = async (zipCode: string): Promise<ZipCode[] | null> => {
|
const getZipCode = async (zipCode: string): Promise<ZipCode[] | null> => {
|
||||||
try {
|
try {
|
||||||
const { data } = await axiosInstance(null).get<ZipCodeResponse>(
|
const { data } = await axiosInstance(null).get<ZipCodeResponse>(
|
||||||
@ -376,40 +278,6 @@ export function useSurvey(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 제출 대상 조회
|
|
||||||
*
|
|
||||||
* @param {Object} params 조회할 데이터
|
|
||||||
* @param {string} params.storeId 판매점 ID
|
|
||||||
* @param {string} params.role 사용자 권한
|
|
||||||
* @returns {Promise<SubmitTargetResponse[]|null>} 제출 대상 목록
|
|
||||||
*/
|
|
||||||
const getSubmitTarget = async (params: { storeId: string; role: string }): Promise<SubmitTargetResponse[] | null> => {
|
|
||||||
try {
|
|
||||||
if (!params.storeId) {
|
|
||||||
alert('販売店IDがありません。')
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const endpoints = {
|
|
||||||
Admin_Sub: `/api/submission/admin-sub?id=${params.storeId}`,
|
|
||||||
Builder: `/api/submission/builder?id=${params.storeId}`,
|
|
||||||
} as const
|
|
||||||
|
|
||||||
const endpoint = endpoints[params.role as keyof typeof endpoints]
|
|
||||||
if (!endpoint) {
|
|
||||||
alert('権限が間違っています。')
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
const { data } = await axiosInstance(null).get<SubmitTargetResponse[]>(endpoint)
|
|
||||||
return data
|
|
||||||
} catch (error: any) {
|
|
||||||
alert(error.response?.data.error)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
surveyList: surveyData.data,
|
surveyList: surveyData.data,
|
||||||
surveyDetail: surveyDetail as SurveyBasicInfo | null,
|
surveyDetail: surveyDetail as SurveyBasicInfo | null,
|
||||||
@ -425,8 +293,6 @@ export function useSurvey(
|
|||||||
submitSurvey,
|
submitSurvey,
|
||||||
validateSurveyDetail,
|
validateSurveyDetail,
|
||||||
getZipCode,
|
getZipCode,
|
||||||
getSubmitTarget,
|
|
||||||
refetchSurveyList,
|
refetchSurveyList,
|
||||||
refetchSurveyDetail,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
import { InquiryListRequest } from '@/types/Inquiry'
|
import { InquiryListRequest } from '@/types/Inquiry'
|
||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 목록 필터 상태 타입
|
|
||||||
*/
|
|
||||||
type InquiryFilterState = {
|
type InquiryFilterState = {
|
||||||
inquiryListRequest: InquiryListRequest
|
inquiryListRequest: InquiryListRequest
|
||||||
setInquiryListRequest: (inquiryListRequest: InquiryListRequest) => void
|
setInquiryListRequest: (inquiryListRequest: InquiryListRequest) => void
|
||||||
@ -12,15 +9,6 @@ type InquiryFilterState = {
|
|||||||
setOffset: (offset: number) => void
|
setOffset: (offset: number) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 목록 필터 상태 관리
|
|
||||||
*
|
|
||||||
* @param {InquiryListRequest} inquiryListRequest 문의 목록 요청 파라미터
|
|
||||||
* @param {Function} setInquiryListRequest 문의 목록 요청 파라미터 설정 함수
|
|
||||||
* @param {Function} reset 문의 목록 요청 파라미터 초기화 함수
|
|
||||||
* @param {number} offset 문의 목록 페이지 오프셋
|
|
||||||
* @param {Function} setOffset 문의 목록 페이지 오프셋 설정 함수
|
|
||||||
*/
|
|
||||||
export const useInquiryFilterStore = create<InquiryFilterState>((set) => ({
|
export const useInquiryFilterStore = create<InquiryFilterState>((set) => ({
|
||||||
inquiryListRequest: {
|
inquiryListRequest: {
|
||||||
compCd: '5200',
|
compCd: '5200',
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 검색 옵션 목록
|
|
||||||
*
|
|
||||||
* @param {string} id 조사 매물 검색 옵션 ID
|
|
||||||
* @param {string} label 조사 매물 검색 옵션 라벨
|
|
||||||
*/
|
|
||||||
export const SEARCH_OPTIONS = [
|
export const SEARCH_OPTIONS = [
|
||||||
{
|
{
|
||||||
id: 'all',
|
id: 'all',
|
||||||
@ -41,12 +35,6 @@ export const SEARCH_OPTIONS = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 검색 옵션 목록 - 파트너
|
|
||||||
*
|
|
||||||
* @param {string} id 조사 매물 검색 옵션 ID
|
|
||||||
* @param {string} label 조사 매물 검색 옵션 라벨
|
|
||||||
*/
|
|
||||||
export const SEARCH_OPTIONS_PARTNERS = [
|
export const SEARCH_OPTIONS_PARTNERS = [
|
||||||
{
|
{
|
||||||
id: 'all',
|
id: 'all',
|
||||||
@ -66,19 +54,8 @@ export const SEARCH_OPTIONS_PARTNERS = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 검색 옵션 목록 타입 정의
|
|
||||||
*/
|
|
||||||
export type SEARCH_OPTIONS_ENUM = (typeof SEARCH_OPTIONS)[number]['id']
|
export type SEARCH_OPTIONS_ENUM = (typeof SEARCH_OPTIONS)[number]['id']
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 파트너 권한의 조사 매물 검색 옵션 목록 타입 정의
|
|
||||||
*/
|
|
||||||
export type SEARCH_OPTIONS_PARTNERS_ENUM = (typeof SEARCH_OPTIONS_PARTNERS)[number]['id']
|
export type SEARCH_OPTIONS_PARTNERS_ENUM = (typeof SEARCH_OPTIONS_PARTNERS)[number]['id']
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 정렬 옵션 목록
|
|
||||||
*/
|
|
||||||
export type SORT_OPTIONS_ENUM = 'created' | 'updated'
|
export type SORT_OPTIONS_ENUM = 'created' | 'updated'
|
||||||
|
|
||||||
type SurveyFilterState = {
|
type SurveyFilterState = {
|
||||||
@ -95,22 +72,6 @@ type SurveyFilterState = {
|
|||||||
reset: () => void
|
reset: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 검색 조건 관리
|
|
||||||
*
|
|
||||||
* @param {string} keyword 검색어
|
|
||||||
* @param {SEARCH_OPTIONS_ENUM | SEARCH_OPTIONS_PARTNERS_ENUM} searchOption 검색 옵션
|
|
||||||
* @param {string | null} isMySurvey 내 조사 매물 여부
|
|
||||||
* @param {SORT_OPTIONS_ENUM} sort 정렬 옵션
|
|
||||||
* @param {number} offset 페이지 오프셋
|
|
||||||
*
|
|
||||||
* @param {Function} setKeyword 검색어 설정 함수
|
|
||||||
* @param {Function} setSearchOption 검색 옵션 설정 함수
|
|
||||||
* @param {Function} setIsMySurvey 내 조사 매물 여부 설정 함수
|
|
||||||
* @param {Function} setSort 정렬 옵션 설정 함수
|
|
||||||
* @param {Function} setOffset 페이지 오프셋 설정 함수
|
|
||||||
* @param {Function} reset 필터 초기화 함수
|
|
||||||
*/
|
|
||||||
export const useSurveyFilterStore = create<SurveyFilterState>((set) => ({
|
export const useSurveyFilterStore = create<SurveyFilterState>((set) => ({
|
||||||
keyword: '',
|
keyword: '',
|
||||||
searchOption: 'all',
|
searchOption: 'all',
|
||||||
|
|||||||
26
src/store/surveySaleTabState.ts
Normal file
26
src/store/surveySaleTabState.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { create } from 'zustand'
|
||||||
|
|
||||||
|
type SurveySaleTabState = {
|
||||||
|
basicInfoSelected: boolean
|
||||||
|
roofInfoSelected: boolean
|
||||||
|
setBasicInfoSelected: () => void
|
||||||
|
setRoofInfoSelected: () => void
|
||||||
|
reset: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
type InitialState = {
|
||||||
|
basicInfoSelected: boolean
|
||||||
|
roofInfoSelected: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const initialState: InitialState = {
|
||||||
|
basicInfoSelected: true,
|
||||||
|
roofInfoSelected: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useSurveySaleTabState = create<SurveySaleTabState>((set) => ({
|
||||||
|
...initialState,
|
||||||
|
setBasicInfoSelected: () => set((state) => ({ ...state, basicInfoSelected: true, roofInfoSelected: false })),
|
||||||
|
setRoofInfoSelected: () => set((state) => ({ ...state, basicInfoSelected: false, roofInfoSelected: true })),
|
||||||
|
reset: () => set(initialState),
|
||||||
|
}))
|
||||||
@ -1,190 +1,94 @@
|
|||||||
/**
|
|
||||||
* @description 문의 목록 요청 파라미터 타입
|
|
||||||
*/
|
|
||||||
export type InquiryListRequest = {
|
export type InquiryListRequest = {
|
||||||
/* 회사 코드 */
|
compCd: string //company code
|
||||||
compCd: string
|
langCd: string //language code
|
||||||
/* 언어 코드 */
|
storeId: string //store id
|
||||||
langCd: string
|
siteTpCd: string //site type code (QC: QCast, QR: QRead)
|
||||||
/* 판매점 ID */
|
schTitle: string | null //search title
|
||||||
storeId: string
|
schRegId: string | null //search regId
|
||||||
/* 사이트 유형 코드 */
|
schFromDt: string | null //search start date
|
||||||
siteTpCd: string
|
schToDt: string | null //search end date
|
||||||
/* 검색 제목 */
|
schAnswerYn: string | null //search answer yn
|
||||||
schTitle: string | null
|
loginId: string //login id
|
||||||
/* 검색 등록자 ID */
|
|
||||||
schRegId: string | null
|
|
||||||
/* 검색 시작 일자 */
|
|
||||||
schFromDt: string | null
|
|
||||||
/* 검색 종료 일자 */
|
|
||||||
schToDt: string | null
|
|
||||||
/* 검색 답변 여부 */
|
|
||||||
schAnswerYn: string | null
|
|
||||||
/* 로그인 ID */
|
|
||||||
loginId: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 목록 응답 타입
|
|
||||||
*/
|
|
||||||
export type InquiryList = {
|
export type InquiryList = {
|
||||||
/* 총 건수 */
|
totCnt: number //total count
|
||||||
totCnt: number
|
rowNumber: number //row number
|
||||||
/* 행 번호 */
|
compCd: string //company code
|
||||||
rowNumber: number
|
qnaNo: number //qna number
|
||||||
/* 회사 코드 */
|
qstTitle: string //title
|
||||||
compCd: string
|
regDt: string //registration date
|
||||||
/* 문의 번호 */
|
regId: string //registration Userid
|
||||||
qnaNo: number
|
regNm: string //registration User name
|
||||||
/* 문의 제목 */
|
answerYn: string //answer yn - Y / N
|
||||||
qstTitle: string
|
attachYn: string | null //attach yn - Y / N
|
||||||
/* 문의 등록 일자 */
|
qnaClsLrgCd: string //qna CLS large Code
|
||||||
regDt: string
|
qnaClsMidCd: string //qna CLS Mid Code
|
||||||
/* 문의 등록자 이메일 */
|
qnaClsSmlCd: string | null //qna CLS Small Code
|
||||||
regEmail: string
|
regUserNm: string //registration User name
|
||||||
/* 문의 등록자 ID */
|
|
||||||
regId: string
|
|
||||||
/* 문의 등록자 이름 */
|
|
||||||
regNm: string
|
|
||||||
/* 답변 여부 */
|
|
||||||
answerYn: string
|
|
||||||
/* 첨부 여부 */
|
|
||||||
attachYn: string | null
|
|
||||||
/* 문의 대분류 코드 */
|
|
||||||
qnaClsLrgCd: string
|
|
||||||
/* 문의 중분류 코드 */
|
|
||||||
qnaClsMidCd: string
|
|
||||||
/* 문의 소분류 코드 */
|
|
||||||
qnaClsSmlCd: string | null
|
|
||||||
/* 문의 등록자 이름 */
|
|
||||||
regUserNm: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 상세 조회 요청 파라미터 타입
|
|
||||||
*/
|
|
||||||
export type InquiryDetailRequest = {
|
export type InquiryDetailRequest = {
|
||||||
/* 회사 코드 */
|
compCd: string //company code
|
||||||
compCd: string
|
langCd: string //language code
|
||||||
/* 언어 코드 */
|
qnaNo: number //qna number
|
||||||
langCd: string
|
loginId: string //login id
|
||||||
/* 문의 번호 */
|
|
||||||
qnaNo: number
|
|
||||||
/* 로그인 ID */
|
|
||||||
loginId: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 상세 조회 응답 타입
|
|
||||||
*/
|
|
||||||
export type Inquiry = {
|
export type Inquiry = {
|
||||||
/* 회사 코드 */
|
compCd: string //company code
|
||||||
compCd: string
|
qnaNo: number //qna number
|
||||||
/* 문의 번호 */
|
qstTitle: string //title
|
||||||
qnaNo: number
|
qstContents: string //content
|
||||||
/* 문의 제목 */
|
regDt: string //registration date
|
||||||
qstTitle: string
|
regId: string //registration Userid
|
||||||
/* 문의 내용 */
|
regNm: string //registration User name
|
||||||
qstContents: string
|
regEmail: string //registration User email
|
||||||
/* 문의 등록 일자 */
|
answerYn: string //answer yn - Y / N
|
||||||
regDt: string
|
ansContents: string | null //answer content
|
||||||
/* 문의 등록자 ID */
|
ansRegDt: string | null //answer registration date
|
||||||
regId: string
|
ansRegNm: string | null //answer registration User name
|
||||||
/* 문의 등록자 이름 */
|
storeId: string | null //store id
|
||||||
regNm: string
|
storeNm: string | null //store name
|
||||||
/* 문의 등록자 이메일 */
|
regUserNm: string //registration User name
|
||||||
regEmail: string
|
regUserTelNo: string | null //registration User tel number
|
||||||
/* 답변 여부 */
|
qnaClsLrgCd: string //qna CLS large Code
|
||||||
answerYn: string
|
qnaClsMidCd: string //qna CLS Mid Code
|
||||||
/* 답변 내용 */
|
qnaClsSmlCd: string | null //qna CLS Small Code
|
||||||
ansContents: string | null
|
listFile: listFile[] | null //Question list file
|
||||||
/* 답변 등록 일자 */
|
ansListFile: listFile[] | null //Answer list file
|
||||||
ansRegDt: string | null
|
|
||||||
/* 답변 등록자 이름 */
|
|
||||||
ansRegNm: string | null
|
|
||||||
/* 판매점 ID */
|
|
||||||
storeId: string | null
|
|
||||||
/* 판매점 이름 */
|
|
||||||
storeNm: string | null
|
|
||||||
/* 문의 등록자 이름 */
|
|
||||||
regUserNm: string
|
|
||||||
/* 문의 등록자 전화번호 */
|
|
||||||
regUserTelNo: string | null
|
|
||||||
/* 문의 대분류 코드 */
|
|
||||||
qnaClsLrgCd: string
|
|
||||||
/* 문의 중분류 코드 */
|
|
||||||
qnaClsMidCd: string
|
|
||||||
/* 문의 소분류 코드 */
|
|
||||||
qnaClsSmlCd: string | null
|
|
||||||
/* 문의 첨부 파일 */
|
|
||||||
listFile: listFile[] | null
|
|
||||||
/* 답변 첨부 파일 */
|
|
||||||
ansListFile: listFile[] | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 첨부 파일 타입
|
|
||||||
*/
|
|
||||||
export type listFile = {
|
export type listFile = {
|
||||||
/* 파일 번호 */
|
fileNo: number //file number
|
||||||
fileNo: number
|
encodeFileNo: string //encode file number
|
||||||
/* 인코딩 파일 번호 */
|
srcFileNm: string //source file name
|
||||||
encodeFileNo: string
|
fileCours: string //file course
|
||||||
/* 소스 파일 이름 */
|
fileSize: number //file size(Byte)
|
||||||
srcFileNm: string
|
regDt: string //registration date
|
||||||
/* 파일 코스 */
|
|
||||||
fileCours: string
|
|
||||||
/* 파일 크기 */
|
|
||||||
fileSize: number
|
|
||||||
/* 등록 일자 */
|
|
||||||
regDt: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 등록 요청 파라미터 타입
|
|
||||||
*/
|
|
||||||
export type InquiryRequest = {
|
export type InquiryRequest = {
|
||||||
/* 회사 코드 */
|
compCd: string //company code
|
||||||
compCd: string
|
siteTpCd: string //site type code(QC: QCast, QR: QRead)
|
||||||
/* 사이트 유형 코드 */
|
qnaClsLrgCd: string //qna CLS large Code
|
||||||
siteTpCd: string
|
qnaClsMidCd: string //qna CLS Mid Code
|
||||||
/* 문의 대분류 코드 */
|
qnaClsSmlCd: string | null //qna CLS Small Code
|
||||||
qnaClsLrgCd: string
|
title: string //title
|
||||||
/* 문의 중분류 코드 */
|
contents: string //contents
|
||||||
qnaClsMidCd: string
|
regId: string //registration Userid
|
||||||
/* 문의 소분류 코드 */
|
storeId: string //store id
|
||||||
qnaClsSmlCd: string | null
|
regUserNm: string //registration User name
|
||||||
/* 문의 제목 */
|
regUserTelNo: string | null //registration User tel number
|
||||||
title: string
|
qstMail: string //mail
|
||||||
/* 문의 내용 */
|
|
||||||
contents: string
|
|
||||||
/* 문의 등록자 ID */
|
|
||||||
regId: string
|
|
||||||
/* 판매점 ID */
|
|
||||||
storeId: string
|
|
||||||
/* 문의 등록자 이름 */
|
|
||||||
regUserNm: string
|
|
||||||
/* 문의 등록자 전화번호 */
|
|
||||||
regUserTelNo: string | null
|
|
||||||
/* 문의 이메일 */
|
|
||||||
qstMail: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 문의 등록 응답 타입
|
|
||||||
*/
|
|
||||||
export type InquirySaveResponse = {
|
export type InquirySaveResponse = {
|
||||||
/* 건수 */
|
cnt: number | null //count
|
||||||
cnt: number | null
|
qnaNo: number //qna number
|
||||||
/* 문의 번호 */
|
mailYn: string //mail yn - Y / N
|
||||||
qnaNo: number
|
|
||||||
/* 메일 여부 */
|
|
||||||
mailYn: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 공통 코드 타입
|
|
||||||
*/
|
|
||||||
export type CommonCode = {
|
export type CommonCode = {
|
||||||
headCd: string
|
headCd: string
|
||||||
code: string
|
code: string
|
||||||
|
|||||||
@ -1,303 +1,148 @@
|
|||||||
/**
|
|
||||||
* @description 조사 매물 타입
|
|
||||||
*/
|
|
||||||
export type SurveyBasicInfo = {
|
export type SurveyBasicInfo = {
|
||||||
/* 조사 매물 ID */
|
|
||||||
id: number
|
id: number
|
||||||
/* 담당자명 */
|
|
||||||
representative: string
|
representative: string
|
||||||
/* 담당자 ID */
|
|
||||||
representativeId: string | null
|
representativeId: string | null
|
||||||
/* 판매점명 */
|
|
||||||
store: string | null
|
store: string | null
|
||||||
/* 판매점 ID */
|
|
||||||
storeId: string | null
|
storeId: string | null
|
||||||
/* 시공점명 */
|
|
||||||
constructionPoint: string | null
|
constructionPoint: string | null
|
||||||
/* 시공점 ID */
|
|
||||||
constructionPointId: string | null
|
constructionPointId: string | null
|
||||||
/* 조사 일자 */
|
|
||||||
investigationDate: string | null
|
investigationDate: string | null
|
||||||
/* 건물 이름 */
|
|
||||||
buildingName: string | null
|
buildingName: string | null
|
||||||
/* 고객명 */
|
|
||||||
customerName: string | null
|
customerName: string | null
|
||||||
/* 우편번호 */
|
|
||||||
postCode: string | null
|
postCode: string | null
|
||||||
/* 주소 (도도부현) */
|
|
||||||
address: string | null
|
address: string | null
|
||||||
/* 상세 주소 */
|
|
||||||
addressDetail: string | null
|
addressDetail: string | null
|
||||||
/* 제출 상태 */
|
|
||||||
submissionStatus: boolean
|
submissionStatus: boolean
|
||||||
/* 제출 일시 */
|
|
||||||
submissionDate: string | null
|
submissionDate: string | null
|
||||||
/* 조사 매물 상세 데이터 */
|
|
||||||
detailInfo: SurveyDetailInfo | null
|
detailInfo: SurveyDetailInfo | null
|
||||||
/* 등록 일시 */
|
|
||||||
regDt: Date
|
regDt: Date
|
||||||
/* 수정 일시 */
|
|
||||||
uptDt: Date
|
uptDt: Date
|
||||||
/* 제출 대상 판매점 ID */
|
|
||||||
submissionTargetId: string | null
|
submissionTargetId: string | null
|
||||||
/* 제출 대상 판매점명 */
|
|
||||||
submissionTargetNm: string | null
|
submissionTargetNm: string | null
|
||||||
/* 일련번호 */
|
srlNo: string | null //판매점IDyyMMdd000
|
||||||
srlNo: string | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 상세 타입
|
|
||||||
*/
|
|
||||||
export type SurveyDetailInfo = {
|
export type SurveyDetailInfo = {
|
||||||
/* 조사 매물 상세 ID */
|
|
||||||
id: number
|
id: number
|
||||||
/* 조사 매물 기본 데이터 ID */
|
|
||||||
basicInfoId: number
|
basicInfoId: number
|
||||||
/* 전기계약 용량 */
|
|
||||||
contractCapacity: string | null
|
contractCapacity: string | null
|
||||||
/* 전기 소매 회사 */
|
|
||||||
retailCompany: string | null
|
retailCompany: string | null
|
||||||
/* 전기 부대 설비 */
|
|
||||||
supplementaryFacilities: string | null // number 배열
|
supplementaryFacilities: string | null // number 배열
|
||||||
/* 전기 부대 설비 기타 */
|
|
||||||
supplementaryFacilitiesEtc: string | null
|
supplementaryFacilitiesEtc: string | null
|
||||||
/* 설치 희망 시스템 */
|
|
||||||
installationSystem: string | null
|
installationSystem: string | null
|
||||||
/* 설치 희망 시스템 기타 */
|
|
||||||
installationSystemEtc: string | null
|
installationSystemEtc: string | null
|
||||||
/* 건축 년도 */
|
|
||||||
constructionYear: string | null
|
constructionYear: string | null
|
||||||
/* 건축 년도 기타 */
|
|
||||||
constructionYearEtc: string | null
|
constructionYearEtc: string | null
|
||||||
/* 지붕재 - 다중 선택 가능 [number]*/
|
roofMaterial: string | null // number 배열
|
||||||
roofMaterial: string | null
|
|
||||||
/* 지붕재 기타 */
|
|
||||||
roofMaterialEtc: string | null
|
roofMaterialEtc: string | null
|
||||||
/* 지붕모양 */
|
|
||||||
roofShape: string | null
|
roofShape: string | null
|
||||||
/* 지붕모양 기타 */
|
|
||||||
roofShapeEtc: string | null
|
roofShapeEtc: string | null
|
||||||
/* 지붕 경사 */
|
|
||||||
roofSlope: string | null
|
roofSlope: string | null
|
||||||
/* 주택 구조 */
|
|
||||||
houseStructure: string | null
|
houseStructure: string | null
|
||||||
/* 주택 구조 기타 */
|
|
||||||
houseStructureEtc: string | null
|
houseStructureEtc: string | null
|
||||||
/* 서까래 재질*/
|
|
||||||
rafterMaterial: string | null
|
rafterMaterial: string | null
|
||||||
/* 서까래 재질 기타 */
|
|
||||||
rafterMaterialEtc: string | null
|
rafterMaterialEtc: string | null
|
||||||
/* 서까래 크기 */
|
|
||||||
rafterSize: string | null
|
rafterSize: string | null
|
||||||
/* 서까래 크기 기타 */
|
|
||||||
rafterSizeEtc: string | null
|
rafterSizeEtc: string | null
|
||||||
/* 서까래 피치 */
|
|
||||||
rafterPitch: string | null
|
rafterPitch: string | null
|
||||||
/* 서까래 피치 기타 */
|
|
||||||
rafterPitchEtc: string | null
|
rafterPitchEtc: string | null
|
||||||
/* 서까래 방향 */
|
|
||||||
rafterDirection: string | null
|
rafterDirection: string | null
|
||||||
/* 노지판의 종류 */
|
|
||||||
openFieldPlateKind: string | null
|
openFieldPlateKind: string | null
|
||||||
/* 노지판의 종류 기타 */
|
|
||||||
openFieldPlateKindEtc: string | null
|
openFieldPlateKindEtc: string | null
|
||||||
/* 노지판의 두께 */
|
|
||||||
openFieldPlateThickness: string | null
|
openFieldPlateThickness: string | null
|
||||||
/* 누수 흔적 */
|
|
||||||
leakTrace: boolean | null
|
leakTrace: boolean | null
|
||||||
/* 방수재 종류*/
|
|
||||||
waterproofMaterial: string | null
|
waterproofMaterial: string | null
|
||||||
/* 방수재 종류 기타 */
|
|
||||||
waterproofMaterialEtc: string | null
|
waterproofMaterialEtc: string | null
|
||||||
/* 단열재 유무 */
|
|
||||||
insulationPresence: string | null
|
insulationPresence: string | null
|
||||||
/* 단열재 유무 기타 */
|
|
||||||
insulationPresenceEtc: string | null
|
insulationPresenceEtc: string | null
|
||||||
/* 지붕 구조의 순서*/
|
|
||||||
structureOrder: string | null
|
structureOrder: string | null
|
||||||
/* 지붕 구조의 순서 기타 */
|
|
||||||
structureOrderEtc: string | null
|
structureOrderEtc: string | null
|
||||||
/* 지붕 제품명 설치 가능 여부 확인*/
|
|
||||||
installationAvailability: string | null
|
installationAvailability: string | null
|
||||||
/* 지붕 제품명 설치 가능 여부 확인 기타 */
|
|
||||||
installationAvailabilityEtc: string | null
|
installationAvailabilityEtc: string | null
|
||||||
/* 메모 */
|
|
||||||
memo: string | null
|
memo: string | null
|
||||||
/* 등록 일시 */
|
|
||||||
regDt: Date
|
regDt: Date
|
||||||
/* 수정 일시 */
|
|
||||||
uptDt: Date
|
uptDt: Date
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 생성 요청 파라미터 타입
|
|
||||||
*/
|
|
||||||
export type SurveyBasicRequest = {
|
export type SurveyBasicRequest = {
|
||||||
/* 담당자명 */
|
|
||||||
representative: string
|
representative: string
|
||||||
/* 담당자 ID */
|
|
||||||
representativeId: string | null
|
representativeId: string | null
|
||||||
/* 판매점명 */
|
|
||||||
store: string | null
|
store: string | null
|
||||||
/* 판매점 ID */
|
|
||||||
storeId: string | null
|
storeId: string | null
|
||||||
/* 시공점명 */
|
|
||||||
constructionPoint: string | null
|
constructionPoint: string | null
|
||||||
/* 시공점 ID */
|
|
||||||
constructionPointId: string | null
|
constructionPointId: string | null
|
||||||
/* 조사 일자 */
|
|
||||||
investigationDate: string | null
|
investigationDate: string | null
|
||||||
/* 건물 이름 */
|
|
||||||
buildingName: string | null
|
buildingName: string | null
|
||||||
/* 고객명 */
|
|
||||||
customerName: string | null
|
customerName: string | null
|
||||||
/* 우편번호 */
|
|
||||||
postCode: string | null
|
postCode: string | null
|
||||||
/* 주소 (도도부현) */
|
|
||||||
address: string | null
|
address: string | null
|
||||||
/* 상세 주소 */
|
|
||||||
addressDetail: string | null
|
addressDetail: string | null
|
||||||
/* 제출 상태 */
|
|
||||||
submissionStatus: boolean
|
submissionStatus: boolean
|
||||||
/* 제출 일시 */
|
|
||||||
submissionDate: string | null
|
submissionDate: string | null
|
||||||
/* 제출 대상 판매점 ID */
|
|
||||||
submissionTargetId: string | null
|
submissionTargetId: string | null
|
||||||
/* 제출 대상 판매점명 */
|
|
||||||
submissionTargetNm: string | null
|
submissionTargetNm: string | null
|
||||||
/* 일련번호 */
|
srlNo: string | null //판매점IDyyMMdd000
|
||||||
srlNo: string | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 조사 매물 상세 요청 파라미터 타입
|
|
||||||
*/
|
|
||||||
export type SurveyDetailRequest = {
|
export type SurveyDetailRequest = {
|
||||||
/* 전기계약 용량 */
|
|
||||||
contractCapacity: string | null
|
contractCapacity: string | null
|
||||||
/* 전기 소매 회사 */
|
|
||||||
retailCompany: string | null
|
retailCompany: string | null
|
||||||
/* 전기 부대 설비 */
|
|
||||||
supplementaryFacilities: string | null // number 배열
|
supplementaryFacilities: string | null // number 배열
|
||||||
/* 전기 부대 설비 기타 */
|
|
||||||
supplementaryFacilitiesEtc: string | null
|
supplementaryFacilitiesEtc: string | null
|
||||||
/* 설치 희망 시스템 */
|
|
||||||
installationSystem: string | null
|
installationSystem: string | null
|
||||||
/* 설치 희망 시스템 기타 */
|
|
||||||
installationSystemEtc: string | null
|
installationSystemEtc: string | null
|
||||||
/* 건축 년도 */
|
|
||||||
constructionYear: string | null
|
constructionYear: string | null
|
||||||
/* 건축 년도 기타 */
|
|
||||||
constructionYearEtc: string | null
|
constructionYearEtc: string | null
|
||||||
/* 지붕재 - 다중 선택 가능 [number]*/
|
roofMaterial: string | null // number 배열
|
||||||
roofMaterial: string | null
|
|
||||||
/* 지붕재 기타 */
|
|
||||||
roofMaterialEtc: string | null
|
roofMaterialEtc: string | null
|
||||||
/* 지붕모양 */
|
|
||||||
roofShape: string | null
|
roofShape: string | null
|
||||||
/* 지붕모양 기타 */
|
|
||||||
roofShapeEtc: string | null
|
roofShapeEtc: string | null
|
||||||
/* 지붕 경사 */
|
|
||||||
roofSlope: string | null
|
roofSlope: string | null
|
||||||
/* 주택 구조 */
|
|
||||||
houseStructure: string | null
|
houseStructure: string | null
|
||||||
/* 주택 구조 기타 */
|
|
||||||
houseStructureEtc: string | null
|
houseStructureEtc: string | null
|
||||||
/* 서까래 재질*/
|
|
||||||
rafterMaterial: string | null
|
rafterMaterial: string | null
|
||||||
/* 서까래 재질 기타 */
|
|
||||||
rafterMaterialEtc: string | null
|
rafterMaterialEtc: string | null
|
||||||
/* 서까래 크기 */
|
|
||||||
rafterSize: string | null
|
rafterSize: string | null
|
||||||
/* 서까래 크기 기타 */
|
|
||||||
rafterSizeEtc: string | null
|
rafterSizeEtc: string | null
|
||||||
/* 서까래 피치 */
|
|
||||||
rafterPitch: string | null
|
rafterPitch: string | null
|
||||||
/* 서까래 피치 기타 */
|
|
||||||
rafterPitchEtc: string | null
|
rafterPitchEtc: string | null
|
||||||
/* 서까래 방향 */
|
|
||||||
rafterDirection: string | null
|
rafterDirection: string | null
|
||||||
/* 노지판의 종류 */
|
|
||||||
openFieldPlateKind: string | null
|
openFieldPlateKind: string | null
|
||||||
/* 노지판의 종류 기타 */
|
|
||||||
openFieldPlateKindEtc: string | null
|
openFieldPlateKindEtc: string | null
|
||||||
/* 노지판의 두께 */
|
|
||||||
openFieldPlateThickness: string | null
|
openFieldPlateThickness: string | null
|
||||||
/* 누수 흔적 */
|
|
||||||
leakTrace: boolean | null
|
leakTrace: boolean | null
|
||||||
/* 방수재 종류*/
|
|
||||||
waterproofMaterial: string | null
|
waterproofMaterial: string | null
|
||||||
/* 방수재 종류 기타 */
|
|
||||||
waterproofMaterialEtc: string | null
|
waterproofMaterialEtc: string | null
|
||||||
/* 단열재 유무 */
|
|
||||||
insulationPresence: string | null
|
insulationPresence: string | null
|
||||||
/* 단열재 유무 기타 */
|
|
||||||
insulationPresenceEtc: string | null
|
insulationPresenceEtc: string | null
|
||||||
/* 지붕 구조의 순서*/
|
|
||||||
structureOrder: string | null
|
structureOrder: string | null
|
||||||
/* 지붕 구조의 순서 기타 */
|
|
||||||
structureOrderEtc: string | null
|
structureOrderEtc: string | null
|
||||||
/* 지붕 제품명 설치 가능 여부 확인*/
|
|
||||||
installationAvailability: string | null
|
installationAvailability: string | null
|
||||||
/* 지붕 제품명 설치 가능 여부 확인 기타 */
|
|
||||||
installationAvailabilityEtc: string | null
|
installationAvailabilityEtc: string | null
|
||||||
/* 메모 */
|
|
||||||
memo: string | null
|
memo: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export type SurveyDetailCoverRequest = {
|
||||||
* @description 조사 매물 등록 요청 파라미터 타입
|
detailInfo: SurveyDetailRequest
|
||||||
*/
|
}
|
||||||
|
|
||||||
export type SurveyRegistRequest = {
|
export type SurveyRegistRequest = {
|
||||||
/* 담당자명 */
|
|
||||||
representative: string
|
representative: string
|
||||||
/* 담당자 ID */
|
|
||||||
representativeId: string | null
|
representativeId: string | null
|
||||||
/* 판매점명 */
|
|
||||||
store: string | null
|
store: string | null
|
||||||
/* 판매점 ID */
|
|
||||||
storeId: string | null
|
storeId: string | null
|
||||||
/* 시공점명 */
|
|
||||||
constructionPoint: string | null
|
constructionPoint: string | null
|
||||||
/* 조사 일자 */
|
|
||||||
investigationDate: string | null
|
investigationDate: string | null
|
||||||
/* 건물 이름 */
|
|
||||||
buildingName: string | null
|
buildingName: string | null
|
||||||
/* 고객명 */
|
|
||||||
customerName: string | null
|
customerName: string | null
|
||||||
/* 우편번호 */
|
|
||||||
postCode: string | null
|
postCode: string | null
|
||||||
/* 주소 (도도부현) */
|
|
||||||
address: string | null
|
address: string | null
|
||||||
/* 상세 주소 */
|
|
||||||
addressDetail: string | null
|
addressDetail: string | null
|
||||||
/* 제출 상태 */
|
|
||||||
submissionStatus: boolean
|
submissionStatus: boolean
|
||||||
/* 제출 일시 */
|
|
||||||
submissionDate: string | null
|
submissionDate: string | null
|
||||||
/* 조사 매물 상세 데이터 */
|
|
||||||
detailInfo: SurveyDetailRequest | null
|
detailInfo: SurveyDetailRequest | null
|
||||||
/* 제출 대상 판매점 ID */
|
|
||||||
submissionTargetId: string | null
|
submissionTargetId: string | null
|
||||||
/* 일련번호 */
|
srlNo: string | null //판매점IDyyMMdd000
|
||||||
srlNo: string | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export type Mode = 'CREATE' | 'EDIT' | 'READ' | 'TEMP' // 등록 | 수정 | 상세 | 임시저장
|
||||||
* @description 조사 매물 페이지 모드
|
|
||||||
*/
|
|
||||||
export type Mode = 'CREATE' | 'EDIT' | 'READ' | 'SUBMIT'
|
|
||||||
|
|
||||||
export type SubmitTargetResponse = {
|
|
||||||
/* 제출 대상 판매점 ID */
|
|
||||||
targetStoreId: string
|
|
||||||
/* 제출 대상 판매점명 */
|
|
||||||
targetStoreNm: string
|
|
||||||
/* 담당자 ID */
|
|
||||||
repUserId: string
|
|
||||||
/* 담당자 이메일 */
|
|
||||||
repUserEmail: string
|
|
||||||
/* 권한 */
|
|
||||||
auth: string
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user