Browse Source

비행계획서 - 비행 시작 및 종료 계획서 수정 불가

feature/auth
junh_eee(이준희) 2 years ago
parent
commit
2e4ce5c265
  1. 113
      src/components/basis/flight/plan/FlightPlanForm.js

113
src/components/basis/flight/plan/FlightPlanForm.js

@ -1,4 +1,4 @@
import React, { useEffect } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Card, Card,
CardBody, CardBody,
@ -24,6 +24,34 @@ import { useDispatch, useSelector } from 'react-redux';
const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => {
const {areaList, pilotList, arcrftList} = data; const {areaList, pilotList, arcrftList} = data;
const flightState = useSelector(state => state.flightState);
const { detail } = flightState;
const [date ,setDate] = useState();
const [isBigCurrent, setIsBigCurrent] = 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) {
setIsBigCurrent(true);
} else {
setIsBigCurrent(false);
}
}
}, [date])
return ( return (
<Row> <Row>
<Col sm='12'> <Col sm='12'>
@ -69,6 +97,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
{ ...(isBigCurrent ? {readOnly:true} : {}) }
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -84,7 +113,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
id='clncd' id='clncd'
name='clncd' name='clncd'
// defaultValue={data.clncd} // defaultValue={data.clncd}
value={data.clncd || '+81'} value={data.clncd || '+82'}
bsSize='sm' bsSize='sm'
placeholder='+82' placeholder='+82'
onChange={(e) => { onChange={(e) => {
@ -115,6 +144,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
}) })
}} }}
placeholder='010-0000-0000' placeholder='010-0000-0000'
{ ...(isBigCurrent ? {readOnly:true} : {}) }
/> />
</div> </div>
</FormGroup> </FormGroup>
@ -140,6 +170,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
}} }}
// innerRef={props.data} // innerRef={props.data}
placeholder='' placeholder=''
{ ...(isBigCurrent ? {readOnly:true} : {}) }
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -157,7 +188,23 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Flatpickr size='sm' {
(isBigCurrent) ?
(
<Input
type='text'
id='groupNm'
name='groupNm'
value={data.schFltStDt}
bsSize='sm'
placeholder=''
readOnly
/>
)
:
(
<Flatpickr
size='sm'
className='form-control calendar-flat' className='form-control calendar-flat'
type='text' type='text'
id='schFltStDt' id='schFltStDt'
@ -173,8 +220,11 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
value value
}) })
}} }}
placeholder='비행 시작일자 선택(클릭)'/> placeholder='비행 시작일자 선택(클릭)'
{...{options:{minDate: "today"}}}
/>
)
}
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
@ -182,12 +232,29 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Flatpickr size='sm' {
(isBigCurrent) ?
(
<Input
type='text'
id='groupNm'
name='groupNm'
value={data.schFltEndDt}
bsSize='sm'
placeholder=''
readOnly
/>
)
:
(
<Flatpickr
size='sm'
className='form-control calendar-flat' className='form-control calendar-flat'
type='text' type='text'
id='schFltEndDt' id='schFltEndDt'
name='schFltEndDt' name='schFltEndDt'
data-enable-time data-enable-time
// defaultValue={data.schFltEndDt}
value={data.schFltEndDt} value={data.schFltEndDt}
onChange={(date) => { onChange={(date) => {
const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || ''; const value = moment(date[0]).format('YYYY-MM-DD HH:mm:ss') || '';
@ -197,8 +264,11 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
value value
}) })
}} }}
placeholder='비행 종료일자 선택(클릭)'/> placeholder='비행 종료일자 선택(클릭)'
{...{options:{minDate: "today"}}}
/>
)
}
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
@ -207,7 +277,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Input <Input
type='select' {...(isBigCurrent? {type:'text'} : {type:'select'})}
// type='select'
id='fltPurpose' id='fltPurpose'
name='fltPurpose' name='fltPurpose'
value={data.fltPurpose} value={data.fltPurpose}
@ -220,12 +291,17 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
value, value,
}) })
}} }}
{...(isBigCurrent? {readOnly:true} : {})}
// innerRef={props.data} // innerRef={props.data}
// className={classnames({ // className={classnames({
// 'is-invalid': props.errors.arcrftTypeCd // 'is-invalid': props.errors.arcrftTypeCd
// })} // })}
> >
{/* TODO CDNOT 코드연동 필요 */} {/* TODO CDNOT 코드연동 필요 */}
{ isBigCurrent ?
<></>
:
<>
<option value=''>= 선택 =</option> <option value=''>= 선택 =</option>
<option value='시험비행'>= 시험비행 =</option> <option value='시험비행'>= 시험비행 =</option>
<option value='교육비행'>= 교육비행 =</option> <option value='교육비행'>= 교육비행 =</option>
@ -233,6 +309,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
<option value='비행훈련'>= 비행훈련 =</option> <option value='비행훈련'>= 비행훈련 =</option>
<option value='비행교육'>= 비행교육 =</option> <option value='비행교육'>= 비행교육 =</option>
<option value='비행실기시험'>= 비행실기시험 =</option> <option value='비행실기시험'>= 비행실기시험 =</option>
</>
}
</Input> </Input>
</FormGroup> </FormGroup>
@ -249,6 +327,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
onClick={(e) => { onClick={(e) => {
handleModal({target: 'area', isOpen: true}) handleModal({target: 'area', isOpen: true})
}} }}
{...(isBigCurrent)? {disabled:true} : {} }
> >
비행 구역 설정 비행 구역 설정
</Button.Ripple> </Button.Ripple>
@ -268,6 +347,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
onClick={(e) => { onClick={(e) => {
handleModal({target: 'pilot', isOpen: true}) handleModal({target: 'pilot', isOpen: true})
}} }}
{...(isBigCurrent)? {disabled:true} : {} }
> >
조종사 조회 조종사 조회
</Button.Ripple> </Button.Ripple>
@ -278,7 +358,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
index={i} index={i}
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray ={handleDeleteArray}/>) handleDeleteArray ={handleDeleteArray}
isBigCurrent={isBigCurrent}/>)
: <PilotForm data={initFlightBas.pilot} : <PilotForm data={initFlightBas.pilot}
handleChange={handleChange}/>} handleChange={handleChange}/>}
</dt> </dt>
@ -290,6 +371,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
onClick={(e) => { onClick={(e) => {
handleModal({target: 'arcrft', isOpen: true}); handleModal({target: 'arcrft', isOpen: true});
}} }}
{...(isBigCurrent)? {disabled:true} : {} }
> >
기체 조회 기체 조회
</Button.Ripple> </Button.Ripple>
@ -300,7 +382,8 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
index={i} index={i}
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray ={handleDeleteArray}/>) handleDeleteArray ={handleDeleteArray}
isBigCurrent={isBigCurrent}/>)
: <ArcrftForm data={initFlightBas.arcrft} : <ArcrftForm data={initFlightBas.arcrft}
handleChange={handleChange}/>} handleChange={handleChange}/>}
@ -312,6 +395,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
color='primary' color='primary'
size='sm' size='sm'
onClick={handleSave} onClick={handleSave}
{...(isBigCurrent)? {disabled:true} : {} }
> >
저장 저장
</Button.Ripple> </Button.Ripple>
@ -319,6 +403,7 @@ const FlightPlanForm = ({data, handleModal, handleChange, handleSave, handleDele
color='danger' color='danger'
size='sm' size='sm'
onClick={handleDelete} onClick={handleDelete}
{...(isBigCurrent)? {disabled:true} : {} }
> >
삭제 삭제
</Button.Ripple> </Button.Ripple>
@ -517,7 +602,7 @@ const AreaForm = ({data, handleChange, index}) => {
</Row> </Row>
</div>) </div>)
} }
const PilotForm = ({data, handleChange, index, handleDeleteArray}) => { const PilotForm = ({data, handleChange, index, handleDeleteArray, isBigCurrent}) => {
return (<div className='search-info-box'> return (<div className='search-info-box'>
<Row> <Row>
<Col className='list-input' lg={4} md={6} sm={12}> <Col className='list-input' lg={4} md={6} sm={12}>
@ -634,6 +719,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
handleDeleteArray({ type: 'pilot', index }) handleDeleteArray({ type: 'pilot', index })
} }
outline outline
{...(isBigCurrent)? {disabled:true} : {} }
> >
<X size={14} className='mr-50' /> <X size={14} className='mr-50' />
<span>삭제</span> <span>삭제</span>
@ -650,7 +736,7 @@ const PilotForm = ({data, handleChange, index, handleDeleteArray}) => {
} }
const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => { const ArcrftForm = ({data, handleChange, index, handleDeleteArray, isBigCurrent}) => {
return (<div className='search-info-box'> return (<div className='search-info-box'>
<Row> <Row>
<Col className='list-input' lg={3} md={6} sm={12}> <Col className='list-input' lg={3} md={6} sm={12}>
@ -791,6 +877,7 @@ const ArcrftForm = ({data, handleChange, index, handleDeleteArray}) => {
handleDeleteArray({ type: 'arcrft', index }) handleDeleteArray({ type: 'arcrft', index })
} }
outline outline
{...(isBigCurrent)? {disabled:true} : {} }
> >
<X size={14} className='mr-50' /> <X size={14} className='mr-50' />
<span>삭제</span> <span>삭제</span>

Loading…
Cancel
Save