Browse Source

laanc Validity check and pdf modal css modify

pull/2/head
sanguu516(박상현) 12 months ago
parent
commit
ed25275664
  1. 7
      src/modules/laanc/models/laancModels.ts
  2. 11
      src/views/laanc/LaacnStep3.js
  3. 145
      src/views/laanc/LaancStep2.js

7
src/modules/laanc/models/laancModels.ts

@ -235,12 +235,15 @@ export interface LaancApproval {
arcrftInsurance: boolean; // 항공기 보험 여부 arcrftInsurance: boolean; // 항공기 보험 여부
flightArea: boolean; // 비행 가능 여부 flightArea: boolean; // 비행 가능 여부
pilotQlfc: boolean; // 자격 여부 pilotQlfc: boolean; // 자격 여부
arcrftDuplicated: boolean; // 기체 중복 여부 시간대로만 true 이면 중복 arcrftDuplicated: boolean; // 기체 중복 여부 시간대로만 true 이면 = 기체중복
evaluatedTargetArea: boolean; // 평가대상지역여부 - 공역 구역이면 true evaluatedTargetArea: boolean; // 평가대상지역여부 - 공역 구역이면 true
planAreaDuplicatd: boolean; // 비행 구역 중복 여부 시간 중복 planAreaDuplicatd: boolean; // 비행 구역 중복 여부 시간 중복 == 비행구역내에 타 사용자 비행구역 정보
flight: boolean; // 무조건 날 수 있음 flight: boolean; // 무조건 날 수 있음
}; };
} }
// valid false 이면서 flight true이면 승인 불필요 조건 성립
// valid false 이면 laanc가 필요 없는 것도 걸러줌
// 만약 둘 다 false이면 뭐 땜에 안되는지 정의 필요
export interface FlightPlanData { export interface FlightPlanData {
planSno?: number; planSno?: number;

11
src/views/laanc/LaacnStep3.js

@ -52,6 +52,7 @@ export default function LaacnStep3({
const [numPages, setNumPages] = useState(null); // total const [numPages, setNumPages] = useState(null); // total
const [pageNum, setPageNum] = useState(1); const [pageNum, setPageNum] = useState(1);
const { user } = useSelector(state => state.authState); const { user } = useSelector(state => state.authState);
const { laancPdf } = useSelector(state => state.laancState);
const handlerClose = () => { const handlerClose = () => {
setFormModal(!formModal); setFormModal(!formModal);
}; };
@ -208,7 +209,7 @@ export default function LaacnStep3({
bsSize='sm' bsSize='sm'
placeholder='' placeholder=''
disabled disabled
value={data.addr} value={laancPdf.address}
/> />
</FormGroup> </FormGroup>
</Col> </Col>
@ -261,10 +262,8 @@ export default function LaacnStep3({
</div> </div>
</div> </div>
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter style={{ justifyContent: 'right' }}>
<Button outline color='danger' onClick={() => handlerStep(2)}> <> </>
이전
</Button>
<ul className='step'> <ul className='step'>
<li> <li>
<span></span> <span></span>
@ -314,11 +313,11 @@ export default function LaacnStep3({
isOpen={formModal} isOpen={formModal}
toggle={handlerClose} toggle={handlerClose}
className='modal-dialog-centered' className='modal-dialog-centered'
style={{ maxWidth: '650px' }}
> >
<ModalHeader toggle={handlerClose}>공문 미리보기</ModalHeader> <ModalHeader toggle={handlerClose}>공문 미리보기</ModalHeader>
<ModalBody> <ModalBody>
{/* <LaancPdf /> */} {/* <LaancPdf /> */}
<Document <Document
file={`http://211.253.11.189:8080${localStorage.getItem('pdfUrl')}`} file={`http://211.253.11.189:8080${localStorage.getItem('pdfUrl')}`}
onLoadSuccess={onDocumentLoadSuccess} onLoadSuccess={onDocumentLoadSuccess}

145
src/views/laanc/LaancStep2.js

@ -65,9 +65,25 @@ export default function LaancStep2({
}; };
const [isterms, setIsterms] = useState(false); const [isterms, setIsterms] = useState(false);
const [flightData, setFlightData] = useState({}); const [flightData, setFlightData] = useState({});
const [laancIsCheck, setLancIsCheck] = useState();
const { user } = useSelector(state => state.authState); const { user } = useSelector(state => state.authState);
const { laancApply } = useSelector(state => state.laancState); const { laancApply } = useSelector(state => state.laancState);
const dispatch = useDispatch(); const dispatch = useDispatch();
useEffect(() => {
if (!laancApply?.valid) setLancIsCheck(true);
else if (laancApply?.valid) setLancIsCheck(false);
}, [laancApply]);
useEffect(() => {
console.log('>>>>', laancIsCheck);
}, [laancIsCheck]);
useEffect(() => {
if (flightData && Object.keys(flightData).length > 0) {
dispatch(LaancAction.LAANC_FLIGHT_CREATE.request(flightData));
handlerStep(3);
}
}, [flightData]);
// 소수점 6자리에서 반올림 하는 함수 // 소수점 6자리에서 반올림 하는 함수
const truncateToSixDecimalPlaces = number => { const truncateToSixDecimalPlaces = number => {
const decimalPlaces = 6; const decimalPlaces = 6;
@ -92,14 +108,50 @@ export default function LaancStep2({
// dispatch(LaancAction.LAANC_FLIGHT_CREATE.request(flightData)); // dispatch(LaancAction.LAANC_FLIGHT_CREATE.request(flightData));
}; };
useEffect(() => { const laancReason = (
if (flightData && Object.keys(flightData).length > 0) { flight,
console.log('>>>', flightData); arcrftDuplicated,
planAreaDuplicatd,
dispatch(LaancAction.LAANC_FLIGHT_CREATE.request(flightData)); pilotQlfc,
handlerStep(3); arcrftInsurance
) => {
if (flight) {
return (
<>
{' '}
<AlertCircle size={15} />
<span className='ms-1'>검토 결과 승인 대상입니다.</span>
<span className='cancel-txt'>
제출하신 비행계획상의 비행구역과 비행시간이 별도의 승인을
<br />
필요로 하지 않지만, 아래 조종자 준수사항에 유의하여
<br /> 비행하시기 바랍니다.
</span>
</>
);
{
/* <span className='cancel-txt'>
유효성 검사에 실패하였습니다.
<br />
다시 검사해주시기 바랍니다.
</span> */
} }
}, [flightData]); } else {
if (arcrftDuplicated || planAreaDuplicatd) {
return (
<>
{' '}
<AlertCircle size={15} />
<span className='ms-1'>검토 결과 승인 대상입니다.</span>
<span className='cancel-txt'>
설정하신 비행구역 비행시간에 이미 승인완료된 <br />
신청건이 있습니다. 다시 설정 부탁드립니다.
</span>
</>
);
}
}
};
return ( return (
<> <>
<ModalHeader> <ModalHeader>
@ -115,15 +167,13 @@ export default function LaancStep2({
<Col className='list-input' md='6'> <Col className='list-input' md='6'>
<Alert <Alert
color={ color={
data.arcrftList[0].idntfNum === 'PA0001' || data.arcrftList[0].idntfNum != 'PA0002'
data.arcrftList[0].idntfNum === 'PA0002'
? 'success' ? 'success'
: 'warning' : 'warning'
} }
> >
<div className='alert-body'> <div className='alert-body'>
{data.arcrftList[0].idntfNum === 'PA0001' || {data.arcrftList[0].idntfNum != 'PA0002' ? (
data.arcrftList[0].idntfNum === 'PA0002' ? (
<CheckCircle size={15} /> <CheckCircle size={15} />
) : ( ) : (
<AlertCircle size={15} /> <AlertCircle size={15} />
@ -133,19 +183,9 @@ export default function LaancStep2({
</Alert> </Alert>
</Col> </Col>
<Col className='list-input' md='6'> <Col className='list-input' md='6'>
<Alert <Alert color={'success'}>
color={
data.arcrftList[0].idntfNum === 'PA0002'
? 'warning'
: 'success'
}
>
<div className='alert-body'> <div className='alert-body'>
{data.arcrftList[0].idntfNum === 'PA0001' ? (
<CheckCircle size={15} /> <CheckCircle size={15} />
) : (
<AlertCircle size={15} />
)}
<span className='ms-1'>기체보험가입 정보</span> <span className='ms-1'>기체보험가입 정보</span>
</div> </div>
</Alert> </Alert>
@ -183,63 +223,36 @@ export default function LaancStep2({
</div> </div>
<div className='mt-1'> <div className='mt-1'>
{/* 사전 결과 승인 대상일때 color=success */} {/* 사전 결과 승인 대상일때 color=success */}
<Alert <Alert color={laancApply?.valid ? 'success' : 'warning'}>
color={
laancApply?.report && laancApply?.evaluatedTargetArea
? laancApply?.valid
? 'success'
: 'warning'
: 'warning'
}
>
<div className='alert-body'> <div className='alert-body'>
{laancApply?.report && laancApply?.evaluatedTargetArea ? ( {laancApply?.valid ? (
laancApply?.valid ? (
<> <>
<CheckCircle size={15} /> <CheckCircle size={15} />
<span className='ms-1'>검토 결과 승인 대상입니다.</span> <span className='ms-1'>검토 결과 승인 대상입니다.</span>
</> </>
) : ( ) : (
<> <>
<CheckCircle size={15} /> {data.arcrftList[0].idntfNum === 'PA0002' ? (
<>
<AlertCircle size={15} />
<span className='ms-1'> <span className='ms-1'>
검토 결과 승인 대상입니다. 검토 결과 승인 대상입니다.
</span> </span>
{laancApply.planAreaDuplicatd ||
laancApply.arcrftDuplicated ? (
<span className='cancel-txt'>
설정하신 비행구역 비행시간에 이미 승인완료된 <br />
신청건이 있습니다. 다시 설정 부탁드립니다.
</span>
) : null}
</>
)
) : (
<>
<AlertCircle size={15} />
<span className='ms-1'>검토 결과 승인 대상입니다.</span>
{!laancApply?.planAreaDuplicatd ||
(!laancApply?.report &&
!laancApply?.evaluatedTargetArea) ? (
<span className='cancel-txt'> <span className='cancel-txt'>
제출하신 비행계획상의 비행구역과 비행시간이 별도의 유효성 검사에 실패하였습니다.
승인을
<br /> <br />
필요로 하지 않지만, 아래 조종자 준수사항에 유의하여 다시 검사해주시기 바랍니다.
<br /> 비행하시기 바랍니다.
</span> </span>
</>
) : ( ) : (
<span className='cancel-txt'> laancReason(
제출하신 비행계획상의 비행시간이 다른 계획서와 laancApply?.flight,
<br /> laancApply?.arcrftDuplicated,
겹치는 비행시간 입니다. laancApply?.planAreaDuplicatd,
</span> laancApply?.pilotQlfc,
laancApply?.arcrftInsurance
)
)} )}
{/* <span className='cancel-txt'>
유효성 검사에 실패하였습니다.
<br />
다시 검사해주시기 바랍니다.
</span> */}
</> </>
)} )}
</div> </div>
@ -497,7 +510,7 @@ export default function LaancStep2({
있는 경우에는 이에 따라 비행해야 한다. 있는 경우에는 이에 따라 비행해야 한다.
</p> </p>
</div> </div>
{data.arcrftList[0].idntfNum != 'PA0002' ? ( {!laancIsCheck ? (
<CustomInput <CustomInput
inline inline
type='checkbox' type='checkbox'
@ -528,7 +541,7 @@ export default function LaancStep2({
</li> </li>
</ul> </ul>
<Button <Button
disabled={!isterms || data.arcrftList[0].idntfNum != 'PA0001'} disabled={!isterms || laancIsCheck}
outline outline
onClick={() => handlerCreate()} onClick={() => handlerCreate()}
> >

Loading…
Cancel
Save