Compare commits

...

15 Commits

Author SHA1 Message Date
7973d7c2b1 Merge pull request 'feature/suitable' (#26) from feature/suitable into dev
Reviewed-on: #26
2025-05-13 09:42:19 +09:00
186843e154 remove: 미사용 테스트 파일 삭제 2025-05-13 09:40:08 +09:00
bc1c1579cc feat: 지붕재 적합성 데이터 관련 테이블 모델 추가 2025-05-13 09:35:21 +09:00
0cdd7cdebd Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-05-13 09:33:10 +09:00
2d914d3798 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-05-12 15:03:49 +09:00
db2daf8ba0 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-05-12 09:57:05 +09:00
b61f5205e4 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-05-09 09:49:18 +09:00
b1f81d7853 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable
# Conflicts:
#	src/api/suitable.ts
2025-05-08 15:53:53 +09:00
e86c5d18b4 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable
# Conflicts:
#	src/app/api/suitable/list/route.ts
#	src/components/Suitable.tsx
#	src/components/SuitableDetails.tsx
#	src/components/SuitableSearch.tsx
2025-05-07 09:52:10 +09:00
adfe6d7a32 feat: 지붕재 적합성 pdf 기본기능 추가 2025-04-30 16:20:36 +09:00
56c2693bb7 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-04-30 15:07:15 +09:00
68ea411064 Merge branch 'dev' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-04-29 10:55:31 +09:00
bfbbdc01b8 feat: 지붕재 데이터 선택 기능 추가 2025-04-29 10:49:58 +09:00
d36084add5 Merge branch 'main' of https://git.hanasys.jp/qcast3/onsitesurvey into feature/suitable 2025-04-29 10:41:18 +09:00
cc8ef6a7d3 feat: 지붕재 데이터 조회 기능 추가 2025-04-28 16:51:01 +09:00
3 changed files with 130 additions and 2 deletions

View File

@ -79,13 +79,13 @@ model SD_SERVEY_SALES_DETAIL_INFO {
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
contract_capacity String? @db.VarChar(20) contract_capacity String? @db.VarChar(20)
retail_company String? @db.VarChar(100) retail_company String? @db.VarChar(100)
supplementary_facilities Int? supplementary_facilities String? @db.VarChar(20)
supplementary_facilities_etc String? @db.VarChar(200) supplementary_facilities_etc String? @db.VarChar(200)
installation_system Int? installation_system Int?
installation_system_etc String? @db.VarChar(200) installation_system_etc String? @db.VarChar(200)
construction_year Int? construction_year Int?
construction_year_etc String? @db.VarChar(200) construction_year_etc String? @db.VarChar(200)
roof_material Int? roof_material String? @db.VarChar(20)
roof_material_etc String? @db.VarChar(200) roof_material_etc String? @db.VarChar(200)
roof_shape Int? roof_shape Int?
roof_shape_etc String? @db.VarChar(200) roof_shape_etc String? @db.VarChar(200)
@ -177,3 +177,33 @@ model BC_COMM_L {
@@id([HEAD_CD, CODE], map: "PK_BC_COMM_L") @@id([HEAD_CD, CODE], map: "PK_BC_COMM_L")
} }
model MS_SUITABLE_ROOF_MATERIAL_GROUP {
id Int @id @default(autoincrement())
roof_material_group String @db.VarChar(200)
roof_material String @db.VarChar(200)
created_at DateTime @default(now(), map: "DF__MS_SUITAB__creat__4F7CD00D")
updated_at DateTime
}
model MS_SUITABLE_DETAIL {
id Int @id @default(autoincrement())
main_id Int
trestle_manufacturer_product_code String? @db.VarChar(200)
trestle_manufacturer_product_name String? @db.VarChar(200)
memo String? @db.VarChar(500)
created_at DateTime @default(now(), map: "DF__MS_SUITAB__creat__571DF1D5")
updated_at DateTime?
MS_SUITABLE_MAIN MS_SUITABLE_MAIN @relation(fields: [main_id], references: [id], onUpdate: NoAction, map: "MS_SUITABLE_DETAIL_MS_SUITABLE_MAIN_FK")
}
model MS_SUITABLE_MAIN {
id Int @id @default(autoincrement())
product_name String @db.VarChar(200)
manufacturer String? @db.VarChar(200)
roof_material String? @db.VarChar(100)
shape String? @db.VarChar(200)
created_at DateTime @default(now(), map: "DF__MS_SUITAB__creat__5441852A")
updated_at DateTime? @updatedAt
details MS_SUITABLE_DETAIL[]
}

30
src/hooks/useSuitable.ts Normal file
View File

@ -0,0 +1,30 @@
import { suitableApi } from '@/api/suitable'
export function useSuitable() {
const getCategories = async () => {
try {
return await suitableApi.getCategory()
} catch (error) {
console.error('카테고리 데이터 로드 실패:', error)
return []
}
}
const getSuitables = async () => {
try {
return await suitableApi.getList()
} catch (error) {
console.error('지붕재 데이터 로드 실패:', error)
}
}
const updateSearchResults = async (selectedCategory: string | undefined, searchValue: string | undefined) => {
try {
return await suitableApi.getList(selectedCategory, searchValue)
} catch (error) {
console.error('지붕재 데이터 검색 실패:', error)
}
}
return { getCategories, getSuitables, updateSearchResults }
}

View File

@ -0,0 +1,68 @@
import { create } from 'zustand'
import { Suitable, suitableApi } from '@/api/suitable'
interface SuitableState {
// // 검색 결과 리스트
// searchResults: Suitable[]
// // 초기 데이터 로드
// fetchInitializeData: () => Promise<void>
// // 검색 결과 설정
// setSearchResults: (results: Suitable[]) => void
// // 검색 결과 초기화
// resetSearchResults: () => void
// 선택된 아이템 리스트
selectedItems: Suitable[]
// 선택된 아이템 추가
addSelectedItem: (item: Suitable) => void
// 선택된 아이템 제거
removeSelectedItem: (itemId: number) => void
// 선택된 아이템 모두 제거
clearSelectedItems: () => void
}
export const useSuitableStore = create<SuitableState>((set) => ({
// // 초기 상태
// searchResults: [],
// // 초기 데이터 로드
// fetchInitializeData: async () => {
// const suitables = await fetchInitialSuitablee()
// set({ searchResults: suitables })
// },
// // 검색 결과 설정
// setSearchResults: (results) => set({ searchResults: results }),
// // 검색 결과 초기화
// resetSearchResults: () => set({ searchResults: [] }),
// 초기 상태
selectedItems: [],
// 선택된 아이템 추가 (중복 방지)
addSelectedItem: (item) =>
set((state) => ({
selectedItems: state.selectedItems.some((i) => i.id === item.id) ? state.selectedItems : [...state.selectedItems, item],
})),
// 선택된 아이템 제거
removeSelectedItem: (itemId) =>
set((state) => ({
selectedItems: state.selectedItems.filter((item) => item.id !== itemId),
})),
// 선택된 아이템 모두 제거
clearSelectedItems: () => set({ selectedItems: [] }),
}))
// // 전체 데이터 초기화 함수
// async function fetchInitialSuitablee() {
// try {
// const suitable = await suitableApi.getList()
// return suitable
// } catch (error) {
// console.error('초기 데이터 로드 실패:', error)
// return []
// }
// }