diff --git a/src/assets/css/custom.css b/src/assets/css/custom.css index 7afb0e1e..84834457 100644 --- a/src/assets/css/custom.css +++ b/src/assets/css/custom.css @@ -743,4 +743,13 @@ background-size: 75% auto; .layer-content-box .history-btn{border-radius:4px;display:block;width:100%;height:45px;line-height:45px;text-align:center;font-size: 0.875rem;color:#ddd;font-weight:500;} .layer-content-box .history-btn:hover{border-radius:4px;background:#00cfe8;border-color:#00cfe8;transition: 0.3s ease;-webkit-transition: 0.3s ease;} .historyModal .drone-ti span{font-weight:500;margin-top:6px} -.historyModal .drone-name{color:#00cfe8;margin:0 10px 0 0;} \ No newline at end of file +.historyModal .drone-name{color:#00cfe8;margin:0 10px 0 0;} + +.search-info-box-del-btn{display: flex; align-items: center;} +.search-info-box-del-btn button{cursor: pointer;margin-top:10px} +@media (max-width: 992px){ + .search-info-box-del-btn button { + margin-bottom:1rem; + margin-top:0px; + } +} diff --git a/src/components/basis/flight/plan/FlightPlanAreaMap.js b/src/components/basis/flight/plan/FlightPlanAreaMap.js index 31fd6199..a75ed5a6 100644 --- a/src/components/basis/flight/plan/FlightPlanAreaMap.js +++ b/src/components/basis/flight/plan/FlightPlanAreaMap.js @@ -44,8 +44,8 @@ const FlightPlanAreaMap = (props) => { const ModeInit = () => { setMode(mapControl.drawType) + } - console.log(areaCoordList); const NaverMapInit = () => { const center = {}; const bufferzoom ={}; @@ -81,7 +81,7 @@ const FlightPlanAreaMap = (props) => { }; setMap(new naver.maps.Map('map', mapOptions2)); } - + } const handlerDrawType = val => { dispatch(drawTypeChangeAction(val)); }; diff --git a/src/components/basis/flight/plan/FlightPlanForm.js b/src/components/basis/flight/plan/FlightPlanForm.js index 33c3d051..a8d3eb62 100644 --- a/src/components/basis/flight/plan/FlightPlanForm.js +++ b/src/components/basis/flight/plan/FlightPlanForm.js @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { Card, CardBody, @@ -24,6 +24,33 @@ import { useDispatch, useSelector } from 'react-redux'; const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { const {areaList, pilotList, arcrftList} = data; + const { detail } = useSelector(state => state.flightState); + + const [date ,setDate] = useState(); + const [isFlightDone, setIsFlightDone] = useState(); + + useEffect(() => { + if(detail.createDt) { + setDate(detail.schFltStDt); + } + }, [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 ( @@ -69,6 +96,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele bsSize='sm' placeholder='' + { ...(isFlightDone ? {readOnly:true} : {}) } /> @@ -115,6 +143,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele }) }} placeholder='010-0000-0000' + { ...(isFlightDone ? {readOnly:true} : {}) } /> @@ -140,6 +169,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele }} // innerRef={props.data} placeholder='' + { ...(isFlightDone ? {readOnly:true} : {}) } /> @@ -157,23 +187,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele - { - const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; - handleChange({ - type: 'plan', - name: 'schFltStDt', - value - }) - }} - placeholder='비행 시작일자 선택(클릭)'/> + { + (isFlightDone) ? + ( + + ) + : + ( + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltStDt', + value + }) + }} + placeholder='비행 시작일자 선택(클릭)' + {...{options:{minDate: "today"}}} + /> + ) + } @@ -182,23 +232,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele - { - const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; - handleChange({ - type: 'plan', - name: 'schFltEndDt', - value - }) - }} - placeholder='비행 종료일자 선택(클릭)'/> - + { + (isFlightDone) ? + ( + + ) + : + ( + { + const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; + handleChange({ + type: 'plan', + name: 'schFltEndDt', + value + }) + }} + placeholder='비행 종료일자 선택(클릭)' + {...{options:{minDate: "today"}}} + /> + ) + } @@ -207,7 +277,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele *비행 목적 {/* TODO CDNOT 코드연동 필요 */} - - - - - - - - + { isFlightDone ? + <> + : + <> + + + + + + + + + } + @@ -249,6 +326,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'area', isOpen: true}) }} + {...(isFlightDone)? {disabled:true} : {} } > 비행 구역 설정 @@ -268,6 +346,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'pilot', isOpen: true}) }} + {...(isFlightDone)? {disabled:true} : {} } > 조종사 조회 @@ -278,7 +357,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele index={i} data={item} handleChange={handleChange} - handleDeleteArray ={handleDeleteArray}/>) + handleDeleteArray ={handleDeleteArray} + isFlightDone={isFlightDone} + />) : } @@ -290,6 +371,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele onClick={(e) => { handleModal({target: 'arcrft', isOpen: true}); }} + {...(isFlightDone)? {disabled:true} : {} } > 기체 조회 @@ -300,7 +382,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele index={i} data={item} handleChange={handleChange} - handleDeleteArray ={handleDeleteArray}/>) + handleDeleteArray ={handleDeleteArray} + isFlightDone={isFlightDone} + />) : } @@ -312,6 +396,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele color='primary' size='sm' onClick={handleSave} + {...(isFlightDone)? {disabled:true} : {} } > 저장 @@ -319,6 +404,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele color='danger' size='sm' onClick={handleDelete} + {...(isFlightDone)? {disabled:true} : {} } > 삭제 @@ -517,7 +603,7 @@ const AreaForm = ({data, handleChange, index}) => { ) } -const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { +const PilotForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => { return (
@@ -597,7 +683,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
- + - {data.groupNm? - ( - - - handleDeleteArray({ type: 'pilot', index }) - } - outline - > - - 삭제 - - - ) - : - ( - <> - ) - } + + {data.groupNm? + ( + + handleDeleteArray({ type: 'pilot', index }) + } + {...(isFlightDone)? {disabled:true} : {} } + > + + + + ) + : + ( + <> + ) + } + ) } -const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { +const ArcrftForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => { return (
@@ -734,7 +820,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { /> - +