Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
e791ba24d2
@ -1,11 +1,15 @@
|
||||
import React from 'react'
|
||||
import Hero from '@/components/Hero'
|
||||
import StuffDetail from '@/components/management/StuffDetail'
|
||||
import Link from 'next/link'
|
||||
export default function ManagementStuffDetailPage() {
|
||||
return (
|
||||
<>
|
||||
<div className="pt-48 flex justify-left">
|
||||
<h1 className="text-4xl archivo-black-regular">물건정보</h1>
|
||||
<Link href="/management/plan">
|
||||
<h1 className="text-4xl archivo-black-regular">도면작성</h1>
|
||||
</Link>
|
||||
</div>
|
||||
<div className="m2">
|
||||
<StuffDetail />
|
||||
|
||||
15
src/app/management/stuff/tempdetail/page.jsx
Normal file
15
src/app/management/stuff/tempdetail/page.jsx
Normal file
@ -0,0 +1,15 @@
|
||||
import React from 'react'
|
||||
import Hero from '@/components/Hero'
|
||||
import StuffDetail from '@/components/management/StuffDetail'
|
||||
export default function ManagementStuffDetailPage() {
|
||||
return (
|
||||
<>
|
||||
<div className="pt-48 flex justify-left">
|
||||
<h1 className="text-4xl archivo-black-regular">물건정보</h1>
|
||||
</div>
|
||||
<div className="m2">
|
||||
<StuffDetail />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@ -1,16 +1,22 @@
|
||||
'use client'
|
||||
import { useState } from 'react'
|
||||
|
||||
export default function QSelectBox({ title, option }) {
|
||||
const [selectAct, setSelectAct] = useState(false)
|
||||
export default function QSelectBox({ title = '', options, onChange }) {
|
||||
const [openSelect, setOpenSelect] = useState(false)
|
||||
const [selected, setSelected] = useState(title === '' ? options[0].name : title)
|
||||
|
||||
const handleClickSelectOption = (option) => {
|
||||
setSelected(option.name)
|
||||
onChange?.(option)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`sort-select ${selectAct ? 'active' : ''}`} onClick={() => setSelectAct(!selectAct)}>
|
||||
<p>{title}</p>
|
||||
<div className={`sort-select ${openSelect ? 'active' : ''}`} onClick={() => setOpenSelect(!openSelect)}>
|
||||
<p>{selected}</p>
|
||||
<ul className="select-item-wrap">
|
||||
{option.map((el, idx) => (
|
||||
<li key={idx} className="select-item">
|
||||
<button>{el.name}</button>
|
||||
{options?.map((option) => (
|
||||
<li key={option.id} className="select-item">
|
||||
<button onClick={() => handleClickSelectOption(option)}>{option.name}</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
'use client'
|
||||
import { Fragment } from 'react'
|
||||
import { Fragment, useState } from 'react'
|
||||
import Link from 'next/link'
|
||||
import { usePathname, useRouter } from 'next/navigation'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
@ -29,7 +29,14 @@ export default function Header(props) {
|
||||
// if (pathName.includes('login') || pathName.includes('join')) {
|
||||
// return null
|
||||
// }
|
||||
const SelectOption = [{ name: 'オンライン保証シ' }, { name: 'ステム' }]
|
||||
const [selected, setSelected] = useState('')
|
||||
|
||||
const SelectOptions = [
|
||||
{ id: 0, name: 'オンライン保証シ', link: '' },
|
||||
{ id: 1, name: 'ステム', link: '' },
|
||||
{ id: 2, name: 'TEST1', link: 'https://www.weather.go.kr/w/index.do' },
|
||||
{ id: 3, name: 'TEST2', link: 'https://www.google.com' },
|
||||
]
|
||||
const menus = [
|
||||
{ id: 0, name: 'header.menus.home', url: '/', children: [] },
|
||||
{
|
||||
@ -53,6 +60,15 @@ export default function Header(props) {
|
||||
},
|
||||
]
|
||||
|
||||
const onChangeSelect = (option) => {
|
||||
setSelected(option)
|
||||
}
|
||||
const navPage = () => {
|
||||
if (selected.link) {
|
||||
location.href = selected.link
|
||||
}
|
||||
}
|
||||
|
||||
const getMenuTemplate = (menus) => {
|
||||
return menus.map((menu) => {
|
||||
return (
|
||||
@ -112,10 +128,12 @@ export default function Header(props) {
|
||||
</button>
|
||||
</div>
|
||||
<div className="select-box">
|
||||
<QSelectBox title={'Q.ORDER'} option={SelectOption} />
|
||||
<QSelectBox title={'Q.ORDER'} options={SelectOptions} onChange={onChangeSelect} />
|
||||
</div>
|
||||
<div className="btn-wrap">
|
||||
<button className="btn-frame small dark">{getMessage('header.go')}</button>
|
||||
<button className="btn-frame small dark" onClick={() => navPage()}>
|
||||
{getMessage('header.go')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -269,7 +269,8 @@ export default function Stuff() {
|
||||
// let size
|
||||
// let pageCount
|
||||
|
||||
const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(params)}`
|
||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(params)}`
|
||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(params)}`
|
||||
|
||||
await get({
|
||||
url: apiUrl,
|
||||
@ -292,7 +293,8 @@ export default function Stuff() {
|
||||
stuffSearchParams.schSortType = defaultSortType
|
||||
console.log('조회 눌럿을때 ::::::::::::::', stuffSearchParams)
|
||||
async function fetchData() {
|
||||
const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
||||
await get({ url: apiUrl }).then((res) => {
|
||||
console.log('API결과:::::::', res)
|
||||
if (!isEmptyArray(res)) {
|
||||
@ -322,7 +324,8 @@ export default function Stuff() {
|
||||
})
|
||||
console.log('셋팅된 검색조건:::', stuffSearchParams)
|
||||
//조회API호출
|
||||
const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
||||
get({ url: apiUrl }).then((res) => {
|
||||
console.log('보여줄개수바꿨을때 조회 ::::::::::', res)
|
||||
if (!isEmptyArray(res)) {
|
||||
@ -345,7 +348,8 @@ export default function Stuff() {
|
||||
code: 'S',
|
||||
schSortType: e.target.value,
|
||||
})
|
||||
const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||
// const apiUrl = `/api/object/list?saleStoreId=201TES01&${queryStringFormatter(stuffSearchParams)}`
|
||||
const apiUrl = `/api/object/list?saleStoreId=X167&${queryStringFormatter(stuffSearchParams)}`
|
||||
// console.log('apiUrl::', apiUrl)
|
||||
get({ url: apiUrl }).then((res) => {
|
||||
console.log('정렬바꿨을때 조회 ::::::::::', res)
|
||||
|
||||
@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { Input, RadioGroup, Radio, Button, Autocomplete, AutocompleteItem, Select, SelectItem, Checkbox, Textarea, button } from '@nextui-org/react'
|
||||
import Link from 'next/link'
|
||||
import { del, get } from '@/lib/Axios'
|
||||
import { del, get, post } from '@/lib/Axios'
|
||||
import { queryStringFormatter, isEmptyArray } from '@/util/common-utils'
|
||||
import dayjs from 'dayjs'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
@ -24,8 +24,11 @@ export default function StuffDetail() {
|
||||
objectNameKana: '', //물건명 후리가나
|
||||
saleStoreId: '', //판매점ID
|
||||
saleStoreName: '', //판매점명
|
||||
otherSaleStoreId: '',
|
||||
otherSaleStoreName: '',
|
||||
zipNo: '', //우편번호
|
||||
prefId: '', //도도부현
|
||||
prefName: '',
|
||||
address: '', //주소
|
||||
powerSimArea: '', //발전량시뮬레이션지역
|
||||
windSpeed: '', //기준풍속
|
||||
@ -35,7 +38,7 @@ export default function StuffDetail() {
|
||||
saltAreaChk: false, //염해지역용아이템사용
|
||||
installHeight: '', //설치높이
|
||||
powerConTerms: '0', //계약조건(잉여 / 전량)
|
||||
remark: '', //메모
|
||||
remarks: '', //메모
|
||||
tempFlag: 'T', //임시저장(1) 저장(0)
|
||||
}
|
||||
const { register, setValue, getValues, handleSubmit, resetField, control, watch } = useForm({
|
||||
@ -47,6 +50,7 @@ export default function StuffDetail() {
|
||||
const [prefCodeList, setPrefCodeList] = useState([]) //도도부현 코트 리스트
|
||||
const [prefValue, setPrefValue] = useState('')
|
||||
const [saleStoreList, setSaleStoreList] = useState([]) // 판매점 리스트
|
||||
const [otherSaleStoreList, setOtherSaleStoreList] = useState([])
|
||||
|
||||
const [powerSimAreaList, setPowerSimAreaList] = useState([]) //발전시뮬레이션 리스트
|
||||
|
||||
@ -59,6 +63,7 @@ export default function StuffDetail() {
|
||||
|
||||
useEffect(() => {
|
||||
if (objectNo) {
|
||||
console.log('수정화면')
|
||||
setEditMode('EDIT')
|
||||
|
||||
if (objectNo.substring(0, 1) === 'R') {
|
||||
@ -66,9 +71,9 @@ export default function StuffDetail() {
|
||||
setIsFormValid(true)
|
||||
}
|
||||
get({ url: `/api/object/${objectNo}/detail` }).then((res) => {
|
||||
console.log('물건번호로 상세 API 호출')
|
||||
// console.log('물건번호로 상세 API 호출')
|
||||
if (res != null) {
|
||||
console.log('상세res:::::::', res)
|
||||
// console.log('상세res:::::::', res)
|
||||
setDetailData(res)
|
||||
|
||||
// 신규 상세 공통APi
|
||||
@ -83,7 +88,7 @@ export default function StuffDetail() {
|
||||
// 임시 1차점 판매점코드 saleStoreId=201TES01
|
||||
// T01
|
||||
//1차점 : X167
|
||||
get({ url: `/api/object/saleStore/201TES01/list` }).then((res) => {
|
||||
get({ url: `/api/object/saleStore/X167/list` }).then((res) => {
|
||||
if (!isEmptyArray(res)) {
|
||||
console.log('판매점 결과:::::', res)
|
||||
setSaleStoreList(res)
|
||||
@ -91,6 +96,7 @@ export default function StuffDetail() {
|
||||
form.setValue('saleStoreId', res[0].saleStoreId)
|
||||
//1차 판매점 번호 셋팅
|
||||
form.setValue('saleStoreName', res[0].saleStoreId)
|
||||
setOtherSaleStoreList([])
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -99,7 +105,7 @@ export default function StuffDetail() {
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('신규일떄 공통코드세팅')
|
||||
console.log('신규화면')
|
||||
// 신규 상세 공통APi
|
||||
// 도도부현API
|
||||
get({ url: '/api/object/prefecture/list' }).then((res) => {
|
||||
@ -112,14 +118,22 @@ export default function StuffDetail() {
|
||||
// 임시 1차점 판매점코드 saleStoreId=201TES01
|
||||
// T01
|
||||
//1차점 : X167
|
||||
get({ url: `/api/object/saleStore/201TES01/list` }).then((res) => {
|
||||
get({ url: `/api/object/saleStore/X167/list` }).then((res) => {
|
||||
if (!isEmptyArray(res)) {
|
||||
console.log('판매점 결과:::::', res)
|
||||
setSaleStoreList(res)
|
||||
const firstList = res.filter((row) => row.saleStoreLevel === '1')
|
||||
const otherList = res.filter((row) => row.saleStoreLevel !== '1')
|
||||
console.log('first:::::', firstList)
|
||||
console.log('otherList:::::', otherList)
|
||||
//1차점 셀렉트박스
|
||||
setSaleStoreList(firstList)
|
||||
//1차 판매점 자동완성 값 셋팅
|
||||
form.setValue('saleStoreId', res[0].saleStoreId)
|
||||
form.setValue('saleStoreId', firstList[0].saleStoreId)
|
||||
//1차 판매점 번호 셋팅
|
||||
form.setValue('saleStoreName', res[0].saleStoreId)
|
||||
form.setValue('saleStoreName', firstList[0].saleStoreId)
|
||||
|
||||
//1차점 아닌 판매점 셀렉트박스
|
||||
setOtherSaleStoreList(otherList)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -135,6 +149,11 @@ export default function StuffDetail() {
|
||||
form.setValue('saleStoreName', key)
|
||||
}
|
||||
}
|
||||
|
||||
//2차점 변경 이벤트
|
||||
const onSelectionChange2 = (key) => {
|
||||
console.log(key)
|
||||
}
|
||||
// 우편번호 숫자만 체크
|
||||
const _zipNo = watch('zipNo')
|
||||
useEffect(() => {
|
||||
@ -161,7 +180,7 @@ export default function StuffDetail() {
|
||||
// saltAreaChk: false, //염해지역용아이템사용
|
||||
// installHeight: '', //설치높이
|
||||
// powerConTerms: '0', //계약조건(잉여 / 전량)
|
||||
// remark: '', //메모
|
||||
// remarks: '', //메모
|
||||
// tempFlag: 'T', //임시저장(1) 저장(0)
|
||||
const _dispCompanyName = watch('dispCompanyName')
|
||||
const _objectName = watch('objectName')
|
||||
@ -174,10 +193,10 @@ export default function StuffDetail() {
|
||||
const _snowCover = watch('snowCover')
|
||||
const _installHeight = watch('installHeight')
|
||||
useEffect(() => {
|
||||
console.log('mode:::::', editMode)
|
||||
// console.log('mode:::::', editMode)
|
||||
if (editMode === 'NEW') {
|
||||
const formData = form.getValues()
|
||||
console.log('폼::::::::::::', formData)
|
||||
// console.log('폼::::::::::::', formData)
|
||||
let errors = {}
|
||||
if (!_dispCompanyName || _dispCompanyName.trim().length === 0) {
|
||||
errors.dispCompanyName = true
|
||||
@ -220,10 +239,10 @@ export default function StuffDetail() {
|
||||
errors.installHeight = true
|
||||
}
|
||||
|
||||
console.log('errors::', errors)
|
||||
// console.log('errors::', errors)
|
||||
setIsFormValid(Object.keys(errors).length === 0)
|
||||
} else {
|
||||
console.log('상세일때 폼체크')
|
||||
// console.log('상세일때 폼체크')
|
||||
}
|
||||
}, [_dispCompanyName, _objectName, _objectNameOmit, _saleStoreId, _zipNo, _prefId, _address, _powerSimArea, _windSpeed, _snowCover, _installHeight])
|
||||
|
||||
@ -237,17 +256,17 @@ export default function StuffDetail() {
|
||||
//9302226
|
||||
if (res.status === 200) {
|
||||
if (res.results != null) {
|
||||
console.log('주소검색::', res.results)
|
||||
// prefId: '', //도도부현
|
||||
// address: '', //주소
|
||||
console.log('prefcode::', res.results[0].prefcode)
|
||||
console.log('address::', res.results[0].address2 + res.results[0].address3)
|
||||
// console.log('주소검색::', res.results)
|
||||
// console.log('prefcode::', res.results[0].prefcode)
|
||||
// console.log('address::', res.results[0].address2 + res.results[0].address3)
|
||||
setPrefValue(res.results[0].prefcode)
|
||||
form.setValue('prefId', res.results[0].prefcode)
|
||||
form.setValue('prefName', res.results[0].address1)
|
||||
form.setValue('address', res.results[0].address2 + res.results[0].address3)
|
||||
} else {
|
||||
alert('등록된 우편번호에서 주소를 찾을 수 없습니다. 다시 입력해주세요.')
|
||||
form.setValue('prefId', '')
|
||||
form.setValue('prefName', '')
|
||||
form.setValue('address', '')
|
||||
form.setValue('zipNo', '')
|
||||
setPrefValue('')
|
||||
@ -262,12 +281,12 @@ export default function StuffDetail() {
|
||||
|
||||
useEffect(() => {
|
||||
if (prefValue !== '') {
|
||||
console.log('우편번호 검색해서 도도부현골랐을때::::', prefValue)
|
||||
// console.log('우편번호 검색해서 도도부현골랐을때::::', prefValue)
|
||||
// 발전량시뮬레이션 지역 목록
|
||||
// /api/object/prefecture/도도부현코드/list
|
||||
get({ url: `/api/object/prefecture/${prefValue}/list` }).then((res) => {
|
||||
if (!isEmptyArray(res)) {
|
||||
console.log('발전시뮬레이션::::::::', res)
|
||||
// console.log('발전시뮬레이션::::::::', res)
|
||||
setPowerSimAreaList(res)
|
||||
}
|
||||
})
|
||||
@ -276,10 +295,11 @@ export default function StuffDetail() {
|
||||
|
||||
//필수값 다 입력했을때
|
||||
const onValid = (data) => {
|
||||
console.log('필수값 다 있고 저장')
|
||||
console.log('data::::::', data)
|
||||
// 수정모드일때는 PUT
|
||||
// console.log('필수값 다 있고 저장')
|
||||
// console.log('data::::::', data)
|
||||
const formData = form.getValues()
|
||||
console.log('formData::::', formData)
|
||||
// console.log('formData::::', formData)
|
||||
// const _dispCompanyName = watch('dispCompanyName')
|
||||
// const _objectStatusId = watch('objectStatusId')
|
||||
// const _objectNameOmit = watch('objectNameOmit')
|
||||
@ -297,15 +317,52 @@ export default function StuffDetail() {
|
||||
// console.log('_coldAreaChk::', _coldAreaChk)
|
||||
}
|
||||
|
||||
//필수값 안넣었을때 임시저장
|
||||
const onInvalid = (errors) => {
|
||||
//필수값 안넣었을때 임시저장 form required사용시
|
||||
// const onInvalid = (errors) => {
|
||||
// console.log('22222222222222222222222')
|
||||
// const formData = form.getValues()
|
||||
// console.log('임시저장formData::::', formData)
|
||||
// }
|
||||
|
||||
// 임시저장
|
||||
const onTempSave = async () => {
|
||||
const formData = form.getValues()
|
||||
console.log('임시저장formData::::', formData)
|
||||
//console.log('임시저장::::::::', formData)
|
||||
|
||||
const params = {
|
||||
saleStoreId: formData.saleStoreId,
|
||||
saleStoreName: formData.saleStoreName,
|
||||
objectStatusId: formData.objectStatusId,
|
||||
objectName: formData.objectName,
|
||||
objectNameOmit: formData.objectNameOmit,
|
||||
objectNameKana: formData.objectNameKana,
|
||||
zipNo: formData.zipNo,
|
||||
prefId: formData.prefId,
|
||||
prefName: formData.prefName,
|
||||
address: formData.address,
|
||||
powerSimArea: formData.powerSimArea,
|
||||
receiveUser: formData.dispCompanyName,
|
||||
installHeight: formData.installHeight,
|
||||
windSpeed: formData.windSpeed,
|
||||
snowCover: formData.snowCover,
|
||||
surfaceType: formData.surfaceType,
|
||||
powerConTerms: formData.powerConTerms,
|
||||
saltAreaChk: formData.saltAreaChk,
|
||||
coldAreaChk: formData.coldAreaChk,
|
||||
tempFlg: '1',
|
||||
workNo: null,
|
||||
workName: null,
|
||||
}
|
||||
console.log('임시저장params::', params)
|
||||
return
|
||||
await post({ url: '/api/object/save-object', data: params }).then((res) => {
|
||||
console.log('res::::::', res)
|
||||
})
|
||||
}
|
||||
|
||||
// 발전량 시뮬레이션 변경
|
||||
const handlePowerSimAreaOnChange = (e) => {
|
||||
console.log('가지고있는 도도부현코드:::::::::', prefValue)
|
||||
// console.log('가지고있는 도도부현코드:::::::::', prefValue)
|
||||
// console.log('발전량시뮬레이션변경:::::::::', e.target.value)
|
||||
//값 set해주고 그거 useEffect로 api호출
|
||||
}
|
||||
@ -313,13 +370,13 @@ export default function StuffDetail() {
|
||||
// 물건삭제
|
||||
const onDelete = () => {
|
||||
//http://localhost:8080/api/object/R201TES01240910023
|
||||
console.log('물건번호::::::::', objectNo)
|
||||
// console.log('물건번호::::::::', objectNo)
|
||||
alert('사양확정일이 있으면 삭제 불가')
|
||||
if (confirm(getMessage('common.message.data.delete'))) {
|
||||
let testobj = '10'
|
||||
|
||||
del({ url: `/api/object/${testobj}` }).then((res) => {
|
||||
console.log('삭제 결과:::', res)
|
||||
// console.log('삭제 결과:::', res)
|
||||
router.push('/management/stuff')
|
||||
})
|
||||
}
|
||||
@ -328,12 +385,12 @@ export default function StuffDetail() {
|
||||
return (
|
||||
<>
|
||||
{(editMode === 'NEW' && (
|
||||
<form onSubmit={handleSubmit(onValid, onInvalid)}>
|
||||
<form onSubmit={handleSubmit(onValid)}>
|
||||
<div>
|
||||
<div>(*필수 입력항목)</div>
|
||||
<div className="form-input">
|
||||
<label>담당자*</label>
|
||||
<input type="text" className="input-origin" {...form.register('dispCompanyName', { required: true })} />
|
||||
<input type="text" className="input-origin" {...form.register('dispCompanyName')} />
|
||||
</div>
|
||||
<div className="form-input">
|
||||
<label>물건구분/물건명*</label>
|
||||
@ -341,9 +398,9 @@ export default function StuffDetail() {
|
||||
<label htmlFor="objectStatus0">신축</label>
|
||||
<input type="radio" name="objectStatusId" value="1" id="objectStatus1" {...form.register('objectStatusId')} />
|
||||
<label htmlFor="objectStatus0">기축</label>
|
||||
<input type="text" className="input-origin" {...form.register('objectName', { required: true })} />
|
||||
<input type="text" className="input-origin" {...form.register('objectName')} />
|
||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
||||
<select name="objectNameOmit" {...register('objectNameOmit', { required: true })}>
|
||||
<select name="objectNameOmit" {...register('objectNameOmit')}>
|
||||
<option value="">경칭선택</option>
|
||||
<option value="11">111</option>
|
||||
<option value="22">222</option>
|
||||
@ -353,7 +410,7 @@ export default function StuffDetail() {
|
||||
</div>
|
||||
<div className="form-input">
|
||||
<label>물건명 후리가나</label>
|
||||
<input type="text" className="input-origin" {...form.register('objectNameKana', { required: true })} />
|
||||
<input type="text" className="input-origin" {...form.register('objectNameKana')} />
|
||||
</div>
|
||||
<div className="form-input">
|
||||
<label>1차 판매점명 / ID</label>
|
||||
@ -363,9 +420,8 @@ export default function StuffDetail() {
|
||||
className="max-w-xs"
|
||||
defaultItems={saleStoreList}
|
||||
label="판매점ID자동완성"
|
||||
// selectedKey={saleStoreValue}
|
||||
selectedKey={form.watch('saleStoreId')}
|
||||
{...form.register('saleStoreId', { required: true })}
|
||||
{...form.register('saleStoreId')}
|
||||
onSelectionChange={onSelectionChange}
|
||||
>
|
||||
{(option) => <AutocompleteItem key={option.saleStoreId}>{option.saleStoreName}</AutocompleteItem>}
|
||||
@ -376,6 +432,19 @@ export default function StuffDetail() {
|
||||
</div>
|
||||
<div className="form-input">
|
||||
<label>2차 판매점명 / ID</label>
|
||||
<div className="flex w-full max-w-xs flex-col gap2">
|
||||
{otherSaleStoreList?.length > 0 && (
|
||||
<Autocomplete
|
||||
className="max-w-xs"
|
||||
defaultItems={otherSaleStoreList}
|
||||
label="2차판매점ID자동완성"
|
||||
{...form.register('otherSaleStoreId')}
|
||||
onSelectionChange={onSelectionChange2}
|
||||
>
|
||||
{(option) => <AutocompleteItem key={option.saleStoreId}>{option.saleStoreName}</AutocompleteItem>}
|
||||
</Autocomplete>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-input">
|
||||
<label>우편번호</label>
|
||||
@ -384,7 +453,6 @@ export default function StuffDetail() {
|
||||
className="input-origin"
|
||||
maxLength={7}
|
||||
{...form.register('zipNo', {
|
||||
required: true,
|
||||
minLength: { value: 7, message: '7자리만가능' },
|
||||
pattern: { value: /^[0-9]*$/g, message: '숫자만 입력' },
|
||||
})}
|
||||
@ -398,7 +466,7 @@ export default function StuffDetail() {
|
||||
<label>도도부현 / 주소</label>
|
||||
<div className="flex w-full flex-wrap items-end md:flex-nowrap mb-6 md:mb-0 gap-4">
|
||||
{prefCodeList?.length > 0 && (
|
||||
<Select className="max-w-xs" selectedKeys={prefValue} isDisabled {...form.register('prefId', { required: true })}>
|
||||
<Select className="max-w-xs" selectedKeys={prefValue} isDisabled {...form.register('prefId')}>
|
||||
{prefCodeList.map((row) => {
|
||||
return <SelectItem key={row.prefId}>{row.prefName}</SelectItem>
|
||||
})}
|
||||
@ -414,7 +482,7 @@ export default function StuffDetail() {
|
||||
<Select
|
||||
className="max-w-xs"
|
||||
selectedKeys={form.watch('powerSimArea')}
|
||||
{...form.register('powerSimArea', { required: true })}
|
||||
{...form.register('powerSimArea')}
|
||||
onChange={handlePowerSimAreaOnChange}
|
||||
>
|
||||
{powerSimAreaList.map((row) => {
|
||||
@ -431,7 +499,7 @@ export default function StuffDetail() {
|
||||
<div className="form-input">
|
||||
<label>기준풍속</label>
|
||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
||||
<select name="windSpeed" {...register('windSpeed', { required: true })}>
|
||||
<select name="windSpeed" {...register('windSpeed')}>
|
||||
<option value="">기준풍속</option>
|
||||
<option value="30">30</option>
|
||||
<option value="50">50</option>
|
||||
@ -446,7 +514,6 @@ export default function StuffDetail() {
|
||||
className="input-origin"
|
||||
maxLength={3}
|
||||
{...form.register('snowCover', {
|
||||
required: true,
|
||||
pattern: { value: /^[0-9]*$/g, message: '정수만 입력' },
|
||||
})}
|
||||
/>{' '}
|
||||
@ -478,7 +545,7 @@ export default function StuffDetail() {
|
||||
<div className="form-input">
|
||||
<label>설치높이</label>
|
||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
||||
<select name="installHeight" {...register('installHeight', { required: true })}>
|
||||
<select name="installHeight" {...register('installHeight')}>
|
||||
<option value="">설치높이</option>
|
||||
<option value="11">111</option>
|
||||
<option value="22">222</option>
|
||||
@ -501,17 +568,19 @@ export default function StuffDetail() {
|
||||
base: 'max-w-xs',
|
||||
input: 'resize-y min-h-[40px]',
|
||||
}}
|
||||
{...form.register('remark')}
|
||||
{...form.register('remarks')}
|
||||
onValueChange={(e) => {
|
||||
// console.log('e::::', e)
|
||||
form.setValue('remark', e)
|
||||
form.setValue('remarks', e)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{!isFormValid ? (
|
||||
<>
|
||||
<Button type="submit">NEW화면임시저장</Button>
|
||||
<Button type="submit" onClick={onTempSave}>
|
||||
NEW화면임시저장
|
||||
</Button>
|
||||
</>
|
||||
) : (
|
||||
<button type="submit">NEW화면 저장</button>
|
||||
@ -541,197 +610,7 @@ export default function StuffDetail() {
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
// <div>
|
||||
// EDIT모드
|
||||
|
||||
// {/* {objectNo.substring(0,1) ? 'R' ? <><Link>RRRRRRR</Link></> : <><Link>TTTTTTTT</Link></>} */}
|
||||
// {/* <Link href="/management/stuff">
|
||||
// <button type="button">상세:물건목록</button>
|
||||
// </Link>
|
||||
// <button type="submit">상세:저장</button>
|
||||
// <button type="submit" onClick={onDelete}>
|
||||
// 상세:물건삭제
|
||||
// </button> */}
|
||||
// </div>
|
||||
)}
|
||||
|
||||
{/* <div className="flex w-full flex-wrap md:flex-nowrap gap-4">
|
||||
<div>
|
||||
<span>물건번호</span>
|
||||
<span>{objectNo}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>사양확정일</span>
|
||||
<span>{detailData?.specDate ? dayjs(detailData.specDate).format('YYYY.MM.DD') : null}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>갱신일시</span>
|
||||
<span>
|
||||
{detailData?.lastEditDatetime
|
||||
? dayjs(detailData.lastEditDatetime).format('YYYY.MM.DD HH:mm:ss')
|
||||
: detailData?.createDatetime
|
||||
? dayjs(detailData.createDatetime).format('YYYY.MM.DD HH:mm:ss')
|
||||
: null}
|
||||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<span>등록일</span>
|
||||
<span></span>
|
||||
</div>
|
||||
</div> */}
|
||||
{/* <div>(*필수 입력항목)</div>
|
||||
|
||||
<div>
|
||||
<input type="text" placeholder="물건명" value={name2} onChange={(e) => setName2(e.target.value)} />
|
||||
</div>
|
||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
||||
<Select label="경칭선택" className="max-w-xs" onChange={(e) => setSel(e.target.value)}>
|
||||
<SelectItem key="1">111</SelectItem>
|
||||
<SelectItem key="2">222</SelectItem>
|
||||
<SelectItem key="3">333</SelectItem>
|
||||
</Select>
|
||||
</div>
|
||||
<div>
|
||||
<span>물건명 후리가나</span>
|
||||
<input type="text" placeholder="물건명 후리가나" value={name3} onChange={(e) => setName3(e.target.value)} />
|
||||
</div>
|
||||
</div> */}
|
||||
{/* <div>
|
||||
<span>판매점명 /ID *</span>
|
||||
<div className="flex w-full max-w-xs flex-col gap-2">
|
||||
<Autocomplete
|
||||
className="max-w-xs"
|
||||
defaultItems={testSelOption}
|
||||
label="판매점ID자동완성으로 바꾸기"
|
||||
selectedKey={autoSelectValue}
|
||||
onSelectionChange={setAutoSelectValue}
|
||||
>
|
||||
{(option) => <AutocompleteItem key={option.id}>{option.name}</AutocompleteItem>}
|
||||
</Autocomplete>
|
||||
</div>
|
||||
</div> */}
|
||||
{/* <div>
|
||||
<span>우편번호*</span>
|
||||
<input type="text" placeholder="숫자7자리 입력여부 체크" value={zipCode} maxLength="7" onChange={textTypeHandler} />
|
||||
<Button onClick={onSearchPostNumber} isDisabled={buttonValid}>
|
||||
주소검색
|
||||
</Button>
|
||||
*우편번호 7자리를 입력한 후, 주소검색 버튼을 클릭해 주십시오
|
||||
</div> */}
|
||||
{/* <div>
|
||||
<span>도도부현 / 주소*</span>
|
||||
<input type="text" placeholder="주소검색 결과 주소 셋팅 칸" value={address2 + address3} onChange={changeAddress2} />
|
||||
</div> */}
|
||||
{/* <div>
|
||||
<span>발전량시뮬레이션지역*</span>
|
||||
<Select label="발전량시뮬레이션지역" className="max-w-xs" onChange={(e) => setSel2(e.target.value)}>
|
||||
<SelectItem key="1">111</SelectItem>
|
||||
<SelectItem key="2">222</SelectItem>
|
||||
<SelectItem key="3">333</SelectItem>
|
||||
</Select>
|
||||
</div>
|
||||
<div>
|
||||
<span>기준풍속*</span>
|
||||
<Select label="기준풍속" className="max-w-xs" onChange={(e) => setSel3(e.target.value)}>
|
||||
<SelectItem key="1">111</SelectItem>
|
||||
<SelectItem key="2">222</SelectItem>
|
||||
<SelectItem key="3">333</SelectItem>
|
||||
</Select>
|
||||
m/s이하
|
||||
</div>
|
||||
<div>
|
||||
<span>수직적설량*</span>
|
||||
<input type="text" placeholder="수직적설량" value={name5} maxLength="3" onChange={textTypeHandler2} /> cm
|
||||
<Checkbox isSelected={isSelected} onValueChange={setIsSelected}>
|
||||
한랭지대책시행
|
||||
</Checkbox>
|
||||
</div> */}
|
||||
{/* <div>
|
||||
<span>면조도구분*</span>
|
||||
<input
|
||||
type="radio"
|
||||
name="radio_gubun2"
|
||||
id="radio_1"
|
||||
value={'1'}
|
||||
checked={gubun2 === '1' ? true : false}
|
||||
onChange={(e) => {
|
||||
setGubun2(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="radio_1">III·IV</label>
|
||||
<input
|
||||
type="radio"
|
||||
name="radio_gubun2"
|
||||
id="radio_2"
|
||||
value={'2'}
|
||||
checked={gubun2 === '2' ? true : false}
|
||||
onChange={(e) => {
|
||||
setGubun2(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="radio_2">II</label>
|
||||
<Checkbox isSelected={isSelected2} onValueChange={setIsSelected2}>
|
||||
염해지역용아이템사용
|
||||
</Checkbox>
|
||||
</div>
|
||||
<div>
|
||||
<span>설치높이*</span>
|
||||
<Select label="설치높이" className="max-w-xs" onChange={(e) => setSel4(e.target.value)}>
|
||||
<SelectItem key="1">111</SelectItem>
|
||||
<SelectItem key="2">222</SelectItem>
|
||||
<SelectItem key="3">333</SelectItem>
|
||||
</Select>
|
||||
m
|
||||
</div>
|
||||
<div>
|
||||
<span>계약조건</span>
|
||||
<input
|
||||
type="radio"
|
||||
name="radio_gubun3"
|
||||
id="radio_a"
|
||||
value={'A'}
|
||||
checked={gubun3 === 'A' ? true : false}
|
||||
onChange={(e) => {
|
||||
setGubun3(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="radio_a">잉여</label>
|
||||
<input
|
||||
type="radio"
|
||||
name="radio_gubun3"
|
||||
id="radio_b"
|
||||
value={'B'}
|
||||
checked={gubun3 === 'B' ? true : false}
|
||||
onChange={(e) => {
|
||||
setGubun3(e.target.value)
|
||||
}}
|
||||
/>
|
||||
<label htmlFor="radio_2">전량</label>
|
||||
</div>
|
||||
<div>
|
||||
<span>메모</span>
|
||||
<Textarea
|
||||
value={memo}
|
||||
onValueChange={setMemo}
|
||||
disableAutosize
|
||||
classNames={{
|
||||
base: 'max-w-xs',
|
||||
input: 'resize-y min-h-[40px]',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{!isFormValid ? (
|
||||
<>
|
||||
<Button onClick={onTempSave}>임시저장</Button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Button onClick={onSave}>진짜저장</Button>
|
||||
</>
|
||||
)}
|
||||
<Link href="/management/stuff">
|
||||
<button type="button">물건목록</button>
|
||||
</Link> */}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user