|
|
|
@ -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 ( |
|
|
|
|
<Row> |
|
|
|
|
<Col sm='12'> |
|
|
|
@ -69,6 +96,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
|
|
|
|
|
bsSize='sm' |
|
|
|
|
placeholder='' |
|
|
|
|
{ ...(isFlightDone ? {readOnly:true} : {}) } |
|
|
|
|
/> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
@ -115,6 +143,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
}) |
|
|
|
|
}} |
|
|
|
|
placeholder='010-0000-0000' |
|
|
|
|
{ ...(isFlightDone ? {readOnly:true} : {}) } |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
</FormGroup> |
|
|
|
@ -140,6 +169,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
}} |
|
|
|
|
// innerRef={props.data}
|
|
|
|
|
placeholder='' |
|
|
|
|
{ ...(isFlightDone ? {readOnly:true} : {}) } |
|
|
|
|
/> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
@ -157,23 +187,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
<Label for='test'> |
|
|
|
|
<span className='necessary'>*</span>비행시작일자 |
|
|
|
|
</Label> |
|
|
|
|
<Flatpickr size='sm' |
|
|
|
|
className='form-control form-control-sm calendar-flat' |
|
|
|
|
type='text' |
|
|
|
|
id='schFltStDt' |
|
|
|
|
name='schFltStDt' |
|
|
|
|
data-enable-time |
|
|
|
|
// defaultValue={data.schFltStDt}
|
|
|
|
|
value={data.schFltStDt} |
|
|
|
|
onChange={(date) => { |
|
|
|
|
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; |
|
|
|
|
handleChange({ |
|
|
|
|
type: 'plan', |
|
|
|
|
name: 'schFltStDt', |
|
|
|
|
value |
|
|
|
|
}) |
|
|
|
|
}} |
|
|
|
|
placeholder='비행 시작일자 선택(클릭)'/> |
|
|
|
|
{ |
|
|
|
|
(isFlightDone) ? |
|
|
|
|
( |
|
|
|
|
<Input |
|
|
|
|
type='text' |
|
|
|
|
id='groupNm' |
|
|
|
|
name='groupNm' |
|
|
|
|
value={data.schFltStDt} |
|
|
|
|
bsSize='sm' |
|
|
|
|
placeholder='' |
|
|
|
|
readOnly |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
: |
|
|
|
|
( |
|
|
|
|
<Flatpickr
|
|
|
|
|
size='sm' |
|
|
|
|
className='form-control calendar-flat' |
|
|
|
|
type='text' |
|
|
|
|
id='schFltStDt' |
|
|
|
|
name='schFltStDt' |
|
|
|
|
data-enable-time |
|
|
|
|
// defaultValue={data.schFltStDt}
|
|
|
|
|
value={data.schFltStDt} |
|
|
|
|
onChange={(date) => { |
|
|
|
|
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; |
|
|
|
|
handleChange({ |
|
|
|
|
type: 'plan', |
|
|
|
|
name: 'schFltStDt', |
|
|
|
|
value |
|
|
|
|
}) |
|
|
|
|
}} |
|
|
|
|
placeholder='비행 시작일자 선택(클릭)' |
|
|
|
|
{...{options:{minDate: "today"}}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
@ -182,23 +232,43 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
<Label for='test'> |
|
|
|
|
<span className='necessary'>*</span>비행종료일자 |
|
|
|
|
</Label> |
|
|
|
|
<Flatpickr size='sm' |
|
|
|
|
className='form-control form-control-sm calendar-flat' |
|
|
|
|
type='text' |
|
|
|
|
id='schFltEndDt' |
|
|
|
|
name='schFltEndDt' |
|
|
|
|
data-enable-time |
|
|
|
|
value={data.schFltEndDt} |
|
|
|
|
onChange={(date) => { |
|
|
|
|
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; |
|
|
|
|
handleChange({ |
|
|
|
|
type: 'plan', |
|
|
|
|
name: 'schFltEndDt', |
|
|
|
|
value |
|
|
|
|
}) |
|
|
|
|
}} |
|
|
|
|
placeholder='비행 종료일자 선택(클릭)'/> |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
(isFlightDone) ? |
|
|
|
|
( |
|
|
|
|
<Input |
|
|
|
|
type='text' |
|
|
|
|
id='groupNm' |
|
|
|
|
name='groupNm' |
|
|
|
|
value={data.schFltEndDt} |
|
|
|
|
bsSize='sm' |
|
|
|
|
placeholder='' |
|
|
|
|
readOnly |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
: |
|
|
|
|
( |
|
|
|
|
<Flatpickr
|
|
|
|
|
size='sm' |
|
|
|
|
className='form-control calendar-flat' |
|
|
|
|
type='text' |
|
|
|
|
id='schFltEndDt' |
|
|
|
|
name='schFltEndDt' |
|
|
|
|
data-enable-time |
|
|
|
|
// defaultValue={data.schFltEndDt}
|
|
|
|
|
value={data.schFltEndDt} |
|
|
|
|
onChange={(date) => { |
|
|
|
|
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; |
|
|
|
|
handleChange({ |
|
|
|
|
type: 'plan', |
|
|
|
|
name: 'schFltEndDt', |
|
|
|
|
value |
|
|
|
|
}) |
|
|
|
|
}} |
|
|
|
|
placeholder='비행 종료일자 선택(클릭)' |
|
|
|
|
{...{options:{minDate: "today"}}} |
|
|
|
|
/> |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
|
<Col className='list-input' lg={4} md={4} sm={12}> |
|
|
|
@ -207,7 +277,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
<span className='necessary'>*</span>비행 목적 |
|
|
|
|
</Label> |
|
|
|
|
<Input |
|
|
|
|
type='select' |
|
|
|
|
{...(isFlightDone? {type:'text'} : {type:'select'})} |
|
|
|
|
id='fltPurpose' |
|
|
|
|
name='fltPurpose' |
|
|
|
|
value={data.fltPurpose} |
|
|
|
@ -220,20 +290,27 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
value, |
|
|
|
|
}) |
|
|
|
|
}} |
|
|
|
|
{...(isFlightDone? {readOnly:true} : {})} |
|
|
|
|
// innerRef={props.data}
|
|
|
|
|
// className={classnames({
|
|
|
|
|
// 'is-invalid': props.errors.arcrftTypeCd
|
|
|
|
|
// })}
|
|
|
|
|
> |
|
|
|
|
{/* TODO CDNOT 코드연동 필요 */} |
|
|
|
|
<option value=''>= 선택 =</option> |
|
|
|
|
<option value='시험비행'>= 시험비행 =</option> |
|
|
|
|
<option value='교육비행'>= 교육비행 =</option> |
|
|
|
|
<option value='사진/영상촬영'>= 사진/영상촬영 =</option> |
|
|
|
|
<option value='비행훈련'>= 비행훈련 =</option> |
|
|
|
|
<option value='비행교육'>= 비행교육 =</option> |
|
|
|
|
<option value='비행실기시험'>= 비행실기시험 =</option> |
|
|
|
|
|
|
|
|
|
{ isFlightDone ? |
|
|
|
|
<></> |
|
|
|
|
: |
|
|
|
|
<> |
|
|
|
|
<option value=''>= 선택 =</option> |
|
|
|
|
<option value='시험비행'>= 시험비행 =</option> |
|
|
|
|
<option value='교육비행'>= 교육비행 =</option> |
|
|
|
|
<option value='사진/영상촬영'>= 사진/영상촬영 =</option> |
|
|
|
|
<option value='비행훈련'>= 비행훈련 =</option> |
|
|
|
|
<option value='비행교육'>= 비행교육 =</option> |
|
|
|
|
<option value='비행실기시험'>= 비행실기시험 =</option> |
|
|
|
|
</> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
</Input> |
|
|
|
|
</FormGroup> |
|
|
|
|
</Col> |
|
|
|
@ -249,6 +326,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
onClick={(e) => { |
|
|
|
|
handleModal({target: 'area', isOpen: true}) |
|
|
|
|
}} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
비행 구역 설정 |
|
|
|
|
</Button.Ripple> |
|
|
|
@ -268,6 +346,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
onClick={(e) => { |
|
|
|
|
handleModal({target: 'pilot', isOpen: true}) |
|
|
|
|
}} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
조종사 조회 |
|
|
|
|
</Button.Ripple> |
|
|
|
@ -278,7 +357,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
index={i} |
|
|
|
|
data={item} |
|
|
|
|
handleChange={handleChange} |
|
|
|
|
handleDeleteArray ={handleDeleteArray}/>) |
|
|
|
|
handleDeleteArray ={handleDeleteArray} |
|
|
|
|
isFlightDone={isFlightDone} |
|
|
|
|
/>) |
|
|
|
|
: <PilotForm data={initFlightBas.pilot} |
|
|
|
|
handleChange={handleChange}/>} |
|
|
|
|
</dt> |
|
|
|
@ -290,6 +371,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
onClick={(e) => { |
|
|
|
|
handleModal({target: 'arcrft', isOpen: true}); |
|
|
|
|
}} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
기체 조회 |
|
|
|
|
</Button.Ripple> |
|
|
|
@ -300,7 +382,9 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
index={i} |
|
|
|
|
data={item} |
|
|
|
|
handleChange={handleChange} |
|
|
|
|
handleDeleteArray ={handleDeleteArray}/>) |
|
|
|
|
handleDeleteArray ={handleDeleteArray} |
|
|
|
|
isFlightDone={isFlightDone} |
|
|
|
|
/>) |
|
|
|
|
|
|
|
|
|
: <ArcrftForm data={initFlightBas.arcrft} |
|
|
|
|
handleChange={handleChange}/>} |
|
|
|
@ -312,6 +396,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
color='primary' |
|
|
|
|
size='sm' |
|
|
|
|
onClick={handleSave} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
저장 |
|
|
|
|
</Button.Ripple> |
|
|
|
@ -319,6 +404,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
|
|
|
|
|
color='danger' |
|
|
|
|
size='sm' |
|
|
|
|
onClick={handleDelete} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
삭제 |
|
|
|
|
</Button.Ripple> |
|
|
|
@ -517,7 +603,7 @@ const AreaForm = ({data, handleChange, index}) => {
|
|
|
|
|
</Row> |
|
|
|
|
</div>) |
|
|
|
|
} |
|
|
|
|
const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { |
|
|
|
|
const PilotForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => { |
|
|
|
|
return (<div className='search-info-box'> |
|
|
|
|
<Row> |
|
|
|
|
<Col className='list-input' lg={4} md={6} sm={12}> |
|
|
|
@ -633,6 +719,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
|
|
|
|
|
onClick={() => |
|
|
|
|
handleDeleteArray({ type: 'pilot', index }) |
|
|
|
|
} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
<X size={14} /> |
|
|
|
|
</Button.Ripple> |
|
|
|
@ -649,7 +736,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { |
|
|
|
|
const ArcrftForm = ({data, handleChange, index, handleDeleteArray, isFlightDone}) => { |
|
|
|
|
return (<div className='search-info-box'> |
|
|
|
|
<Row> |
|
|
|
|
<Col className='list-input' lg={3} md={6} sm={12}> |
|
|
|
@ -789,6 +876,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => {
|
|
|
|
|
onClick={() => |
|
|
|
|
handleDeleteArray({ type: 'arcrft', index }) |
|
|
|
|
} |
|
|
|
|
{...(isFlightDone)? {disabled:true} : {} } |
|
|
|
|
> |
|
|
|
|
<X size={14} /> |
|
|
|
|
</Button.Ripple> |
|
|
|
|