diff --git a/src/modules/laanc/actions/laancActions.ts b/src/modules/laanc/actions/laancActions.ts index 4b03c78..54df87f 100644 --- a/src/modules/laanc/actions/laancActions.ts +++ b/src/modules/laanc/actions/laancActions.ts @@ -33,11 +33,6 @@ const LAANC_SUN_DATA_FAILURE = 'laanc/sun/FAILURE'; // laanc 초기화 const INIT_LAANC = 'laanc/init'; // laanc 공문 pdf 다운로드 -export const laancPdfAction = createAsyncAction( - LAANC_PDF_REQUEST, - LAANC_PDF_SUCCESS, - LAANC_PDF_FAILURE -)(); // laanc 비행계획서 승인 export const LAANC_FLIGHT_Approval = createAsyncAction( @@ -57,13 +52,12 @@ export const LAANC_FLIGHT_CREATE = createAsyncAction( // laanc 일물 일출 export const LAANC_SUN_DATA = createAsyncAction( - LAANC_FLIGHT_CREATE_REQUEST, - LAANC_FLIGHT_CREATE_SUCCESS, - LAANC_FLIGHT_CREATE_FAILURE + LAANC_SUN_DATA_REQUEST, + LAANC_SUN_DATA_SUCCESS, + LAANC_SUN_DATA_FAILURE )(); const actions = { - laancPdfAction, LAANC_FLIGHT_Approval, LAANC_FLIGHT_CREATE, LAANC_APPROVAL_INIT, diff --git a/src/modules/laanc/reducers/laancReducers.ts b/src/modules/laanc/reducers/laancReducers.ts index c307bfb..4115e96 100644 --- a/src/modules/laanc/reducers/laancReducers.ts +++ b/src/modules/laanc/reducers/laancReducers.ts @@ -5,7 +5,6 @@ import { createReducer } from 'typesafe-actions'; import * as Actions from '../actions/laancActions'; // action -import { laancPdfAction } from '../actions/laancActions'; import { LaancFlightData, @@ -21,36 +20,24 @@ export const laancReducer = createReducer( produce(state, draft => { const data = action.payload; draft.laancApply = data; - // draft.detail = initFlightBas.initDetail; }) ) .handleAction(Actions.LAANC_FLIGHT_CREATE.success, (state, action) => produce(state, draft => { const data = action.payload; draft.laancPdf = data; - // draft.detail = initFlightBas.initDetail; }) ) .handleAction(Actions.LAANC_APPROVAL_INIT, (state, action) => produce(state, draft => { draft.laancApply = undefined; - // draft.detail = initFlightBas.initDetail; }) ) .handleAction(Actions.LAANC_SUN_DATA.success, (state, action) => produce(state, draft => { const data = action.payload; draft.laancSun = data; - // draft.detail = initFlightBas.initDetail; }) ); -// handleAction(Actions.laancFlightApproval.success, (state, action) => -// produce(state, draft => { -// // laanc 승인 처리 -// const data = action.payload; -// draft.approval = data; -// }) -// ); - export default laancReducer; diff --git a/src/modules/laanc/sagas/laancSagas.ts b/src/modules/laanc/sagas/laancSagas.ts index b5bee51..146be10 100644 --- a/src/modules/laanc/sagas/laancSagas.ts +++ b/src/modules/laanc/sagas/laancSagas.ts @@ -5,9 +5,6 @@ import * as MessageActions from '../../comn/message/actions/comnMessageAction'; import * as Apis from '../apis/laancApi'; import { ERROR_MESSAGE, SAVE_MESSAGE } from '../../../configs/constants'; // pdf 연결 -function* getLaancPdfsaga( - action: ActionType -) {} // laanc 승인 여부 function* postApprovalsata( @@ -42,26 +39,6 @@ function* postApprovalsata( } } -// laanc 일물 일출 -function* getSunDataSaga( - action: ActionType -) { - try { - const detail = action.payload; - const res = yield call(Apis.laancApi.getSunData, detail); - yield put(Actions.LAANC_SUN_DATA.success(res)); - } catch (error) { - yield put( - MessageActions.IS_ERROR({ - errorCode: ERROR_MESSAGE.code, - errorMessage: ERROR_MESSAGE.message, - isHistoryBack: false, - isRefresh: false - }) - ); - } -} - // laanc 생성 function* postCreatesata( action: ActionType @@ -72,7 +49,7 @@ function* postCreatesata( const res = yield call(Apis.laancApi.postCreate, detail); // const { data } = res; - localStorage.setItem('pdfUrl', res.data.pdfUrl); + // localStorage.setItem('pdfUrl', res.data.pdfUrl); // yield put( // MessageActions.IS_MESSAGE({ // messageCode: SAVE_MESSAGE.code, @@ -94,9 +71,28 @@ function* postCreatesata( // yield put(Actions.FLIGHT_PLAN_CREATE.failure(error)); } } +// laanc 일물 일출 +function* getSunDataSaga( + action: ActionType +) { + try { + const detail = action.payload; + const res = yield call(Apis.laancApi.getSunData, detail); + + yield put(Actions.LAANC_SUN_DATA.success(res)); + } catch (error) { + yield put( + MessageActions.IS_ERROR({ + errorCode: ERROR_MESSAGE.code, + errorMessage: ERROR_MESSAGE.message, + isHistoryBack: false, + isRefresh: false + }) + ); + } +} export function* laancSaga() { - yield takeEvery(Actions.laancPdfAction.request, getLaancPdfsaga); yield takeEvery(Actions.LAANC_FLIGHT_Approval.request, postApprovalsata); yield takeEvery(Actions.LAANC_FLIGHT_CREATE.request, postCreatesata); yield takeEvery(Actions.LAANC_SUN_DATA.request, getSunDataSaga); diff --git a/src/views/laanc/LaacnStep3.js b/src/views/laanc/LaacnStep3.js index b10d62f..b6b85dd 100644 --- a/src/views/laanc/LaacnStep3.js +++ b/src/views/laanc/LaacnStep3.js @@ -1,8 +1,6 @@ import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector, shallowEqual } from 'react-redux'; import { Document, Page, pdfjs } from 'react-pdf'; -import moment from 'moment'; - import { Row, Col, @@ -17,9 +15,8 @@ import { Input, Badge } from 'reactstrap'; -import { useHistory } from 'react-router-dom'; import FlightArea from './FlightArea'; -import { AlertCircle, CheckCircle, Download } from 'react-feather'; +import { CheckCircle } from 'react-feather'; pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`; @@ -52,9 +49,7 @@ export default function LaacnStep3({ const [pageNum, setPageNum] = useState(1); const { user } = useSelector(state => state.authState); const { laancPdf } = useSelector(state => state.laancState); - const handlerClose = () => { - setFormModal(!formModal); - }; + const handlerPdfDownload = e => { if (laancPdf.pdfUrl) { let alink = document.createElement('a'); @@ -202,7 +197,7 @@ export default function LaacnStep3({ bsSize='sm' placeholder='' disabled - value={laancPdf?.address} + value={laancPdf?.address || ''} /> diff --git a/src/views/laanc/LaancStep1.js b/src/views/laanc/LaancStep1.js index 67f3557..3d19028 100644 --- a/src/views/laanc/LaancStep1.js +++ b/src/views/laanc/LaancStep1.js @@ -359,34 +359,41 @@ export default function LaancStep1({ name: 'schFltStDt', value }); - const filteredData = laancSun.filter(data => { - const dataDateTime = moment(data.locDate, 'YYYYMMDD'); - return dataDateTime.isSame(moment(value, 'YYYYMMDD')); - }); - filteredData.forEach(data => { - if ( - data.civile === moment(value).format('HHmmss') || - data.civilm === moment(value).format('HHmmss') - ) { - setIsLaancModal({ - isOpen: true, - title: '특별 비행 신청', - desc: ( - <> - 야간 비행 신청의 경우 특별 비행 신청을 - 진행하셔야 합니다. -
- 드론원스톱을 통해서 신청해 주시기 바랍니다. - - ), - type: 'date' - }); - handleChange({ - name: 'schFltStDt', - value: '' - }); - } - }); + if (laancSun.length > 0) { + const filteredData = laancSun.filter(data => { + const dataDateTime = moment( + data.locDate, + 'YYYYMMDD' + ); + return dataDateTime.isSame( + moment(value, 'YYYYMMDD') + ); + }); + filteredData.forEach(data => { + if ( + data.civile === moment(value).format('HHmmss') || + data.civilm === moment(value).format('HHmmss') + ) { + setIsLaancModal({ + isOpen: true, + title: '특별 비행 신청', + desc: ( + <> + 야간 비행 신청의 경우 특별 비행 신청을 + 진행하셔야 합니다. +
+ 드론원스톱을 통해서 신청해 주시기 바랍니다. + + ), + type: 'date' + }); + handleChange({ + name: 'schFltStDt', + value: '' + }); + } + }); + } }} placeholder='비행 시작일자 선택(클릭)' /> @@ -438,34 +445,41 @@ export default function LaancStep1({ name: 'schFltEndDt', value }); - const filteredData = laancSun.filter(data => { - const dataDateTime = moment(data.locDate, 'YYYYMMDD'); - return dataDateTime.isSame(moment(value, 'YYYYMMDD')); - }); - filteredData.forEach(data => { - if ( - data.civile === moment(value).format('HHmmss') || - data.civilm === moment(value).format('HHmmss') - ) { - setIsLaancModal({ - isOpen: true, - title: '특별 비행 신청', - desc: ( - <> - 야간 비행 신청의 경우 특별 비행 신청을 - 진행하셔야 합니다. -
- 드론원스톱을 통해서 신청해 주시기 바랍니다. - - ), - type: 'date' - }); - handleChange({ - name: 'schFltEndDt', - value: '' - }); - } - }); + if (laancSun.length > 0) { + const filteredData = laancSun.filter(data => { + const dataDateTime = moment( + data.locDate, + 'YYYYMMDD' + ); + return dataDateTime.isSame( + moment(value, 'YYYYMMDD') + ); + }); + filteredData.forEach(data => { + if ( + data.civile === moment(value).format('HHmmss') || + data.civilm === moment(value).format('HHmmss') + ) { + setIsLaancModal({ + isOpen: true, + title: '특별 비행 신청', + desc: ( + <> + 야간 비행 신청의 경우 특별 비행 신청을 + 진행하셔야 합니다. +
+ 드론원스톱을 통해서 신청해 주시기 바랍니다. + + ), + type: 'date' + }); + handleChange({ + name: 'schFltEndDt', + value: '' + }); + } + }); + } }} placeholder='비행 종료일자 선택(클릭)' /> diff --git a/src/views/laanc/LaancStep2.js b/src/views/laanc/LaancStep2.js index dc52853..a4ab6ef 100644 --- a/src/views/laanc/LaancStep2.js +++ b/src/views/laanc/LaancStep2.js @@ -1,24 +1,12 @@ import React, { useEffect, useState } from 'react'; -import { Search } from 'react-feather'; -import { BiBuildings, BiGridAlt } from 'react-icons/bi'; -import { CgTrees } from 'react-icons/cg'; -import { VscRadioTower } from 'react-icons/vsc'; import { useDispatch, useSelector } from 'react-redux'; -import Flatpickr from 'react-flatpickr'; import '@styles/react/libs/flatpickr/flatpickr.scss'; -import moment from 'moment'; -import { - AlertCircle, - CheckCircle, - XCircle, - AlertTriangle -} from 'react-feather'; +import { AlertCircle, CheckCircle, AlertTriangle } from 'react-feather'; import FlightArea from './FlightArea'; import { Row, Col, Button, - Modal, ModalHeader, ModalBody, ModalFooter, @@ -28,17 +16,6 @@ import { Input, CustomInput } from 'reactstrap'; -import { - initFlight, - initFlightBas -} from '../../modules/basis/flight/models/basisFlightModel'; -import { useHistory } from 'react-router-dom'; -import { - areaClickAction, - environmentClickAction, - mapTypeChangeAction, - sensorClickAction -} from '../../modules/control/map/actions/controlMapActions'; import * as LaancAction from '../../modules/laanc/actions/laancActions'; import * as TermsActions from '../../modules/account/register/actions/accountAction'; @@ -66,7 +43,7 @@ export default function LaancStep2({ }; const [isterms, setIsterms] = useState(false); const [flightData, setFlightData] = useState({}); - const [laancIsCheck, setLancIsCheck] = useState(); + const [laancIsCheck, setLancIsCheck] = useState(false); const { user } = useSelector(state => state.authState); const { laancApply } = useSelector(state => state.laancState); const { termsList } = useSelector(state => state.accountState); @@ -81,6 +58,7 @@ export default function LaancStep2({ }) ); }, []); + useEffect(() => { if (!laancApply?.valid) setLancIsCheck(true); else if (laancApply?.valid) setLancIsCheck(false); @@ -107,7 +85,7 @@ export default function LaancStep2({ terms: [ { agreeYn: 'Y', - termsSno: 1 + termsSno: termsList[0]?.termsSno } ], validatedRs: laancApply @@ -147,7 +125,6 @@ export default function LaancStep2({ if (arcrftDuplicated || planAreaDuplicatd) { return ( <> - {' '} 검토 결과 미 승인 대상입니다.