Browse Source

Merge branch 'master' of http://gitea.palntour.com/pav/pav-home

pull/2/head
junh_eee(이준희) 2 years ago
parent
commit
500ff2426b
  1. 395
      src/components/basis/flight/plan/FlightPlanForm.js

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

@ -12,7 +12,10 @@ import {
import Flatpickr from 'react-flatpickr'; import Flatpickr from 'react-flatpickr';
import '@styles/react/libs/flatpickr/flatpickr.scss'; import '@styles/react/libs/flatpickr/flatpickr.scss';
import moment from 'moment'; 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 FlightPlanPilotContainer from '../../../../containers/basis/flight/plan/FlightPlanPilotContainer';
import { FlightPlanModal } from './FlightPlanModal'; import { FlightPlanModal } from './FlightPlanModal';
import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer'; import FlightPlanArcrftContainer from '../../../../containers/basis/flight/plan/FlightPlanArcrftContainer';
@ -21,11 +24,17 @@ import { X } from 'react-feather';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { shallowEqual } from 'react-redux'; import { shallowEqual } from 'react-redux';
const FlightPlanForm = ({
const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDelete, modal, handleDeleteArray }) => { data,
handleModal,
handleChange,
handleSave,
handleDelete,
modal,
handleDeleteArray
}) => {
const { areaList, pilotList, arcrftList } = data; const { areaList, pilotList, arcrftList } = data;
const [date, setDate] = useState(); const [date, setDate] = useState();
const [isFlightDone, setIsFlightDone] = useState(); const [isFlightDone, setIsFlightDone] = useState();
@ -33,7 +42,6 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
const { user } = useSelector(state => state.authState, shallowEqual); const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState); const { detail } = useSelector(state => state.flightState);
useEffect(() => { useEffect(() => {
if (detail.createDt) { if (detail.createDt) {
setDate(detail.schFltStDt); setDate(detail.schFltStDt);
@ -41,28 +49,28 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) {
// console.log(true) // console.log(true)
setTest(false) setTest(false);
} else { } else {
// console.log(false) // console.log(false)
setTest(true) setTest(true);
} }
}, [detail]) }, [detail]);
useEffect(() => { useEffect(() => {
setDate(''); setDate('');
}, []) }, []);
useEffect(() => { useEffect(() => {
if (date) { if (date) {
let cTime = new Date(); let cTime = new Date();
let pTime = new Date(date) let pTime = new Date(date);
if (cTime > pTime) { if (cTime > pTime) {
setIsFlightDone(true); setIsFlightDone(true);
} else { } else {
setIsFlightDone(false); setIsFlightDone(false);
} }
} }
}, [date]) }, [date]);
return ( return (
<Row> <Row>
@ -74,10 +82,8 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
<Card> <Card>
<CardBody className='pal-card-body'> <CardBody className='pal-card-body'>
<div className='search-cont search-info pd-0'> <div className='search-cont search-info pd-0'>
<div <div className='cont-ti mb-1 d-flex justify-content-between align-items-sm-center align-items-start flex-sm-row'>
className='cont-ti mb-1 d-flex justify-content-between align-items-sm-center align-items-start flex-sm-row'> <div className='final'></div>
<div className='final'>
</div>
</div> </div>
<dl> <dl>
@ -86,12 +92,12 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
<h4 className='ti'>신청인 정보</h4> <h4 className='ti'>신청인 정보</h4>
</div> </div>
<div className='search-info-box'> <div className='search-info-box'>
<Row> <Row>
<Col className='list-input' lg={4} md={3} sm={12}> <Col className='list-input' lg={4} md={3} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'><span <Label for='test'>
className='necessary'>*</span></Label> <span className='necessary'>*</span>
</Label>
<Input <Input
readOnly={test} readOnly={test}
type='text' type='text'
@ -99,26 +105,25 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
name='memberName' name='memberName'
// defaultValue={data.memberName} // defaultValue={data.memberName}
value={data.memberName || ''} value={data.memberName || ''}
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'plan', type: 'plan',
name, name,
value, value
}) });
}} }}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
/> />
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={4} md={5} sm={12}> <Col className='list-input' lg={4} md={5} sm={12}>
<FormGroup className='m_ft'> <FormGroup className='m_ft'>
<div className='m_ft_box'> <div className='m_ft_box'>
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>{' '}
핸드폰 번호
</Label> </Label>
<Input <Input
type='text' type='text'
@ -128,15 +133,16 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
value={data.clncd || '+81'} value={data.clncd || '+81'}
bsSize='sm' bsSize='sm'
placeholder='+82' placeholder='+82'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'plan', type: 'plan',
name, name,
value, value
}) });
}} }}
readOnly /> readOnly
/>
</div> </div>
<div className='m_ft_box'> <div className='m_ft_box'>
<Input <Input
@ -147,13 +153,13 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
// defaultValue={data.hpno} // defaultValue={data.hpno}
value={data.hpno || ''} value={data.hpno || ''}
bsSize='sm' bsSize='sm'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'plan', type: 'plan',
name, name,
value, value
}) });
}} }}
placeholder='010-0000-0000' placeholder='010-0000-0000'
/> />
@ -162,8 +168,9 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
</Col> </Col>
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'><span <Label for='test'>
className='necessary'>*</span></Label> <span className='necessary'>*</span>
</Label>
<Input <Input
readOnly={test} readOnly={test}
type='text' type='text'
@ -172,13 +179,13 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
defaultValue={data.email || ''} defaultValue={data.email || ''}
// value={data.email} // value={data.email}
bsSize='sm' bsSize='sm'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'plan', type: 'plan',
name, name,
value, value
}) });
}} }}
// innerRef={props.data} // innerRef={props.data}
placeholder='' placeholder=''
@ -197,7 +204,8 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
비행시작일자
</Label> </Label>
{/* { {/* {
(isFlightDone) ? (isFlightDone) ?
@ -246,13 +254,16 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
data-enable-time data-enable-time
// defaultValue={data.schFltStDt} // defaultValue={data.schFltStDt}
value={data.schFltStDt} value={data.schFltStDt}
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'
) || '';
handleChange({ handleChange({
type: 'plan', type: 'plan',
name: 'schFltStDt', name: 'schFltStDt',
value value
}) });
}} }}
placeholder='비행 시작일자 선택(클릭)' placeholder='비행 시작일자 선택(클릭)'
// {...{options:{minDate: "today"}}} // {...{options:{minDate: "today"}}}
@ -262,7 +273,8 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
비행종료일자
</Label> </Label>
{/* { {/* {
(isFlightDone) ? (isFlightDone) ?
@ -311,13 +323,16 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
data-enable-time data-enable-time
// defaultValue={data.schFltEndDt} // 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'
) || '';
handleChange({ handleChange({
type: 'plan', type: 'plan',
name: 'schFltEndDt', name: 'schFltEndDt',
value value
}) });
}} }}
placeholder='비행 종료일자 선택(클릭)' placeholder='비행 종료일자 선택(클릭)'
// {...{options:{minDate: "today"}}} // {...{options:{minDate: "today"}}}
@ -327,7 +342,8 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
<Col className='list-input' lg={4} md={4} sm={12}> <Col className='list-input' lg={4} md={4} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'> <Label for='test'>
<span className='necessary'>*</span> <span className='necessary'>*</span>
목적
</Label> </Label>
<Input <Input
disabled={test} disabled={test}
@ -336,13 +352,13 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
name='fltPurpose' name='fltPurpose'
value={data.fltPurpose} value={data.fltPurpose}
bsSize='sm' bsSize='sm'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'plan', type: 'plan',
name, name,
value, value
}) });
}} }}
// innerRef={props.data} // innerRef={props.data}
// className={classnames({ // className={classnames({
@ -351,12 +367,24 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
> >
{/* TODO CDNOT 코드연동 필요 */} {/* TODO CDNOT 코드연동 필요 */}
<option value=''>= 선택 =</option> <option value=''>= 선택 =</option>
<option value='시험비행'>= 시험비행 =</option> <option value='시험비행'>
<option value='교육비행'>= 교육비행 =</option> = 시험비행 =
<option value='사진/영상촬영'>= 사진/영상촬영 =</option> </option>
<option value='비행훈련'>= 비행훈련 =</option> <option value='교육비행'>
<option value='비행교육'>= 비행교육 =</option> = 교육비행 =
<option value='비행실기시험'>= 비행실기시험 =</option> </option>
<option value='사진/영상촬영'>
= 사진/영상촬영 =
</option>
<option value='비행훈련'>
= 비행훈련 =
</option>
<option value='비행교육'>
= 비행교육 =
</option>
<option value='비행실기시험'>
= 비행실기시험 =
</option>
</Input> </Input>
</FormGroup> </FormGroup>
</Col> </Col>
@ -368,69 +396,89 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
<div className='search-info-ti d-flex justify-content-between'> <div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>비행 구역 정보</h4> <h4 className='ti'>비행 구역 정보</h4>
<Button.Ripple <Button.Ripple
color="primary" color='primary'
onClick={(e) => { onClick={e => {
handleModal({ target: 'area', isOpen: true }) handleModal({ target: 'area', isOpen: true });
}} }}
> >
비행 구역 설정 비행 구역 설정
</Button.Ripple> </Button.Ripple>
</div> </div>
{areaList {areaList ? (
? areaList.map((item, i) => areaList.map((item, i) => (
<AreaForm key={i} index={i} data={item} <AreaForm
handleChange={handleChange} />) key={i}
: <AreaForm data={initFlightBas.area} index={i}
handleChange={handleChange} />} data={item}
handleChange={handleChange}
/>
))
) : (
<AreaForm
data={initFlightBas.area}
handleChange={handleChange}
/>
)}
</dt> </dt>
<dt> <dt>
<div className='search-info-ti d-flex justify-content-between'> <div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>조종사 정보</h4> <h4 className='ti'>조종사 정보</h4>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test}
color="primary" color='primary'
onClick={(e) => { onClick={e => {
handleModal({ target: 'pilot', isOpen: true }) handleModal({ target: 'pilot', isOpen: true });
}} }}
> >
조종사 조회 조종사 조회
</Button.Ripple> </Button.Ripple>
</div> </div>
{pilotList {pilotList ? (
? pilotList.map((item, i) => pilotList.map((item, i) => (
<PilotForm key={i} <PilotForm
key={i}
index={i} index={i}
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray={handleDeleteArray} handleDeleteArray={handleDeleteArray}
/>) />
: <PilotForm data={initFlightBas.pilot} ))
handleChange={handleChange} />} ) : (
<PilotForm
data={initFlightBas.pilot}
handleChange={handleChange}
/>
)}
</dt> </dt>
<dt> <dt>
<div className='search-info-ti d-flex justify-content-between'> <div className='search-info-ti d-flex justify-content-between'>
<h4 className='ti'>기체 정보</h4> <h4 className='ti'>기체 정보</h4>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test}
color="primary" color='primary'
onClick={(e) => { onClick={e => {
handleModal({ target: 'arcrft', isOpen: true }); handleModal({ target: 'arcrft', isOpen: true });
}} }}
> >
기체 조회 기체 조회
</Button.Ripple> </Button.Ripple>
</div> </div>
{arcrftList {arcrftList ? (
? arcrftList.map((item, i) => arcrftList.map((item, i) => (
<ArcrftForm key={i} <ArcrftForm
key={i}
index={i} index={i}
data={item} data={item}
handleChange={handleChange} handleChange={handleChange}
handleDeleteArray={handleDeleteArray} handleDeleteArray={handleDeleteArray}
/>) />
))
: <ArcrftForm data={initFlightBas.arcrft} ) : (
handleChange={handleChange} />} <ArcrftForm
data={initFlightBas.arcrft}
handleChange={handleChange}
/>
)}
</dt> </dt>
<div className='d-flex align-items-center'> <div className='d-flex align-items-center'>
@ -443,6 +491,7 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
> >
저장 저장
</Button.Ripple> </Button.Ripple>
{data.planSno ? (
<Button.Ripple <Button.Ripple
disabled={test} disabled={test}
color='danger' color='danger'
@ -451,26 +500,21 @@ const FlightPlanForm = ({ data, handleModal, handleChange, handleSave, handleDel
> >
삭제 삭제
</Button.Ripple> </Button.Ripple>
) : null}
</div> </div>
</dl> </dl>
</div> </div>
</CardBody> </CardBody>
</Card> </Card>
</Col> </Col>
</Row> </Row>
</CardBody> </CardBody>
</Card> </Card>
</Col> </Col>
<SelectModal <SelectModal modal={modal} handleModal={handleModal} test={test} />
modal={modal}
handleModal={handleModal}
test={test}
/>
</Row> </Row>
) );
} };
export default FlightPlanForm; export default FlightPlanForm;
@ -484,21 +528,31 @@ const SelectModal = ({ handleModal, modal, test }) => {
isOpen = modal.pilot; isOpen = modal.pilot;
title = '조종사 조회'; title = '조종사 조회';
type = 'pilot'; type = 'pilot';
description = <FlightPlanPilotContainer handleModal={handleModal} type={type} /> description = (
<FlightPlanPilotContainer handleModal={handleModal} type={type} />
);
} }
if (modal.arcrft) { if (modal.arcrft) {
isOpen = modal.arcrft; isOpen = modal.arcrft;
title = '기체 조회'; title = '기체 조회';
type = 'arcrft'; type = 'arcrft';
description = <FlightPlanArcrftContainer handleModal={handleModal} type={type} />; description = (
<FlightPlanArcrftContainer handleModal={handleModal} type={type} />
);
} }
if (modal.area) { if (modal.area) {
isOpen = modal.area; isOpen = modal.area;
title = '비행 구역 설정'; title = '비행 구역 설정';
type = 'area'; type = 'area';
description = <FlightPlanAreaContainer handleModal={handleModal} type={type} test={test} />; description = (
<FlightPlanAreaContainer
handleModal={handleModal}
type={type}
test={test}
/>
);
} }
return ( return (
@ -509,29 +563,33 @@ const SelectModal = ({ handleModal, modal, test }) => {
isOpen={isOpen} isOpen={isOpen}
handleModal={handleModal} handleModal={handleModal}
/> />
) );
};
}
const AreaForm = ({ data, handleChange, index }) => { const AreaForm = ({ data, handleChange, index }) => {
return (
return (<div className='search-info-box'> <div className='search-info-box'>
<Row> <Row>
<Col className='list-input' lg={4} md={12} sm={12}> <Col className='list-input' lg={4} md={12} sm={12}>
<FormGroup> <FormGroup>
<Label for='test'> <Label for='test'>
<span rowSpan={3} className='necessary'>*</span> <span rowSpan={3} className='necessary'>
*
</span>
좌표
</Label> </Label>
{data && data.coordList && data.coordList.length > 0 {data && data.coordList && data.coordList.length > 0 ? (
? data.coordList.map((item, i) => { data.coordList.map((item, i) => {
return <Input return (
<Input
key={i} key={i}
type='text' type='text'
id='lonlat' id='lonlat'
name='lonlat' name='lonlat'
// defaultValue={(item.lat && item.lon) ? `${item.lat} / ${item.lon}` : '-'} // defaultValue={(item.lat && item.lon) ? `${item.lat} / ${item.lon}` : '-'}
value={(item.lat && item.lon) ? `${item.lat} / ${item.lon}` : ''} value={
item.lat && item.lon ? `${item.lat} / ${item.lon}` : ''
}
bsSize='sm' bsSize='sm'
placeholder='-' placeholder='-'
// onChange={(e) => { // onChange={(e) => {
@ -547,13 +605,16 @@ const AreaForm = ({ data, handleChange, index }) => {
// style={{marginBottom: 5}} // style={{marginBottom: 5}}
readOnly readOnly
/> />
}) : <Input );
})
) : (
<Input
type='text' type='text'
id='lonlat' id='lonlat'
name='lonlat' name='lonlat'
bsSize='sm' bsSize='sm'
placeholder='-!!' placeholder='-!!'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'coord', type: 'coord',
@ -561,12 +622,11 @@ const AreaForm = ({ data, handleChange, index }) => {
value, value,
index: 0, index: 0,
pIndex: index pIndex: index
}) });
}} }}
readOnly readOnly
/>} />
)}
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='list-input' lg={4} md={6} sm={12}> <Col className='list-input' lg={4} md={6} sm={12}>
@ -583,14 +643,14 @@ const AreaForm = ({ data, handleChange, index }) => {
value={data.bufferZone} value={data.bufferZone}
bsSize='sm' bsSize='sm'
placeholder='반경' placeholder='반경'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'area', type: 'area',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -604,14 +664,14 @@ const AreaForm = ({ data, handleChange, index }) => {
value={data.fltElev} value={data.fltElev}
bsSize='sm' bsSize='sm'
placeholder='고도' placeholder='고도'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'area', type: 'area',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -631,41 +691,40 @@ const AreaForm = ({ data, handleChange, index }) => {
value={data.fltMethod} value={data.fltMethod}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'area', type: 'area',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
</FormGroup> </FormGroup>
</Col> </Col>
</Row> </Row>
</div>) </div>
} );
};
const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => { const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
const [test, setTest] = useState(); const [test, setTest] = useState();
const { user } = useSelector(state => state.authState, shallowEqual); const { user } = useSelector(state => state.authState, shallowEqual);
const { detail } = useSelector(state => state.flightState); const { detail } = useSelector(state => state.flightState);
useEffect(() => { useEffect(() => {
if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) {
// console.log(true) // console.log(true)
setTest(false) setTest(false);
} else { } else {
// console.log(false) // console.log(false)
setTest(true) setTest(true);
} }
}, [detail]);
return (
}, [detail]) <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}>
<FormGroup> <FormGroup>
@ -673,7 +732,6 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
<span className='necessary'>*</span> <span className='necessary'>*</span>
</Label> </Label>
<Input <Input
type='text' type='text'
id='memberName' id='memberName'
name='memberName' name='memberName'
@ -681,14 +739,14 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.memberName} value={data.memberName}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'pilot', type: 'pilot',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -708,14 +766,14 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.clncd} value={data.clncd}
bsSize='sm' bsSize='sm'
placeholder='+82' placeholder='+82'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'pilot', type: 'pilot',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -729,17 +787,16 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.hpno} value={data.hpno}
bsSize='sm' bsSize='sm'
placeholder='010-0000-0000' placeholder='010-0000-0000'
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'pilot', type: 'pilot',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
</div> </div>
</FormGroup> </FormGroup>
@ -757,45 +814,37 @@ const PilotForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.email} value={data.email}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'pilot', type: 'pilot',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
</FormGroup> </FormGroup>
</Col> </Col>
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}> <Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
{data.groupNm ? {data.groupNm ? (
(
<Button.Ripple <Button.Ripple
disabled={test} disabled={test}
color='danger' color='danger'
className='btn-icon' className='btn-icon'
onClick={() => onClick={() => handleDeleteArray({ type: 'pilot', index })}
handleDeleteArray({ type: 'pilot', index })
}
> >
<X size={14} /> <X size={14} />
</Button.Ripple> </Button.Ripple>
) : (
)
:
(
<></> <></>
) )}
}
</Col> </Col>
</Row> </Row>
</div>) </div>
} );
};
const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => { const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
const [test, setTest] = useState(); const [test, setTest] = useState();
@ -803,18 +852,17 @@ const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
const { detail } = useSelector(state => state.flightState); const { detail } = useSelector(state => state.flightState);
useEffect(() => { useEffect(() => {
if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) { if (detail?.createUserId == user?.cstmrSno || !detail.createUserId) {
// console.log(true) // console.log(true)
setTest(false) setTest(false);
} else { } else {
// console.log(false) // console.log(false)
setTest(true) setTest(true);
} }
}, [detail]);
}, [detail]) 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}>
<FormGroup> <FormGroup>
@ -829,14 +877,14 @@ const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.idntfNum} value={data.idntfNum}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'arcrft', type: 'arcrft',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -855,14 +903,14 @@ const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.arcrftModelNm} value={data.arcrftModelNm}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'arcrft', type: 'arcrft',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -881,14 +929,14 @@ const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.arcrftTypeCd} value={data.arcrftTypeCd}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'arcrft', type: 'arcrft',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
@ -907,39 +955,34 @@ const ArcrftForm = ({ data, handleChange, index, handleDeleteArray }) => {
value={data.ownerNm} value={data.ownerNm}
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
onChange={(e) => { onChange={e => {
const { name, value } = e.target; const { name, value } = e.target;
handleChange({ handleChange({
type: 'arcrft', type: 'arcrft',
name, name,
value, value,
index index
}) });
}} }}
readOnly readOnly
/> />
</FormGroup> </FormGroup>
</Col> </Col>
{data.groupNm ? {data.groupNm ? (
(
<Col className='search-info-box-del-btn' lg={1} md={6} sm={12}> <Col className='search-info-box-del-btn' lg={1} md={6} sm={12}>
<Button.Ripple <Button.Ripple
disabled={test} disabled={test}
color='danger' color='danger'
className='btn-icon' className='btn-icon'
onClick={() => onClick={() => handleDeleteArray({ type: 'arcrft', index })}
handleDeleteArray({ type: 'arcrft', index })
}
> >
<X size={14} /> <X size={14} />
</Button.Ripple> </Button.Ripple>
</Col> </Col>
) ) : (
:
(
<></> <></>
) )}
}
</Row> </Row>
</div>) </div>
} );
};

Loading…
Cancel
Save