견적서 복사 팝업
This commit is contained in:
parent
334fbca188
commit
1c8007e96d
@ -757,7 +757,7 @@ export default function Estimate({ params }) {
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`form-flex-wrap ${style}`} key={uuidv4()}>
|
||||
<div className={`form-flex-wrap ${style}`} key={fixedKey}>
|
||||
<div className="input-wrap mr5" style={{ width: '610px' }} key={`roof${index}`}>
|
||||
<input type="text" className="input-light" value={roofList} readOnly />
|
||||
</div>
|
||||
|
||||
208
src/components/estimate/popup/EstimateCopyPop.jsx
Normal file
208
src/components/estimate/popup/EstimateCopyPop.jsx
Normal file
@ -0,0 +1,208 @@
|
||||
'use client'
|
||||
import { useEffect, useState, useContext, use } from 'react'
|
||||
import { useMessage } from '@/hooks/useMessage'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useRecoilValue } from 'recoil'
|
||||
import { floorPlanObjectState } from '@/store/floorPlanObjectAtom'
|
||||
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 { handleEstimateCopy, state } = useEstimateController(planNo)
|
||||
|
||||
const { session } = useContext(SessionContext)
|
||||
|
||||
// recoil 물건번호
|
||||
const objectRecoil = useRecoilValue(floorPlanObjectState)
|
||||
|
||||
const [saleStoreList, setSaleStoreList] = useState([]) // 판매점 리스트
|
||||
const [favoriteStoreList, setFavoriteStoreList] = useState([]) //즐겨찾기한 판매점목록
|
||||
const [showSaleStoreList, setShowSaleStoreList] = useState([]) //보여줄 판매점목록
|
||||
|
||||
const estimateRecoilState = useRecoilValue(estimateState)
|
||||
|
||||
const [otherSaleStoreList, setOtherSaleStoreList] = useState([])
|
||||
const [originOtherSaleStoreList, setOriginOtherSaleStoreList] = useState([])
|
||||
|
||||
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
|
||||
let favList
|
||||
let otherList
|
||||
if (session.storeId === 'T01') {
|
||||
url = `/api/object/saleStore/${session?.storeId}/firstList?userId=${session?.userId}`
|
||||
} else {
|
||||
if (session.storeLvl === '1') {
|
||||
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}`
|
||||
} else {
|
||||
url = `/api/object/saleStore/${session?.storeId}/list?firstFlg=1&userId=${session?.userId}`
|
||||
}
|
||||
}
|
||||
|
||||
get({ url: url }).then((res) => {
|
||||
if (!isEmptyArray(res)) {
|
||||
res.map((row) => {
|
||||
//자동완성 검색을 위한 필드명 셋팅
|
||||
row.value = row.saleStoreId
|
||||
row.label = row.saleStoreName
|
||||
})
|
||||
|
||||
if (session.storeId === 'T01') {
|
||||
console.log('T01:::::::::::', res)
|
||||
} else {
|
||||
if (session.storeLvl === '1') {
|
||||
console.log('T01아닌 1차점', res)
|
||||
} else {
|
||||
console.log('1차점 아님::::::::', res)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (planNo) {
|
||||
setSendPlanNo(planNo)
|
||||
}
|
||||
}, [planNo])
|
||||
return (
|
||||
<div className="modal-popup">
|
||||
<div className="modal-dialog">
|
||||
<div className="modal-content">
|
||||
<div className="modal-header">
|
||||
<h1 className="title">{getMessage('estimate.detail.estimateCopyPopup.title')}</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="modal-close"
|
||||
onClick={() => {
|
||||
setEstimateCopyPopupOpen(false)
|
||||
}}
|
||||
>
|
||||
{getMessage('estimate.detail.estimateCopyPopup.close')}
|
||||
</button>
|
||||
</div>
|
||||
<div className="modal-body">
|
||||
<div className="modal-body-inner">
|
||||
<div className="explane">{getMessage('estimate.detail.estimateCopyPopup.explane')}</div>
|
||||
<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>
|
||||
</div>
|
||||
{session.storeId === 'T01' && (
|
||||
<div className="estimate-copy-info-box">
|
||||
<div className="estimate-copy-sel">
|
||||
<Select
|
||||
id="long-value-select1"
|
||||
instanceId="long-value-select1"
|
||||
className="react-select-custom"
|
||||
classNamePrefix="custom"
|
||||
placeholder="Select"
|
||||
/>
|
||||
</div>
|
||||
<div className="estimate-copy-id">로그인T01 선택한 1차점 아이디</div>
|
||||
</div>
|
||||
)}
|
||||
{session.storeId !== 'T01' && session.storeLvl === '1' && (
|
||||
<div className="estimate-copy-info-box">
|
||||
<div className="estimate-copy-sel">
|
||||
<Select
|
||||
id="long-value-select1"
|
||||
instanceId="long-value-select1"
|
||||
className="react-select-custom"
|
||||
classNamePrefix="custom"
|
||||
placeholder="Select"
|
||||
/>
|
||||
</div>
|
||||
<div className="estimate-copy-id">로그인 1차점 선택한 1차점 아이디</div>
|
||||
</div>
|
||||
)}
|
||||
{session.storeId !== 'T01' && session.storeLvl !== '1' && (
|
||||
<div className="estimate-copy-info-box">
|
||||
<div className="estimate-copy-sel">
|
||||
<Select
|
||||
id="long-value-select1"
|
||||
instanceId="long-value-select1"
|
||||
className="react-select-custom"
|
||||
classNamePrefix="custom"
|
||||
placeholder="Select"
|
||||
/>
|
||||
</div>
|
||||
<div className="estimate-copy-id">로그인 1차점 아님 선택한 1차점 아이디</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="estimate-copy-info-item">
|
||||
<div className="estimate-copy-info-tit">
|
||||
{getMessage('estimate.detail.estimateCopyPopup.label.otherSaleStoreId')} <span className="red">*</span>
|
||||
</div>
|
||||
<div className="estimate-copy-info-box">
|
||||
<div className="estimate-copy-sel">
|
||||
<Select
|
||||
id="long-value-select2"
|
||||
instanceId="long-value-select2"
|
||||
className="react-select-custom"
|
||||
classNamePrefix="custom"
|
||||
placeholder="Select"
|
||||
/>
|
||||
</div>
|
||||
<div className="estimate-copy-id">선택한 2차점 아이디</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="estimate-copy-info-item">
|
||||
<div className="estimate-copy-info-tit">
|
||||
{getMessage('estimate.detail.estimateCopyPopup.label.receiveUser')} <span className="red">*</span>
|
||||
</div>
|
||||
<div className="input-wrap">
|
||||
<input
|
||||
type="text"
|
||||
className="input-light"
|
||||
defaultValue={state?.charger}
|
||||
onChange={(e) => {
|
||||
setSendCharger(e.target.value)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="footer-btn-wrap">
|
||||
<button type="button" className="btn-origin grey mr5" onClick={() => setEstimateCopyPopupOpen(false)}>
|
||||
{getMessage('estimate.detail.estimateCopyPopup.close')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn-origin navy"
|
||||
onClick={() => {
|
||||
handleEstimateCopy(sendPlanNo, sendCharger)
|
||||
}}
|
||||
>
|
||||
{getMessage('estimate.detail.estimateCopyPopup.copyBtn')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -36,6 +36,7 @@ import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateCon
|
||||
import { estimateState } from '@/store/floorPlanObjectAtom'
|
||||
import DocDownOptionPop from '../estimate/popup/DocDownOptionPop'
|
||||
import { FloorPlanContext } from '@/app/floor-plan/FloorPlanProvider'
|
||||
import EstimateCopyPop from '../estimate/popup/EstimateCopyPop'
|
||||
|
||||
export default function CanvasMenu(props) {
|
||||
const { menuNumber, setMenuNumber } = props
|
||||
@ -60,6 +61,7 @@ export default function CanvasMenu(props) {
|
||||
const { handleEstimateSubmit } = useEstimateController()
|
||||
const estimateRecoilState = useRecoilValue(estimateState)
|
||||
const [estimatePopupOpen, setEstimatePopupOpen] = useState(false)
|
||||
const [estimateCopyPopupOpen, setEstimateCopyPopupOpen] = useState(false)
|
||||
|
||||
const { getMessage } = useMessage()
|
||||
const { currentCanvasPlan, saveCanvas } = usePlan()
|
||||
@ -163,19 +165,6 @@ export default function CanvasMenu(props) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 복사버튼
|
||||
* (견적서 번호(estimateRecoilState.docNo)가 생성된 이후 버튼 활성화 )
|
||||
* T01관리자 계정 및 1차판매점에게만 제공
|
||||
*/
|
||||
|
||||
const handleEstimateCopy = () => {
|
||||
//objectNo, planNo
|
||||
console.log('복사')
|
||||
console.log('물건정보+도면+견적서를 모두 복사')
|
||||
console.log('견적서 가격은 정가를 표시')
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (globalLocale === 'ko') {
|
||||
setAppMessageState(KO)
|
||||
@ -295,10 +284,9 @@ export default function CanvasMenu(props) {
|
||||
|
||||
{estimateRecoilState?.docNo !== null && (sessionState.storeId === 'T01' || sessionState.storeLvl === '1') && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn-frame gray ico-flx"
|
||||
onClick={() => {
|
||||
handleEstimateCopy()
|
||||
setEstimateCopyPopupOpen(true)
|
||||
}}
|
||||
>
|
||||
<span className="ico ico04"></span>
|
||||
@ -329,6 +317,8 @@ export default function CanvasMenu(props) {
|
||||
</div>
|
||||
{/* 견적서(menuNumber=== 5) 상세화면인경우 문서다운로드 팝업 */}
|
||||
{estimatePopupOpen && <DocDownOptionPop planNo={estimateRecoilState?.planNo} setEstimatePopupOpen={setEstimatePopupOpen} />}
|
||||
{/* 견적서(menuNumber ===5)복사 팝업 */}
|
||||
{estimateCopyPopupOpen && <EstimateCopyPop planNo={estimateRecoilState?.planNo} setEstimateCopyPopupOpen={setEstimateCopyPopupOpen} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@ -201,6 +201,33 @@ export const useEstimateController = (planNo) => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 복사버튼
|
||||
* (견적서 번호(estimateData.docNo)가 생성된 이후 버튼 활성화 )
|
||||
* T01관리자 계정 및 1차판매점에게만 제공
|
||||
*/
|
||||
const handleEstimateCopy = async (sendPlanNo, sendCharger) => {
|
||||
console.log('입력한 값들!@@@@@', sendPlanNo, sendCharger)
|
||||
const params = {
|
||||
saleStoreId: session.storeId,
|
||||
sapSalesStoreCd: session.custCd,
|
||||
objectNo: objectRecoil.floorPlanObjectNo,
|
||||
planNo: sendPlanNo,
|
||||
copySaleStoreId: 'X11',
|
||||
copyReceiveUser: sendCharger,
|
||||
userId: session.userId,
|
||||
}
|
||||
console.log('전송파람:::', params)
|
||||
|
||||
return
|
||||
await promisePost({ url: '/api/estimate/save-estimate-copy', data: params }).then((res) => {
|
||||
console.log('복사결과::::::::', res)
|
||||
//물건 번호 새로 내려옴
|
||||
//견적서가 복사되었습니다. 복사된 물건정보로 이동합니다.
|
||||
// alert(getMessage('estimate.detail.estimateCopyPopup.copy.alertMessage'))
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
setState,
|
||||
@ -209,5 +236,6 @@ export const useEstimateController = (planNo) => {
|
||||
handleEstimateSubmit,
|
||||
fetchSetting,
|
||||
handleEstimateFileDownload,
|
||||
handleEstimateCopy,
|
||||
}
|
||||
}
|
||||
|
||||
@ -874,6 +874,14 @@
|
||||
"estimate.detail.docPopup.schDrawingFlg.schDrawingFlg0": "含まない",
|
||||
"estimate.detail.docPopup.close": "閉じる",
|
||||
"estimate.detail.docPopup.docDownload": "文書のダウンロード",
|
||||
"estimate.detail.estimateCopyPopup.title": "見積もり",
|
||||
"estimate.detail.estimateCopyPopup.explane": "見積書をコピーする販売店を設定します。見積もりは定価にコピーされます.",
|
||||
"estimate.detail.estimateCopyPopup.label.saleStoreId": "一次販売店名 / ID",
|
||||
"estimate.detail.estimateCopyPopup.label.otherSaleStoreId": "二次販売店名 / ID",
|
||||
"estimate.detail.estimateCopyPopup.label.receiveUser": "担当者",
|
||||
"estimate.detail.estimateCopyPopup.close": "閉じる",
|
||||
"estimate.detail.estimateCopyPopup.copyBtn": "見積もり",
|
||||
"estimate.detail.estimateCopyPopup.copy.alertMessage": "見積書がコピーされました. コピーした商品情報に移動します.",
|
||||
"estimate.detail.productFeaturesPopup.title": "製品特異事項",
|
||||
"estimate.detail.productFeaturesPopup.close": "閉じる",
|
||||
"estimate.detail.save.alertMsg": "保存されている見積書で製品を変更した場合、図面や回路には反映されません.",
|
||||
|
||||
@ -884,6 +884,14 @@
|
||||
"estimate.detail.docPopup.schDrawingFlg.schDrawingFlg0": "미포함",
|
||||
"estimate.detail.docPopup.close": "닫기",
|
||||
"estimate.detail.docPopup.docDownload": "문서 다운로드",
|
||||
"estimate.detail.estimateCopyPopup.title": "견적복사",
|
||||
"estimate.detail.estimateCopyPopup.explane": "견적서를 복사할 판매점을 설정하십시오. 견적서는 정가로 복사됩니다.",
|
||||
"estimate.detail.estimateCopyPopup.label.saleStoreId": "1차 판매점명 / ID",
|
||||
"estimate.detail.estimateCopyPopup.label.otherSaleStoreId": "2차 판매점명 / ID",
|
||||
"estimate.detail.estimateCopyPopup.label.receiveUser": "담당자",
|
||||
"estimate.detail.estimateCopyPopup.close": "닫기",
|
||||
"estimate.detail.estimateCopyPopup.copyBtn": "견적복사",
|
||||
"estimate.detail.estimateCopyPopup.copy.alertMessage": "견적서가 복사되었습니다. 복사된 물건정보로 이동합니다.",
|
||||
"estimate.detail.productFeaturesPopup.title": "제품특이사항",
|
||||
"estimate.detail.productFeaturesPopup.close": "닫기",
|
||||
"estimate.detail.save.alertMsg": "저장되었습니다. 견적서에서 제품을 변경할 경우, 도면 및 회로에 반영되지 않습니다.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user