|
|
|
@ -6,6 +6,8 @@ import {useDispatch, useSelector} from 'react-redux';
|
|
|
|
|
import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; |
|
|
|
|
import {initFlight, initFlightBas} from '../../../../modules/basis/flight/models/basisFlightModel'; |
|
|
|
|
import { AiFillPropertySafety } from 'react-icons/ai'; |
|
|
|
|
import { ErrorModal } from '../../../../components/modal/ErrorModal'; |
|
|
|
|
import { CgArrowLeftR } from 'react-icons/cg'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initModal = { |
|
|
|
@ -23,6 +25,12 @@ const FlightPlanDetailContainer = () => {
|
|
|
|
|
const { detail, pilotSelect, arcrftSelect, areaList, selectGroup } = flightState; |
|
|
|
|
const [modal, setModal] = useState(initModal); |
|
|
|
|
const [detailData, setDetailData] = useState(initFlightBas.initDetail); |
|
|
|
|
//모달 관련 설정
|
|
|
|
|
const [modal2, setModal2] = useState({ |
|
|
|
|
isOpen: false, |
|
|
|
|
title: '', |
|
|
|
|
desc: '' |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (Object.keys(urlParams).length === 0 && urlParams.constructor === Object) return; |
|
|
|
@ -55,7 +63,11 @@ const FlightPlanDetailContainer = () => {
|
|
|
|
|
|
|
|
|
|
pilotList.forEach((p, i) => {
|
|
|
|
|
if(p.cstmrSno === pilotSelect.cstmrSno) { |
|
|
|
|
alert('이미 등록된 조종사입니다.'); |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '중복값 입력 오류', |
|
|
|
|
desc: '이미 등록된 조종사 정보 입니다.' |
|
|
|
|
}); |
|
|
|
|
checking = false; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
@ -98,7 +110,11 @@ const FlightPlanDetailContainer = () => {
|
|
|
|
|
|
|
|
|
|
arcrftList.forEach((p,i) => {
|
|
|
|
|
if(p.idntfNum === arcrftSelect.idntfNum) {
|
|
|
|
|
alert('이미 등록된 기체 식별번호입니다.'); |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '중복값 입력 오류', |
|
|
|
|
desc: '이미 등록된 기체 정보 입니다.' |
|
|
|
|
}); |
|
|
|
|
checking = false; |
|
|
|
|
return false; |
|
|
|
|
}
|
|
|
|
@ -363,11 +379,69 @@ const FlightPlanDetailContainer = () => {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
console.log("상현>>>>>>",detailData); |
|
|
|
|
},[detailData]) |
|
|
|
|
// 저장
|
|
|
|
|
const handleSave = () => { |
|
|
|
|
if (!detailData.planSno) { |
|
|
|
|
|
|
|
|
|
if (!detailData.memberName) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '이름을 입력해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.hpno) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '전화번호를 입력해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if(!detailData.email){ |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '이메일을 입력해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.areaList[0]) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '좌표를 선택해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.areaList[0].fltElev) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '반경/고도를 입력해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.areaList[0].fltMethod) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '비행방식를 입력해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.pilotList[0]) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '조종사를 선택해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.arcrftList[0]) { |
|
|
|
|
setModal2({ |
|
|
|
|
isOpen: true, |
|
|
|
|
title: '필수값 입력 오류', |
|
|
|
|
desc: '기체를 선택해주세요.' |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
else if (!detailData.planSno) { |
|
|
|
|
dispatch(Actions.FLIGHT_PLAN_CREATE.request(detailData)); |
|
|
|
|
} else {
|
|
|
|
|
dispatch(Actions.FLIGHT_PLAN_UPDATE.request(detailData)); |
|
|
|
@ -378,6 +452,7 @@ const FlightPlanDetailContainer = () => {
|
|
|
|
|
// 삭제
|
|
|
|
|
const handleDelete = () => { |
|
|
|
|
if(!urlParams.planSno || urlParams.planSno){ |
|
|
|
|
|
|
|
|
|
dispatch(Actions.FLIGHT_PLAN_DELETE.request(urlParams.planSno)); |
|
|
|
|
} |
|
|
|
|
dispatch(Actions.FLIGHT_PLAN_GROUP_SELECT({cstmrSno: 0, groupId: '', groupNm: ''})); |
|
|
|
@ -401,6 +476,7 @@ const FlightPlanDetailContainer = () => {
|
|
|
|
|
// handlerDelete={handlerDelete}
|
|
|
|
|
// handlerInput={handlerInput}
|
|
|
|
|
/> |
|
|
|
|
<ErrorModal modal={modal2} setModal={setModal2} /> |
|
|
|
|
{/*<FlightPlanAreaModal*/} |
|
|
|
|
{/* modal={modal}*/} |
|
|
|
|
{/* save={saveFlightPlanArea}*/} |
|
|
|
|