feature/survey : 조사매물 지붕정보 공통코드 값 추가 #122
@ -206,7 +206,7 @@ export default function RoofForm(props: {
|
||||
<SelectedBox mode={mode} column="openFieldPlateKind" detailInfoData={roofInfo as SurveyDetailInfo} setRoofInfo={setRoofInfo} />
|
||||
</div>
|
||||
</div>
|
||||
{roofInfo.openFieldPlateKind === '4' && (
|
||||
{roofInfo.openFieldPlateKind === 'S' && (
|
||||
<div className="data-input-form-bx">
|
||||
{/* 노지판 두께 */}
|
||||
<div className="data-input-form-tit">
|
||||
@ -309,7 +309,7 @@ const SelectedBox = ({
|
||||
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
const value = e.target.value
|
||||
const isEtc = value === 'etc'
|
||||
const isSpecialEtc = isSpecialCase && value === '2'
|
||||
const isSpecialEtc = isSpecialCase && value === 'O'
|
||||
|
||||
const updatedData = {
|
||||
...detailInfoData,
|
||||
@ -339,7 +339,7 @@ const SelectedBox = ({
|
||||
if (mode === 'READ') return true
|
||||
if (column === 'installationAvailability') return false
|
||||
if (column === 'constructionYear') {
|
||||
return detailInfoData.constructionYear === '1' || detailInfoData.constructionYear === null
|
||||
return detailInfoData.constructionYear === 'N' || detailInfoData.constructionYear === null
|
||||
}
|
||||
return !isEtcSelected && !etcValue
|
||||
}
|
||||
@ -351,11 +351,11 @@ const SelectedBox = ({
|
||||
name={column}
|
||||
id={column}
|
||||
disabled={mode === 'READ'}
|
||||
value={selectedId ? Number(selectedId) : etcValue || isEtcSelected ? 'etc' : ''}
|
||||
value={selectedId ? String(selectedId) : etcValue || isEtcSelected ? 'etc' : ''}
|
||||
onChange={handleSelectChange}
|
||||
>
|
||||
{selectBoxOptions[column as keyof typeof selectBoxOptions].map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
<option key={item.code ?? String(item.id)} value={item.code ?? String(item.id)}>
|
||||
{item.name}
|
||||
</option>
|
||||
))}
|
||||
@ -458,17 +458,17 @@ const RadioSelected = ({
|
||||
return (
|
||||
<>
|
||||
{radioEtcData[column as keyof typeof radioEtcData].map((item) => (
|
||||
<div className="radio-form-box mb10" key={item.id}>
|
||||
<div className="radio-form-box mb10" key={item.code ?? String(item.id)}>
|
||||
<input
|
||||
type="radio"
|
||||
name={column}
|
||||
id={`${column}_${item.id}`}
|
||||
id={`${column}_${item.code ?? item.id}`}
|
||||
disabled={mode === 'READ'}
|
||||
checked={Number(selectedId) === item.id}
|
||||
checked={Number(selectedId) === (item.code ?? item.id)}
|
||||
onChange={handleRadioChange}
|
||||
value={item.id}
|
||||
value={item.code ?? item.id}
|
||||
/>
|
||||
<label htmlFor={`${column}_${item.id}`}>{item.label}</label>
|
||||
<label htmlFor={`${column}_${item.code ?? item.id}`}>{item.label}</label>
|
||||
</div>
|
||||
))}
|
||||
{showEtcOption && (
|
||||
@ -528,12 +528,12 @@ const MultiCheck = ({
|
||||
const selectedValues = makeNumArr(String(roofInfo[column as keyof SurveyDetailInfo] ?? ''))
|
||||
|
||||
/** 다중 선택 처리 */
|
||||
const handleCheckbox = (id: number) => {
|
||||
const handleCheckbox = (item: { id: number; code: string | null; name: string }) => {
|
||||
const isOtherSelected = Boolean(etcValue)
|
||||
let newValue: string[]
|
||||
|
||||
if (selectedValues.includes(String(id))) {
|
||||
newValue = selectedValues.filter((v) => v !== String(id))
|
||||
if (selectedValues.includes(item.code ?? String(item.id))) {
|
||||
newValue = selectedValues.filter((v) => v !== item.code && v !== String(item.id))
|
||||
} else {
|
||||
/** 지붕 재료 처리 - 최대 2개 선택 처리 */
|
||||
if (isRoofMaterial) {
|
||||
@ -543,7 +543,7 @@ const MultiCheck = ({
|
||||
return
|
||||
}
|
||||
}
|
||||
newValue = [...selectedValues, String(id)]
|
||||
newValue = [...selectedValues, item.code ?? String(item.id)]
|
||||
}
|
||||
setRoofInfo({ ...roofInfo, [column]: newValue.join(',') })
|
||||
}
|
||||
@ -586,9 +586,9 @@ const MultiCheck = ({
|
||||
<input
|
||||
type="checkbox"
|
||||
id={`${column}_${item.id}`}
|
||||
checked={selectedValues.includes(String(item.id))}
|
||||
checked={selectedValues.includes(item.code ?? String(item.id))}
|
||||
disabled={mode === 'READ'}
|
||||
onChange={() => handleCheckbox(item.id)}
|
||||
onChange={() => handleCheckbox(item)}
|
||||
/>
|
||||
<label htmlFor={`${column}_${item.id}`}>{item.name}</label>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user