Compare commits
No commits in common. "ed47d6abf592eb8edb3eaab33cd349041565c087" and "a227ba7115ab778298e7a4fa9dfb2798655566f9" have entirely different histories.
ed47d6abf5
...
a227ba7115
22
package-lock.json
generated
22
package-lock.json
generated
@ -20,7 +20,6 @@
|
|||||||
"react-to-pdf": "^2.0.0",
|
"react-to-pdf": "^2.0.0",
|
||||||
"sass": "^1.87.0",
|
"sass": "^1.87.0",
|
||||||
"swiper": "^11.2.6",
|
"swiper": "^11.2.6",
|
||||||
"usehooks-ts": "^3.1.1",
|
|
||||||
"zustand": "^5.0.3"
|
"zustand": "^5.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -3294,12 +3293,6 @@
|
|||||||
"url": "https://opencollective.com/parcel"
|
"url": "https://opencollective.com/parcel"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lodash.debounce": {
|
|
||||||
"version": "4.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
|
|
||||||
"integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/lodash.includes": {
|
"node_modules/lodash.includes": {
|
||||||
"version": "4.3.0",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
|
||||||
@ -4075,21 +4068,6 @@
|
|||||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/usehooks-ts": {
|
|
||||||
"version": "3.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/usehooks-ts/-/usehooks-ts-3.1.1.tgz",
|
|
||||||
"integrity": "sha512-I4diPp9Cq6ieSUH2wu+fDAVQO43xwtulo+fKEidHUwZPnYImbtkTjzIJYcDcJqxgmX31GVqNFURodvcgHcW0pA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"lodash.debounce": "^4.0.8"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=16.15.0"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"react": "^16.8.0 || ^17 || ^18 || ^19 || ^19.0.0-rc"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/utrie": {
|
"node_modules/utrie": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz",
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
"react-to-pdf": "^2.0.0",
|
"react-to-pdf": "^2.0.0",
|
||||||
"sass": "^1.87.0",
|
"sass": "^1.87.0",
|
||||||
"swiper": "^11.2.6",
|
"swiper": "^11.2.6",
|
||||||
"usehooks-ts": "^3.1.1",
|
|
||||||
"zustand": "^5.0.3"
|
"zustand": "^5.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
19
pnpm-lock.yaml
generated
19
pnpm-lock.yaml
generated
@ -47,9 +47,6 @@ importers:
|
|||||||
swiper:
|
swiper:
|
||||||
specifier: ^11.2.6
|
specifier: ^11.2.6
|
||||||
version: 11.2.6
|
version: 11.2.6
|
||||||
usehooks-ts:
|
|
||||||
specifier: ^3.1.1
|
|
||||||
version: 3.1.1(react@19.1.0)
|
|
||||||
zustand:
|
zustand:
|
||||||
specifier: ^5.0.3
|
specifier: ^5.0.3
|
||||||
version: 5.0.3(@types/react@19.0.12)(react@19.1.0)
|
version: 5.0.3(@types/react@19.0.12)(react@19.1.0)
|
||||||
@ -1088,9 +1085,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-6b6gd/RUXKaw5keVdSEtqFVdzWnU5jMxTUjA2bVcMNPLwSQ08Sv/UodBVtETLCn7k4S1Ibxwh7k68IwLZPgKaA==}
|
resolution: {integrity: sha512-6b6gd/RUXKaw5keVdSEtqFVdzWnU5jMxTUjA2bVcMNPLwSQ08Sv/UodBVtETLCn7k4S1Ibxwh7k68IwLZPgKaA==}
|
||||||
engines: {node: '>= 12.0.0'}
|
engines: {node: '>= 12.0.0'}
|
||||||
|
|
||||||
lodash.debounce@4.0.8:
|
|
||||||
resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==}
|
|
||||||
|
|
||||||
lodash.includes@4.3.0:
|
lodash.includes@4.3.0:
|
||||||
resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==}
|
resolution: {integrity: sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==}
|
||||||
|
|
||||||
@ -1361,12 +1355,6 @@ packages:
|
|||||||
undici-types@6.19.8:
|
undici-types@6.19.8:
|
||||||
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
|
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
|
||||||
|
|
||||||
usehooks-ts@3.1.1:
|
|
||||||
resolution: {integrity: sha512-I4diPp9Cq6ieSUH2wu+fDAVQO43xwtulo+fKEidHUwZPnYImbtkTjzIJYcDcJqxgmX31GVqNFURodvcgHcW0pA==}
|
|
||||||
engines: {node: '>=16.15.0'}
|
|
||||||
peerDependencies:
|
|
||||||
react: ^16.8.0 || ^17 || ^18 || ^19 || ^19.0.0-rc
|
|
||||||
|
|
||||||
utrie@1.0.2:
|
utrie@1.0.2:
|
||||||
resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
|
resolution: {integrity: sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==}
|
||||||
|
|
||||||
@ -2330,8 +2318,6 @@ snapshots:
|
|||||||
lightningcss-win32-arm64-msvc: 1.29.2
|
lightningcss-win32-arm64-msvc: 1.29.2
|
||||||
lightningcss-win32-x64-msvc: 1.29.2
|
lightningcss-win32-x64-msvc: 1.29.2
|
||||||
|
|
||||||
lodash.debounce@4.0.8: {}
|
|
||||||
|
|
||||||
lodash.includes@4.3.0: {}
|
lodash.includes@4.3.0: {}
|
||||||
|
|
||||||
lodash.isboolean@3.0.3: {}
|
lodash.isboolean@3.0.3: {}
|
||||||
@ -2603,11 +2589,6 @@ snapshots:
|
|||||||
|
|
||||||
undici-types@6.19.8: {}
|
undici-types@6.19.8: {}
|
||||||
|
|
||||||
usehooks-ts@3.1.1(react@19.1.0):
|
|
||||||
dependencies:
|
|
||||||
lodash.debounce: 4.0.8
|
|
||||||
react: 19.1.0
|
|
||||||
|
|
||||||
utrie@1.0.2:
|
utrie@1.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
base64-arraybuffer: 1.0.2
|
base64-arraybuffer: 1.0.2
|
||||||
|
|||||||
@ -1,22 +0,0 @@
|
|||||||
'use server'
|
|
||||||
|
|
||||||
import { sessionOptions } from '@/libs/session'
|
|
||||||
import type { SessionData } from '@/types/Auth'
|
|
||||||
import { getIronSession } from 'iron-session'
|
|
||||||
import { cookies } from 'next/headers'
|
|
||||||
import { redirect } from 'next/navigation'
|
|
||||||
|
|
||||||
export const logout = async () => {
|
|
||||||
const cookieStore = await cookies()
|
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
|
||||||
|
|
||||||
session.destroy()
|
|
||||||
return redirect('/login')
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getSession = async () => {
|
|
||||||
const cookieStore = await cookies()
|
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
|
||||||
|
|
||||||
return session
|
|
||||||
}
|
|
||||||
@ -1,107 +0,0 @@
|
|||||||
import { database } from '@/data'
|
|
||||||
import { axiosInstance } from '@/libs/axios'
|
|
||||||
|
|
||||||
export interface Suitable {
|
|
||||||
id?: number
|
|
||||||
product_name: string
|
|
||||||
manufacturer: string
|
|
||||||
roof_material: string
|
|
||||||
shape: string
|
|
||||||
support_roof_tile: string
|
|
||||||
support_roof_tile_memo: string
|
|
||||||
support_roof_bracket: string
|
|
||||||
support_roof_bracket_memo: string
|
|
||||||
yg_anchor: string
|
|
||||||
yg_anchor_memo: string
|
|
||||||
rg_roof_tile_part: string
|
|
||||||
rg_roof_tile_part_memo: string
|
|
||||||
dido_hunt_support_tile_2: string
|
|
||||||
dido_hunt_support_tile_2_memo: string
|
|
||||||
takashima_power_base: string
|
|
||||||
takashima_power_base_memo: string
|
|
||||||
takashima_tile_bracket: string
|
|
||||||
takashima_tile_bracket_memo: string
|
|
||||||
slate_bracket_4: string
|
|
||||||
slate_bracket_4_memo: string
|
|
||||||
slate_single_metal_bracket: string
|
|
||||||
slate_single_metal_bracket_memo: string
|
|
||||||
dido_hunt_short_rack_4: string
|
|
||||||
dido_hunt_short_rack_4_memo: string
|
|
||||||
takashima_slate_bracket_slate_single: string
|
|
||||||
takashima_slate_bracket_slate_single_memo: string
|
|
||||||
df_metal_bracket: string
|
|
||||||
df_metal_bracket_memo: string
|
|
||||||
slate_metal_bracket: string
|
|
||||||
slate_metal_bracket_memo: string
|
|
||||||
takashima_slate_bracket_metal_roof: string
|
|
||||||
takashima_slate_bracket_metal_roof_memo: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const suitableApi = {
|
|
||||||
// getList: async (category?: string, keyword?: string): Promise<Suitable[]> => {
|
|
||||||
// let condition: any = {}
|
|
||||||
// if (category) {
|
|
||||||
// condition['category'] = category
|
|
||||||
// }
|
|
||||||
// if (keyword) {
|
|
||||||
// condition['keyword'] = {
|
|
||||||
// contains: keyword,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// console.log('🚀 ~ getList: ~ condition:', condition)
|
|
||||||
// const response = await axiosInstance(null).get<Suitable[]>('/api/suitable/list', { params: condition })
|
|
||||||
// console.log('🚀 ~ getList: ~ response:', response)
|
|
||||||
// return response.data
|
|
||||||
// },
|
|
||||||
// getCategory: async (): Promise<Suitable[]> => {
|
|
||||||
// const response = await axiosInstance(null).get<Suitable[]>('/api/suitable/category')
|
|
||||||
// console.log('🚀 ~ getCategory: ~ response:', response)
|
|
||||||
// return response.data
|
|
||||||
// },
|
|
||||||
// getDetails: async (roofMaterial: string): Promise<Suitable[]> => {
|
|
||||||
// const response = await axiosInstance(null).get<Suitable[]>(`/api/suitable/details?roof-material=${roofMaterial}`)
|
|
||||||
// console.log('🚀 ~ getDetails: ~ response:', response)
|
|
||||||
// return response.data
|
|
||||||
// },
|
|
||||||
// create: async () => {
|
|
||||||
// const suitableData: Suitable[] = []
|
|
||||||
// database.forEach((item) => {
|
|
||||||
// suitableData.push({
|
|
||||||
// product_name: item[0],
|
|
||||||
// manufacturer: item[1],
|
|
||||||
// roof_material: item[2],
|
|
||||||
// shape: item[3],
|
|
||||||
// support_roof_tile: item[4],
|
|
||||||
// support_roof_tile_memo: item[5],
|
|
||||||
// support_roof_bracket: item[6],
|
|
||||||
// support_roof_bracket_memo: item[7],
|
|
||||||
// yg_anchor: item[8],
|
|
||||||
// yg_anchor_memo: item[9],
|
|
||||||
// rg_roof_tile_part: item[10],
|
|
||||||
// rg_roof_tile_part_memo: item[11],
|
|
||||||
// dido_hunt_support_tile_2: item[12],
|
|
||||||
// dido_hunt_support_tile_2_memo: item[13],
|
|
||||||
// takashima_power_base: item[14],
|
|
||||||
// takashima_power_base_memo: item[15],
|
|
||||||
// takashima_tile_bracket: item[16],
|
|
||||||
// takashima_tile_bracket_memo: item[17],
|
|
||||||
// slate_bracket_4: item[18],
|
|
||||||
// slate_bracket_4_memo: item[19],
|
|
||||||
// slate_single_metal_bracket: item[20],
|
|
||||||
// slate_single_metal_bracket_memo: item[21],
|
|
||||||
// dido_hunt_short_rack_4: item[22],
|
|
||||||
// dido_hunt_short_rack_4_memo: item[23],
|
|
||||||
// takashima_slate_bracket_slate_single: item[24],
|
|
||||||
// takashima_slate_bracket_slate_single_memo: item[25],
|
|
||||||
// df_metal_bracket: item[26],
|
|
||||||
// df_metal_bracket_memo: item[27],
|
|
||||||
// slate_metal_bracket: item[28],
|
|
||||||
// slate_metal_bracket_memo: item[29],
|
|
||||||
// takashima_slate_bracket_metal_roof: item[30],
|
|
||||||
// takashima_slate_bracket_metal_roof_memo: item[31],
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// const response = await axiosInstance(null).post<Suitable[]>('/api/suitable', suitableData)
|
|
||||||
// return response.data
|
|
||||||
// },
|
|
||||||
}
|
|
||||||
@ -1,127 +0,0 @@
|
|||||||
import { axiosInstance } from '@/libs/axios'
|
|
||||||
|
|
||||||
export interface SurveySalesBasicInfo {
|
|
||||||
id?: number
|
|
||||||
representative: string
|
|
||||||
store: string | null
|
|
||||||
construction_point: string | null
|
|
||||||
investigation_date: string | null
|
|
||||||
building_name: string | null
|
|
||||||
customer_name: string | null
|
|
||||||
post_code: string | null
|
|
||||||
address: string | null
|
|
||||||
address_detail: string | null
|
|
||||||
submission_status: boolean
|
|
||||||
submission_date?: string | null
|
|
||||||
detail_info?: SurveySalesDetailInfo | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface SurveySalesDetailInfo {
|
|
||||||
id?: number
|
|
||||||
contract_capacity: string | null
|
|
||||||
retail_company: string | null
|
|
||||||
supplementary_facilities: number | null
|
|
||||||
supplementary_facilities_etc: string | null
|
|
||||||
installation_system: number | null
|
|
||||||
installation_system_etc: string | null
|
|
||||||
construction_year: number | null
|
|
||||||
construction_year_etc: string | null
|
|
||||||
roof_material: number | null
|
|
||||||
roof_material_etc: string | null
|
|
||||||
roof_shape: number | null
|
|
||||||
roof_shape_etc: string | null
|
|
||||||
roof_slope: string | null
|
|
||||||
house_structure: number | null
|
|
||||||
house_structure_etc: string | null
|
|
||||||
rafter_material: number | null
|
|
||||||
rafter_material_etc: string | null
|
|
||||||
rafter_size: number | null
|
|
||||||
rafter_size_etc: string | null
|
|
||||||
rafter_pitch: number | null
|
|
||||||
rafter_pitch_etc: string | null
|
|
||||||
rafter_direction: number | null
|
|
||||||
open_field_plate_kind: number | null
|
|
||||||
open_field_plate_kind_etc: string | null
|
|
||||||
open_field_plate_thickness: string | null
|
|
||||||
leak_trace: boolean | null
|
|
||||||
waterproof_material: number | null
|
|
||||||
waterproof_material_etc: string | null
|
|
||||||
insulation_presence: number | null
|
|
||||||
insulation_presence_etc: string | null
|
|
||||||
structure_order: number | null
|
|
||||||
structure_order_etc: string | null
|
|
||||||
installation_availability: number | null
|
|
||||||
installation_availability_etc: string | null
|
|
||||||
memo: string | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export const surveySalesApi = {
|
|
||||||
create: async (data: SurveySalesBasicInfo): Promise<number> => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance(null).post<SurveySalesBasicInfo>('/api/survey-sales', data)
|
|
||||||
return response.data.id ?? 0
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getList: async (): Promise<SurveySalesBasicInfo[] | []> => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance(null).get<SurveySalesBasicInfo[]>('/api/survey-sales')
|
|
||||||
return response.data
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getDetail: async (id: number): Promise<SurveySalesBasicInfo | null> => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance(null).get<SurveySalesBasicInfo>(`/api/survey-sales/${id}`)
|
|
||||||
return response.data
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
update: async (id: number, data: SurveySalesBasicInfo): Promise<SurveySalesBasicInfo | null> => {
|
|
||||||
try {
|
|
||||||
const response = await axiosInstance(null).put<SurveySalesBasicInfo>(`/api/survey-sales/${id}`, data)
|
|
||||||
return response.data
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
},
|
|
||||||
delete: async (id: number, isDetail: boolean = false): Promise<boolean> => {
|
|
||||||
try {
|
|
||||||
await axiosInstance(null).delete(`/api/survey-sales/${id}`, {
|
|
||||||
params: {
|
|
||||||
detail_id: isDetail ? id : undefined,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return true
|
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
},
|
|
||||||
createDetail: async (surveyId: number, data: SurveySalesDetailInfo): Promise<boolean> => {
|
|
||||||
try {
|
|
||||||
await axiosInstance(null).post<SurveySalesDetailInfo>(`/api/survey-sales/${surveyId}`, data)
|
|
||||||
return true
|
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirm: async (id: number): Promise<boolean> => {
|
|
||||||
try {
|
|
||||||
await axiosInstance(null).patch<SurveySalesBasicInfo>(`/api/survey-sales/${id}`)
|
|
||||||
return true
|
|
||||||
} catch (error) {
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// update: async (data: SurveySalesBasicInfo): Promise<SurveySalesBasicInfo> => {
|
|
||||||
// const response = await axiosInstance.put<SurveySalesBasicInfo>(`/api/survey-sales`, data)
|
|
||||||
// return response.data
|
|
||||||
// },
|
|
||||||
}
|
|
||||||
@ -1,37 +0,0 @@
|
|||||||
import { axiosInstance } from '@/libs/axios'
|
|
||||||
|
|
||||||
export interface UserData {
|
|
||||||
username: string
|
|
||||||
email: string
|
|
||||||
password: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface User {
|
|
||||||
id: number
|
|
||||||
username: string
|
|
||||||
email: string
|
|
||||||
created_at: string
|
|
||||||
updated_at: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoginData {
|
|
||||||
username: string
|
|
||||||
password: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export const userApi = {
|
|
||||||
create: async (data: UserData): Promise<User> => {
|
|
||||||
const response = await axiosInstance(null).post<User>('/api/user/create', data)
|
|
||||||
return response.data
|
|
||||||
},
|
|
||||||
|
|
||||||
getList: async (): Promise<User[]> => {
|
|
||||||
const response = await axiosInstance(null).get<User[]>('/api/user/list')
|
|
||||||
return response.data
|
|
||||||
},
|
|
||||||
|
|
||||||
getUser: async (data: LoginData): Promise<User> => {
|
|
||||||
const response = await axiosInstance(null).post<User>(`/api/user`, data)
|
|
||||||
return response.data
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
import { NextResponse } from 'next/server'
|
|
||||||
|
|
||||||
import { axiosInstance } from '@/libs/axios'
|
|
||||||
|
|
||||||
export async function POST(req: Request) {
|
|
||||||
const { loginId, email, pwd, chgPwd } = await req.json()
|
|
||||||
console.log('🚀 ~ POST ~ loginId:', loginId)
|
|
||||||
console.log('🚀 ~ POST ~ email:', email)
|
|
||||||
console.log('🚀 ~ POST ~ pwd:', pwd)
|
|
||||||
console.log('🚀 ~ POST ~ chgPwd:', chgPwd)
|
|
||||||
|
|
||||||
const result = await axiosInstance(`${process.env.NEXT_PUBLIC_QSP_API_URL}`).post(`/api/user/userPwdChg`, {
|
|
||||||
loginId,
|
|
||||||
chgType: 'C',
|
|
||||||
email,
|
|
||||||
pwd,
|
|
||||||
chgPwd,
|
|
||||||
})
|
|
||||||
console.log('🚀 ~ result ~ result:', result)
|
|
||||||
|
|
||||||
return NextResponse.json({ code: 200, data: result.data })
|
|
||||||
}
|
|
||||||
@ -1,62 +1,40 @@
|
|||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import { prisma } from '@/libs/prisma'
|
|
||||||
|
|
||||||
export async function GET(request: Request, context: { params: { id: string } }) {
|
export async function GET(request: Request, context: { params: { id: string } }) {
|
||||||
try {
|
const { id } = await context.params
|
||||||
const { id } = await context.params
|
// @ts-ignore
|
||||||
// @ts-ignore
|
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
||||||
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
where: { ID: Number(id) },
|
||||||
where: { ID: Number(id) },
|
include: {
|
||||||
include: {
|
DETAIL_INFO: true,
|
||||||
DETAIL_INFO: true,
|
},
|
||||||
},
|
})
|
||||||
})
|
return NextResponse.json(survey)
|
||||||
return NextResponse.json(survey)
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error fetching survey:', error)
|
|
||||||
return NextResponse.json({ error: 'Failed to fetch survey' }, { status: 500 })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PUT(request: Request, context: { params: { id: string } }) {
|
export async function PUT(request: Request, context: { params: { id: string } }) {
|
||||||
|
const { id } = await context.params
|
||||||
|
const body = await request.json()
|
||||||
try {
|
try {
|
||||||
const { id } = await context.params
|
|
||||||
const body = await request.json()
|
|
||||||
console.log('body:: ', body)
|
|
||||||
|
|
||||||
// DETAIL_INFO를 분리
|
|
||||||
const { DETAIL_INFO, ...basicInfo } = body
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
||||||
where: { ID: Number(id) },
|
where: { ID: Number(id) },
|
||||||
data: {
|
data: {
|
||||||
...basicInfo,
|
...body,
|
||||||
UPT_DT: new Date(),
|
|
||||||
DETAIL_INFO: DETAIL_INFO
|
|
||||||
? {
|
|
||||||
upsert: {
|
|
||||||
create: DETAIL_INFO,
|
|
||||||
update: DETAIL_INFO,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
},
|
|
||||||
include: {
|
|
||||||
DETAIL_INFO: true,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return NextResponse.json(survey)
|
return NextResponse.json(survey)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error updating survey:', error)
|
console.error(error)
|
||||||
return NextResponse.json({ error: 'Failed to update survey' }, { status: 500 })
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function DELETE(request: Request, context: { params: { id: string } }) {
|
export async function DELETE(request: Request, context: { params: { id: string } }) {
|
||||||
try {
|
const { id } = await context.params
|
||||||
const { id } = await context.params
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
//@ts-ignore
|
||||||
await prisma.$transaction(async (tx) => {
|
await prisma.$transaction(async (tx) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
const detailData = await tx.SD_SURVEY_SALES_BASIC_INFO.findUnique({
|
||||||
@ -65,75 +43,69 @@ export async function DELETE(request: Request, context: { params: { id: string }
|
|||||||
DETAIL_INFO: true,
|
DETAIL_INFO: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
console.log('detailData:: ', detailData)
|
||||||
if (detailData?.DETAIL_INFO?.ID) {
|
if (detailData?.DETAIL_INFO?.ID) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await tx.SD_SURVEY_SALES_DETAIL_INFO.delete({
|
await tx.SD_SURVEY_SALES_DETAIL_INFO.delete({
|
||||||
where: { ID: Number(detailData.DETAIL_INFO.ID) },
|
where: { ID: Number(detailData?.DETAIL_INFO?.ID) },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await tx.SD_SURVEY_SALES_BASIC_INFO.delete({
|
await tx.SD_SURVEY_SALES_BASIC_INFO.delete({
|
||||||
where: { ID: Number(id) },
|
where: { ID: Number(id) },
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return NextResponse.json({ message: 'Survey deleted successfully' })
|
return NextResponse.json({ message: 'Survey deleted successfully' })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error deleting survey:', error)
|
console.error(error)
|
||||||
return NextResponse.json({ error: 'Failed to delete survey' }, { status: 500 })
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function PATCH(request: Request, context: { params: { id: string } }) {
|
export async function PATCH(request: Request, context: { params: { id: string } }) {
|
||||||
try {
|
const { id } = await context.params
|
||||||
const { id } = await context.params
|
const body = await request.json()
|
||||||
const body = await request.json()
|
|
||||||
|
|
||||||
if (body.submit) {
|
if (body.submit) {
|
||||||
|
// @ts-ignore
|
||||||
|
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
||||||
|
where: { ID: Number(id) },
|
||||||
|
data: {
|
||||||
|
SUBMISSION_STATUS: true,
|
||||||
|
SUBMISSION_DATE: new Date(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return NextResponse.json({ message: 'Survey confirmed successfully' })
|
||||||
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
|
const hasDetails = await prisma.SD_SURVEY_SALES_DETAIL_INFO.findUnique({
|
||||||
|
where: { BASIC_INFO_ID: Number(id) },
|
||||||
|
})
|
||||||
|
console.log('hasDetails:: ', hasDetails)
|
||||||
|
if (hasDetails) {
|
||||||
|
//@ts-ignore
|
||||||
|
const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
||||||
|
where: { ID: Number(id) },
|
||||||
|
data: {
|
||||||
|
UPT_DT: new Date(),
|
||||||
|
DETAIL_INFO: {
|
||||||
|
update: body.DETAIL_INFO,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
return NextResponse.json(result)
|
||||||
|
} else {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
||||||
where: { ID: Number(id) },
|
where: { ID: Number(id) },
|
||||||
data: {
|
data: {
|
||||||
SUBMISSION_STATUS: true,
|
DETAIL_INFO: {
|
||||||
SUBMISSION_DATE: new Date(),
|
create: body.DETAIL_INFO,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
return NextResponse.json({ message: 'Survey confirmed successfully' })
|
console.log(survey)
|
||||||
} else {
|
return NextResponse.json({ message: 'Survey detail created successfully' })
|
||||||
// @ts-ignore
|
|
||||||
const hasDetails = await prisma.SD_SURVEY_SALES_DETAIL_INFO.findUnique({
|
|
||||||
where: { BASIC_INFO_ID: Number(id) },
|
|
||||||
})
|
|
||||||
|
|
||||||
if (hasDetails) {
|
|
||||||
//@ts-ignore
|
|
||||||
const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
|
||||||
where: { ID: Number(id) },
|
|
||||||
data: {
|
|
||||||
UPT_DT: new Date(),
|
|
||||||
DETAIL_INFO: {
|
|
||||||
update: body.DETAIL_INFO,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return NextResponse.json(result)
|
|
||||||
} else {
|
|
||||||
// @ts-ignore
|
|
||||||
const survey = await prisma.SD_SURVEY_SALES_BASIC_INFO.update({
|
|
||||||
where: { ID: Number(id) },
|
|
||||||
data: {
|
|
||||||
DETAIL_INFO: {
|
|
||||||
create: body.DETAIL_INFO,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return NextResponse.json({ message: 'Survey detail created successfully' })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error('Error updating survey:', error)
|
|
||||||
return NextResponse.json({ error: 'Failed to update survey' }, { status: 500 })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,18 +1,16 @@
|
|||||||
import { NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import { prisma } from '@/libs/prisma'
|
import { prisma } from '@/libs/prisma'
|
||||||
|
|
||||||
/**
|
// Types
|
||||||
* 검색 파라미터
|
|
||||||
*/
|
|
||||||
type SearchParams = {
|
type SearchParams = {
|
||||||
keyword?: string | null // 검색어
|
keyword?: string | null
|
||||||
searchOption?: string | null // 검색 옵션 (select 옵션)
|
searchOption?: string | null
|
||||||
isMySurvey?: string | null // 내가 작성한 매물
|
isMySurvey?: string | null
|
||||||
sort?: string | null // 정렬 방식
|
sort?: string | null
|
||||||
offset?: string | null
|
offset?: string | null
|
||||||
role?: string | null // 회원권한한
|
memberRole?: string | null
|
||||||
store?: string | null // 판매점ID
|
store?: string | null
|
||||||
builderNo?: string | null // 시공ID
|
builderNo?: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
type WhereCondition = {
|
type WhereCondition = {
|
||||||
@ -21,131 +19,133 @@ type WhereCondition = {
|
|||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
// 검색 가능한 필드 옵션
|
// Constants
|
||||||
const SEARCH_OPTIONS = [
|
const SEARCH_OPTIONS = [
|
||||||
'BUILDING_NAME', // 건물명
|
'BUILDING_NAME',
|
||||||
'REPRESENTATIVE', // 담당자
|
'REPRESENTATIVE',
|
||||||
'STORE', // 판매점
|
'STORE',
|
||||||
'CONSTRUCTION_POINT', // 시공점
|
'CONSTRUCTION_POINT',
|
||||||
'CUSTOMER_NAME', // 고객명
|
'CUSTOMER_NAME',
|
||||||
'POST_CODE', // 우편번호
|
'POST_CODE',
|
||||||
'ADDRESS', // 주소
|
'ADDRESS',
|
||||||
'ADDRESS_DETAIL', // 상세주소
|
'ADDRESS_DETAIL',
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
// 페이지당 항목 수
|
|
||||||
const ITEMS_PER_PAGE = 10
|
const ITEMS_PER_PAGE = 10
|
||||||
|
|
||||||
/**
|
// Helper functions
|
||||||
* 키워드 검색 조건 생성 함수
|
|
||||||
* @param keyword 검색 키워드
|
|
||||||
* @param searchOption 검색 옵션
|
|
||||||
* @returns 검색 조건 객체
|
|
||||||
*/
|
|
||||||
const createKeywordSearchCondition = (keyword: string, searchOption: string): WhereCondition => {
|
const createKeywordSearchCondition = (keyword: string, searchOption: string): WhereCondition => {
|
||||||
const where: WhereCondition = {}
|
const where: WhereCondition = {}
|
||||||
|
|
||||||
if (searchOption === 'all') {
|
if (searchOption === 'all') {
|
||||||
// 모든 필드 검색 시 OR 조건 사용
|
|
||||||
where.OR = []
|
where.OR = []
|
||||||
|
|
||||||
// ID가 숫자인 경우 ID 검색 조건 추가
|
// ID 검색 조건 추가
|
||||||
if (keyword.match(/^\d+$/) || !isNaN(Number(keyword))) {
|
if (keyword.match(/^\d+$/) || !isNaN(Number(keyword))) {
|
||||||
where.OR.push({
|
where.OR.push({
|
||||||
ID: { equals: Number(keyword) },
|
ID: { equals: Number(keyword) },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 다른 필드 검색 조건 추가
|
||||||
where.OR.push(
|
where.OR.push(
|
||||||
...SEARCH_OPTIONS.map((field) => ({
|
...SEARCH_OPTIONS.map((field) => ({
|
||||||
[field]: { contains: keyword },
|
[field]: { contains: keyword },
|
||||||
})),
|
})),
|
||||||
)
|
)
|
||||||
} else if (SEARCH_OPTIONS.includes(searchOption.toUpperCase() as any)) {
|
} else if (SEARCH_OPTIONS.includes(searchOption as any)) {
|
||||||
// 특정 필드 검색
|
where[searchOption] = { contains: keyword }
|
||||||
where[searchOption.toUpperCase()] = { contains: keyword }
|
|
||||||
} else if (searchOption === 'id') {
|
} else if (searchOption === 'id') {
|
||||||
// ID 검색 (숫자 변환 필요)
|
where.ID = { equals: Number(keyword) }
|
||||||
const number = Number(keyword)
|
|
||||||
if (!isNaN(number)) {
|
|
||||||
where.ID = { equals: number }
|
|
||||||
} else {
|
|
||||||
// 유효하지 않은 ID 검색 시 빈 결과 반환
|
|
||||||
where.ID = { equals: null }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return where
|
return where
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 회원 역할별 검색 조건 생성 함수
|
|
||||||
* @param params 검색 파라미터
|
|
||||||
* @returns 검색 조건 객체
|
|
||||||
*/
|
|
||||||
const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
|
const createMemberRoleCondition = (params: SearchParams): WhereCondition => {
|
||||||
const where: WhereCondition = { AND: [] }
|
const where: WhereCondition = { AND: [] }
|
||||||
|
|
||||||
switch (params.role) {
|
switch (params.memberRole) {
|
||||||
case 'Admin': // 1차점
|
// 1차점: 같은 판매점에서 작성된 매물 + 2차점에서 제출받은 매물
|
||||||
// 같은 판매점에서 작성된 매물 + 2차점에서 제출받은 매물
|
case 'Admin':
|
||||||
where.OR = [
|
|
||||||
{
|
|
||||||
AND: [{ STORE: { equals: params.store } }],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
AND: [{ STORE: { startsWith: params.store } }, { SUBMISSION_STATUS: { equals: true } }],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
break
|
|
||||||
|
|
||||||
case 'Admin_Sub': // 2차점
|
|
||||||
where.OR = [
|
where.OR = [
|
||||||
{
|
{
|
||||||
AND: [
|
AND: [
|
||||||
{ STORE: { equals: params.store } },
|
{ STORE: { equals: params.store } },
|
||||||
{
|
{ SUBMISSION_STATUS: { equals: false } }
|
||||||
OR: [
|
|
||||||
{ CONSTRUCTION_POINT: { equals: null } },
|
|
||||||
{ CONSTRUCTION_POINT: { equals: '' } }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
AND: [
|
AND: [
|
||||||
{ STORE: { equals: params.store } },
|
{ STORE: { endsWith: params.store } },
|
||||||
{ CONSTRUCTION_POINT: { not: null } },
|
|
||||||
{ CONSTRUCTION_POINT: { not: '' } },
|
|
||||||
{ SUBMISSION_STATUS: { equals: true } }
|
{ SUBMISSION_STATUS: { equals: true } }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
break
|
break
|
||||||
|
|
||||||
case 'Builder': // 2차점 시공권한
|
// 2차점: 같은 판매점에서 작성된 매물 + Builder에게 제출받은 매물
|
||||||
case 'Partner': // Partner
|
case 'Admin_Sub':
|
||||||
// 같은 시공ID에서 작성된 매물
|
where.OR = [
|
||||||
|
{
|
||||||
|
AND: [
|
||||||
|
{ STORE: { equals: params.store } },
|
||||||
|
{ CONSTRUCTION_POINT: { equals: null } },
|
||||||
|
{ SUBMISSION_STATUS: { equals: false } }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
AND: [
|
||||||
|
{ STORE: { equals: params.store } },
|
||||||
|
{ CONSTRUCTION_POINT: { not: null } },
|
||||||
|
{ SUBMISSION_STATUS: { equals: true } }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
break
|
||||||
|
|
||||||
|
// 2차점 시공권한: 같은 시공ID에서 작성된 매물
|
||||||
|
case 'Builder':
|
||||||
where.AND?.push({
|
where.AND?.push({
|
||||||
CONSTRUCTION_POINT: { equals: params.builderNo },
|
CONSTRUCTION_POINT: { equals: params.builderNo },
|
||||||
|
SUBMISSION_STATUS: { equals: false },
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
|
|
||||||
|
// 시공점: 같은 시공ID에서 작성된 매물
|
||||||
|
case 'Partner':
|
||||||
|
where.AND?.push({
|
||||||
|
CONSTRUCTION_POINT: { equals: params.builderNo },
|
||||||
|
SUBMISSION_STATUS: { equals: false },
|
||||||
|
})
|
||||||
|
break
|
||||||
|
|
||||||
|
// 모든 매물 조회 가능
|
||||||
case 'T01':
|
case 'T01':
|
||||||
case 'User':
|
case 'User':
|
||||||
// 모든 매물 조회 가능 (추가 조건 없음)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
return where
|
return where
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// API Routes
|
||||||
* GET 핸들러 - 설문 목록 조회
|
export async function POST(request: Request) {
|
||||||
*/
|
try {
|
||||||
|
const body = await request.json()
|
||||||
|
// @ts-ignore
|
||||||
|
const res = await prisma.SD_SURVEY_SALES_BASIC_INFO.create({
|
||||||
|
data: body,
|
||||||
|
})
|
||||||
|
return NextResponse.json(res)
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error creating survey:', error)
|
||||||
|
return NextResponse.json({ error: 'Failed to create survey' }, { status: 500 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function GET(request: Request) {
|
export async function GET(request: Request) {
|
||||||
try {
|
try {
|
||||||
// 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'),
|
||||||
@ -153,95 +153,59 @@ export async function GET(request: Request) {
|
|||||||
isMySurvey: searchParams.get('isMySurvey'),
|
isMySurvey: searchParams.get('isMySurvey'),
|
||||||
sort: searchParams.get('sort'),
|
sort: searchParams.get('sort'),
|
||||||
offset: searchParams.get('offset'),
|
offset: searchParams.get('offset'),
|
||||||
role: searchParams.get('role'),
|
memberRole: searchParams.get('memberRole'),
|
||||||
store: searchParams.get('store'),
|
store: searchParams.get('store'),
|
||||||
builderNo: searchParams.get('builderNo'),
|
builderNo: searchParams.get('builderNo'),
|
||||||
}
|
}
|
||||||
|
|
||||||
// 검색 조건 구성
|
|
||||||
const where: WhereCondition = {}
|
const where: WhereCondition = {}
|
||||||
|
|
||||||
// 내가 작성한 매물 조건 적용
|
// 내가 작성한 매물 조건
|
||||||
if (params.isMySurvey) {
|
if (params.isMySurvey) {
|
||||||
where.REPRESENTATIVE = params.isMySurvey
|
where.REPRESENTATIVE = params.isMySurvey
|
||||||
}
|
}
|
||||||
|
|
||||||
// 키워드 검색 조건 적용
|
// 키워드 검색 조건
|
||||||
if (params.keyword && params.searchOption) {
|
if (params.keyword && params.searchOption) {
|
||||||
Object.assign(where, createKeywordSearchCondition(params.keyword, params.searchOption))
|
Object.assign(where, createKeywordSearchCondition(params.keyword, params.searchOption))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 회원 유형 조건 적용
|
// 회원 유형 조건
|
||||||
Object.assign(where, createMemberRoleCondition(params))
|
Object.assign(where, createMemberRoleCondition(params))
|
||||||
|
|
||||||
// 데이터 조회 또는 카운트
|
// 데이터 조회
|
||||||
if (params.offset) {
|
if (params.offset) {
|
||||||
// 페이지네이션 데이터 조회
|
// @ts-ignore
|
||||||
//@ts-ignore
|
const res = await prisma.SD_SURVEY_SALES_BASIC_INFO.findMany({
|
||||||
const surveys = await prisma.SD_SURVEY_SALES_BASIC_INFO.findMany({
|
|
||||||
where,
|
where,
|
||||||
orderBy: params.sort === 'created' ? { REG_DT: 'desc' } : { UPT_DT: 'desc' },
|
orderBy: params.sort === 'created' ? { REG_DT: 'desc' } : { UPT_DT: 'desc' },
|
||||||
skip: Number(params.offset),
|
skip: Number(params.offset),
|
||||||
take: ITEMS_PER_PAGE,
|
take: ITEMS_PER_PAGE,
|
||||||
})
|
})
|
||||||
return NextResponse.json(surveys)
|
return NextResponse.json(res)
|
||||||
} else {
|
|
||||||
// 전체 개수만 조회
|
|
||||||
//@ts-ignore
|
|
||||||
const count = await prisma.SD_SURVEY_SALES_BASIC_INFO.count({ where })
|
|
||||||
return NextResponse.json(count)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 전체 개수 조회
|
||||||
|
// @ts-ignore
|
||||||
|
const count = await prisma.SD_SURVEY_SALES_BASIC_INFO.count({ where })
|
||||||
|
return NextResponse.json(count)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error('Error fetching surveys:', error)
|
||||||
return NextResponse.json({ error: 'Fail Read Survey' }, { status: 500 })
|
return NextResponse.json({ error: 'Failed to fetch surveys' }, { status: 500 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PUT 핸들러 - 상세 정보 추가
|
|
||||||
*/
|
|
||||||
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 = { ...body.detail_info, BASIC_INFO_ID: body.id }
|
||||||
// 상세 정보 생성을 위한 데이터 구성
|
// @ts-ignore
|
||||||
const detailInfo = {
|
const res = await prisma.SD_SURVEY_SALES_DETAIL_INFO.create({
|
||||||
...body.detail_info,
|
|
||||||
BASIC_INFO_ID: body.id,
|
|
||||||
}
|
|
||||||
|
|
||||||
// 상세 정보 생성
|
|
||||||
//@ts-ignore
|
|
||||||
await prisma.SD_SURVEY_SALES_DETAIL_INFO.create({
|
|
||||||
data: detailInfo,
|
data: detailInfo,
|
||||||
})
|
})
|
||||||
|
return NextResponse.json({ message: 'Survey sales updated successfully' })
|
||||||
return NextResponse.json({
|
|
||||||
message: 'Success Update Survey',
|
|
||||||
})
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error('Error updating survey:', error)
|
||||||
return NextResponse.json({ error: 'Fail Update Survey' }, { status: 500 })
|
return NextResponse.json({ error: 'Failed to update survey' }, { status: 500 })
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
|
||||||
try {
|
|
||||||
const body = await request.json()
|
|
||||||
const { DETAIL_INFO, ...basicInfo } = body
|
|
||||||
// 기본 정보 생성
|
|
||||||
//@ts-ignore
|
|
||||||
const result = await prisma.SD_SURVEY_SALES_BASIC_INFO.create({
|
|
||||||
data: {
|
|
||||||
...basicInfo,
|
|
||||||
DETAIL_INFO: {
|
|
||||||
create: DETAIL_INFO,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return NextResponse.json(result)
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
return NextResponse.json({ error: 'Fail Create Survey' }, { status: 500 })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,8 @@ export async function POST(request: Request) {
|
|||||||
const cookieStore = await cookies()
|
const cookieStore = await cookies()
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
||||||
console.log('start session edit!')
|
console.log('start session edit!')
|
||||||
// session.username = user.username!
|
session.userNm = user.username!
|
||||||
// session.email = user.email!
|
session.email = user.email!
|
||||||
session.isLoggedIn = true
|
session.isLoggedIn = true
|
||||||
console.log('end session edit!')
|
console.log('end session edit!')
|
||||||
await session.save()
|
await session.save()
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import RegistForm from '@/components/survey-sale/temp/registForm'
|
|
||||||
|
|
||||||
export default function RegistPage() {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<RegistForm />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -3,10 +3,7 @@
|
|||||||
import type { SessionData } from '@/types/Auth'
|
import type { SessionData } from '@/types/Auth'
|
||||||
import { useEffect, useReducer, useState } from 'react'
|
import { useEffect, useReducer, useState } from 'react'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
|
|
||||||
import { useLocalStorage } from 'usehooks-ts'
|
|
||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
|
|
||||||
import { axiosInstance } from '@/libs/axios'
|
import { axiosInstance } from '@/libs/axios'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
|
|
||||||
@ -27,7 +24,6 @@ export default function Login() {
|
|||||||
const [isLogin, setIsLogin] = useState(false)
|
const [isLogin, setIsLogin] = useState(false)
|
||||||
|
|
||||||
const { session, setSession } = useSessionStore()
|
const { session, setSession } = useSessionStore()
|
||||||
const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' })
|
|
||||||
|
|
||||||
const reducer = (state: AccountState, newState: Partial<AccountState>) => ({ ...state, ...newState })
|
const reducer = (state: AccountState, newState: Partial<AccountState>) => ({ ...state, ...newState })
|
||||||
const [account, setAccount] = useReducer(reducer, {
|
const [account, setAccount] = useReducer(reducer, {
|
||||||
@ -52,6 +48,7 @@ export default function Login() {
|
|||||||
loginId: account.loginId,
|
loginId: account.loginId,
|
||||||
pwd: account.pwd,
|
pwd: account.pwd,
|
||||||
})
|
})
|
||||||
|
// router.push('/')
|
||||||
|
|
||||||
return data
|
return data
|
||||||
},
|
},
|
||||||
@ -63,11 +60,6 @@ export default function Login() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsLogin(false)
|
setIsLogin(false)
|
||||||
if (loginData?.code === 200) {
|
if (loginData?.code === 200) {
|
||||||
// 유저 정보 저장
|
|
||||||
setValue({
|
|
||||||
indivisualData: account.pwd,
|
|
||||||
})
|
|
||||||
// 세션 정보 저장
|
|
||||||
setSession({
|
setSession({
|
||||||
...session,
|
...session,
|
||||||
...loginData?.result,
|
...loginData?.result,
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export default function Answer() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="inquiry-detail-data">
|
<div className="inquiry-detail-data">
|
||||||
<div className="inquiry-answer-tit">回答</div>
|
<div className="inquiry-detail-category">回答</div>
|
||||||
<div className="inquiry-detail-txt">
|
<div className="inquiry-detail-txt">
|
||||||
一次側接続は, 自動切替開閉器と住宅分電盤昼間遮断器との間に蓄電システム遮断器を配線する方法です. 二次側接続は,
|
一次側接続は, 自動切替開閉器と住宅分電盤昼間遮断器との間に蓄電システム遮断器を配線する方法です. 二次側接続は,
|
||||||
住宅分電盤週間ブレーカの二次側に蓄電システムブレーカを接続する
|
住宅分電盤週間ブレーカの二次側に蓄電システムブレーカを接続する
|
||||||
|
|||||||
@ -7,7 +7,7 @@ export default function Detail() {
|
|||||||
//todo: 답변 완료 표시를 위해 임시로 추가 해 놓은 state
|
//todo: 답변 완료 표시를 위해 임시로 추가 해 놓은 state
|
||||||
// 추후에 api 작업 완료후 삭제
|
// 추후에 api 작업 완료후 삭제
|
||||||
// 답변 완료 클래스 & 하단 답변내용 출력도
|
// 답변 완료 클래스 & 하단 답변내용 출력도
|
||||||
const [inquiry, setInquiry] = useState<Boolean>(true)
|
const [inquiry, setInquiry] = useState<Boolean>(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -31,14 +31,6 @@ export default function Detail() {
|
|||||||
<th>作者</th>
|
<th>作者</th>
|
||||||
<td>Hong gi</td>
|
<td>Hong gi</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th>名前</th>
|
|
||||||
<td>Kim</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>番号</th>
|
|
||||||
<td>070-1234-5678</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>販売店</th>
|
<th>販売店</th>
|
||||||
<td>interplug</td>
|
<td>interplug</td>
|
||||||
@ -55,11 +47,7 @@ export default function Detail() {
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div className="inquiry-detail-data">
|
<div className="inquiry-detail-data">
|
||||||
<div className="inquiry-detail-category">
|
<div className="inquiry-detail-category">屋根適合</div>
|
||||||
<span>屋根</span>
|
|
||||||
<span>適合性</span>
|
|
||||||
<span>屋根材</span>
|
|
||||||
</div>
|
|
||||||
<div className="inquiry-detail-tit">屋根材適合性確認依頼</div>
|
<div className="inquiry-detail-tit">屋根材適合性確認依頼</div>
|
||||||
<div className="inquiry-detail-txt">
|
<div className="inquiry-detail-txt">
|
||||||
入力した内容が表示されます.
|
入力した内容が表示されます.
|
||||||
|
|||||||
@ -70,59 +70,18 @@ export default function ListTable() {
|
|||||||
合計 <span>98</span>個
|
合計 <span>98</span>個
|
||||||
</div>
|
</div>
|
||||||
<ul className="inquiry-list">
|
<ul className="inquiry-list">
|
||||||
<li className="inquiry-item">
|
{inquiryList.map((inquiry) => (
|
||||||
<div className="inquiry-item-bx">
|
<li className="inquiry-item" key={inquiry.id}>
|
||||||
<div className="inquiry-item-category">
|
<div className="inquiry-item-bx">
|
||||||
<span>屋根</span>
|
<div className="inquiry-item-category">{inquiry.category}</div>
|
||||||
<span>適合性</span>
|
<div className="inquiry-item-tit">{inquiry.title}</div>
|
||||||
<span>屋根材</span>
|
<div className="inquiry-item-date">{inquiry.date}</div>
|
||||||
|
<div className={`inquiry-badge badge ${badgeStyle.find((badge) => badge.id === inquiry.status)?.color}`}>
|
||||||
|
{badgeStyle.find((badge) => badge.id === inquiry.status)?.label}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="inquiry-item-tit">屋根材適合性確認依頼</div>
|
</li>
|
||||||
<div className="inquiry-item-date">2025.04.02</div>
|
))}
|
||||||
<div className="inquiry-badge badge blue">回答待ち</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li className="inquiry-item">
|
|
||||||
<div className="inquiry-item-bx">
|
|
||||||
<div className="inquiry-item-category">
|
|
||||||
<span>屋根</span>
|
|
||||||
<span>適合性</span>
|
|
||||||
<span>屋根材</span>
|
|
||||||
</div>
|
|
||||||
<div className="inquiry-item-tit">設置可能ですか?</div>
|
|
||||||
<div className="inquiry-item-date">2025.04.02</div>
|
|
||||||
<div className="inquiry-badge badge orange">回答完了</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li className="inquiry-item">
|
|
||||||
<div className="inquiry-item-bx">
|
|
||||||
<div className="inquiry-item-category">
|
|
||||||
<span>屋根</span>
|
|
||||||
<span>適合性</span>
|
|
||||||
<span>屋根材</span>
|
|
||||||
</div>
|
|
||||||
<div className="inquiry-item-tit">屋根材適合性確認依頼屋根材適合性確認依頼屋根材適合性確認依頼屋根材適合性確認依頼</div>
|
|
||||||
<div className="inquiry-item-date">2025.04.02</div>
|
|
||||||
<div className="inquiry-badge badge blue">回答待ち</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li className="inquiry-item">
|
|
||||||
<div className="inquiry-item-bx">
|
|
||||||
<div className="inquiry-item-category">
|
|
||||||
<span>屋根</span>
|
|
||||||
<span>適合性</span>
|
|
||||||
<span>屋根材</span>
|
|
||||||
</div>
|
|
||||||
<div className="inquiry-item-tit">設置可能ですか?</div>
|
|
||||||
<div className="inquiry-item-date">2025.04.02</div>
|
|
||||||
<div className="inquiry-badge badge orange">回答完了</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li className="inquiry-item">
|
|
||||||
<div className="inquiry-item-bx nodata">
|
|
||||||
<div className="inquiry-item-nodata">조회된 데이터가 없습니다</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div className="sale-edit-btn">
|
<div className="sale-edit-btn">
|
||||||
<LoadMoreButton hasMore={hasMore} onLoadMore={() => setOffset(offset + 10)} />
|
<LoadMoreButton hasMore={hasMore} onLoadMore={() => setOffset(offset + 10)} />
|
||||||
|
|||||||
@ -17,45 +17,19 @@ export default function RegistForm() {
|
|||||||
<option value="">屋根適合</option>
|
<option value="">屋根適合</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div className="data-input mt5">
|
|
||||||
<select className="select-form" name="" id="">
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div className="data-input mt5">
|
|
||||||
<select className="select-form" name="" id="">
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
<option value="">屋根適合</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">
|
|
||||||
名前 <i className="import">*</i>
|
|
||||||
</div>
|
|
||||||
<div className="data-input">
|
|
||||||
<input className="input-frame" type="text" placeholder="名前を書いてください" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">電話番号</div>
|
|
||||||
<div className="data-input">
|
|
||||||
<input className="input-frame" type="text" placeholder="電話番号を書き留めてください" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
<div className="data-input-form-tit">
|
<div className="data-input-form-tit">
|
||||||
お問い合わせタイトル <i className="import">*</i>
|
お問い合わせタイトル <i className="import">*</i>
|
||||||
</div>
|
</div>
|
||||||
<div className="data-input">
|
<div className="data-input">
|
||||||
<input className="input-frame" type="text" placeholder="お問い合わせタイトルを記入してください" />
|
<select className="select-form" name="" id="">
|
||||||
|
<option value="">モジュールの取り付けを確認するかどうか</option>
|
||||||
|
<option value="">モジュールの取り付けを確認するかどうか</option>
|
||||||
|
<option value="">モジュールの取り付けを確認するかどうか</option>
|
||||||
|
<option value="">モジュールの取り付けを確認するかどうか</option>
|
||||||
|
<option value="">モジュールの取り付けを確認するかどうか</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
|
|||||||
@ -28,11 +28,10 @@ export default function ZipCodePopup() {
|
|||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
|
|
||||||
const handleApply = () => {
|
const handleApply = () => {
|
||||||
console.log(addressInfo?.[0])
|
|
||||||
setAddressData({
|
setAddressData({
|
||||||
post_code: addressInfo?.[0]?.zipcode || '',
|
post_code: addressInfo?.[0]?.zipcode || '',
|
||||||
address: addressInfo?.[0]?.address1 || '',
|
address: addressInfo?.[0]?.prefcode || '',
|
||||||
address_detail: addressInfo?.[0]?.address2 + ' ' + addressInfo?.[0]?.address3 || '',
|
address_detail: addressInfo?.[0]?.address1 + ' ' + addressInfo?.[0]?.address2 + ' ' + addressInfo?.[0]?.address3 || '',
|
||||||
})
|
})
|
||||||
popupController.setZipCodePopup(false)
|
popupController.setZipCodePopup(false)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,50 +3,11 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
|
|
||||||
import { useLocalStorage } from 'usehooks-ts'
|
|
||||||
|
|
||||||
import { axiosInstance } from '@/libs/axios'
|
|
||||||
import { useSessionStore } from '@/store/session'
|
|
||||||
|
|
||||||
export default function PwResetForm() {
|
export default function PwResetForm() {
|
||||||
const [pwShow01, setPwShow01] = useState<boolean>(false) //비밀번호 확인 보이기 숨기기
|
const [pwShow01, setPwShow01] = useState(false) //비밀번호 확인 보이기 숨기기
|
||||||
const [pwShow02, setPwShow02] = useState<boolean>(false) //비밀번호 재확인 보이기 숨기기
|
const [pwShow02, setPwShow02] = useState(false) //비밀번호 재확인 보이기 숨기기
|
||||||
|
|
||||||
const [pwd01, setPwd01] = useState<string>('')
|
|
||||||
const [pwd02, setPwd02] = useState<string>('')
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const { session } = useSessionStore()
|
|
||||||
const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' })
|
|
||||||
|
|
||||||
const validatePwd = () => {
|
|
||||||
if (pwd01 !== pwd02) {
|
|
||||||
alert('비밀번호가 일치하지 않습니다.')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleReset = async () => {
|
|
||||||
if (validatePwd()) {
|
|
||||||
const { data } = await axiosInstance(null).post(`/api/auth/chg-pwd`, {
|
|
||||||
loginId: session.userId,
|
|
||||||
email: session.email,
|
|
||||||
pwd: value.indivisualData,
|
|
||||||
chgPwd: pwd01,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (data.data.result.resultCode === 'S') {
|
|
||||||
setValue({ indivisualData: pwd01 })
|
|
||||||
}
|
|
||||||
|
|
||||||
window.neoAlert(data.data.result.resultMsg, () => {
|
|
||||||
router.back()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="border-frame">
|
<div className="border-frame">
|
||||||
@ -57,12 +18,7 @@ export default function PwResetForm() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="data-input">
|
<div className="data-input">
|
||||||
<div className="login-input pw change">
|
<div className="login-input pw change">
|
||||||
<input
|
<input type={`${pwShow01 ? 'text' : 'password'}`} className="login-frame" placeholder="●●●●" />
|
||||||
type={`${pwShow01 ? 'text' : 'password'}`}
|
|
||||||
className="login-frame"
|
|
||||||
placeholder="●●●●"
|
|
||||||
onChange={(e) => setPwd01(e.target.value)}
|
|
||||||
/>
|
|
||||||
<button className={`login-icon ${pwShow01 ? 'act' : ''}`} onClick={() => setPwShow01(!pwShow01)}>
|
<button className={`login-icon ${pwShow01 ? 'act' : ''}`} onClick={() => setPwShow01(!pwShow01)}>
|
||||||
<i className="show-icon"></i>
|
<i className="show-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -76,12 +32,7 @@ export default function PwResetForm() {
|
|||||||
</div>
|
</div>
|
||||||
<div className="data-input">
|
<div className="data-input">
|
||||||
<div className="login-input pw change">
|
<div className="login-input pw change">
|
||||||
<input
|
<input type={`${pwShow02 ? 'text' : 'password'}`} className="login-frame" placeholder="●●●●" />
|
||||||
type={`${pwShow02 ? 'text' : 'password'}`}
|
|
||||||
className="login-frame"
|
|
||||||
placeholder="●●●●"
|
|
||||||
onChange={(e) => setPwd02(e.target.value)}
|
|
||||||
/>
|
|
||||||
<button className={`login-icon ${pwShow02 ? 'act' : ''}`} onClick={() => setPwShow02(!pwShow02)}>
|
<button className={`login-icon ${pwShow02 ? 'act' : ''}`} onClick={() => setPwShow02(!pwShow02)}>
|
||||||
<i className="show-icon"></i>
|
<i className="show-icon"></i>
|
||||||
</button>
|
</button>
|
||||||
@ -97,7 +48,7 @@ export default function PwResetForm() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button className="btn-frame red icon" onClick={handleReset}>
|
<button className="btn-frame red icon">
|
||||||
リセットする<i className="btn-arr"></i>
|
リセットする<i className="btn-arr"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export default function NavTab() {
|
|||||||
const params = useParams()
|
const params = useParams()
|
||||||
const detailId = params.id
|
const detailId = params.id
|
||||||
|
|
||||||
const { basicInfoSelected, roofInfoSelected, reset, setBasicInfoSelected, setRoofInfoSelected } = useSurveySaleTabState()
|
const { basicInfoSelected, roofInfoSelected, reset } = useSurveySaleTabState()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
@ -27,36 +27,26 @@ export default function NavTab() {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollSection = (section: string) => {
|
|
||||||
const sectionElement = document.getElementById(section)
|
|
||||||
if (sectionElement) {
|
|
||||||
sectionElement.scrollIntoView({ behavior: 'smooth' })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleBasicInfoClick = () => {
|
const handleBasicInfoClick = () => {
|
||||||
// if (id) {
|
if (id) {
|
||||||
// router.push(`/survey-sale/basic-info?id=${id}`)
|
router.push(`/survey-sale/basic-info?id=${id}`)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
if (detailId) {
|
if (detailId) {
|
||||||
router.push(`/survey-sale/${detailId}`)
|
router.push(`/survey-sale/${detailId}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
scrollSection('basic-form-section')
|
|
||||||
|
|
||||||
setBasicInfoSelected()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRoofInfoClick = () => {
|
const handleRoofInfoClick = () => {
|
||||||
// if (id) {
|
if (id) {
|
||||||
// if (isTemp === 'true') {
|
if (isTemp === 'true') {
|
||||||
// alert('基本情報が一時保存された状態です。')
|
alert('基本情報が一時保存された状態です。')
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// router.push(`/survey-sale/roof-info?id=${id}`)
|
router.push(`/survey-sale/roof-info?id=${id}`)
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
if (detailId) {
|
if (detailId) {
|
||||||
router.push(`/survey-sale/${detailId}?tab=roof-info`)
|
router.push(`/survey-sale/${detailId}?tab=roof-info`)
|
||||||
return
|
return
|
||||||
@ -65,10 +55,6 @@ export default function NavTab() {
|
|||||||
alert('基本情報を先に保存してください。')
|
alert('基本情報を先に保存してください。')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
// if (pathname === '/survey-sale/regist') {
|
|
||||||
scrollSection('roof-form-section')
|
|
||||||
// }
|
|
||||||
setRoofInfoSelected()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
import { useParams, useSearchParams } from 'next/navigation'
|
import { useParams, useSearchParams } from 'next/navigation'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect } from 'react'
|
||||||
|
import { useState } from 'react'
|
||||||
import DetailForm from './DetailForm'
|
import DetailForm from './DetailForm'
|
||||||
|
import { useSurveySaleTabState } from '@/store/surveySaleTabState'
|
||||||
import RoofDetailForm from './RoofDetailForm'
|
import RoofDetailForm from './RoofDetailForm'
|
||||||
|
|
||||||
export default function DataTable() {
|
export default function DataTable() {
|
||||||
@ -12,21 +14,21 @@ export default function DataTable() {
|
|||||||
|
|
||||||
const searchParams = useSearchParams()
|
const searchParams = useSearchParams()
|
||||||
const tab = searchParams.get('tab')
|
const tab = searchParams.get('tab')
|
||||||
const isTemp = searchParams.get('isTemporary')
|
|
||||||
|
|
||||||
const { surveyDetail, isLoadingSurveyDetail } = useServey(Number(id))
|
const { surveyDetail, isLoadingSurveyDetail } = useServey(Number(id))
|
||||||
const [isTemporary, setIsTemporary] = useState(isTemp === 'true')
|
const [isTemporary, setIsTemporary] = useState(true)
|
||||||
|
const { setBasicInfoSelected, setRoofInfoSelected } = useSurveySaleTabState()
|
||||||
const { validateSurveyDetail } = useServey(Number(id))
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (surveyDetail?.DETAIL_INFO) {
|
if (surveyDetail?.REPRESENTATIVE && surveyDetail?.STORE && surveyDetail?.CONSTRUCTION_POINT) {
|
||||||
const validate = validateSurveyDetail(surveyDetail.DETAIL_INFO)
|
setIsTemporary(false)
|
||||||
if (validate.trim() !== '') {
|
|
||||||
setIsTemporary(false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [surveyDetail])
|
if (tab === 'roof-info') {
|
||||||
|
setRoofInfoSelected()
|
||||||
|
} else {
|
||||||
|
setBasicInfoSelected()
|
||||||
|
}
|
||||||
|
}, [surveyDetail, tab, setBasicInfoSelected, setRoofInfoSelected])
|
||||||
|
|
||||||
if (isLoadingSurveyDetail) {
|
if (isLoadingSurveyDetail) {
|
||||||
return <div>Loading...</div>
|
return <div>Loading...</div>
|
||||||
@ -66,7 +68,7 @@ export default function DataTable() {
|
|||||||
<>
|
<>
|
||||||
{/* TODO: 제출한 판매점 ID 추가 필요 */}
|
{/* TODO: 제출한 판매점 ID 추가 필요 */}
|
||||||
<div>{new Date(surveyDetail.SUBMISSION_DATE).toLocaleString()}</div>
|
<div>{new Date(surveyDetail.SUBMISSION_DATE).toLocaleString()}</div>
|
||||||
<div>{surveyDetail.STORE}</div>
|
<div>販売店 ID...</div>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
'-'
|
'-'
|
||||||
|
|||||||
@ -1,119 +1,86 @@
|
|||||||
'use client'
|
'use client'
|
||||||
import { useRouter, useSearchParams } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
import { useServey } from '@/hooks/useSurvey'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { SurveyBasicInfo } from '@/types/Survey'
|
import { useEffect, useState } from 'react'
|
||||||
import { useState } from 'react'
|
|
||||||
|
|
||||||
export default function DetailButton({ surveyDetail }: { surveyDetail: SurveyBasicInfo | null }) {
|
export default function DetailButton({ isTemporary, surveyId, representative }: { isTemporary: boolean; surveyId: number; representative: string }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
const { submitSurvey, deleteSurvey } = useServey(surveyDetail?.ID ?? 0)
|
const { submitSurvey, deleteSurvey } = useServey(surveyId)
|
||||||
|
const [userId, setUserId] = useState('')
|
||||||
|
|
||||||
const searchParams = useSearchParams()
|
useEffect(() => {
|
||||||
const isTemp = searchParams.get('isTemporary')
|
if (session?.isLoggedIn) {
|
||||||
const [isTemporary, setIsTemporary] = useState(isTemp === 'true')
|
setUserId(session?.userId ?? '')
|
||||||
|
|
||||||
const checkRole = () => {
|
|
||||||
switch (session?.role) {
|
|
||||||
case 'T01':
|
|
||||||
return session?.userNm === surveyDetail?.REPRESENTATIVE ? true : false
|
|
||||||
case 'Admin':
|
|
||||||
return session?.storeNm === surveyDetail?.STORE ? true : false
|
|
||||||
case 'Admin_Sub':
|
|
||||||
return session?.storeNm === surveyDetail?.STORE ? true : false
|
|
||||||
case 'Builder':
|
|
||||||
return session?.builderNo === surveyDetail?.CONSTRUCTION_POINT ? true : false
|
|
||||||
case 'Partner':
|
|
||||||
return session?.builderNo === surveyDetail?.CONSTRUCTION_POINT ? true : false
|
|
||||||
default:
|
|
||||||
return ''
|
|
||||||
}
|
}
|
||||||
}
|
}, [session, setUserId])
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
const result = checkRole()
|
if (isTemporary) {
|
||||||
if (result) {
|
alert('一時保存されたデータは提出できません。')
|
||||||
if (isTemporary) {
|
return
|
||||||
alert('一時保存されたデータは提出できません。')
|
}
|
||||||
return
|
if (userId === representative) {
|
||||||
|
if (confirm('提出しますか??')) {
|
||||||
|
if (surveyId) {
|
||||||
|
// TODO: 제출 페이지 추가
|
||||||
|
alert('SUBMIT POPUP!!!!!!!!!!!')
|
||||||
|
await submitSurvey()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
window.neoConfirm(
|
} else {
|
||||||
'提出しますか??',
|
alert('担当者のみ提出可能です。')
|
||||||
async () => {
|
|
||||||
if (surveyDetail?.ID) {
|
|
||||||
// TODO: 제출 페이지 추가
|
|
||||||
alert('SUBMIT POPUP!!!!!!!!!!!')
|
|
||||||
await submitSurvey()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
() => null,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleUpdate = () => {
|
const handleUpdate = () => {
|
||||||
const result = checkRole()
|
if (userId === representative) {
|
||||||
if (result) {
|
router.push(`/survey-sale/basic-info?id=${surveyId}&isTemp=${isTemporary}`)
|
||||||
// router.push(`/survey-sale/basic-info?id=${surveyDetail?.ID}&isTemp=${isTemporary}`)
|
|
||||||
router.push(`/survey-sale/regist?id=${surveyDetail?.ID}`)
|
|
||||||
} else {
|
} else {
|
||||||
alert('担当者のみ修正可能です。')
|
alert('担当者のみ修正可能です。')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
window.neoConfirm(
|
if (confirm('削除しますか?')) {
|
||||||
'削除しますか?',
|
if (surveyId) {
|
||||||
async () => {
|
if (userId === representative) {
|
||||||
if (surveyDetail?.ID) {
|
await deleteSurvey()
|
||||||
if (session.userNm === surveyDetail?.REPRESENTATIVE) {
|
router.push('/survey-sale')
|
||||||
await deleteSurvey()
|
} else {
|
||||||
alert('削除されました。')
|
alert('担当者のみ削除可能です。')
|
||||||
router.push('/survey-sale')
|
|
||||||
} else {
|
|
||||||
alert('担当者のみ削除可能です。')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
() => null,
|
}
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isSubmitter = session?.storeNm === surveyDetail?.STORE && session?.builderNo === surveyDetail?.CONSTRUCTION_POINT
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="btn-flex-wrap">
|
<div className="btn-flex-wrap">
|
||||||
<div className="btn-bx">
|
{isTemporary ? (
|
||||||
<button className="btn-frame n-blue icon" onClick={() => router.push('/survey-sale')}>
|
|
||||||
リスト<i className="btn-arr"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
{isSubmitter && surveyDetail?.SUBMISSION_STATUS ? (
|
|
||||||
<></>
|
<></>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{isTemporary || surveyDetail?.SUBMISSION_STATUS ? (
|
|
||||||
<></>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<div className="btn-bx">
|
|
||||||
<button className="btn-frame red icon" onClick={handleSubmit}>
|
|
||||||
提出<i className="btn-arr"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button className="btn-frame n-blue icon" onClick={handleUpdate}>
|
<button className="btn-frame n-blue icon" onClick={() => router.push('/survey-sale')}>
|
||||||
修正<i className="btn-arr"></i>
|
リスト<i className="btn-arr"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="btn-bx">
|
<div className="btn-bx">
|
||||||
<button className="btn-frame n-blue icon" onClick={handleDelete}>
|
<button className="btn-frame red icon" onClick={handleSubmit}>
|
||||||
削除<i className="btn-arr"></i>
|
提出<i className="btn-arr"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
<div className="btn-bx">
|
||||||
|
<button className="btn-frame n-blue icon" onClick={handleUpdate}>
|
||||||
|
修正<i className="btn-arr"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="btn-bx">
|
||||||
|
<button className="btn-frame n-blue icon" onClick={handleDelete}>
|
||||||
|
削除<i className="btn-arr"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
import DetailButton from './DetailButton'
|
import DetailButton from './DetailButton'
|
||||||
import { SurveyBasicInfo } from '@/types/Survey'
|
import { SurveyBasicInfo } from '@/types/Survey'
|
||||||
|
|
||||||
@ -10,6 +11,14 @@ export default function DetailForm({
|
|||||||
surveyDetail: SurveyBasicInfo | null
|
surveyDetail: SurveyBasicInfo | null
|
||||||
isLoadingSurveyDetail: boolean
|
isLoadingSurveyDetail: boolean
|
||||||
}) {
|
}) {
|
||||||
|
const [isTemporary, setIsTemporary] = useState(true)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (surveyDetail?.REPRESENTATIVE && surveyDetail?.STORE && surveyDetail?.CONSTRUCTION_POINT) {
|
||||||
|
setIsTemporary(false)
|
||||||
|
}
|
||||||
|
}, [surveyDetail])
|
||||||
|
|
||||||
if (isLoadingSurveyDetail) {
|
if (isLoadingSurveyDetail) {
|
||||||
return <div>Loading...</div>
|
return <div>Loading...</div>
|
||||||
}
|
}
|
||||||
@ -47,7 +56,7 @@ export default function DetailForm({
|
|||||||
<input type="text" className="input-frame" disabled defaultValue={surveyDetail?.CUSTOMER_NAME ?? ''} />
|
<input type="text" className="input-frame" disabled defaultValue={surveyDetail?.CUSTOMER_NAME ?? ''} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DetailButton surveyDetail={surveyDetail ?? null} />
|
<DetailButton isTemporary={isTemporary} surveyId={Number(surveyDetail?.ID)} representative={surveyDetail?.REPRESENTATIVE ?? ''} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { SurveyBasicInfo, SurveyDetailInfo } from '@/types/Survey'
|
import { SurveyBasicInfo, SurveyDetailInfo } from '@/types/Survey'
|
||||||
import DetailButton from './DetailButton'
|
import DetailButton from './DetailButton'
|
||||||
import { roof_material, supplementary_facilities } from './form/etcProcess/MultiCheckEtc'
|
import { roof_material, supplementary_facilities } from './form/MultiCheckEtc'
|
||||||
import { selectBoxOptions } from './form/etcProcess/SelectBoxEtc'
|
import { selectBoxOptions } from './form/SelectBoxEtc'
|
||||||
import { radioEtcData } from './form/etcProcess/RadioEtc'
|
import { radioEtcData } from './form/RadioEtc'
|
||||||
|
|
||||||
export default function RoofDetailForm({
|
export default function RoofDetailForm({
|
||||||
surveyDetail,
|
surveyDetail,
|
||||||
@ -196,10 +196,7 @@ export default function RoofDetailForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DetailButton
|
<DetailButton isTemporary={false} surveyId={Number(surveyDetail?.ID)} representative={surveyDetail?.REPRESENTATIVE ?? ''} />
|
||||||
isTemporary={false}
|
|
||||||
surveyDetail={surveyDetail}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { useSurveySaleTabState } from '@/store/surveySaleTabState'
|
|||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useAddressStore } from '@/store/addressStore'
|
import { useAddressStore } from '@/store/addressStore'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
// import { useUserType } from '@/hooks/useUserType'
|
import { useUserType } from '@/hooks/useUserType'
|
||||||
|
|
||||||
const defaultBasicInfoForm: SurveyBasicRequest = {
|
const defaultBasicInfoForm: SurveyBasicRequest = {
|
||||||
REPRESENTATIVE: '',
|
REPRESENTATIVE: '',
|
||||||
@ -37,6 +37,7 @@ export default function BasicForm() {
|
|||||||
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(defaultBasicInfoForm)
|
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(defaultBasicInfoForm)
|
||||||
|
|
||||||
const { addressData } = useAddressStore()
|
const { addressData } = useAddressStore()
|
||||||
|
const { memberRole, store, builderNo } = useUserType()
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
|
|
||||||
const popupController = usePopupController()
|
const popupController = usePopupController()
|
||||||
@ -58,12 +59,12 @@ export default function BasicForm() {
|
|||||||
setBasicInfoData((prev) => ({
|
setBasicInfoData((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
REPRESENTATIVE: session?.userId ?? '',
|
REPRESENTATIVE: session?.userId ?? '',
|
||||||
STORE: session?.storeNm ?? '',
|
STORE: store ?? '',
|
||||||
CONSTRUCTION_POINT: session?.builderNo ?? '',
|
CONSTRUCTION_POINT: builderNo ?? '',
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
setBasicInfoSelected()
|
setBasicInfoSelected()
|
||||||
}, [surveyDetail, addressData, session?.isLoggedIn, session?.userId, session?.storeNm, session?.builderNo])
|
}, [surveyDetail, addressData, session?.isLoggedIn, session?.userNm, store, builderNo])
|
||||||
|
|
||||||
const focusInput = (input: keyof SurveyBasicRequest) => {
|
const focusInput = (input: keyof SurveyBasicRequest) => {
|
||||||
const inputElement = document.getElementById(input)
|
const inputElement = document.getElementById(input)
|
||||||
@ -87,19 +88,19 @@ export default function BasicForm() {
|
|||||||
|
|
||||||
const handleSave = async (isTemporary: boolean) => {
|
const handleSave = async (isTemporary: boolean) => {
|
||||||
if (id) {
|
if (id) {
|
||||||
// updateSurvey(basicInfoData)
|
updateSurvey(basicInfoData)
|
||||||
alert('保存しました。')
|
alert('保存しました。')
|
||||||
// router.push(`/survey-sale/${id}?tab=basic-info`)
|
router.push(`/survey-sale/${id}?tab=basic-info`)
|
||||||
}
|
}
|
||||||
if (isTemporary) {
|
if (isTemporary) {
|
||||||
// const saveId = await createSurvey(basicInfoData)
|
const saveId = await createSurvey(basicInfoData)
|
||||||
alert('一時保存されました。')
|
alert('一時保存されました。')
|
||||||
// router.push(`/survey-sale/${saveId}?tab=basic-info`)
|
router.push(`/survey-sale/${saveId}?tab=basic-info`)
|
||||||
} else {
|
} else {
|
||||||
if (validateSurvey(basicInfoData)) {
|
if (validateSurvey(basicInfoData)) {
|
||||||
// const saveId = await createSurvey(basicInfoData)
|
const saveId = await createSurvey(basicInfoData)
|
||||||
alert('保存しました。')
|
alert('保存しました。 登録番号: ' + saveId)
|
||||||
// router.push(`/survey-sale/${saveId}?tab=basic-info`)
|
router.push(`/survey-sale/${saveId}?tab=basic-info`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,7 +123,7 @@ export default function BasicForm() {
|
|||||||
onChange={(e) => handleChange('REPRESENTATIVE', e.target.value)}
|
onChange={(e) => handleChange('REPRESENTATIVE', e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{(session?.role === 'Builder' || session?.role?.includes('Admin')) && (
|
{(memberRole === 'Builder' || memberRole?.includes('Admin')) && (
|
||||||
<>
|
<>
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
<div className="data-input-form-tit">販売店</div>
|
<div className="data-input-form-tit">販売店</div>
|
||||||
@ -130,20 +131,20 @@ export default function BasicForm() {
|
|||||||
type="text"
|
type="text"
|
||||||
className="input-frame"
|
className="input-frame"
|
||||||
id="store"
|
id="store"
|
||||||
value={session?.storeNm ? session?.storeNm : basicInfoData.STORE ?? ''}
|
value={store ? store : basicInfoData.STORE ?? ''}
|
||||||
onChange={(e) => handleChange('STORE', e.target.value)}
|
onChange={(e) => handleChange('STORE', e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{(session?.role === 'Partner' || session?.role === 'Builder') && (
|
{(memberRole === 'Partner' || memberRole === 'Builder') && (
|
||||||
<div className="data-input-form-bx">
|
<div className="data-input-form-bx">
|
||||||
<div className="data-input-form-tit">施工店</div>
|
<div className="data-input-form-tit">施工店</div>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
className="input-frame"
|
className="input-frame"
|
||||||
id="construction_point"
|
id="construction_point"
|
||||||
value={session?.builderNo ? session?.builderNo : basicInfoData.CONSTRUCTION_POINT ?? ''}
|
value={builderNo ? builderNo : basicInfoData.CONSTRUCTION_POINT ?? ''}
|
||||||
onChange={(e) => handleChange('CONSTRUCTION_POINT', e.target.value)}
|
onChange={(e) => handleChange('CONSTRUCTION_POINT', e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -195,13 +196,15 @@ export default function BasicForm() {
|
|||||||
<input type="text" className="input-frame" id="POST_CODE" value={basicInfoData.POST_CODE ?? ''} readOnly />
|
<input type="text" className="input-frame" id="POST_CODE" value={basicInfoData.POST_CODE ?? ''} readOnly />
|
||||||
</div>
|
</div>
|
||||||
<div className="form-bx">
|
<div className="form-bx">
|
||||||
<input
|
<select
|
||||||
type="text"
|
className="select-form"
|
||||||
className="input-frame"
|
name="address"
|
||||||
name="address"
|
id="ADDRESS"
|
||||||
id="ADDRESS"
|
value={basicInfoData.ADDRESS ?? ''}
|
||||||
value={basicInfoData.ADDRESS ?? ''}
|
onChange={(e) => handleChange('ADDRESS', e.target.value)}
|
||||||
/>
|
>
|
||||||
|
<option value="">東京都</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-btn">
|
<div className="form-btn">
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import { useServey } from '@/hooks/useSurvey'
|
|||||||
import { SurveyDetailRequest } from '@/types/Survey'
|
import { SurveyDetailRequest } from '@/types/Survey'
|
||||||
import { useRouter, useSearchParams } from 'next/navigation'
|
import { useRouter, useSearchParams } from 'next/navigation'
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import MultiCheckEtc from './etcProcess/MultiCheckEtc'
|
import MultiCheckEtc from './MultiCheckEtc'
|
||||||
import SelectBoxEtc from './etcProcess/SelectBoxEtc'
|
import SelectBoxEtc from './SelectBoxEtc'
|
||||||
import RadioEtc from './etcProcess/RadioEtc'
|
import RadioEtc from './RadioEtc'
|
||||||
|
|
||||||
const defaultDetailInfoForm: SurveyDetailRequest = {
|
const defaultDetailInfoForm: SurveyDetailRequest = {
|
||||||
CONTRACT_CAPACITY: null,
|
CONTRACT_CAPACITY: null,
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { useEffect, useState } from 'react'
|
|||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import SearchForm from './SearchForm'
|
import SearchForm from './SearchForm'
|
||||||
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
||||||
|
import { MemberRole } from '@/hooks/useUserType'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
|
|
||||||
export default function ListTable() {
|
export default function ListTable() {
|
||||||
@ -15,6 +16,7 @@ export default function ListTable() {
|
|||||||
|
|
||||||
const [heldSurveyList, setHeldSurveyList] = useState<typeof surveyList>([])
|
const [heldSurveyList, setHeldSurveyList] = useState<typeof surveyList>([])
|
||||||
const [hasMore, setHasMore] = useState(false)
|
const [hasMore, setHasMore] = useState(false)
|
||||||
|
const [memberRole, setMemberRole] = useState<MemberRole>()
|
||||||
|
|
||||||
const { session } = useSessionStore()
|
const { session } = useSessionStore()
|
||||||
|
|
||||||
@ -30,7 +32,8 @@ export default function ListTable() {
|
|||||||
}
|
}
|
||||||
setHasMore(surveyListCount > offset + 10)
|
setHasMore(surveyListCount > offset + 10)
|
||||||
}
|
}
|
||||||
}, [surveyList, surveyListCount, offset, session?.role])
|
setMemberRole(session.role as MemberRole)
|
||||||
|
}, [surveyList, surveyListCount, offset, session])
|
||||||
|
|
||||||
const handleDetailClick = (id: number) => {
|
const handleDetailClick = (id: number) => {
|
||||||
router.push(`/survey-sale/${id}`)
|
router.push(`/survey-sale/${id}`)
|
||||||
@ -44,7 +47,7 @@ export default function ListTable() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<SearchForm onItemsInit={handleItemsInit} memberRole={session?.role ?? ''} userId={session?.userId ?? ''} />
|
<SearchForm onItemsInit={handleItemsInit} memberRole={memberRole as MemberRole} />
|
||||||
{heldSurveyList.length > 0 ? (
|
{heldSurveyList.length > 0 ? (
|
||||||
<div className="sale-frame">
|
<div className="sale-frame">
|
||||||
<ul className="sale-list-wrap">
|
<ul className="sale-list-wrap">
|
||||||
|
|||||||
@ -1,22 +1,23 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { SEARCH_OPTIONS, SEARCH_OPTIONS_ENUM, SEARCH_OPTIONS_PARTNERS, useSurveyFilterStore } from '@/store/surveyFilterStore'
|
import { SEARCH_OPTIONS, SEARCH_OPTIONS_ENUM, SEARCH_OPTIONS_PARTNERS, useSurveyFilterStore } from '@/store/surveyFilterStore'
|
||||||
|
import { MemberRole } from '@/hooks/useUserType'
|
||||||
import { useRouter } from 'next/navigation'
|
import { useRouter } from 'next/navigation'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
|
|
||||||
export default function SearchForm({ onItemsInit, memberRole, userId }: { onItemsInit: () => void; memberRole: string; userId: string }) {
|
export default function SearchForm({ onItemsInit, memberRole }: { onItemsInit: () => void; memberRole: MemberRole }) {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { setSearchOption, setSort, setIsMySurvey, setKeyword, isMySurvey, keyword, searchOption, sort } = useSurveyFilterStore()
|
const { setSearchOption, setSort, setIsMySurvey, setKeyword, isMySurvey, keyword, searchOption, sort } = useSurveyFilterStore()
|
||||||
const [searchKeyword, setSearchKeyword] = useState(keyword)
|
const [searchKeyword, setSearchKeyword] = useState(keyword)
|
||||||
const [option, setOption] = useState(searchOption)
|
|
||||||
|
const username = 'test'
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
if (option !== 'id' && searchKeyword.trim().length < 2) {
|
if (searchKeyword.trim().length < 2) {
|
||||||
alert('2文字以上入力してください')
|
alert('2文字以上入力してください')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setKeyword(searchKeyword)
|
setKeyword(searchKeyword)
|
||||||
setSearchOption(option)
|
|
||||||
onItemsInit()
|
onItemsInit()
|
||||||
}
|
}
|
||||||
const searchOptions = memberRole === 'Partner' ? SEARCH_OPTIONS_PARTNERS : SEARCH_OPTIONS
|
const searchOptions = memberRole === 'Partner' ? SEARCH_OPTIONS_PARTNERS : SEARCH_OPTIONS
|
||||||
@ -24,7 +25,7 @@ export default function SearchForm({ onItemsInit, memberRole, userId }: { onItem
|
|||||||
return (
|
return (
|
||||||
<div className="sale-frame">
|
<div className="sale-frame">
|
||||||
<div className="sale-form-bx">
|
<div className="sale-form-bx">
|
||||||
<button className="btn-frame n-blue icon" onClick={() => router.push('/survey-sale/regist')}>
|
<button className="btn-frame n-blue icon" onClick={() => router.push('/survey-sale/basic-info')}>
|
||||||
新規売買登録<i className="btn-arr"></i>
|
新規売買登録<i className="btn-arr"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -33,18 +34,8 @@ export default function SearchForm({ onItemsInit, memberRole, userId }: { onItem
|
|||||||
className="select-form"
|
className="select-form"
|
||||||
name="search-option"
|
name="search-option"
|
||||||
id="search-option"
|
id="search-option"
|
||||||
value={option}
|
value={searchOption}
|
||||||
onChange={(e) => {
|
onChange={(e) => setSearchOption(e.target.value as SEARCH_OPTIONS_ENUM)}
|
||||||
if (e.target.value === 'all') {
|
|
||||||
setKeyword('')
|
|
||||||
setSearchKeyword('')
|
|
||||||
onItemsInit()
|
|
||||||
setSearchOption('all')
|
|
||||||
setOption('all')
|
|
||||||
} else {
|
|
||||||
setOption(e.target.value as SEARCH_OPTIONS_ENUM)
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{searchOptions.map((option) => (
|
{searchOptions.map((option) => (
|
||||||
<option key={option.id} value={option.id}>
|
<option key={option.id} value={option.id}>
|
||||||
@ -60,9 +51,7 @@ export default function SearchForm({ onItemsInit, memberRole, userId }: { onItem
|
|||||||
className="search-frame"
|
className="search-frame"
|
||||||
value={searchKeyword}
|
value={searchKeyword}
|
||||||
placeholder="タイトルを入力してください. (2文字以上)"
|
placeholder="タイトルを入力してください. (2文字以上)"
|
||||||
onChange={(e) => {
|
onChange={(e) => setSearchKeyword(e.target.value)}
|
||||||
setSearchKeyword(e.target.value)
|
|
||||||
}}
|
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
handleSearch()
|
handleSearch()
|
||||||
@ -77,9 +66,9 @@ export default function SearchForm({ onItemsInit, memberRole, userId }: { onItem
|
|||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="ch01"
|
id="ch01"
|
||||||
checked={isMySurvey === userId}
|
checked={isMySurvey === username}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
setIsMySurvey(isMySurvey === userId ? null : userId)
|
setIsMySurvey(isMySurvey === username ? null : username)
|
||||||
onItemsInit()
|
onItemsInit()
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -1,156 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import { SurveyBasicRequest, SurveyRegistRequest } from '@/types/Survey'
|
|
||||||
import { useEffect } from 'react'
|
|
||||||
import { usePopupController } from '@/store/popupController'
|
|
||||||
import { useAddressStore } from '@/store/addressStore'
|
|
||||||
import { useSessionStore } from '@/store/session'
|
|
||||||
|
|
||||||
|
|
||||||
export default function BasicRegist({
|
|
||||||
basicInfoData,
|
|
||||||
setBasicInfoData,
|
|
||||||
}: {
|
|
||||||
basicInfoData: SurveyBasicRequest
|
|
||||||
setBasicInfoData: (data: SurveyBasicRequest) => void
|
|
||||||
}) {
|
|
||||||
|
|
||||||
const { addressData } = useAddressStore()
|
|
||||||
const { session } = useSessionStore()
|
|
||||||
|
|
||||||
const popupController = usePopupController()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (addressData) {
|
|
||||||
setBasicInfoData({
|
|
||||||
...basicInfoData,
|
|
||||||
POST_CODE: addressData.post_code,
|
|
||||||
ADDRESS: addressData.address,
|
|
||||||
ADDRESS_DETAIL: addressData.address_detail,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, [addressData])
|
|
||||||
|
|
||||||
const handleChange = (key: keyof SurveyRegistRequest, value: string) => {
|
|
||||||
setBasicInfoData({ ...basicInfoData, [key]: value })
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="sale-frame" id="basic-form-section">
|
|
||||||
<div className="data-form-wrap">
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">担当者名</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
id="representative"
|
|
||||||
value={session?.userNm ? session?.userNm : basicInfoData.REPRESENTATIVE}
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{(session?.role === 'Builder' || session?.role?.includes('Admin')) && (
|
|
||||||
<>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">販売店</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
id="store"
|
|
||||||
value={session?.storeNm ? session?.storeNm : basicInfoData.STORE ?? ''}
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{(session?.role === 'Partner' || session?.role === 'Builder') && (
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">施工店</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
id="construction_point"
|
|
||||||
value={session?.builderNo ? session?.builderNo : basicInfoData.CONSTRUCTION_POINT ?? ''}
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="sale-frame">
|
|
||||||
<div className="data-form-wrap">
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">現地調査日</div>
|
|
||||||
<div className="date-input">
|
|
||||||
<button className="date-btn">
|
|
||||||
<i className="date-icon"></i>
|
|
||||||
</button>
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
className="date-frame"
|
|
||||||
id="INVESTIGATION_DATE"
|
|
||||||
value={basicInfoData.INVESTIGATION_DATE ?? ''}
|
|
||||||
onChange={(e) => handleChange('INVESTIGATION_DATE', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">建物名</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
id="BUILDING_NAME"
|
|
||||||
value={basicInfoData.BUILDING_NAME ?? ''}
|
|
||||||
onChange={(e) => handleChange('BUILDING_NAME', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">顧客名</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
id="CUSTOMER_NAME"
|
|
||||||
value={basicInfoData.CUSTOMER_NAME ?? ''}
|
|
||||||
onChange={(e) => handleChange('CUSTOMER_NAME', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">建物の住所</div>
|
|
||||||
<div className="form-flex">
|
|
||||||
<div className="form-bx">
|
|
||||||
<input type="text" className="input-frame" id="POST_CODE" placeholder="郵便番号" value={basicInfoData.POST_CODE ?? ''} readOnly />
|
|
||||||
</div>
|
|
||||||
<div className="form-bx">
|
|
||||||
<input
|
|
||||||
className="input-frame"
|
|
||||||
name="address"
|
|
||||||
id="ADDRESS"
|
|
||||||
placeholder="都道府県"
|
|
||||||
value={basicInfoData.ADDRESS ?? ''}
|
|
||||||
onChange={(e) => handleChange('ADDRESS', e.target.value)}
|
|
||||||
readOnly
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="form-btn">
|
|
||||||
<button className="btn-frame n-blue icon" onClick={() => popupController.setZipCodePopup(true)}>
|
|
||||||
郵便番号<i className="btn-arr"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">市区町村名, 以後の住所</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
id="ADDRESS_DETAIL"
|
|
||||||
value={basicInfoData.ADDRESS_DETAIL ?? ''}
|
|
||||||
onChange={(e) => handleChange('ADDRESS_DETAIL', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import { SurveyBasicRequest, SurveyRegistRequest } from '@/types/Survey'
|
|
||||||
import { SurveyDetailRequest } from '@/types/Survey'
|
|
||||||
import { useRouter } from 'next/navigation'
|
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
|
||||||
|
|
||||||
export default function FormButton({
|
|
||||||
surveyData,
|
|
||||||
idParam,
|
|
||||||
}: {
|
|
||||||
surveyData: { basic: SurveyBasicRequest; roof: SurveyDetailRequest }
|
|
||||||
idParam: string | null
|
|
||||||
}) {
|
|
||||||
const router = useRouter()
|
|
||||||
const { validateSurveyDetail, createSurvey, updateSurvey } = useServey(Number(idParam))
|
|
||||||
|
|
||||||
const saveData = {
|
|
||||||
...surveyData.basic,
|
|
||||||
DETAIL_INFO: surveyData.roof,
|
|
||||||
}
|
|
||||||
|
|
||||||
const focusInput = (input: keyof SurveyRegistRequest) => {
|
|
||||||
const inputElement = document.getElementById(input)
|
|
||||||
if (inputElement) {
|
|
||||||
inputElement.focus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleSave = (isTemporary: boolean) => {
|
|
||||||
const emptyField = validateSurveyDetail(saveData.DETAIL_INFO)
|
|
||||||
if (!isTemporary) {
|
|
||||||
saveProcess(emptyField)
|
|
||||||
} else {
|
|
||||||
temporarySaveProcess()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const saveProcess = async (emptyField: string) => {
|
|
||||||
if (emptyField.trim() === '') {
|
|
||||||
if (idParam) {
|
|
||||||
// 매물 수정 (저장)
|
|
||||||
updateSurvey(saveData)
|
|
||||||
router.push(`/survey-sale/${idParam}`)
|
|
||||||
} else {
|
|
||||||
// 매물 생성 (저장)
|
|
||||||
const id = await createSurvey(saveData)
|
|
||||||
router.push(`/survey-sale/${id}`)
|
|
||||||
}
|
|
||||||
alert('保存されました。')
|
|
||||||
} else {
|
|
||||||
alert(emptyField + ' 項目が空です。')
|
|
||||||
focusInput(emptyField as keyof SurveyRegistRequest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const temporarySaveProcess = async () => {
|
|
||||||
if (idParam) {
|
|
||||||
// 매물 수정 (임시저장)
|
|
||||||
updateSurvey(saveData)
|
|
||||||
router.push(`/survey-sale/${idParam}?isTemporary=true`)
|
|
||||||
} else {
|
|
||||||
// 매물 생성 (임시저장)
|
|
||||||
const id = await createSurvey(saveData)
|
|
||||||
router.push(`/survey-sale/${id}?isTemporary=true`)
|
|
||||||
}
|
|
||||||
alert('一時保存されました。')
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="sale-frame">
|
|
||||||
<div className="btn-flex-wrap">
|
|
||||||
<div className="btn-bx">
|
|
||||||
<button className="btn-frame n-blue icon" onClick={() => handleSave(true)}>
|
|
||||||
一時保存<i className="btn-arr"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div className="btn-bx">
|
|
||||||
<button className="btn-frame red icon" onClick={() => handleSave(false)}>
|
|
||||||
保存<i className="btn-arr"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div className="btn-bx">
|
|
||||||
<button className="btn-frame n-blue icon" onClick={() => router.push('/survey-sale')}>
|
|
||||||
リスト<i className="btn-arr"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import { SurveyBasicRequest, SurveyDetailRequest, SurveyRegistRequest } from '@/types/Survey'
|
|
||||||
import FormButton from './formButton'
|
|
||||||
import { useEffect, useState } from 'react'
|
|
||||||
import BasicRegist from './basicRegist'
|
|
||||||
import RoofRegist from './roofRegist'
|
|
||||||
import { useSessionStore } from '@/store/session'
|
|
||||||
import { useSearchParams } from 'next/navigation'
|
|
||||||
import { useServey } from '@/hooks/useSurvey'
|
|
||||||
|
|
||||||
const roofInfoForm: SurveyDetailRequest = {
|
|
||||||
CONTRACT_CAPACITY: null,
|
|
||||||
RETAIL_COMPANY: null,
|
|
||||||
SUPPLEMENTARY_FACILITIES: null,
|
|
||||||
SUPPLEMENTARY_FACILITIES_ETC: null,
|
|
||||||
INSTALLATION_SYSTEM: null,
|
|
||||||
INSTALLATION_SYSTEM_ETC: null,
|
|
||||||
CONSTRUCTION_YEAR: null,
|
|
||||||
CONSTRUCTION_YEAR_ETC: null,
|
|
||||||
ROOF_MATERIAL: null,
|
|
||||||
ROOF_MATERIAL_ETC: null,
|
|
||||||
ROOF_SHAPE: null,
|
|
||||||
ROOF_SHAPE_ETC: null,
|
|
||||||
ROOF_SLOPE: null,
|
|
||||||
HOUSE_STRUCTURE: '1',
|
|
||||||
HOUSE_STRUCTURE_ETC: null,
|
|
||||||
RAFTER_MATERIAL: '1',
|
|
||||||
RAFTER_MATERIAL_ETC: null,
|
|
||||||
RAFTER_SIZE: null,
|
|
||||||
RAFTER_SIZE_ETC: null,
|
|
||||||
RAFTER_PITCH: null,
|
|
||||||
RAFTER_PITCH_ETC: null,
|
|
||||||
RAFTER_DIRECTION: '1',
|
|
||||||
OPEN_FIELD_PLATE_KIND: null,
|
|
||||||
OPEN_FIELD_PLATE_KIND_ETC: null,
|
|
||||||
OPEN_FIELD_PLATE_THICKNESS: null,
|
|
||||||
LEAK_TRACE: false,
|
|
||||||
WATERPROOF_MATERIAL: null,
|
|
||||||
WATERPROOF_MATERIAL_ETC: null,
|
|
||||||
INSULATION_PRESENCE: '1',
|
|
||||||
INSULATION_PRESENCE_ETC: null,
|
|
||||||
STRUCTURE_ORDER: null,
|
|
||||||
STRUCTURE_ORDER_ETC: null,
|
|
||||||
INSTALLATION_AVAILABILITY: null,
|
|
||||||
INSTALLATION_AVAILABILITY_ETC: null,
|
|
||||||
MEMO: null,
|
|
||||||
}
|
|
||||||
|
|
||||||
const basicInfoForm: SurveyBasicRequest = {
|
|
||||||
REPRESENTATIVE: '',
|
|
||||||
STORE: null,
|
|
||||||
CONSTRUCTION_POINT: null,
|
|
||||||
INVESTIGATION_DATE: new Date().toLocaleDateString('en-CA'),
|
|
||||||
BUILDING_NAME: null,
|
|
||||||
CUSTOMER_NAME: null,
|
|
||||||
POST_CODE: null,
|
|
||||||
ADDRESS: null,
|
|
||||||
ADDRESS_DETAIL: null,
|
|
||||||
SUBMISSION_STATUS: false,
|
|
||||||
SUBMISSION_DATE: null,
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function RegistForm() {
|
|
||||||
const searchParams = useSearchParams()
|
|
||||||
const id = searchParams.get('id')
|
|
||||||
|
|
||||||
const { session } = useSessionStore()
|
|
||||||
const { surveyDetail } = useServey(Number(id))
|
|
||||||
|
|
||||||
const [basicInfoData, setBasicInfoData] = useState<SurveyBasicRequest>(basicInfoForm)
|
|
||||||
const [roofInfoData, setRoofInfoData] = useState<SurveyDetailRequest>(roofInfoForm)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (session) {
|
|
||||||
setBasicInfoData({
|
|
||||||
...basicInfoForm,
|
|
||||||
REPRESENTATIVE: session.userNm ?? '',
|
|
||||||
STORE: session.role === 'T01' ? '' : session.storeNm ?? '',
|
|
||||||
CONSTRUCTION_POINT: session.builderNo ?? '',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if (id && surveyDetail) {
|
|
||||||
const { ID, UPT_DT, REG_DT, DETAIL_INFO, ...rest } = surveyDetail
|
|
||||||
setBasicInfoData(rest)
|
|
||||||
if (surveyDetail?.DETAIL_INFO) {
|
|
||||||
const { ID, UPT_DT, REG_DT, BASIC_INFO_ID, ...rest } = surveyDetail.DETAIL_INFO
|
|
||||||
setRoofInfoData(rest)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [session, surveyDetail])
|
|
||||||
|
|
||||||
const surveyData = {
|
|
||||||
basic: basicInfoData,
|
|
||||||
roof: roofInfoData,
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<BasicRegist basicInfoData={basicInfoData} setBasicInfoData={setBasicInfoData} />
|
|
||||||
<RoofRegist roofInfoData={roofInfoData} setRoofInfoData={setRoofInfoData} />
|
|
||||||
<FormButton surveyData={surveyData} idParam={id} />
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -1,284 +0,0 @@
|
|||||||
'use client'
|
|
||||||
|
|
||||||
import { useSurveySaleTabState } from '@/store/surveySaleTabState'
|
|
||||||
|
|
||||||
import { SurveyBasicInfo, SurveyDetailRequest } from '@/types/Survey'
|
|
||||||
import { useEffect } from 'react'
|
|
||||||
import MultiCheckEtc from '../detail/form/etcProcess/MultiCheckEtc'
|
|
||||||
import SelectBoxEtc from '../detail/form/etcProcess/SelectBoxEtc'
|
|
||||||
import RadioEtc from '../detail/form/etcProcess/RadioEtc'
|
|
||||||
|
|
||||||
export default function RoofRegist({
|
|
||||||
roofInfoData,
|
|
||||||
setRoofInfoData,
|
|
||||||
}: {
|
|
||||||
roofInfoData: SurveyDetailRequest
|
|
||||||
setRoofInfoData: (data: SurveyDetailRequest) => void
|
|
||||||
}) {
|
|
||||||
const { setRoofInfoSelected } = useSurveySaleTabState()
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setRoofInfoSelected()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const handleNumberInput = (key: keyof SurveyDetailRequest, value: number | string) => {
|
|
||||||
if (key === 'ROOF_SLOPE' || key === 'OPEN_FIELD_PLATE_THICKNESS') {
|
|
||||||
const stringValue = value.toString()
|
|
||||||
if (stringValue.length > 5) {
|
|
||||||
alert('保存できるサイズを超えました。')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (stringValue.includes('.')) {
|
|
||||||
const decimalPlaces = stringValue.split('.')[1].length
|
|
||||||
if (decimalPlaces > 1) {
|
|
||||||
alert('小数点以下1桁までしか許されません。')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setRoofInfoData({ ...roofInfoData, [key]: value.toString() })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleTextInput = (key: keyof SurveyDetailRequest, value: string) => {
|
|
||||||
setRoofInfoData({ ...roofInfoData, [key]: value || null })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleBooleanInput = (key: keyof SurveyDetailRequest, value: boolean) => {
|
|
||||||
setRoofInfoData({ ...roofInfoData, [key]: value })
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleUnitInput = (value: string) => {
|
|
||||||
const numericValue = roofInfoData.CONTRACT_CAPACITY?.replace(/[^0-9.]/g, '') || ''
|
|
||||||
setRoofInfoData({
|
|
||||||
...roofInfoData,
|
|
||||||
CONTRACT_CAPACITY: numericValue ? `${numericValue} ${value}` : value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// const handleSave = async () => {
|
|
||||||
// if (id) {
|
|
||||||
// const emptyField = validateSurveyDetail(roofInfoData)
|
|
||||||
// if (emptyField.trim() === '') {
|
|
||||||
// const updatedBasicInfoData = {
|
|
||||||
// DETAIL_INFO: roofInfoData,
|
|
||||||
// }
|
|
||||||
// try {
|
|
||||||
// createSurveyDetail({
|
|
||||||
// surveyId: Number(id),
|
|
||||||
// surveyDetail: updatedBasicInfoData,
|
|
||||||
// })
|
|
||||||
// alert('調査物件を保存しました。')
|
|
||||||
// } catch (error) {
|
|
||||||
// alert(error)
|
|
||||||
// throw new Error('failed to create survey detail: ' + error)
|
|
||||||
// }
|
|
||||||
// router.push(`/survey-sale`)
|
|
||||||
// } else {
|
|
||||||
// alert(emptyField + ' は必須項目です。')
|
|
||||||
// focusOnInput(emptyField)
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// alert('基本情報を作成した後、屋根情報を作成することができます。')
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// const focusOnInput = (field: string) => {
|
|
||||||
// const input = document.getElementById(field)
|
|
||||||
// if (input) {
|
|
||||||
// input.focus()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<div className="sale-frame" id="roof-form-section">
|
|
||||||
<div className="sale-roof-title">電気関係</div>
|
|
||||||
<div className="data-form-wrap">
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
{/* 전기계약 용량 - contract_capacity */}
|
|
||||||
<div className="data-input-form-tit">電気契約容量</div>
|
|
||||||
<div className="data-input mb5">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
inputMode="decimal"
|
|
||||||
className="input-frame"
|
|
||||||
value={roofInfoData.CONTRACT_CAPACITY?.split(' ')[0] ?? ''}
|
|
||||||
onChange={(e) => handleNumberInput('CONTRACT_CAPACITY', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="data-input">
|
|
||||||
<select
|
|
||||||
className="select-form"
|
|
||||||
name="CONTRACT_CAPACITY_UNIT"
|
|
||||||
id="CONTRACT_CAPACITY_UNIT"
|
|
||||||
onChange={(e) => handleUnitInput(e.target.value)}
|
|
||||||
value={roofInfoData.CONTRACT_CAPACITY?.split(' ')[1] ?? ''}
|
|
||||||
>
|
|
||||||
<option value="" hidden>
|
|
||||||
選択してください
|
|
||||||
</option>
|
|
||||||
<option value="kVA">kVA</option>
|
|
||||||
<option value="A">A</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* 전기 소매 회사 - retail_company */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">電気小売会社</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
className="input-frame"
|
|
||||||
value={roofInfoData.RETAIL_COMPANY ?? ''}
|
|
||||||
onChange={(e) => handleTextInput('RETAIL_COMPANY', e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/* 전기 부대 설비 - supplementary_facilities */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<MultiCheckEtc column={'SUPPLEMENTARY_FACILITIES'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
</div>
|
|
||||||
{/* 설치 희망 시스템 - installation_system */}
|
|
||||||
<SelectBoxEtc column={'INSTALLATION_SYSTEM'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="sale-frame">
|
|
||||||
<div className="sale-roof-title">屋根関係</div>
|
|
||||||
<div className="data-form-wrap">
|
|
||||||
{/* 건축 연수 - construction_year */}
|
|
||||||
<SelectBoxEtc column={'CONSTRUCTION_YEAR'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 지붕재 - roof_material */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<MultiCheckEtc column={'ROOF_MATERIAL'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
</div>
|
|
||||||
{/* 지붕 모양 - roof_shape */}
|
|
||||||
<SelectBoxEtc column={'ROOF_SHAPE'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 지붕 경사도 - roof_slope */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">屋根の斜面</div>
|
|
||||||
<div className="data-input flex">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step={0.1}
|
|
||||||
inputMode="decimal"
|
|
||||||
className="input-frame"
|
|
||||||
value={roofInfoData.ROOF_SLOPE ?? ''}
|
|
||||||
onChange={(e) => handleNumberInput('ROOF_SLOPE', e.target.value)}
|
|
||||||
/>
|
|
||||||
<span>寸</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* 주택 구조 - house_structure */}
|
|
||||||
<RadioEtc column={'HOUSE_STRUCTURE'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 서까래 재질 - rafter_material */}
|
|
||||||
<RadioEtc column={'RAFTER_MATERIAL'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 서까래 크기 - rafter_size */}
|
|
||||||
<SelectBoxEtc column={'RAFTER_SIZE'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 서까래 피치 - rafter_pitch */}
|
|
||||||
<SelectBoxEtc column={'RAFTER_PITCH'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 서까래 방향 - rafter_direction */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit red-f">垂木の方向</div>
|
|
||||||
<div className="data-check-wrap mb0" id="rafter_direction">
|
|
||||||
<div className="radio-form-box">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="RAFTER_DIRECTION"
|
|
||||||
id="RAFTER_DIRECTION_1"
|
|
||||||
value={1}
|
|
||||||
onChange={(e) => handleNumberInput('RAFTER_DIRECTION', Number(e.target.value))}
|
|
||||||
checked={roofInfoData.RAFTER_DIRECTION === '1'}
|
|
||||||
/>
|
|
||||||
<label htmlFor="RAFTER_DIRECTION_1">垂直垂木</label>
|
|
||||||
</div>
|
|
||||||
<div className="radio-form-box">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="RAFTER_DIRECTION"
|
|
||||||
id="RAFTER_DIRECTION_2"
|
|
||||||
value={2}
|
|
||||||
onChange={(e) => handleNumberInput('RAFTER_DIRECTION', Number(e.target.value))}
|
|
||||||
checked={roofInfoData.RAFTER_DIRECTION === '2'}
|
|
||||||
/>
|
|
||||||
<label htmlFor="RAFTER_DIRECTION_2">水平垂木</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* 노지판 종류 - open_field_plate_kind */}
|
|
||||||
<SelectBoxEtc column={'OPEN_FIELD_PLATE_KIND'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 노지판 두께 - open_field_plate_thickness */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">
|
|
||||||
路地板厚<span>※小幅板を選択した場合, 厚さ. 小幅板間の間隔寸法を記載</span>
|
|
||||||
</div>
|
|
||||||
<div className="data-input flex">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
step={0.1}
|
|
||||||
inputMode="decimal"
|
|
||||||
className="input-frame"
|
|
||||||
value={roofInfoData.OPEN_FIELD_PLATE_THICKNESS ?? ''}
|
|
||||||
onChange={(e) => handleNumberInput('OPEN_FIELD_PLATE_THICKNESS', e.target.value)}
|
|
||||||
/>
|
|
||||||
<span>mm</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* 누수 흔적 - leak_trace */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit ">水漏れの痕跡</div>
|
|
||||||
<div className="data-check-wrap mb0">
|
|
||||||
<div className="radio-form-box">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="LEAK_TRACE"
|
|
||||||
id="LEAK_TRACE_1"
|
|
||||||
checked={roofInfoData.LEAK_TRACE === true}
|
|
||||||
onChange={(e) => handleBooleanInput('LEAK_TRACE', true)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="LEAK_TRACE_1">あり</label>
|
|
||||||
</div>
|
|
||||||
<div className="radio-form-box">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="LEAK_TRACE"
|
|
||||||
id="LEAK_TRACE_2"
|
|
||||||
checked={roofInfoData.LEAK_TRACE === false}
|
|
||||||
onChange={(e) => handleBooleanInput('LEAK_TRACE', false)}
|
|
||||||
/>
|
|
||||||
<label htmlFor="LEAK_TRACE_2">なし</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* 방수재 종류 - waterproof_material */}
|
|
||||||
<RadioEtc column={'WATERPROOF_MATERIAL'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 단열재 유무 - insulation_presence */}
|
|
||||||
<RadioEtc column={'INSULATION_PRESENCE'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 노지판 종류 - open_field_plate_kind */}
|
|
||||||
<SelectBoxEtc column={'STRUCTURE_ORDER'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 설치 가능 여부 - installation_availability */}
|
|
||||||
<SelectBoxEtc column={'INSTALLATION_AVAILABILITY'} setDetailInfoData={setRoofInfoData} detailInfoData={roofInfoData} />
|
|
||||||
{/* 메모 - memo */}
|
|
||||||
<div className="data-input-form-bx">
|
|
||||||
<div className="data-input-form-tit">メモ</div>
|
|
||||||
<div className="data-input mb5">
|
|
||||||
<select className="select-form" name="" id="">
|
|
||||||
<option value="">確認済み</option>
|
|
||||||
<option value="">確認済み</option>
|
|
||||||
<option value="">確認済み</option>
|
|
||||||
<option value="">確認済み</option>
|
|
||||||
<option value="">確認済み</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div className="data-input">
|
|
||||||
<textarea
|
|
||||||
className="textarea-form"
|
|
||||||
name="MEMO"
|
|
||||||
id="MEMO"
|
|
||||||
value={roofInfoData.MEMO ?? ''}
|
|
||||||
onChange={(e) => handleTextInput('MEMO', e.target.value)}
|
|
||||||
placeholder="例: 漏れの兆候があるため、正確な点検が必要です."
|
|
||||||
></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -3,25 +3,22 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { usePathname, useRouter } from 'next/navigation'
|
import { usePathname, useRouter } from 'next/navigation'
|
||||||
|
|
||||||
import { useLocalStorage } from 'usehooks-ts'
|
|
||||||
import { useQueryClient } from '@tanstack/react-query'
|
|
||||||
import { Swiper, SwiperSlide } from 'swiper/react'
|
import { Swiper, SwiperSlide } from 'swiper/react'
|
||||||
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
|
|
||||||
import { useSideNavState } from '@/store/sideNavState'
|
import { useSideNavState } from '@/store/sideNavState'
|
||||||
import { useHeaderStore } from '@/store/header'
|
import { useHeaderStore } from '@/store/header'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
import { usePopupController } from '@/store/popupController'
|
|
||||||
|
|
||||||
import { useTitle } from '@/hooks/useTitle'
|
import { useTitle } from '@/hooks/useTitle'
|
||||||
|
|
||||||
import { axiosInstance } from '@/libs/axios'
|
import { axiosInstance } from '@/libs/axios'
|
||||||
|
|
||||||
import 'swiper/css'
|
import 'swiper/css'
|
||||||
|
import { usePopupController } from '@/store/popupController'
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const pathname = usePathname()
|
const pathname = usePathname()
|
||||||
const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' })
|
|
||||||
const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState()
|
const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState()
|
||||||
const { backBtn } = useHeaderStore()
|
const { backBtn } = useHeaderStore()
|
||||||
const { getTitle } = useTitle()
|
const { getTitle } = useTitle()
|
||||||
@ -37,7 +34,6 @@ export default function Header() {
|
|||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
reset()
|
reset()
|
||||||
removeValue()
|
|
||||||
const { data } = await axiosInstance(null).get('/api/auth/logout')
|
const { data } = await axiosInstance(null).get('/api/auth/logout')
|
||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
queryClient.clear()
|
queryClient.clear()
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { suitableApi } from '@/api/suitable'
|
|||||||
export function useSuitable() {
|
export function useSuitable() {
|
||||||
const getCategories = async () => {
|
const getCategories = async () => {
|
||||||
try {
|
try {
|
||||||
// return await suitableApi.getCategory()
|
return await suitableApi.getCategory()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('카테고리 데이터 로드 실패:', error)
|
console.error('카테고리 데이터 로드 실패:', error)
|
||||||
return []
|
return []
|
||||||
@ -12,7 +12,7 @@ export function useSuitable() {
|
|||||||
|
|
||||||
const getSuitables = async () => {
|
const getSuitables = async () => {
|
||||||
try {
|
try {
|
||||||
// return await suitableApi.getList()
|
return await suitableApi.getList()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('지붕재 데이터 로드 실패:', error)
|
console.error('지붕재 데이터 로드 실패:', error)
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@ export function useSuitable() {
|
|||||||
|
|
||||||
const updateSearchResults = async (selectedCategory: string | undefined, searchValue: string | undefined) => {
|
const updateSearchResults = async (selectedCategory: string | undefined, searchValue: string | undefined) => {
|
||||||
try {
|
try {
|
||||||
// return await suitableApi.getList(selectedCategory, searchValue)
|
return await suitableApi.getList(selectedCategory, searchValue)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('지붕재 데이터 검색 실패:', error)
|
console.error('지붕재 데이터 검색 실패:', error)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,46 +1,8 @@
|
|||||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||||
import type {
|
import type { SurveyBasicInfo, SurveyBasicRequest, SurveyDetailInfo, SurveyDetailRequest, SurveyDetailCoverRequest } from '@/types/Survey'
|
||||||
SurveyBasicInfo,
|
|
||||||
SurveyDetailInfo,
|
|
||||||
SurveyDetailRequest,
|
|
||||||
SurveyDetailCoverRequest,
|
|
||||||
SurveyRegistRequest,
|
|
||||||
} from '@/types/Survey'
|
|
||||||
import { axiosInstance } from '@/libs/axios'
|
import { axiosInstance } from '@/libs/axios'
|
||||||
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
import { useSurveyFilterStore } from '@/store/surveyFilterStore'
|
||||||
import { queryStringFormatter } from '@/utils/common-utils'
|
import { queryStringFormatter } from '@/utils/common-utils'
|
||||||
import { useSessionStore } from '@/store/session'
|
|
||||||
|
|
||||||
const requiredFields = [
|
|
||||||
{
|
|
||||||
field: 'INSTALLATION_SYSTEM',
|
|
||||||
name: '設置希望システム',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'CONSTRUCTION_YEAR',
|
|
||||||
name: '建築年数',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'RAFTER_SIZE',
|
|
||||||
name: '垂木サイズ',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'RAFTER_PITCH',
|
|
||||||
name: '垂木傾斜',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'WATERPROOF_MATERIAL',
|
|
||||||
name: '防水材',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'INSULATION_PRESENCE',
|
|
||||||
name: '断熱材有無',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
field: 'STRUCTURE_ORDER',
|
|
||||||
name: '屋根構造の順序',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
interface ZipCodeResponse {
|
interface ZipCodeResponse {
|
||||||
status: number
|
status: number
|
||||||
@ -58,6 +20,7 @@ type ZipCode = {
|
|||||||
kana2: string
|
kana2: string
|
||||||
kana3: string
|
kana3: string
|
||||||
}
|
}
|
||||||
|
import { useUserType } from './useUserType'
|
||||||
|
|
||||||
export function useServey(id?: number): {
|
export function useServey(id?: number): {
|
||||||
surveyList: SurveyBasicInfo[] | []
|
surveyList: SurveyBasicInfo[] | []
|
||||||
@ -68,9 +31,9 @@ export function useServey(id?: number): {
|
|||||||
isCreatingSurvey: boolean
|
isCreatingSurvey: boolean
|
||||||
isUpdatingSurvey: boolean
|
isUpdatingSurvey: boolean
|
||||||
isDeletingSurvey: boolean
|
isDeletingSurvey: boolean
|
||||||
createSurvey: (survey: SurveyRegistRequest) => Promise<number>
|
createSurvey: (survey: SurveyBasicRequest) => Promise<number>
|
||||||
createSurveyDetail: (params: { surveyId: number; surveyDetail: SurveyDetailCoverRequest }) => void
|
createSurveyDetail: (params: { surveyId: number; surveyDetail: SurveyDetailCoverRequest }) => void
|
||||||
updateSurvey: (survey: SurveyRegistRequest) => void
|
updateSurvey: (survey: SurveyBasicRequest) => void
|
||||||
deleteSurvey: () => Promise<boolean>
|
deleteSurvey: () => Promise<boolean>
|
||||||
submitSurvey: () => void
|
submitSurvey: () => void
|
||||||
validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string
|
validateSurveyDetail: (surveyDetail: SurveyDetailRequest) => string
|
||||||
@ -78,22 +41,13 @@ export function useServey(id?: number): {
|
|||||||
} {
|
} {
|
||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const { keyword, searchOption, isMySurvey, sort, offset } = useSurveyFilterStore()
|
const { keyword, searchOption, isMySurvey, sort, offset } = useSurveyFilterStore()
|
||||||
const { session } = useSessionStore()
|
const { store, builderNo, memberRole } = useUserType()
|
||||||
|
|
||||||
const { data: surveyList, isLoading: isLoadingSurveyList } = useQuery({
|
const { data: surveyList, isLoading: isLoadingSurveyList } = useQuery({
|
||||||
queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, offset, session?.storeNm, session?.builderNo, session?.role],
|
queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, offset, store, builderNo, memberRole],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const resp = await axiosInstance(null).get<SurveyBasicInfo[]>('/api/survey-sales', {
|
const resp = await axiosInstance(null).get<SurveyBasicInfo[]>('/api/survey-sales', {
|
||||||
params: {
|
params: { keyword, searchOption, isMySurvey, sort, offset, store, builderNo, memberRole },
|
||||||
keyword,
|
|
||||||
searchOption,
|
|
||||||
isMySurvey,
|
|
||||||
sort,
|
|
||||||
offset,
|
|
||||||
store: session?.storeNm,
|
|
||||||
builderNo: session?.builderNo,
|
|
||||||
role: session?.role,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
return resp.data
|
return resp.data
|
||||||
},
|
},
|
||||||
@ -111,25 +65,17 @@ export function useServey(id?: number): {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const { data: surveyListCount } = useQuery({
|
const { data: surveyListCount } = useQuery({
|
||||||
queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort, session?.builderNo, session?.storeNm, session?.role],
|
queryKey: ['survey', 'list', keyword, searchOption, isMySurvey, sort],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const resp = await axiosInstance(null).get<number>('/api/survey-sales', {
|
const resp = await axiosInstance(null).get<number>('/api/survey-sales', {
|
||||||
params: {
|
params: { keyword, searchOption, isMySurvey, sort },
|
||||||
keyword,
|
|
||||||
searchOption,
|
|
||||||
isMySurvey,
|
|
||||||
sort,
|
|
||||||
builderNo: session?.builderNo,
|
|
||||||
store: session?.storeNm,
|
|
||||||
role: session?.role,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
return resp.data
|
return resp.data
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { mutateAsync: createSurvey, isPending: isCreatingSurvey } = useMutation({
|
const { mutateAsync: createSurvey, isPending: isCreatingSurvey } = useMutation({
|
||||||
mutationFn: async (survey: SurveyRegistRequest) => {
|
mutationFn: async (survey: SurveyBasicRequest) => {
|
||||||
const resp = await axiosInstance(null).post<SurveyBasicInfo>('/api/survey-sales', survey)
|
const resp = await axiosInstance(null).post<SurveyBasicInfo>('/api/survey-sales', survey)
|
||||||
return resp.data.ID ?? 0
|
return resp.data.ID ?? 0
|
||||||
},
|
},
|
||||||
@ -141,9 +87,10 @@ export function useServey(id?: number): {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const { mutate: updateSurvey, isPending: isUpdatingSurvey } = useMutation({
|
const { mutate: updateSurvey, isPending: isUpdatingSurvey } = useMutation({
|
||||||
mutationFn: async (survey: SurveyRegistRequest) => {
|
mutationFn: async (survey: SurveyBasicRequest) => {
|
||||||
|
console.log('updateSurvey:: ', survey)
|
||||||
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}`, survey)
|
const resp = await axiosInstance(null).put<SurveyBasicInfo>(`/api/survey-sales/${id}`, survey)
|
||||||
return resp.data
|
return resp.data
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
@ -190,15 +137,24 @@ export function useServey(id?: number): {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const validateSurveyDetail = (surveyDetail: SurveyDetailRequest) => {
|
const validateSurveyDetail = (surveyDetail: SurveyDetailRequest) => {
|
||||||
|
const requiredFields = [
|
||||||
|
'INSTALLATION_SYSTEM',
|
||||||
|
'CONSTRUCTION_YEAR',
|
||||||
|
'RAFTER_SIZE',
|
||||||
|
'RAFTER_PITCH',
|
||||||
|
'RAFTER_DIRECTION',
|
||||||
|
'WATERPROOF_MATERIAL',
|
||||||
|
'INSULATION_PRESENCE',
|
||||||
|
'STRUCTURE_ORDER',
|
||||||
|
] as const
|
||||||
|
|
||||||
const etcFields = ['INSTALLATION_SYSTEM', 'CONSTRUCTION_YEAR', 'RAFTER_SIZE', 'RAFTER_PITCH', 'WATERPROOF_MATERIAL', 'STRUCTURE_ORDER'] as const
|
const etcFields = ['INSTALLATION_SYSTEM', 'CONSTRUCTION_YEAR', 'RAFTER_SIZE', 'RAFTER_PITCH', 'WATERPROOF_MATERIAL', 'STRUCTURE_ORDER'] as const
|
||||||
|
|
||||||
const emptyField = requiredFields.find((field) => {
|
const emptyField = requiredFields.find((field) => {
|
||||||
if (etcFields.includes(field.field as (typeof etcFields)[number])) {
|
if (etcFields.includes(field as (typeof etcFields)[number])) {
|
||||||
return (
|
return surveyDetail[field as keyof SurveyDetailRequest] === null && surveyDetail[`${field}_ETC` as keyof SurveyDetailRequest] === null
|
||||||
surveyDetail[field.field as keyof SurveyDetailRequest] === null && surveyDetail[`${field.field}_ETC` as keyof SurveyDetailRequest] === ''
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
return surveyDetail[field.field as keyof SurveyDetailRequest] === null
|
return surveyDetail[field as keyof SurveyDetailRequest] === null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -207,7 +163,7 @@ export function useServey(id?: number): {
|
|||||||
return 'CONTRACT_CAPACITY_UNIT'
|
return 'CONTRACT_CAPACITY_UNIT'
|
||||||
}
|
}
|
||||||
|
|
||||||
return emptyField?.name || ''
|
return emptyField || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const getZipCode = async (zipCode: string): Promise<ZipCode[] | null> => {
|
const getZipCode = async (zipCode: string): Promise<ZipCode[] | null> => {
|
||||||
@ -215,6 +171,7 @@ export function useServey(id?: number): {
|
|||||||
const { data } = await axiosInstance(null).get<ZipCodeResponse>(
|
const { data } = await axiosInstance(null).get<ZipCodeResponse>(
|
||||||
`https://zipcloud.ibsnet.co.jp/api/search?${queryStringFormatter({ zipcode: zipCode.trim() })}`,
|
`https://zipcloud.ibsnet.co.jp/api/search?${queryStringFormatter({ zipcode: zipCode.trim() })}`,
|
||||||
)
|
)
|
||||||
|
|
||||||
return data.results
|
return data.results
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to fetch zipcode data:', e)
|
console.error('Failed to fetch zipcode data:', e)
|
||||||
|
|||||||
31
src/hooks/useUserType.ts
Normal file
31
src/hooks/useUserType.ts
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { useSessionStore } from '@/store/session'
|
||||||
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
|
export type MemberRole = 'T01' | 'Admin' | 'Admin_Sub' | 'Builder' | 'Partner' | 'User'
|
||||||
|
// TO1 - else
|
||||||
|
// Admin - 1차점, Admin_Sub - 2차점, Builder - 2차점 시공사, Partner - 파트너사, User - else
|
||||||
|
|
||||||
|
// 로그인 된 회원 유형에 따라 조사 매물 목록 변경됨
|
||||||
|
export function useUserType() {
|
||||||
|
const { session } = useSessionStore()
|
||||||
|
const [memberRole, setMemberRole] = useState<MemberRole | null>(null)
|
||||||
|
const [store, setStore] = useState<string | null>(null)
|
||||||
|
const [builderNo, setBuilderNo] = useState<string | null>(null)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!session?.isLoggedIn) return
|
||||||
|
setMemberRole(session.role as MemberRole)
|
||||||
|
if (session.role === 'T01') {
|
||||||
|
setStore(null)
|
||||||
|
} else {
|
||||||
|
setStore(session.storeId)
|
||||||
|
}
|
||||||
|
setBuilderNo(session.builderNo)
|
||||||
|
}, [session])
|
||||||
|
|
||||||
|
return {
|
||||||
|
memberRole,
|
||||||
|
store,
|
||||||
|
builderNo,
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,7 +25,6 @@ export const defaultSession: SessionData = {
|
|||||||
compCd: null,
|
compCd: null,
|
||||||
agencyStoreId: null,
|
agencyStoreId: null,
|
||||||
storeId: null,
|
storeId: null,
|
||||||
storeNm: null,
|
|
||||||
userId: null,
|
userId: null,
|
||||||
category: null,
|
category: null,
|
||||||
userNm: null,
|
userNm: null,
|
||||||
@ -46,7 +45,6 @@ export const defaultSession: SessionData = {
|
|||||||
custCd: null,
|
custCd: null,
|
||||||
builderNo: null,
|
builderNo: null,
|
||||||
isLoggedIn: false,
|
isLoggedIn: false,
|
||||||
role: null,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getSession = async () => {
|
export const getSession = async () => {
|
||||||
|
|||||||
@ -1,16 +1,14 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect } from 'react'
|
|
||||||
import { usePathname } from 'next/navigation'
|
|
||||||
|
|
||||||
import { useHeaderStore } from '@/store/header'
|
import { useHeaderStore } from '@/store/header'
|
||||||
import { usePopupController } from '@/store/popupController'
|
import { usePopupController } from '@/store/popupController'
|
||||||
import { useSideNavState } from '@/store/sideNavState'
|
import { useSideNavState } from '@/store/sideNavState'
|
||||||
|
import { usePathname } from 'next/navigation'
|
||||||
|
import { useEffect } from 'react'
|
||||||
import { useSessionStore } from '@/store/session'
|
import { useSessionStore } from '@/store/session'
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
neoAlert: (msg?: string, alertBtn?: Function) => void
|
|
||||||
neoConfirm: (msg?: string, alertBtn2Yes?: Function, alertBtn2No?: Function) => boolean
|
neoConfirm: (msg?: string, alertBtn2Yes?: Function, alertBtn2No?: Function) => boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,10 +55,6 @@ export default function EdgeProvider({ children, sessionData }: EdgeProviderProp
|
|||||||
window.alert = function (msg, alertBtn = () => setAlert(false)) {
|
window.alert = function (msg, alertBtn = () => setAlert(false)) {
|
||||||
alertFunc(msg, alertBtn)
|
alertFunc(msg, alertBtn)
|
||||||
}
|
}
|
||||||
window.neoAlert = function (msg?: string, alertBtn = () => setAlert(false)) {
|
|
||||||
if (!msg) return
|
|
||||||
alertFunc(msg, alertBtn)
|
|
||||||
}
|
|
||||||
// confirm 함수 변경해서 바인딩
|
// confirm 함수 변경해서 바인딩
|
||||||
window.neoConfirm = function (msg: string | undefined, alertBtn2Yes?: Function, alertBtn2No?: Function) {
|
window.neoConfirm = function (msg: string | undefined, alertBtn2Yes?: Function, alertBtn2No?: Function) {
|
||||||
if (!msg) return false
|
if (!msg) return false
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
import { create } from 'zustand'
|
import { create } from 'zustand'
|
||||||
|
|
||||||
|
// export type SEARCH_OPTIONS_ENUM = 'all' | 'id' | 'building_name' | 'representative' | 'store' | 'construction_point'
|
||||||
|
// | 'store_id' | 'construction_id'
|
||||||
|
// export type SEARCH_OPTIONS_PARTNERS_ENUM = 'all' | 'id' | 'building_name' | 'representative'
|
||||||
|
|
||||||
|
// export type SORT_OPTIONS_ENUM = 'created' | 'updated'
|
||||||
|
|
||||||
export const SEARCH_OPTIONS = [
|
export const SEARCH_OPTIONS = [
|
||||||
{
|
{
|
||||||
id: 'all',
|
id: 'all',
|
||||||
|
|||||||
@ -3,9 +3,7 @@
|
|||||||
// check radio 공통
|
// check radio 공통
|
||||||
.check-form-box input[type="checkbox"],
|
.check-form-box input[type="checkbox"],
|
||||||
.radio-form-box input[type="radio"]{
|
.radio-form-box input[type="radio"]{
|
||||||
position: absolute;
|
position: static;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
margin-left:0;
|
margin-left:0;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
@ -46,24 +44,20 @@
|
|||||||
border: 1px solid #A8B6C7;
|
border: 1px solid #A8B6C7;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
transition: border 0.15s ease-in-out, color 0.15s ease-in-out, background-color 0.15s ease-in-out;
|
transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
&::after{
|
&::after{
|
||||||
content: "";
|
content: "";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -1px;
|
width: 20px;
|
||||||
left: -1px;
|
height: 20px;
|
||||||
width: 7px;
|
top: 0px;
|
||||||
height: 9px;
|
left: 0;
|
||||||
border: 2px solid transparent;
|
margin-left: 0;
|
||||||
border-left: none;
|
border-color: #fff;
|
||||||
border-top: none;
|
|
||||||
transform: translate(7.75px,4.5px) rotate(45deg);
|
|
||||||
-ms-transform: translate(7.75px,4.5px) rotate(45deg);
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
input[type="checkbox"]:checked + label::before{
|
input[type="checkbox"]:checked + label::before{
|
||||||
@ -72,7 +66,17 @@
|
|||||||
}
|
}
|
||||||
input[type="checkbox"]:checked + label::after{
|
input[type="checkbox"]:checked + label::after{
|
||||||
content: "";
|
content: "";
|
||||||
border-color: #fff;
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
top: -1px;
|
||||||
|
left: -1px;
|
||||||
|
width: 7px;
|
||||||
|
height: 9px;
|
||||||
|
border: 2px solid #fff;
|
||||||
|
border-left: none;
|
||||||
|
border-top: none;
|
||||||
|
transform: translate(7.75px,4.5px) rotate(45deg);
|
||||||
|
-ms-transform: translate(7.75px,4.5px) rotate(45deg);
|
||||||
}
|
}
|
||||||
input[type="checkbox"]:disabled + label{
|
input[type="checkbox"]:disabled + label{
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
|
|||||||
@ -529,7 +529,24 @@
|
|||||||
|
|
||||||
// 지붕재 적합성
|
// 지붕재 적합성
|
||||||
.compliance-icon{
|
.compliance-icon{
|
||||||
display: flex;
|
display: block;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: center;
|
||||||
|
&.check{
|
||||||
|
background-image: url(/assets/images/sub/compliance_check_icon.svg);
|
||||||
|
}
|
||||||
|
&.x{
|
||||||
|
background-image: url(/assets/images/sub/compliance_x_icon.svg);
|
||||||
|
}
|
||||||
|
&.quest{
|
||||||
|
background-image: url(/assets/images/sub/compliance_quest_icon.svg);
|
||||||
|
}
|
||||||
|
&.tip{
|
||||||
|
background-image: url(/assets/images/sub/compliance_tip_icon.svg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.compliance-check-wrap{
|
.compliance-check-wrap{
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
@ -559,7 +576,6 @@
|
|||||||
@include defaultFont($font-s-13, $font-w-500, $font-c);
|
@include defaultFont($font-s-13, $font-w-500, $font-c);
|
||||||
}
|
}
|
||||||
.check-name-btn{
|
.check-name-btn{
|
||||||
padding-left: 5px;
|
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
.bx-btn{
|
.bx-btn{
|
||||||
display: block;
|
display: block;
|
||||||
@ -605,13 +621,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.check-item-wrap{
|
.check-item-wrap{
|
||||||
@include flex(0px);
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.compliance-icon-wrap{
|
.compliance-icon-wrap{
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
min-width: 44px;
|
min-width: 44px;
|
||||||
@include flex(0px);
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,18 +115,3 @@ export type SurveyDetailRequest = {
|
|||||||
export type SurveyDetailCoverRequest = {
|
export type SurveyDetailCoverRequest = {
|
||||||
DETAIL_INFO: SurveyDetailRequest
|
DETAIL_INFO: SurveyDetailRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SurveyRegistRequest = {
|
|
||||||
REPRESENTATIVE: string
|
|
||||||
STORE: string | null
|
|
||||||
CONSTRUCTION_POINT: string | null
|
|
||||||
INVESTIGATION_DATE: string | null
|
|
||||||
BUILDING_NAME: string | null
|
|
||||||
CUSTOMER_NAME: string | null
|
|
||||||
POST_CODE: string | null
|
|
||||||
ADDRESS: string | null
|
|
||||||
ADDRESS_DETAIL: string | null
|
|
||||||
SUBMISSION_STATUS: boolean
|
|
||||||
SUBMISSION_DATE: string | null
|
|
||||||
DETAIL_INFO: SurveyDetailRequest | null
|
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user