Compare commits
14 Commits
f06b7cf0ac
...
8c91bd605c
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c91bd605c | |||
| f5022ab423 | |||
| 39056cf35f | |||
| 762ce60e13 | |||
| c62414e619 | |||
| a9ef91a430 | |||
| 85344afd43 | |||
| 1db17d6558 | |||
| a23c4cdfd9 | |||
| 5feef03187 | |||
| afb67c6b36 | |||
| 9eea0bcc58 | |||
| 3ff43475ac | |||
| 69571e86b8 |
@ -9,7 +9,8 @@ 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,7 +9,8 @@ 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=
|
||||||
|
|
||||||
|
|||||||
9
package-lock.json
generated
9
package-lock.json
generated
@ -14,7 +14,6 @@
|
|||||||
"@tanstack/react-query-devtools": "^5.71.0",
|
"@tanstack/react-query-devtools": "^5.71.0",
|
||||||
"@types/nodemailer": "^6.4.17",
|
"@types/nodemailer": "^6.4.17",
|
||||||
"axios": "^1.8.4",
|
"axios": "^1.8.4",
|
||||||
"crypto-js": "^4.2.0",
|
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"iron-session": "^8.0.4",
|
"iron-session": "^8.0.4",
|
||||||
"lucide": "^0.503.0",
|
"lucide": "^0.503.0",
|
||||||
@ -33,7 +32,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
"@types/crypto-js": "^4.2.2",
|
|
||||||
"@types/mysql": "^2.15.27",
|
"@types/mysql": "^2.15.27",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
@ -2142,13 +2140,6 @@
|
|||||||
"integrity": "sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ==",
|
"integrity": "sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/crypto-js": {
|
|
||||||
"version": "4.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.2.tgz",
|
|
||||||
"integrity": "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@types/mysql": {
|
"node_modules/@types/mysql": {
|
||||||
"version": "2.15.27",
|
"version": "2.15.27",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.27.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mysql/-/mysql-2.15.27.tgz",
|
||||||
|
|||||||
@ -21,7 +21,6 @@
|
|||||||
"@tanstack/react-query-devtools": "^5.71.0",
|
"@tanstack/react-query-devtools": "^5.71.0",
|
||||||
"@types/nodemailer": "^6.4.17",
|
"@types/nodemailer": "^6.4.17",
|
||||||
"axios": "^1.8.4",
|
"axios": "^1.8.4",
|
||||||
"crypto-js": "^4.2.0",
|
|
||||||
"env-cmd": "^10.1.0",
|
"env-cmd": "^10.1.0",
|
||||||
"iron-session": "^8.0.4",
|
"iron-session": "^8.0.4",
|
||||||
"lucide": "^0.503.0",
|
"lucide": "^0.503.0",
|
||||||
@ -40,7 +39,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/postcss": "^4",
|
"@tailwindcss/postcss": "^4",
|
||||||
"@types/crypto-js": "^4.2.2",
|
|
||||||
"@types/mysql": "^2.15.27",
|
"@types/mysql": "^2.15.27",
|
||||||
"@types/node": "^20",
|
"@types/node": "^20",
|
||||||
"@types/react": "^19",
|
"@types/react": "^19",
|
||||||
|
|||||||
@ -13,7 +13,6 @@ 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)
|
||||||
@ -23,11 +22,12 @@ 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,3 +179,304 @@ 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")
|
||||||
|
}
|
||||||
|
|||||||
42
src/app/api/submission/admin-sub/route.ts
Normal file
42
src/app/api/submission/admin-sub/route.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
46
src/app/api/submission/admin/route.ts
Normal file
46
src/app/api/submission/admin/route.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/app/api/submission/builder/route.ts
Normal file
48
src/app/api/submission/builder/route.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/app/api/submission/super/route.ts
Normal file
39
src/app/api/submission/super/route.ts
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
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 })
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -65,9 +65,11 @@ export async function GET(request: NextRequest) {
|
|||||||
|
|
||||||
const suitable: Suitable[] = await prisma.$queryRawUnsafe(query, pageNumber, itemPerPage)
|
const suitable: Suitable[] = await prisma.$queryRawUnsafe(query, pageNumber, itemPerPage)
|
||||||
|
|
||||||
// console.log(`검색 조건 :::: 카테고리: ${category}, 키워드: ${keyword}`)
|
return NextResponse.json(suitable, {
|
||||||
|
headers: {
|
||||||
return NextResponse.json(suitable)
|
'spinner-state': 'true',
|
||||||
|
},
|
||||||
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
console.error('❌ 데이터 조회 중 오류가 발생했습니다:', error)
|
||||||
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
return NextResponse.json({ error: '데이터 조회 중 오류가 발생했습니다' }, { status: 500 })
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import SuitableDownloadPdf from '@/components/pdf/SuitableDownloadPdf'
|
|
||||||
|
|
||||||
export default function page() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<SuitableDownloadPdf />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,132 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from 'react'
|
|
||||||
import generatePDF, { Margin, Options, Resolution, usePDF } from 'react-to-pdf'
|
|
||||||
import { useSuitable } from '@/hooks/useSuitable'
|
|
||||||
import { useSuitableStore } from '@/store/useSuitableStore'
|
|
||||||
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
|
||||||
|
|
||||||
export default function SuitableDownloadPdf() {
|
|
||||||
const [fileName, setFileName] = useState<string[]>([])
|
|
||||||
const [createTime, setCreateTime] = useState('')
|
|
||||||
const targetRef = useRef<HTMLDivElement>(null)
|
|
||||||
const { toCodeName, toSuitableDetail, selectedSuitables, isSelectedSuitablesLoading } = useSuitable()
|
|
||||||
const { selectedCategory, suitableCommCode, selectedItemsSearching, setSelectedItemsSearching } = useSuitableStore()
|
|
||||||
|
|
||||||
const handleDownPdf = () => {
|
|
||||||
const options: Options = {
|
|
||||||
filename: `${fileName.join('_')}.pdf`,
|
|
||||||
method: 'open' as const,
|
|
||||||
resolution: Resolution.HIGH,
|
|
||||||
page: {
|
|
||||||
margin: Margin.SMALL,
|
|
||||||
format: 'A4',
|
|
||||||
orientation: 'landscape' as const,
|
|
||||||
},
|
|
||||||
canvas: {
|
|
||||||
mimeType: 'image/png' as const,
|
|
||||||
qualityRatio: 1,
|
|
||||||
},
|
|
||||||
overrides: {
|
|
||||||
pdf: {
|
|
||||||
compress: true,
|
|
||||||
},
|
|
||||||
canvas: {
|
|
||||||
useCORS: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
generatePDF(targetRef, options)
|
|
||||||
// generatePDF(targetRef, { filename: 'page.pdf' })
|
|
||||||
}
|
|
||||||
|
|
||||||
const formatDateString = () => {
|
|
||||||
const now = new Date()
|
|
||||||
const year = now.getFullYear()
|
|
||||||
const month = now.getMonth() + 1
|
|
||||||
const day = now.getDate()
|
|
||||||
const hours = now.getHours()
|
|
||||||
const minutes = now.getMinutes()
|
|
||||||
|
|
||||||
return `${year}年${month}月${day}日 ${hours}:${minutes.toString().padStart(2, '0')}`
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setCreateTime(formatDateString())
|
|
||||||
setFileName([
|
|
||||||
`(${suitableCommCode.get(SUITABLE_HEAD_CODE.ROOF_MATL_GRP_CD)?.find((category) => category.code === selectedCategory)?.codeJp})`,
|
|
||||||
'屋根材適合表',
|
|
||||||
])
|
|
||||||
if (!selectedItemsSearching) {
|
|
||||||
setSelectedItemsSearching(true)
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
if (!selectedCategory) return <div>잘못된 접근입니다.</div>
|
|
||||||
if (isSelectedSuitablesLoading) return <div>Loading...</div>
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{/* <button onClick={() => handleDownPdf()}>PDFダウンロード</button> */}
|
|
||||||
<div className="pdf-table-wrap" ref={targetRef}>
|
|
||||||
<div className="pdf-intro-page">
|
|
||||||
<div className="pdf-intro-tit-wrap">
|
|
||||||
<div className="pdf-intro-tit mb20">ハンファジャパン株式会社</div>
|
|
||||||
<div className="pdf-intro-tit mb20">{fileName.join(' ')}</div>
|
|
||||||
<div className="pdf-intro-date">{createTime}</div>
|
|
||||||
</div>
|
|
||||||
<div className="pdf-intro-cont-wrap">
|
|
||||||
<p>本適合表は参考資料としてご使用下さい。</p>
|
|
||||||
<p>屋根材製品の形状・仕様はメーカーより変更される場合が御座います。</p>
|
|
||||||
<p>又、現場環境(働き、勾配、瓦桟木条件等)により本適合表と異なる適合結果となる場合が御座います。予めご了承下さい。</p>
|
|
||||||
<p>屋根材以外の設置条件(垂木、野地板等の設置基準)も必ずご確認下さい。</p>
|
|
||||||
</div>
|
|
||||||
<div className="pdf-intro-foot-date">{createTime}</div>
|
|
||||||
</div>
|
|
||||||
<div className="pdf-table-content">
|
|
||||||
<div className="pdf-table-grid-wrap">
|
|
||||||
{selectedSuitables?.map((item: Suitable) => (
|
|
||||||
<div className="pdf-table-card" key={item.id}>
|
|
||||||
<div className="pdf-table-tit-wrap">
|
|
||||||
<span>{item.productName}</span>
|
|
||||||
<span>{toCodeName(SUITABLE_HEAD_CODE.MANU_FT_CD, item.manuFtCd)}</span>
|
|
||||||
<span>{toCodeName(SUITABLE_HEAD_CODE.ROOF_MT_CD, item.roofMtCd)}</span>
|
|
||||||
</div>
|
|
||||||
<div className="pdf-roof-table">
|
|
||||||
<table>
|
|
||||||
<colgroup>
|
|
||||||
<col width={'18%'} />
|
|
||||||
<col width={'23%'} />
|
|
||||||
<col width={'18%'} />
|
|
||||||
<col />
|
|
||||||
</colgroup>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>金具タイプ</th>
|
|
||||||
<th>金具名</th>
|
|
||||||
<th>設置可否</th>
|
|
||||||
<th>備考</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{toSuitableDetail(item.detail).map((subItem: SuitableDetail) => (
|
|
||||||
<tr key={subItem.id}>
|
|
||||||
<td>{toCodeName(SUITABLE_HEAD_CODE.ROOF_SH_CD, item.roofShCd)}</td>
|
|
||||||
<td>{toCodeName(SUITABLE_HEAD_CODE.TRESTLE_MFPC_CD, subItem.trestleMfpcCd)}</td>
|
|
||||||
<td>{subItem.trestleManufacturerProductName}</td>
|
|
||||||
<td>{subItem.memo}</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<div className="pdf-intro-foot-date">{createTime}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -5,17 +5,16 @@ import { useCallback, useEffect, useState } from 'react'
|
|||||||
import SuitableDetailPopupButton from './SuitableDetailPopupButton'
|
import SuitableDetailPopupButton from './SuitableDetailPopupButton'
|
||||||
import { useSuitable } from '@/hooks/useSuitable'
|
import { useSuitable } from '@/hooks/useSuitable'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useSuitableStore } from '@/store/useSuitableStore'
|
|
||||||
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
||||||
|
|
||||||
export default function SuitableDetailPopup() {
|
export default function SuitableDetailPopup() {
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
const { toCodeName, toSuitableDetail, suitableCheckIcon, suitableCheckMemo, selectedSuitables, isSelectedSuitablesLoading } = useSuitable()
|
const { toCodeName, toSuitableDetail, suitableCheckIcon, suitableCheckMemo, getSelectedSuitables } = useSuitable()
|
||||||
const { setSelectedItemsSearching } = useSuitableStore()
|
|
||||||
|
|
||||||
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
||||||
|
const [selectedSuitables, setSelectedSuitables] = useState<Suitable[]>([])
|
||||||
|
|
||||||
// 아이템 열기/닫기
|
/* 아이템 열기/닫기 */
|
||||||
const toggleItemOpen = useCallback((itemId: number) => {
|
const toggleItemOpen = useCallback((itemId: number) => {
|
||||||
setOpenItems((prev) => {
|
setOpenItems((prev) => {
|
||||||
const newOpenItems = new Set(prev)
|
const newOpenItems = new Set(prev)
|
||||||
@ -25,7 +24,9 @@ export default function SuitableDetailPopup() {
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectedItemsSearching(true)
|
getSelectedSuitables().then((res) => {
|
||||||
|
setSelectedSuitables(res)
|
||||||
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -45,10 +46,7 @@ export default function SuitableDetailPopup() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="compliance-check-pop-wrap">
|
<div className="compliance-check-pop-wrap">
|
||||||
{isSelectedSuitablesLoading ? (
|
{selectedSuitables?.map((item: Suitable) => (
|
||||||
<div>Loading...</div>
|
|
||||||
) : (
|
|
||||||
selectedSuitables?.map((item: Suitable) => (
|
|
||||||
<div className={`compliance-check-bx ${openItems.has(item.id) ? 'act' : ''}`} key={item.id}>
|
<div className={`compliance-check-bx ${openItems.has(item.id) ? 'act' : ''}`} key={item.id}>
|
||||||
<div className="check-name-wrap">
|
<div className="check-name-wrap">
|
||||||
<div className="check-name">{item.productName}</div>
|
<div className="check-name">{item.productName}</div>
|
||||||
@ -97,8 +95,7 @@ export default function SuitableDetailPopup() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
))}
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<SuitableDetailPopupButton />
|
<SuitableDetailPopupButton />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -19,6 +19,7 @@ export default function SuitableDetailPopupButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<div className="float-btn-wrap">
|
||||||
<div className="btn-flex-wrap com">
|
<div className="btn-flex-wrap com">
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button className="btn-frame n-blue icon" onClick={handleClosePopup}>
|
<button className="btn-frame n-blue icon" onClick={handleClosePopup}>
|
||||||
@ -36,5 +37,6 @@ export default function SuitableDetailPopupButton() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 } = useSurvey(Number(routeId))
|
const { surveyDetail, getSubmitTarget } = useSurvey(Number(routeId))
|
||||||
|
|
||||||
const [submitData, setSubmitData] = useState<SubmitFormData>({
|
const [submitData, setSubmitData] = useState<SubmitFormData>({
|
||||||
saleBase: null,
|
saleBase: null,
|
||||||
@ -54,11 +54,25 @@ 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 + ')',
|
||||||
})
|
})
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import SuitableButton from './SuitableButton'
|
|||||||
import SuitableNoData from './SuitableNoData'
|
import SuitableNoData from './SuitableNoData'
|
||||||
import { useSuitable } from '@/hooks/useSuitable'
|
import { useSuitable } from '@/hooks/useSuitable'
|
||||||
import { useSuitableStore } from '@/store/useSuitableStore'
|
import { useSuitableStore } from '@/store/useSuitableStore'
|
||||||
|
import { useSpinnerStore } from '@/store/spinnerStore'
|
||||||
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
import { SUITABLE_HEAD_CODE, type Suitable, type SuitableDetail } from '@/types/Suitable'
|
||||||
|
|
||||||
export default function SuitableList() {
|
export default function SuitableList() {
|
||||||
@ -20,11 +21,11 @@ export default function SuitableList() {
|
|||||||
isLoading,
|
isLoading,
|
||||||
suitableCheckIcon,
|
suitableCheckIcon,
|
||||||
} = useSuitable()
|
} = useSuitable()
|
||||||
const { selectedItems, addSelectedItem, removeSelectedItem, setSelectedItemsSearching } = useSuitableStore()
|
const { selectedItems, addSelectedItem, removeSelectedItem } = useSuitableStore()
|
||||||
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
const [openItems, setOpenItems] = useState<Set<number>>(new Set())
|
||||||
const observerTarget = useRef<HTMLDivElement>(null)
|
const observerTarget = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
// 선택된 아이템 확인 - 메인 하위 아이템 indeterminate 확인
|
/* 선택된 아이템 확인 - 메인 하위 아이템 indeterminate 확인 */
|
||||||
const isMainIndeterminate = useMemo(
|
const isMainIndeterminate = useMemo(
|
||||||
() => (mainId: number, detailCnt: number) => {
|
() => (mainId: number, detailCnt: number) => {
|
||||||
const mainItem = selectedItems.get(mainId)
|
const mainItem = selectedItems.get(mainId)
|
||||||
@ -34,7 +35,7 @@ export default function SuitableList() {
|
|||||||
[selectedItems],
|
[selectedItems],
|
||||||
)
|
)
|
||||||
|
|
||||||
// 선택된 아이템 확인
|
/* 선택된 아이템 확인 */
|
||||||
const isItemSelected = useCallback(
|
const isItemSelected = useCallback(
|
||||||
(mainId: number, detailId?: number): boolean => {
|
(mainId: number, detailId?: number): boolean => {
|
||||||
const mainItem = selectedItems.get(mainId)
|
const mainItem = selectedItems.get(mainId)
|
||||||
@ -45,16 +46,15 @@ export default function SuitableList() {
|
|||||||
[selectedItems],
|
[selectedItems],
|
||||||
)
|
)
|
||||||
|
|
||||||
// 아이템 클릭
|
/* 아이템 클릭 */
|
||||||
const handleItemClick = useCallback(
|
const handleItemClick = useCallback(
|
||||||
(mainId: number, detailId?: number, detailIds?: Set<number>): void => {
|
(mainId: number, detailId?: number, detailIds?: Set<number>): void => {
|
||||||
setSelectedItemsSearching(false)
|
|
||||||
isItemSelected(mainId, detailId) ? removeSelectedItem(mainId, detailId) : addSelectedItem(mainId, detailId, detailIds)
|
isItemSelected(mainId, detailId) ? removeSelectedItem(mainId, detailId) : addSelectedItem(mainId, detailId, detailIds)
|
||||||
},
|
},
|
||||||
[isItemSelected, addSelectedItem, removeSelectedItem],
|
[isItemSelected, addSelectedItem, removeSelectedItem],
|
||||||
)
|
)
|
||||||
|
|
||||||
// 아이템 열기/닫기
|
/* 아이템 열기/닫기 */
|
||||||
const toggleItemOpen = useCallback((itemId: number) => {
|
const toggleItemOpen = useCallback((itemId: number) => {
|
||||||
setOpenItems((prev) => {
|
setOpenItems((prev) => {
|
||||||
const newOpenItems = new Set(prev)
|
const newOpenItems = new Set(prev)
|
||||||
@ -63,7 +63,7 @@ export default function SuitableList() {
|
|||||||
})
|
})
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
// 아이템 렌더링
|
/* 아이템 렌더링 */
|
||||||
const renderItem = useCallback(
|
const renderItem = useCallback(
|
||||||
(item: Suitable) => {
|
(item: Suitable) => {
|
||||||
return (
|
return (
|
||||||
@ -115,10 +115,10 @@ export default function SuitableList() {
|
|||||||
[isItemSelected, openItems, handleItemClick, toggleItemOpen, toCodeName, toSuitableDetail],
|
[isItemSelected, openItems, handleItemClick, toggleItemOpen, toCodeName, toSuitableDetail],
|
||||||
)
|
)
|
||||||
|
|
||||||
// 아이템 리스트
|
/* 조회 데이터 리스트 */
|
||||||
const suitableList = useMemo(() => suitables?.pages.flat() ?? [], [suitables?.pages])
|
const suitableList = useMemo(() => suitables?.pages.flat() ?? [], [suitables?.pages])
|
||||||
|
|
||||||
// Intersection Observer 설정
|
/* Intersection Observer 설정 */
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const observer = new IntersectionObserver(
|
const observer = new IntersectionObserver(
|
||||||
(entries) => {
|
(entries) => {
|
||||||
@ -128,7 +128,7 @@ export default function SuitableList() {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
rootMargin: '100px',
|
rootMargin: `${window.innerHeight * 0.2}px`,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -139,15 +139,18 @@ export default function SuitableList() {
|
|||||||
return () => observer.disconnect()
|
return () => observer.disconnect()
|
||||||
}, [hasNextPage, isFetchingNextPage, fetchNextPage])
|
}, [hasNextPage, isFetchingNextPage, fetchNextPage])
|
||||||
|
|
||||||
if (isLoading) return <div>Loading...</div>
|
/* 데이터 로딩 상태 처리 */
|
||||||
|
useEffect(() => {
|
||||||
|
useSpinnerStore.getState().setIsShow(isLoading || isFetchingNextPage)
|
||||||
|
}, [isLoading, isFetchingNextPage])
|
||||||
|
|
||||||
|
/* 조회 데이터 없는 경우 */
|
||||||
if (!suitableList.length) return <SuitableNoData />
|
if (!suitableList.length) return <SuitableNoData />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{suitableList.map(renderItem)}
|
{suitableList.map(renderItem)}
|
||||||
<div ref={observerTarget} className="loading-indicator">
|
<div ref={observerTarget} />
|
||||||
{isFetchingNextPage && <div className="loading-more">데이터를 불러오는 중...</div>}
|
|
||||||
</div>
|
|
||||||
<SuitableButton />
|
<SuitableButton />
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -7,11 +7,12 @@ import type { CommCode } from '@/types/CommCode'
|
|||||||
import { SUITABLE_HEAD_CODE } from '@/types/Suitable'
|
import { SUITABLE_HEAD_CODE } from '@/types/Suitable'
|
||||||
|
|
||||||
export default function SuitableSearch() {
|
export default function SuitableSearch() {
|
||||||
const [searchValue, setSearchValue] = useState('')
|
const [searchValue, setSearchValue] = useState<string>('')
|
||||||
|
|
||||||
const { getSuitableCommCode, clearSuitableStore } = useSuitable()
|
const { getSuitableCommCode, clearSuitableStore } = useSuitable()
|
||||||
const { suitableCommCode, selectedCategory, setSelectedCategory, setSearchKeyword } = useSuitableStore()
|
const { suitableCommCode, searchCategory, setSearchCategory, setSearchKeyword } = useSuitableStore()
|
||||||
|
|
||||||
|
/* 키워드 입력 글자 제한 */
|
||||||
const handleInputChange = (value: string) => {
|
const handleInputChange = (value: string) => {
|
||||||
if (Array.from(value).length > 30) {
|
if (Array.from(value).length > 30) {
|
||||||
alert('検索ワードは最大30文字まで入力できます。')
|
alert('検索ワードは最大30文字まで入力できます。')
|
||||||
@ -21,6 +22,7 @@ export default function SuitableSearch() {
|
|||||||
setSearchValue(value)
|
setSearchValue(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 키워드 검색 */
|
||||||
const handleInputSearch = async () => {
|
const handleInputSearch = async () => {
|
||||||
if (!searchValue.trim()) {
|
if (!searchValue.trim()) {
|
||||||
alert('屋根材の製品名を入力してください。')
|
alert('屋根材の製品名を入力してください。')
|
||||||
@ -29,6 +31,7 @@ export default function SuitableSearch() {
|
|||||||
setSearchKeyword(searchValue)
|
setSearchKeyword(searchValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 키워드 초기화 */
|
||||||
const handleInputClear = () => {
|
const handleInputClear = () => {
|
||||||
setSearchValue('')
|
setSearchValue('')
|
||||||
clearSuitableStore({ items: true, keyword: true })
|
clearSuitableStore({ items: true, keyword: true })
|
||||||
@ -42,7 +45,7 @@ export default function SuitableSearch() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="sale-form-bx">
|
<div className="sale-form-bx">
|
||||||
<select className="select-form" name="" id="" value={selectedCategory || ''} onChange={(e) => setSelectedCategory(e.target.value)}>
|
<select className="select-form" name="" id="" value={searchCategory || ''} onChange={(e) => setSearchCategory(e.target.value)}>
|
||||||
<option value="">屋根材を選択してください.</option>
|
<option value="">屋根材を選択してください.</option>
|
||||||
{suitableCommCode.get(SUITABLE_HEAD_CODE.ROOF_MATL_GRP_CD)?.map((category: CommCode, index: number) => (
|
{suitableCommCode.get(SUITABLE_HEAD_CODE.ROOF_MATL_GRP_CD)?.map((category: CommCode, index: number) => (
|
||||||
<option key={index} value={category.code}>
|
<option key={index} value={category.code}>
|
||||||
|
|||||||
@ -111,7 +111,7 @@ export default function Header() {
|
|||||||
</div>
|
</div>
|
||||||
</SwiperSlide>
|
</SwiperSlide>
|
||||||
<SwiperSlide>
|
<SwiperSlide>
|
||||||
<div className="side-swiper-card">
|
<div className="side-swiper-card" onClick={() => router.push('/suitable')}>
|
||||||
<div className="side-swiper-icon icon01"></div>
|
<div className="side-swiper-icon icon01"></div>
|
||||||
<div className="side-swiper-infor">私は作成したお問 い合わせ</div>
|
<div className="side-swiper-infor">私は作成したお問 い合わせ</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,9 +9,10 @@ export function useAxios() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const responseHandler = (response: AxiosResponse) => {
|
const responseHandler = (response: AxiosResponse) => {
|
||||||
// if (response.headers['spinner-state'] === undefined) {
|
/* spinner 조작 커스텀이 필요한 경우 api 응답 헤더에 spinner-state: true 추가 */
|
||||||
|
if (!response.headers['spinner-state']) {
|
||||||
useSpinnerStore.getState().setIsShow(false)
|
useSpinnerStore.getState().setIsShow(false)
|
||||||
// }
|
}
|
||||||
response.data = transferResponse(response)
|
response.data = transferResponse(response)
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { useInfiniteQuery, useQuery } from '@tanstack/react-query'
|
import { useInfiniteQuery } from '@tanstack/react-query'
|
||||||
import { SHA256 } from 'crypto-js'
|
|
||||||
import { transformObjectKeys } from '@/libs/axios'
|
import { transformObjectKeys } from '@/libs/axios'
|
||||||
import { useSuitableStore } from '@/store/useSuitableStore'
|
import { useSuitableStore } from '@/store/useSuitableStore'
|
||||||
import { useAxios } from './useAxios'
|
import { useAxios } from './useAxios'
|
||||||
@ -13,13 +12,12 @@ export function useSuitable() {
|
|||||||
itemPerPage,
|
itemPerPage,
|
||||||
suitableCommCode,
|
suitableCommCode,
|
||||||
setSuitableCommCode,
|
setSuitableCommCode,
|
||||||
selectedCategory,
|
searchCategory,
|
||||||
clearSelectedCategory,
|
clearSearchCategory,
|
||||||
searchKeyword,
|
searchKeyword,
|
||||||
clearSearchKeyword,
|
clearSearchKeyword,
|
||||||
selectedItems,
|
selectedItems,
|
||||||
clearSelectedItems,
|
clearSelectedItems,
|
||||||
selectedItemsSearching,
|
|
||||||
} = useSuitableStore()
|
} = useSuitableStore()
|
||||||
|
|
||||||
const getSuitables = async ({
|
const getSuitables = async ({
|
||||||
@ -50,7 +48,7 @@ export function useSuitable() {
|
|||||||
const getSuitableIds = async (): Promise<SuitableIds[]> => {
|
const getSuitableIds = async (): Promise<SuitableIds[]> => {
|
||||||
try {
|
try {
|
||||||
const params: Record<string, string> = {}
|
const params: Record<string, string> = {}
|
||||||
if (selectedCategory) params.category = selectedCategory
|
if (searchCategory) params.category = searchCategory
|
||||||
if (searchKeyword) params.keyword = searchKeyword
|
if (searchKeyword) params.keyword = searchKeyword
|
||||||
const response = await axiosInstance(null).get<SuitableIds[]>('/api/suitable/pick', { params })
|
const response = await axiosInstance(null).get<SuitableIds[]>('/api/suitable/pick', { params })
|
||||||
return response.data
|
return response.data
|
||||||
@ -118,13 +116,13 @@ export function useSuitable() {
|
|||||||
// isError,
|
// isError,
|
||||||
// error,
|
// error,
|
||||||
} = useInfiniteQuery<Suitable[]>({
|
} = useInfiniteQuery<Suitable[]>({
|
||||||
queryKey: ['suitables', 'list', selectedCategory, searchKeyword],
|
queryKey: ['suitables', 'list', searchCategory, searchKeyword],
|
||||||
queryFn: async (context) => {
|
queryFn: async (context) => {
|
||||||
const pageParam = context.pageParam as number
|
const pageParam = context.pageParam as number
|
||||||
if (pageParam === 1) clearSuitableStore({ items: true })
|
if (pageParam === 1) clearSuitableStore({ items: true })
|
||||||
return await getSuitables({
|
return await getSuitables({
|
||||||
pageNumber: pageParam,
|
pageNumber: pageParam,
|
||||||
...(selectedCategory && { category: selectedCategory }),
|
...(searchCategory && { category: searchCategory }),
|
||||||
...(searchKeyword && { keyword: searchKeyword }),
|
...(searchKeyword && { keyword: searchKeyword }),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -134,48 +132,12 @@ export function useSuitable() {
|
|||||||
initialPageParam: 1,
|
initialPageParam: 1,
|
||||||
staleTime: 1000 * 60 * 10,
|
staleTime: 1000 * 60 * 10,
|
||||||
gcTime: 1000 * 60 * 10,
|
gcTime: 1000 * 60 * 10,
|
||||||
enabled: selectedCategory !== '' || searchKeyword !== '',
|
enabled: searchCategory !== '' || searchKeyword !== '',
|
||||||
})
|
|
||||||
|
|
||||||
const serializeSelectedItems = (): { ids: string; detailIds: string } => {
|
|
||||||
const ids: string[] = []
|
|
||||||
const detailIds: string[] = []
|
|
||||||
for (const [key, value] of selectedItems) {
|
|
||||||
ids.push(String(key))
|
|
||||||
for (const id of value) detailIds.push(String(id))
|
|
||||||
}
|
|
||||||
return { ids: ids.join(','), detailIds: detailIds.length > 0 ? detailIds.join(',') : '' }
|
|
||||||
}
|
|
||||||
|
|
||||||
const getSelectedItemsHash = (): string => {
|
|
||||||
const entries = Array.from(selectedItems.entries())
|
|
||||||
.map(([key, value]) => `${key}:${Array.from(value).sort().join(',')}`)
|
|
||||||
.sort()
|
|
||||||
.join('|')
|
|
||||||
return SHA256(entries).toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
const {
|
|
||||||
data: selectedSuitables,
|
|
||||||
isLoading: isSelectedSuitablesLoading,
|
|
||||||
// refetch: refetchSelectedSuitables,
|
|
||||||
} = useQuery<Suitable[]>({
|
|
||||||
queryKey: ['suitables', 'selectedItems', getSelectedItemsHash(), selectedItemsSearching],
|
|
||||||
queryFn: async () => {
|
|
||||||
const { ids, detailIds } = serializeSelectedItems()
|
|
||||||
return await getSuitableDetails(ids, detailIds)
|
|
||||||
},
|
|
||||||
staleTime: Infinity,
|
|
||||||
gcTime: Infinity,
|
|
||||||
enabled: selectedItemsSearching,
|
|
||||||
refetchOnMount: false,
|
|
||||||
refetchOnWindowFocus: false,
|
|
||||||
refetchOnReconnect: false,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const clearSuitableStore = ({ items = false, category = false, keyword = false }: { items?: boolean; category?: boolean; keyword?: boolean }) => {
|
const clearSuitableStore = ({ items = false, category = false, keyword = false }: { items?: boolean; category?: boolean; keyword?: boolean }) => {
|
||||||
if (items) clearSelectedItems()
|
if (items) clearSelectedItems()
|
||||||
if (category) clearSelectedCategory()
|
if (category) clearSearchCategory()
|
||||||
if (keyword) clearSearchKeyword()
|
if (keyword) clearSearchKeyword()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,11 +160,26 @@ export function useSuitable() {
|
|||||||
return `${value}で設置可`
|
return `${value}で設置可`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const serializeSelectedItems = (): { ids: string; detailIds: string } => {
|
||||||
|
const ids: string[] = []
|
||||||
|
const detailIds: string[] = []
|
||||||
|
for (const [key, value] of selectedItems) {
|
||||||
|
ids.push(String(key))
|
||||||
|
for (const id of value) detailIds.push(String(id))
|
||||||
|
}
|
||||||
|
return { ids: ids.join(','), detailIds: detailIds.length > 0 ? detailIds.join(',') : '' }
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSelectedSuitables = async (): Promise<Suitable[]> => {
|
||||||
|
const { ids, detailIds } = serializeSelectedItems()
|
||||||
|
return await getSuitableDetails(ids, detailIds)
|
||||||
|
}
|
||||||
|
|
||||||
const downloadSuitablePdf = async (): Promise<void> => {
|
const downloadSuitablePdf = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
const { ids, detailIds } = serializeSelectedItems()
|
const { ids, detailIds } = serializeSelectedItems()
|
||||||
const fileTitle = `(${
|
const fileTitle = `(${
|
||||||
suitableCommCode.get(SUITABLE_HEAD_CODE.ROOF_MATL_GRP_CD)?.find((category) => category.code === selectedCategory)?.codeJp
|
suitableCommCode.get(SUITABLE_HEAD_CODE.ROOF_MATL_GRP_CD)?.find((category) => category.code === searchCategory)?.codeJp
|
||||||
}) 屋根材適合表`
|
}) 屋根材適合表`
|
||||||
|
|
||||||
const form = document.createElement('form')
|
const form = document.createElement('form')
|
||||||
@ -240,7 +217,6 @@ export function useSuitable() {
|
|||||||
return {
|
return {
|
||||||
getSuitables,
|
getSuitables,
|
||||||
getSuitableIds,
|
getSuitableIds,
|
||||||
getSuitableDetails,
|
|
||||||
getSuitableCommCode,
|
getSuitableCommCode,
|
||||||
toCodeName,
|
toCodeName,
|
||||||
toSuitableDetail,
|
toSuitableDetail,
|
||||||
@ -250,8 +226,7 @@ export function useSuitable() {
|
|||||||
hasNextPage,
|
hasNextPage,
|
||||||
isFetchingNextPage,
|
isFetchingNextPage,
|
||||||
isLoading,
|
isLoading,
|
||||||
selectedSuitables,
|
getSelectedSuitables,
|
||||||
isSelectedSuitablesLoading,
|
|
||||||
clearSuitableStore,
|
clearSuitableStore,
|
||||||
suitableCheckIcon,
|
suitableCheckIcon,
|
||||||
suitableCheckMemo,
|
suitableCheckMemo,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import type { SurveyBasicInfo, SurveyDetailRequest, SurveyRegistRequest } from '@/types/Survey'
|
import type { SubmitTargetResponse, SurveyBasicInfo, SurveyDetailRequest, SurveyRegistRequest } from '@/types/Survey'
|
||||||
import { useMemo, useEffect } from 'react'
|
import { useMemo } 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'
|
||||||
@ -71,6 +71,7 @@ export function useSurvey(id?: number): {
|
|||||||
validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string
|
validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string
|
||||||
getZipCode: (zipCode: string) => Promise<ZipCode[] | null>
|
getZipCode: (zipCode: string) => Promise<ZipCode[] | null>
|
||||||
refetchSurveyList: () => void
|
refetchSurveyList: () => 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()
|
||||||
@ -278,6 +279,33 @@ export function useSurvey(id?: number): {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
console.error('Failed to fetch submit target:', error)
|
||||||
|
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,
|
||||||
@ -293,6 +321,7 @@ export function useSurvey(id?: number): {
|
|||||||
submitSurvey,
|
submitSurvey,
|
||||||
validateSurveyDetail,
|
validateSurveyDetail,
|
||||||
getZipCode,
|
getZipCode,
|
||||||
|
getSubmitTarget,
|
||||||
refetchSurveyList,
|
refetchSurveyList,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,43 +11,38 @@ interface SuitableState {
|
|||||||
/* 공통코드 설정 */
|
/* 공통코드 설정 */
|
||||||
setSuitableCommCode: (headCode: string, commCode: CommCode[]) => void
|
setSuitableCommCode: (headCode: string, commCode: CommCode[]) => void
|
||||||
|
|
||||||
/* 선택된 카테고리 */
|
/* 검색 카테고리 */
|
||||||
selectedCategory: string
|
searchCategory: string
|
||||||
/* 선택된 카테고리 설정 */
|
/* 검색 카테고리 설정 */
|
||||||
setSelectedCategory: (category: string) => void
|
setSearchCategory: (category: string) => void
|
||||||
/* 선택된 카테고리 초기화 */
|
/* 검색 카테고리 초기화 */
|
||||||
clearSelectedCategory: () => void
|
clearSearchCategory: () => void
|
||||||
|
|
||||||
/* 검색 값 */
|
/* 검색 키워드 */
|
||||||
searchKeyword: string
|
searchKeyword: string
|
||||||
/* 검색 값 설정 */
|
/* 검색 키워드 설정 */
|
||||||
setSearchKeyword: (value: string) => void
|
setSearchKeyword: (value: string) => void
|
||||||
/* 검색 값 초기화 */
|
/* 검색 키워드 초기화 */
|
||||||
clearSearchKeyword: () => void
|
clearSearchKeyword: () => void
|
||||||
|
|
||||||
/* 선택된 아이템 리스트 */
|
/* 선택된 아이템 리스트 */
|
||||||
selectedItems: Map<number, Set<number>>
|
selectedItems: Map<number, Set<number>>
|
||||||
/* 선택 아이템 추가 */
|
/* 선택 아이템 추가 */
|
||||||
addSelectedItem: (mainId: number, detailId?: number, detailIds?: Set<number>) => void
|
addSelectedItem: (mainId: number, detailId?: number, detailIds?: Set<number>) => void
|
||||||
/* 아이템 전체 추가 */
|
/* 선택 아이템 전체 추가 */
|
||||||
addAllSelectedItem: (suitableIds: SuitableIds[]) => void
|
addAllSelectedItem: (suitableIds: SuitableIds[]) => void
|
||||||
/* 선택된 아이템 제거 */
|
/* 선택 아이템 제거 */
|
||||||
removeSelectedItem: (mainId: number, detailId?: number) => void
|
removeSelectedItem: (mainId: number, detailId?: number) => void
|
||||||
/* 선택된 아이템 모두 제거 */
|
/* 선택 아이템 모두 제거 */
|
||||||
clearSelectedItems: () => void
|
clearSelectedItems: () => void
|
||||||
/* 선택된 아이템 검색 상태 */
|
|
||||||
selectedItemsSearching: boolean
|
|
||||||
/* 선택된 아이템 검색 상태 설정 */
|
|
||||||
setSelectedItemsSearching: (value: boolean) => void
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useSuitableStore = create<SuitableState>((set) => ({
|
export const useSuitableStore = create<SuitableState>((set) => ({
|
||||||
itemPerPage: 100 as number,
|
itemPerPage: 100 as number,
|
||||||
suitableCommCode: new Map() as Map<string, CommCode[]>,
|
suitableCommCode: new Map() as Map<string, CommCode[]>,
|
||||||
selectedCategory: '' as string,
|
searchCategory: '' as string,
|
||||||
searchKeyword: '' as string,
|
searchKeyword: '' as string,
|
||||||
selectedItems: new Map() as Map<number, Set<number>>,
|
selectedItems: new Map() as Map<number, Set<number>>,
|
||||||
selectedItemsSearching: false as boolean,
|
|
||||||
|
|
||||||
/* 공통코드 설정 */
|
/* 공통코드 설정 */
|
||||||
setSuitableCommCode: (headCode: string, commCode: CommCode[]) =>
|
setSuitableCommCode: (headCode: string, commCode: CommCode[]) =>
|
||||||
@ -55,20 +50,20 @@ export const useSuitableStore = create<SuitableState>((set) => ({
|
|||||||
suitableCommCode: new Map(state.suitableCommCode).set(headCode, commCode),
|
suitableCommCode: new Map(state.suitableCommCode).set(headCode, commCode),
|
||||||
})),
|
})),
|
||||||
|
|
||||||
/* 선택된 카테고리 설정 */
|
/* 검색 카테고리 설정 */
|
||||||
setSelectedCategory: (category: string) => set({ selectedCategory: category }),
|
setSearchCategory: (category: string) => set({ searchCategory: category }),
|
||||||
/* 선택된 카테고리 초기화 */
|
/* 검색 카테고리 초기화 */
|
||||||
clearSelectedCategory: () => set({ selectedCategory: '' }),
|
clearSearchCategory: () => set({ searchCategory: '' }),
|
||||||
|
|
||||||
/* 검색 값 설정 */
|
/* 검색 키워드 설정 */
|
||||||
setSearchKeyword: (value: string) => set({ searchKeyword: value }),
|
setSearchKeyword: (value: string) => set({ searchKeyword: value }),
|
||||||
/* 검색 값 초기화 */
|
/* 검색 키워드 초기화 */
|
||||||
clearSearchKeyword: () => set({ searchKeyword: '' }),
|
clearSearchKeyword: () => set({ searchKeyword: '' }),
|
||||||
|
|
||||||
/* 선택된 아이템 추가 */
|
/* 선택 아이템 추가 */
|
||||||
addSelectedItem: (mainId: number, detailId?: number, detailIds?: Set<number>) => {
|
addSelectedItem: (mainId: number, detailId?: number, detailIds?: Set<number>) => {
|
||||||
if (detailId) {
|
if (detailId) {
|
||||||
// 디테일(하위) 아이템 추가
|
/* 디테일(하위) 아이템 추가 */
|
||||||
set((state) => {
|
set((state) => {
|
||||||
const detailSet = state.selectedItems.get(mainId) || new Set()
|
const detailSet = state.selectedItems.get(mainId) || new Set()
|
||||||
detailSet.add(detailId)
|
detailSet.add(detailId)
|
||||||
@ -76,7 +71,7 @@ export const useSuitableStore = create<SuitableState>((set) => ({
|
|||||||
return { selectedItems: state.selectedItems }
|
return { selectedItems: state.selectedItems }
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 메인(상위) 아이템 추가
|
/* 메인(상위) 아이템 추가 */
|
||||||
set((state) => {
|
set((state) => {
|
||||||
state.selectedItems.set(mainId, detailIds || new Set())
|
state.selectedItems.set(mainId, detailIds || new Set())
|
||||||
return { selectedItems: state.selectedItems }
|
return { selectedItems: state.selectedItems }
|
||||||
@ -84,7 +79,7 @@ export const useSuitableStore = create<SuitableState>((set) => ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 아이템 전체 추가 */
|
/* 선택 아이템 전체 추가 */
|
||||||
addAllSelectedItem: (suitableIds: SuitableIds[]) => {
|
addAllSelectedItem: (suitableIds: SuitableIds[]) => {
|
||||||
set(() => {
|
set(() => {
|
||||||
const newSelectedItems = new Map()
|
const newSelectedItems = new Map()
|
||||||
@ -95,31 +90,28 @@ export const useSuitableStore = create<SuitableState>((set) => ({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 선택된 아이템 제거 */
|
/* 선택 아이템 제거 */
|
||||||
removeSelectedItem: (mainId: number, detailId?: number) => {
|
removeSelectedItem: (mainId: number, detailId?: number) => {
|
||||||
set((state) => {
|
set((state) => {
|
||||||
const newSelectedItems = new Map(state.selectedItems)
|
const newSelectedItems = new Map(state.selectedItems)
|
||||||
|
|
||||||
if (!detailId) {
|
if (!detailId) {
|
||||||
// 메인(상위) 아이템 제거
|
/* 메인(상위) 아이템 제거 */
|
||||||
newSelectedItems.delete(mainId)
|
newSelectedItems.delete(mainId)
|
||||||
return { selectedItems: newSelectedItems }
|
return { selectedItems: newSelectedItems }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 디테일(하위) 아이템 제거
|
/* 디테일(하위) 아이템 제거 */
|
||||||
const detailSet = state.selectedItems.get(mainId) || new Set()
|
const detailSet = state.selectedItems.get(mainId) || new Set()
|
||||||
detailSet.delete(detailId)
|
detailSet.delete(detailId)
|
||||||
|
|
||||||
// 디테일(하위)하위 아이템이 모두 제거되면 메인 아이템도 제거
|
/* 디테일(하위)하위 아이템이 모두 제거되면 메인 아이템도 제거 */
|
||||||
detailSet.size === 0 ? newSelectedItems.delete(mainId) : newSelectedItems.set(mainId, detailSet)
|
detailSet.size === 0 ? newSelectedItems.delete(mainId) : newSelectedItems.set(mainId, detailSet)
|
||||||
|
|
||||||
return { selectedItems: newSelectedItems }
|
return { selectedItems: newSelectedItems }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/* 선택된 아이템 모두 제거 */
|
/* 선택 아이템 모두 제거 */
|
||||||
clearSelectedItems: () => set({ selectedItems: new Map() as Map<number, Set<number>> }),
|
clearSelectedItems: () => set({ selectedItems: new Map() as Map<number, Set<number>> }),
|
||||||
|
|
||||||
/* 선택된 아이템 검색 상태 설정 */
|
|
||||||
setSelectedItemsSearching: (value: boolean) => set({ selectedItemsSearching: value }),
|
|
||||||
}))
|
}))
|
||||||
|
|||||||
@ -146,3 +146,11 @@ export type SurveyRegistRequest = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type Mode = 'CREATE' | 'EDIT' | 'READ' | 'TEMP' // 등록 | 수정 | 상세 | 임시저장
|
export type Mode = 'CREATE' | 'EDIT' | 'READ' | 'TEMP' // 등록 | 수정 | 상세 | 임시저장
|
||||||
|
|
||||||
|
export type SubmitTargetResponse = {
|
||||||
|
targetStoreId: string
|
||||||
|
targetStoreNm: string
|
||||||
|
repUserId: string
|
||||||
|
repUserEmail: string
|
||||||
|
auth: string
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user