dev #799

Merged
ysCha merged 20 commits from dev into prd-deploy 2026-04-28 18:07:08 +09:00
2 changed files with 44 additions and 13 deletions
Showing only changes of commit b9bb4708a8 - Show all commits

View File

@ -2,6 +2,8 @@
import { useEffect, useState, useContext, useRef } from 'react'
import { useMessage } from '@/hooks/useMessage'
import { useAxios } from '@/hooks/useAxios'
import { useRecoilValue } from 'recoil'
import { globalLocaleStore } from '@/store/localeAtom'
import Select from 'react-select'
import { SessionContext } from '@/app/SessionProvider'
import { isEmptyArray, isObjectNotEmpty } from '@/util/common-utils'
@ -10,24 +12,35 @@ import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateCon
export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
const { getMessage } = useMessage()
const { get } = useAxios()
const globalLocale = useRecoilValue(globalLocaleStore)
const { handleEstimateCopy, estimateContextState } = useEstimateController(planNo, true)
const { session } = useContext(SessionContext)
// storeLvl
const lvl = session?.storeLvl || '1'
const nextLvl = Number(lvl) + 1
const saleStoreLabel = globalLocale === 'ko'
? `${lvl}차 판매점명 / ID`
: `${lvl}次販売店名/ID`
const otherSaleStoreLabel = globalLocale === 'ko'
? `${nextLvl}차+하위 판매점명 / ID`
: `${nextLvl}次下位販売店名/ID`
const [saleStoreList, setSaleStoreList] = useState([]) //
const [favoriteStoreList, setFavoriteStoreList] = useState([]) //
const [showSaleStoreList, setShowSaleStoreList] = useState([]) //
const [otherSaleStoreList, setOtherSaleStoreList] = useState([])
const [originOtherSaleStoreList, setOriginOtherSaleStoreList] = useState([])
const [saleStoreId, setSaleStoreId] = useState('') // 1
const [otherSaleStoreId, setOtherSaleStoreId] = useState('') // 1
const [saleStoreId, setSaleStoreId] = useState('') //
const [saleStoreName, setSaleStoreName] = useState('') //
const [otherSaleStoreId, setOtherSaleStoreId] = useState('') //
const [sendPlanNo, setSendPlanNo] = useState('1')
const [copyReceiveUser, setCopyReceiveUser] = useState('')
const ref = useRef() //2
const ref = useRef() //
useEffect(() => {
let url
@ -40,8 +53,9 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
if (session.storeLvl === '1') {
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}`
} else {
//T01 or 1
// url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}`
// 2+ : ,
setSaleStoreId(session?.storeId)
url = `/api/object/saleStore/${session?.storeId}/childList?storeLvl=${session?.storeLvl}&userId=${session?.userId}`
}
}
@ -91,7 +105,14 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
setOtherSaleStoreList(otherList)
} else {
//T01 or 1
// 2+ : ,
const myself = res.find((row) => row.saleStoreId === session?.storeId)
if (myself) {
setSaleStoreName(myself.saleStoreName)
}
otherList = res.filter((row) => row.saleStoreId !== session?.storeId)
setOtherSaleStoreList(otherList)
setOriginOtherSaleStoreList(otherList)
}
}
}
@ -119,7 +140,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
}
}
// 1
//
const onSelectionChange = (key) => {
if (isObjectNotEmpty(key)) {
if (key.saleStoreId === saleStoreId) {
@ -154,7 +175,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
}
}
// 2
//
const onSelectionChange2 = (key) => {
if (isObjectNotEmpty(key)) {
if (key.saleStoreId === otherSaleStoreId) {
@ -169,7 +190,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
}
}
//2
//
const handleClear = () => {
if (ref.current) {
ref.current.clearValue()
@ -198,7 +219,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
<div className="estimate-copy-info-wrap">
<div className="estimate-copy-info-item">
<div className="estimate-copy-info-tit">
{getMessage('estimate.detail.estimateCopyPopup.label.saleStoreId')} <span className="red">*</span>
{saleStoreLabel} <span className="red">*</span>
</div>
{session.storeId === 'T01' && (
<div className="estimate-copy-info-box">
@ -247,9 +268,17 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
<div className="estimate-copy-id">{saleStoreId}</div>
</div>
)}
{session.storeId !== 'T01' && session.storeLvl !== '1' && (
<div className="estimate-copy-info-box">
<div className="estimate-copy-sel">
<input type="text" className="input-light" value={saleStoreName || ''} disabled />
</div>
<div className="estimate-copy-id">{saleStoreId}</div>
</div>
)}
</div>
<div className="estimate-copy-info-item">
<div className="estimate-copy-info-tit">{getMessage('estimate.detail.estimateCopyPopup.label.otherSaleStoreId')}</div>
<div className="estimate-copy-info-tit">{otherSaleStoreLabel}</div>
<div className="estimate-copy-info-box">
<div className="estimate-copy-sel">
<Select

View File

@ -455,6 +455,7 @@ export default function CanvasMenu(props) {
if (createUser && tempFlg && lockFlg) {
if (createUser === 'T01' && sessionState.storeId !== 'T01') {
setAllButtonStyles('none')
setCopyButtonStyle('')
} else {
handleButtonStyles(tempFlg, lockFlg, docNo)
}
@ -516,6 +517,7 @@ export default function CanvasMenu(props) {
if (createUser && tempFlg && lockFlg) {
if (createUser === 'T01' && sessionState.storeId !== 'T01') {
setAllButtonStyles('none')
setCopyButtonStyle('')
} else {
setEstimateContextState({
tempFlg: estimateRecoilState.tempFlg,
@ -693,7 +695,7 @@ export default function CanvasMenu(props) {
<span className="name">{getMessage('plan.menu.estimate.reset')}</span>
</button>
{estimateRecoilState?.docNo !== null && (sessionState.storeId === 'T01' || sessionState.storeLvl === '1') && (
{estimateRecoilState?.docNo !== null && (sessionState.storeId === 'T01' || sessionState.storeLvl) && (
<button
type="button"
style={{ display: copyButtonStyle }}