From 33e94034678eff33b9dbdc7393a874babb5093fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?sanguu516=28=EB=B0=95=EC=83=81=ED=98=84=29?= Date: Mon, 25 Sep 2023 11:23:29 +0900 Subject: [PATCH] =?UTF-8?q?laanc=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/laanc/LaancContainer.js | 259 ++++++ src/modules/laanc/reducers/laancReducers.ts | 14 +- src/views/laanc/FlightArea.js | 49 + src/views/laanc/FlightPlan.js | 847 ++++++++---------- 4 files changed, 695 insertions(+), 474 deletions(-) create mode 100644 src/containers/basis/flight/laanc/LaancContainer.js create mode 100644 src/views/laanc/FlightArea.js diff --git a/src/containers/basis/flight/laanc/LaancContainer.js b/src/containers/basis/flight/laanc/LaancContainer.js new file mode 100644 index 0000000..89bdf32 --- /dev/null +++ b/src/containers/basis/flight/laanc/LaancContainer.js @@ -0,0 +1,259 @@ +import FlightPlan from '../../../../views/laanc/FlightPlan'; +import Apply from '../../../../views/laanc/Apply'; +import { useEffect, useState } from 'react'; +import moment from 'moment'; +import { WeatherContainer } from '../../../../containers/basis/flight/plan/WeatherContainer'; +import { ErrorModal } from '../../../../components/modal/ErrorModal'; +import { + initFlight, + initFlightBas +} from '../../../../modules/basis/flight/models/basisFlightModel'; +import { + Row, + Col, + Button, + Modal, + ModalHeader, + ModalBody, + ModalFooter, + Alert, + FormGroup, + Label, + Input +} from 'reactstrap'; + +const LaancContainer = () => { + const [step, setStep] = useState(1); + const [detailData, setDetailData] = useState(initFlightBas.initDetail); + const [formModal, setFormModal] = useState(false); + const [disabledAnimation, setDisabledAnimation] = useState(true); + const [modal2, setModal2] = useState({ + isOpen: false, + title: '', + desc: '' + }); + const [centeredModal, setCenteredModal] = useState(false); + //날씨 임시 데이터 + const [wheather, setWheather] = useState([ + { + coordList: [ + { + lat: 37.40284040287055, + lon: 126.68639226254697 + } + ] + } + ]); + + // step 핸들러 + const handlerStep = step => { + setStep(step); + }; + + const handlerLogout = () => { + dispatch(Actions.logout.request()); + }; + + useEffect(() => {}, [detailData]); + + // 날씨 핸들러 + const handlerWeather = () => { + setFormModal(!formModal); + }; + + // 비행계획서 작성 핸들러 + const handleChange = ({ name, value, type, index, pIndex }) => { + const arrName = `${type}List`; + + switch (type) { + case 'area': + case 'pilot': + case 'arcrft': + if (name === 'fltElev' || name === 'bufferZone' || name === 'hpno') { + const newValue = value.replace(/[^0-9]/g, ''); + setDetailData(prevState => { + const arr = [...prevState[arrName]]; + const updateData = { + ...prevState[arrName][0], + [name]: newValue + }; + arr[0] = updateData; + return { + ...prevState, + [arrName]: arr + }; + }); + } else { + setDetailData(prevState => { + const arr = [...prevState[arrName]]; + const updateData = { + ...prevState[arrName][0], + [name]: value + }; + arr[0] = updateData; + return { + ...prevState, + [arrName]: arr + }; + }); + } + break; + case 'plan': + default: + setDetailData(prevState => ({ + ...prevState, + [name]: value + })); + break; + } + }; + + console.log('>>>>', detailData); + // 스텝 1 다음 버튼 이벤트 + const handlerNext = () => { + const reg_email = + /^([0-9a-zA-Z_\.-]+)@([0-9a-zA-Z_-]+)(\.[0-9a-zA-Z_-]+){1,2}$/; + const check_num = /[0-9]/; + const check_kor = + /^[가-힣a-zA-Z0-9][^!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?\s]*$/; + // 시작일자 + const schFltStDt = moment(detailData.schFltStDt, 'YYYY-MM-DD HH:mm:ss'); + // 종료일자 + const schFltEndDt = moment(detailData.schFltEndDt, 'YYYY-MM-DD HH:mm:ss'); + + const currentDate = moment(); // 현재 날짜와 시간을 가져옵니다. + + if (!detailData.pilotList[0].memberName) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '이름을 입력해 주세요.' + }); + return false; + } else if (!check_num.test(detailData.pilotList[0].hpno)) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '연락처를 확인해 주세요.' + }); + return false; + } else if (!reg_email.test(detailData.pilotList[0].email)) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '이메일을 확인해 주세요.' + }); + + return false; + } else if ( + !schFltStDt.isAfter(currentDate) || + !schFltEndDt.isAfter(currentDate) + ) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '비행 일자가 이미 지난 일자입니다.' + }); + return false; + } else if (schFltStDt.isAfter(schFltEndDt)) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '비행일자를 확인해주세요.' + }); + return false; + } else if (!detailData.fltPurpose) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '비행목적을 선택해 주세요.' + }); + + return false; + } else if (!detailData.areaList[0].fltElev) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '고도를 입력해 주세요.' + }); + + return false; + } else if (!detailData.areaList[0].bufferZone) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '반경을 입력해 주세요.' + }); + + return false; + } else if (!detailData.areaList[0].fltMethod) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '비행방식를 입력해 주세요.' + }); + + return false; + } else if (!detailData.arcrftList[0].groupNm) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '기체 신고 번호를 입력해 주세요.' + }); + + return false; + } else if (!detailData.arcrftList[0].arcrftTypeCd) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '기체 종류를 입력해 주세요.' + }); + + return false; + } else if (!detailData.arcrftList[0].ownerNm) { + setModal2({ + isOpen: true, + title: '필수값 입력 오류', + desc: '소유자명(법인명)를 입력해 주세요.' + }); + + return false; + } else { + //api 호출 부분 + + setStep(2); + } + }; + + return ( + <> +
+ setDisabledAnimation(!disabledAnimation)} + className='modal-dialog-centered laanc-modal' + fade={false} + backdrop={false} + > + {step === 1 && ( + <> + + + )} + + {step === 2 && } + + +
+ + ); +}; +export default LaancContainer; diff --git a/src/modules/laanc/reducers/laancReducers.ts b/src/modules/laanc/reducers/laancReducers.ts index 16afadd..d6115dc 100644 --- a/src/modules/laanc/reducers/laancReducers.ts +++ b/src/modules/laanc/reducers/laancReducers.ts @@ -15,12 +15,14 @@ import { export const laancReducer = createReducer( laancControlData -).handleAction(Actions.laancFlightApproval.success, (state, action) => - produce(state, draft => { - // laanc 승인 처리 - const data = action.payload; - draft.laancApproval = data; - }) ); +// handleAction(Actions.laancFlightApproval.success, (state, action) => +// produce(state, draft => { +// // laanc 승인 처리 +// const data = action.payload; +// draft.approval = data; +// }) +// ); + export default laancReducer; diff --git a/src/views/laanc/FlightArea.js b/src/views/laanc/FlightArea.js new file mode 100644 index 0000000..5a1c2f3 --- /dev/null +++ b/src/views/laanc/FlightArea.js @@ -0,0 +1,49 @@ +import { + Row, + Col, + Button, + Modal, + ModalHeader, + ModalBody, + ModalFooter, + Alert, + FormGroup, + Label, + Input +} from 'reactstrap'; + +const FlightArea = ({ centeredModal, setCenteredModal }) => { + return ( +
+ setCenteredModal(!centeredModal)} + className='modal-dialog-centered modal-xl' + > + setCenteredModal(!centeredModal)}> + 비행 구역 설정 + + 지도영역 지도 height 정해주기 + +
+
+ + + + +
+
+ +
+
+
+
+
+ ); +}; +export default FlightArea; diff --git a/src/views/laanc/FlightPlan.js b/src/views/laanc/FlightPlan.js index e5e5af8..6749343 100644 --- a/src/views/laanc/FlightPlan.js +++ b/src/views/laanc/FlightPlan.js @@ -9,19 +9,19 @@ import '@styles/react/libs/flatpickr/flatpickr.scss'; import { ErrorModal } from '../../components/modal/ErrorModal'; import moment from 'moment'; import { - Button, - InputGroup, - ButtonGroup, - InputGroupAddon, - Input, Row, Col, + Button, + Modal, + ModalHeader, + ModalBody, + ModalFooter, + Alert, FormGroup, Label, - Card, - CardBody, - CustomInput + Input } from 'reactstrap'; + import { initFlight, initFlightBas @@ -33,8 +33,17 @@ import { sensorClickAction } from '../../modules/control/map/actions/controlMapActions'; import { useHistory } from 'react-router-dom'; -const FlightPlan = ({ handleChange, handlerNext, data, handlerWeather }) => { +import FlightArea from './FlightArea'; +const FlightPlan = ({ + handleChange, + handlerNext, + data, + handlerWeather, + disabledAnimation, + setDisabledAnimation +}) => { const user = useSelector(state => state.authState); + const [centeredModal, setCenteredModal] = useState(false); const history = useHistory(); @@ -43,469 +52,371 @@ const FlightPlan = ({ handleChange, handlerNext, data, handlerWeather }) => { }; return ( -
-
-
-

LAANC 승인 요청

- {/* */} - handlerLaanc()} - > - 취소 - -
-
- - + <> + + LAANC 승인 요청 + + + +
- -
-
-
-
-
-
-
-

위치 선택

-
-
- handlerDrawType('LINE')} - // disabled={isDisabled || isDone} - > - WayPoint - - handlerDrawType('CIRCLE')} - // disabled={isDisabled || isDone} - > - Circle - - handlerDrawType('POLYGON')} - // disabled={isDisabled || isDone} - > - Polygon - - - 날씨 정보 - -
-
-
-

조종사 정보

-
-
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value - }); - }} - bsSize='sm' - placeholder='홍길동' - /> - - - - -
- - { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value - }); - }} - readOnly - /> -
-
- { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value - }); - }} - placeholder='010-0000-0000' - /> -
-
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value - }); - }} - // innerRef={data} - placeholder='' - /> - - -
-
-
-

비행 계획 정보

-
-
- - - - - { - const value = - moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || - ''; - handleChange({ - name: 'schFltStDt', - value - }); - }} - placeholder='비행 시작일자 선택(클릭)' - /> - - - - - - { - const value = - moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || - ''; - handleChange({ - name: 'schFltEndDt', - value - }); - }} - placeholder='비행 종료일자 선택(클릭)' - // {...{options:{minDate: "today"}}} - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'plan', - name, - value - }); - }} - // innerRef={data} - // className={classnames({ - // 'is-invalid': errors.arcrftTypeCd - // })} - > - {/* TODO CDNOT 코드연동 필요 */} - - - - - - - - - - - -
- {/* TODO area 다건 표출 */} -
-

비행 구역 정보

-
-
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'area', - name, - value - }); - }} - // innerRef={data} - placeholder='100m' - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'area', - name, - value - }); - }} - // innerRef={data} - placeholder='100m' - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'area', - name, - value - }); - }} - // innerRef={data} - placeholder='' - /> - - - -
-
-

기체 정보

-
-
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value - }); - }} - // innerRef={data} - placeholder='' - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value - }); - }} - // innerRef={data} - placeholder='100m' - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value - }); - }} - // innerRef={data} - placeholder='' - /> - - - -
-
-

유의사항

-
- {/*
- - {data.planSno ? ( - - 삭제 - - ) : null} -
*/} - handlerNext()} - > - 다음 - -
+ + +
조종사 정보
+ + { + const { name, value } = e.target; + handleChange({ + type: 'pilot', + name, + value + }); + }} + disabled + /> +
+ + + +
비행 유형
+ + + + + + + +
+ + +
비행 계획 정보
+ + + + + { + const value = + moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + name: 'schFltStDt', + value + }); + }} + placeholder='비행 시작일자 선택(클릭)' + /> + + + + + + { + const value = + moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + name: 'schFltEndDt', + value + }); + }} + placeholder='비행 종료일자 선택(클릭)' + // {...{options:{minDate: "today"}}} + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'plan', + name, + value + }); + }} + // innerRef={data} + // className={classnames({ + // 'is-invalid': errors.arcrftTypeCd + // })} + > + {/* TODO CDNOT 코드연동 필요 */} + + + + + + + + + + + + + +
+ 비행 구역 정보
+ + + + + { + const { name, value } = e.target; + handleChange({ + type: 'area', + name, + value + }); + }} + // innerRef={data} + placeholder='100m' + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'area', + name, + value + }); + }} + // innerRef={data} + placeholder='100m' + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'area', + name, + value + }); + }} + // innerRef={data} + placeholder='' + > + + + + + + + + + + 비행방식 + + + + + + + + + + + + +
기체 정보
+ + + + + + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'arcrft', + name, + value + }); + }} + // innerRef={data} + placeholder='100m' + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'arcrft', + name, + value + }); + }} + // innerRef={data} + placeholder='' + /> + + + - - -
+
+
+
+ 비행 구역 설정 + +
+
+ 여기가 지도 영역 + +
+
+
+
유의사항
+
+
+ + +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ {/* 완료후 다음 진행할 수 있을때 버튼에 ouline 뺴주고 color='danger' 넣어주기 */} + +
+ ); }; export default FlightPlan;