견적서 복사
This commit is contained in:
parent
1c8007e96d
commit
88a64282eb
@ -8,14 +8,15 @@ import Select, { components } from 'react-select'
|
||||
import { SessionContext } from '@/app/SessionProvider'
|
||||
import { isEmptyArray } from '@/util/common-utils'
|
||||
import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController'
|
||||
import { ManagementContext } from '@/app/management/ManagementProvider'
|
||||
|
||||
import { estimateState } from '@/store/floorPlanObjectAtom'
|
||||
|
||||
export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
const { getMessage } = useMessage()
|
||||
const { get, promisePost } = useAxios()
|
||||
const { managementState } = useContext(ManagementContext)
|
||||
|
||||
const [selOptions, setSelOptions] = useState('') //선택한 1차점 전송할
|
||||
|
||||
const { handleEstimateCopy, state } = useEstimateController(planNo)
|
||||
|
||||
const { session } = useContext(SessionContext)
|
||||
@ -35,15 +36,6 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
const [sendPlanNo, setSendPlanNo] = useState('1')
|
||||
const [sendCharger, setSendCharger] = useState('')
|
||||
|
||||
// useEffect(() => {
|
||||
// console.log(originState)
|
||||
// }, [originState])
|
||||
|
||||
useEffect(() => {
|
||||
if (state) {
|
||||
console.log('state::::::::', state)
|
||||
}
|
||||
}, [state])
|
||||
useEffect(() => {
|
||||
let url
|
||||
let firstList
|
||||
@ -72,6 +64,15 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
} else {
|
||||
if (session.storeLvl === '1') {
|
||||
console.log('T01아닌 1차점', res)
|
||||
firstList = res
|
||||
favList = res.filter((row) => row.priority !== 'B')
|
||||
otherList = res.filter((row) => row.firstAgentYn === 'N')
|
||||
setSaleStoreList(firstList)
|
||||
setFavoriteStoreList(firstList)
|
||||
setShowSaleStoreList(firstList)
|
||||
setSelOptions(firstList[0].saleStoreId)
|
||||
|
||||
setOtherSaleStoreList(otherList)
|
||||
} else {
|
||||
console.log('1차점 아님::::::::', res)
|
||||
}
|
||||
@ -85,6 +86,28 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
setSendPlanNo(planNo)
|
||||
}
|
||||
}, [planNo])
|
||||
|
||||
useEffect(() => {
|
||||
if (state?.charger) {
|
||||
setSendCharger(state.charger)
|
||||
}
|
||||
}, [state.charger])
|
||||
|
||||
// 1차점 변경 이벤트
|
||||
const onSelectionChange = (key) => {
|
||||
if (isObjectNotEmpty(key)) {
|
||||
if (key.saleStoreId === selOptions) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (isObjectNotEmpty(key)) {
|
||||
console.log('KEY::', key)
|
||||
} else {
|
||||
console.log('XXXXXXXXXXX')
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="modal-popup">
|
||||
<div className="modal-dialog">
|
||||
@ -132,6 +155,15 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
className="react-select-custom"
|
||||
classNamePrefix="custom"
|
||||
placeholder="Select"
|
||||
options={showSaleStoreList[0]}
|
||||
onChange={onSelectionChange}
|
||||
getOptionLabel={(x) => x.saleStoreName}
|
||||
getOptionValue={(x) => x.saleStoreId}
|
||||
isClearable={false}
|
||||
isDisabled={session?.storeLvl !== '1' ? true : session?.storeId !== 'T01' ? true : false}
|
||||
value={showSaleStoreList.filter(function (option) {
|
||||
return option.saleStoreId === selOptions
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
<div className="estimate-copy-id">로그인 1차점 선택한 1차점 아이디</div>
|
||||
@ -194,7 +226,7 @@ export default function EstimateCopyPop({ planNo, setEstimateCopyPopupOpen }) {
|
||||
type="button"
|
||||
className="btn-origin navy"
|
||||
onClick={() => {
|
||||
handleEstimateCopy(sendPlanNo, sendCharger)
|
||||
handleEstimateCopy(sendPlanNo, sendCharger, selOptions)
|
||||
}}
|
||||
>
|
||||
{getMessage('estimate.detail.estimateCopyPopup.copyBtn')}
|
||||
|
||||
@ -206,14 +206,14 @@ export const useEstimateController = (planNo) => {
|
||||
* (견적서 번호(estimateData.docNo)가 생성된 이후 버튼 활성화 )
|
||||
* T01관리자 계정 및 1차판매점에게만 제공
|
||||
*/
|
||||
const handleEstimateCopy = async (sendPlanNo, sendCharger) => {
|
||||
console.log('입력한 값들!@@@@@', sendPlanNo, sendCharger)
|
||||
const handleEstimateCopy = async (sendPlanNo, sendCharger, selOptions) => {
|
||||
console.log('입력한 값들!@@@@@', sendPlanNo, sendCharger, selOptions)
|
||||
const params = {
|
||||
saleStoreId: session.storeId,
|
||||
sapSalesStoreCd: session.custCd,
|
||||
objectNo: objectRecoil.floorPlanObjectNo,
|
||||
planNo: sendPlanNo,
|
||||
copySaleStoreId: 'X11',
|
||||
copySaleStoreId: selOptions,
|
||||
copyReceiveUser: sendCharger,
|
||||
userId: session.userId,
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user