From 58562a3b45ccf6bb642ebe271044d6eca5619721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kimjh=28=EA=B9=80=EC=9E=A5=ED=98=84=29?= Date: Thu, 22 Sep 2022 17:42:54 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=96=89=EA=B3=84=ED=9A=8D=EC=84=9C?= =?UTF-8?q?=20=EC=8B=A0=EC=B2=AD=EC=84=9C=20=EC=9E=91=EC=84=B1=EC=8B=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=EB=B2=84=ED=8A=BC=20=EB=B9=84=EB=85=B8?= =?UTF-8?q?=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basis/flight/plan/FlightPlanForm.js | 1735 +++++++++-------- 1 file changed, 889 insertions(+), 846 deletions(-) diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js index 8c9ed0d..7df6a02 100644 --- a/src/components/basis/flight/plan/FlightPlanForm.js +++ b/src/components/basis/flight/plan/FlightPlanForm.js @@ -1,18 +1,21 @@ import React, { useEffect, useState } from 'react'; import { - Card, - CardBody, - Col, - FormGroup, - Input, - Label, - Row, - Button + Card, + CardBody, + Col, + FormGroup, + Input, + Label, + Row, + Button } from 'reactstrap'; import Flatpickr from 'react-flatpickr'; import '@styles/react/libs/flatpickr/flatpickr.scss'; import moment from 'moment'; -import { initFlight, initFlightBas } from '../../../../modules/basis/flight/models/basisFlightModel'; +import { + initFlight, + initFlightBas +} from '../../../../modules/basis/flight/models/basisFlightModel'; import FlightPlanPilotContainer from '../../../../containers/basis/flight/plan/FlightPlanPilotContainer'; import { FlightPlanModal } from './FlightPlanModal'; import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer'; @@ -21,185 +24,190 @@ import { X } from 'react-feather'; import { useSelector } from 'react-redux'; import { shallowEqual } from 'react-redux'; +const FlightPlanForm = ({ + data, + handleModal, + handleChange, + handleSave, + handleDelete, + modal, + handleDeleteArray +}) => { + const { areaList, pilotList, arcrftList } = data; + + const [date, setDate] = useState(); + const [isFlightDone, setIsFlightDone] = useState(); + + const [test, setTest] = useState(); + const { user } = useSelector(state => state.authState, shallowEqual); + const { detail } = useSelector(state => state.flightState); + + useEffect(() => { + if (detail.createDt) { + setDate(detail.schFltStDt); + } -const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { - const { areaList, pilotList, arcrftList } = data; - - - const [date, setDate] = useState(); - const [isFlightDone, setIsFlightDone] = useState(); - - const [test, setTest] = useState(); - const { user } = useSelector(state => state.authState, shallowEqual); - const { detail } = useSelector(state => state.flightState); - - - useEffect(() => { - if (detail.createDt) { - setDate(detail.schFltStDt); - } - - if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { - // console.log(true) - setTest(false) - } else { - // console.log(false) - setTest(true) - } - }, [detail]) - - useEffect(() => { - setDate(''); - }, []) - - useEffect(() => { - if (date) { - let cTime = new Date(); - let pTime = new Date(date) - if (cTime > pTime) { - setIsFlightDone(true); - } else { - setIsFlightDone(false); - } - } - }, [date]) - - return ( - - + if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { + // console.log(true) + setTest(false); + } else { + // console.log(false) + setTest(true); + } + }, [detail]); + + useEffect(() => { + setDate(''); + }, []); + + useEffect(() => { + if (date) { + let cTime = new Date(); + let pTime = new Date(date); + if (cTime > pTime) { + setIsFlightDone(true); + } else { + setIsFlightDone(false); + } + } + }, [date]); + + return ( + + + + + + - - - - - -
-
-
-
-
- -
-
-
-

신청인 정보

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

비행 계획 정보

-
-
- - - - - {/* { + +
+
+
+
+ +
+
+
+

신청인 정보

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

비행 계획 정보

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

비행 구역 정보

- { - handleModal({ target: 'area', isOpen: true }) - }} - > - 비행 구역 설정 - -
- {areaList - ? areaList.map((item, i) => - ) - : } -
-
-
-

조종사 정보

- { - handleModal({ target: 'pilot', isOpen: true }) - }} - > - 조종사 조회 - -
- {pilotList - ? pilotList.map((item, i) => - ) - : } -
-
-
-

기체 정보

- { - handleModal({ target: 'arcrft', isOpen: true }); - }} - > - 기체 조회 - -
- {arcrftList - ? arcrftList.map((item, i) => - ) - - : } -
- -
- - 저장 - - - 삭제 - -
- -
-
-
- + { + const value = + moment(date[0]).format( + 'YYYY-MM-DD HH:mm:ss' + ) || ''; + handleChange({ + type: 'plan', + name: 'schFltEndDt', + value + }); + }} + placeholder='비행 종료일자 선택(클릭)' + // {...{options:{minDate: "today"}}} + /> +
+ + + + + { + const { name, value } = e.target; + handleChange({ + type: 'plan', + name, + value + }); + }} + // innerRef={props.data} + // className={classnames({ + // 'is-invalid': props.errors.arcrftTypeCd + // })} + > + {/* TODO CDNOT 코드연동 필요 */} + + + + + + + + + + +
+
+
+
+ {/* TODO area 다건 표출 */} +
+

비행 구역 정보

+ { + handleModal({ target: 'area', isOpen: true }); + }} + > + 비행 구역 설정 + +
+ {areaList ? ( + areaList.map((item, i) => ( + + )) + ) : ( + + )} +
+
+
+

조종사 정보

+ { + handleModal({ target: 'pilot', isOpen: true }); + }} + > + 조종사 조회 + +
+ {pilotList ? ( + pilotList.map((item, i) => ( + + )) + ) : ( + + )} +
+
+
+

기체 정보

+ { + handleModal({ target: 'arcrft', isOpen: true }); + }} + > + 기체 조회 + +
+ {arcrftList ? ( + arcrftList.map((item, i) => ( + + )) + ) : ( + + )} +
- - - +
+ + 저장 + + {data.planSno ? ( + + 삭제 + + ) : null} +
+
+
+
- - -
- ) -} + +
+
+
+ + +
+ ); +}; export default FlightPlanForm; const SelectModal = ({ handleModal, modal, test }) => { - let title = ''; - let description = ''; - let type = ''; - let isOpen = false; - - if (modal.pilot) { - isOpen = modal.pilot; - title = '조종사 조회'; - type = 'pilot'; - description = - } - - if (modal.arcrft) { - isOpen = modal.arcrft; - title = '기체 조회'; - type = 'arcrft'; - description = ; - } - - if (modal.area) { - isOpen = modal.area; - title = '비행 구역 설정'; - type = 'area'; - description = ; - } - - return ( - - ) - -} - + let title = ''; + let description = ''; + let type = ''; + let isOpen = false; + + if (modal.pilot) { + isOpen = modal.pilot; + title = '조종사 조회'; + type = 'pilot'; + description = ( + + ); + } + + if (modal.arcrft) { + isOpen = modal.arcrft; + title = '기체 조회'; + type = 'arcrft'; + description = ( + + ); + } + + if (modal.area) { + isOpen = modal.area; + title = '비행 구역 설정'; + type = 'area'; + description = ( + + ); + } + + return ( + + ); +}; const AreaForm = ({ data, handleChange, index }) => { - - return (
- - - - - {data && data.coordList && data.coordList.length > 0 - ? data.coordList.map((item, i) => { - return { - // const {name, value} = e.target; - // handleChange({ - // type: 'coord', - // name, - // value, - // index: i, - // pIndex: index - // }) - // }} - // style={{marginBottom: 5}} - readOnly - /> - }) : { - const { name, value } = e.target; - handleChange({ - type: 'coord', - name, - value, - index: 0, - pIndex: index - }) - }} - readOnly - />} - - - - - - -
- - { - const { name, value } = e.target; - handleChange({ - type: 'area', - name, - value, - index - }) - }} - readOnly - /> -
-
- { - const { name, value } = e.target; - handleChange({ - type: 'area', - name, - value, - index - }) - }} - readOnly - /> -
-
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'area', - name, - value, - index - }) - }} - readOnly - /> - - -
-
) -} + return ( +
+ + + + + {data && data.coordList && data.coordList.length > 0 ? ( + data.coordList.map((item, i) => { + return ( + { + // const {name, value} = e.target; + // handleChange({ + // type: 'coord', + // name, + // value, + // index: i, + // pIndex: index + // }) + // }} + // style={{marginBottom: 5}} + readOnly + /> + ); + }) + ) : ( + { + const { name, value } = e.target; + handleChange({ + type: 'coord', + name, + value, + index: 0, + pIndex: index + }); + }} + readOnly + /> + )} + + + + +
+ + { + const { name, value } = e.target; + handleChange({ + type: 'area', + name, + value, + index + }); + }} + readOnly + /> +
+
+ { + const { name, value } = e.target; + handleChange({ + type: 'area', + name, + value, + index + }); + }} + readOnly + /> +
+
+ + + + + { + const { name, value } = e.target; + handleChange({ + type: 'area', + name, + value, + index + }); + }} + readOnly + /> + + +
+
+ ); +}; const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => { - const [test, setTest] = useState(); - const { user } = useSelector(state => state.authState, shallowEqual); - const { detail } = useSelector(state => state.flightState); - - useEffect(() => { - - if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { - // console.log(true) - setTest(false) - } else { - // console.log(false) - setTest(true) - } - - - }, [detail]) - - return (
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value, - index - }) - }} - readOnly - /> - - - - -
- - { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value, - index - }) - }} - readOnly - /> -
-
- { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value, - index - }) - }} - readOnly - - /> -
-
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'pilot', - name, - value, - index - }) - }} - readOnly - - /> - - - - {data.groupNm ? - ( - - handleDeleteArray({ type: 'pilot', index }) - } - > - - - - ) - : - ( - <> - ) - } - -
-
) -} - + const [test, setTest] = useState(); + const { user } = useSelector(state => state.authState, shallowEqual); + const { detail } = useSelector(state => state.flightState); + + useEffect(() => { + if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { + // console.log(true) + setTest(false); + } else { + // console.log(false) + setTest(true); + } + }, [detail]); + + return ( +
+ + + + + { + const { name, value } = e.target; + handleChange({ + type: 'pilot', + name, + value, + index + }); + }} + readOnly + /> + + + + +
+ + { + const { name, value } = e.target; + handleChange({ + type: 'pilot', + name, + value, + index + }); + }} + readOnly + /> +
+
+ { + const { name, value } = e.target; + handleChange({ + type: 'pilot', + name, + value, + index + }); + }} + readOnly + /> +
+
+ + + + + { + const { name, value } = e.target; + handleChange({ + type: 'pilot', + name, + value, + index + }); + }} + readOnly + /> + + + + {data.groupNm ? ( + handleDeleteArray({ type: 'pilot', index })} + > + + + ) : ( + <> + )} + +
+
+ ); +}; const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => { - const [test, setTest] = useState(); - const { user } = useSelector(state => state.authState, shallowEqual); - const { detail } = useSelector(state => state.flightState); - - useEffect(() => { - - if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { - // console.log(true) - setTest(false) - } else { - // console.log(false) - setTest(true) - } - - }, [detail]) - - return (
- - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value, - index - }) - }} - readOnly - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value, - index - }) - }} - readOnly - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value, - index - }) - }} - readOnly - /> - - - - - - { - const { name, value } = e.target; - handleChange({ - type: 'arcrft', - name, - value, - index - }) - }} - readOnly - /> - - - {data.groupNm ? - ( - - - handleDeleteArray({ type: 'arcrft', index }) - } - > - - - - ) - : - ( - <> - ) - } - -
) -} + const [test, setTest] = useState(); + const { user } = useSelector(state => state.authState, shallowEqual); + const { detail } = useSelector(state => state.flightState); + + useEffect(() => { + if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { + // console.log(true) + setTest(false); + } else { + // console.log(false) + setTest(true); + } + }, [detail]); + + return ( +
+ + + + + { + const { name, value } = e.target; + handleChange({ + type: 'arcrft', + name, + value, + index + }); + }} + readOnly + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'arcrft', + name, + value, + index + }); + }} + readOnly + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'arcrft', + name, + value, + index + }); + }} + readOnly + /> + + + + + + { + const { name, value } = e.target; + handleChange({ + type: 'arcrft', + name, + value, + index + }); + }} + readOnly + /> + + + {data.groupNm ? ( + + handleDeleteArray({ type: 'arcrft', index })} + > + + + + ) : ( + <> + )} + +
+ ); +};