|
|
@ -4,7 +4,8 @@ import {CustomDetailLayout} from '../../../../components/layout/CustomDetailLayo |
|
|
|
import {useHistory, useLocation, useParams} from 'react-router-dom'; |
|
|
|
import {useHistory, useLocation, useParams} from 'react-router-dom'; |
|
|
|
import {useDispatch, useSelector} from 'react-redux'; |
|
|
|
import {useDispatch, useSelector} from 'react-redux'; |
|
|
|
import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; |
|
|
|
import * as Actions from '../../../../modules/basis/flight/actions/basisFlightAction'; |
|
|
|
import {initFlightBas} from '../../../../modules/basis/flight/models/basisFlightModel'; |
|
|
|
import {initFlight, initFlightBas} from '../../../../modules/basis/flight/models/basisFlightModel'; |
|
|
|
|
|
|
|
import { AiFillPropertySafety } from 'react-icons/ai'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initModal = { |
|
|
|
const initModal = { |
|
|
@ -40,6 +41,7 @@ const FlightPlanDetailContainer = () => { |
|
|
|
if(pilotSelect !== undefined) {
|
|
|
|
if(pilotSelect !== undefined) {
|
|
|
|
const pilotList = detailData.pilotList.concat(); |
|
|
|
const pilotList = detailData.pilotList.concat(); |
|
|
|
const pilot = Object.assign({}, initFlightBas['pilot']);
|
|
|
|
const pilot = Object.assign({}, initFlightBas['pilot']);
|
|
|
|
|
|
|
|
console.log(pilotSelect);
|
|
|
|
|
|
|
|
|
|
|
|
pilot.cstmrSno = pilotSelect.cstmrSno; |
|
|
|
pilot.cstmrSno = pilotSelect.cstmrSno; |
|
|
|
pilot.groupNm = pilotSelect.groupNm; |
|
|
|
pilot.groupNm = pilotSelect.groupNm; |
|
|
@ -48,14 +50,28 @@ const FlightPlanDetailContainer = () => { |
|
|
|
pilot.memberName = pilotSelect.memberName; |
|
|
|
pilot.memberName = pilotSelect.memberName; |
|
|
|
pilot.hpno = pilotSelect.hpno; |
|
|
|
pilot.hpno = pilotSelect.hpno; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 파일럿 중복 확인
|
|
|
|
|
|
|
|
let checking = true |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pilotList.forEach(p => { |
|
|
|
|
|
|
|
if(p.cstmrSno !== 0) { |
|
|
|
|
|
|
|
if(p.cstmrSno === pilotSelect.cstmrSno) { |
|
|
|
|
|
|
|
alert('중복'); |
|
|
|
|
|
|
|
checking = false; |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(checking) { |
|
|
|
pilotList.forEach((p, i) => { |
|
|
|
pilotList.forEach((p, i) => { |
|
|
|
|
|
|
|
console.log(pilotList); |
|
|
|
if(p.cstmrSno === 0) { |
|
|
|
if(p.cstmrSno === 0) { |
|
|
|
pilotList[i] = pilot |
|
|
|
pilotList[i] = pilot |
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if(i === pilotList.length-1) { |
|
|
|
|
|
|
|
return pilotList.push(pilot);
|
|
|
|
return pilotList.push(pilot);
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
setDetailData(prevState => { |
|
|
|
setDetailData(prevState => { |
|
|
@ -65,6 +81,7 @@ const FlightPlanDetailContainer = () => { |
|
|
|
} |
|
|
|
} |
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, [pilotSelect]) |
|
|
|
}, [pilotSelect]) |
|
|
|
|
|
|
|
|
|
|
@ -82,15 +99,27 @@ const FlightPlanDetailContainer = () => { |
|
|
|
arcrft.idntfNum = arcrftSelect.idntfNum;
|
|
|
|
arcrft.idntfNum = arcrftSelect.idntfNum;
|
|
|
|
arcrft.ownerNm = arcrftSelect.ownerNm;
|
|
|
|
arcrft.ownerNm = arcrftSelect.ownerNm;
|
|
|
|
|
|
|
|
|
|
|
|
arcrftList.forEach((p, i) => { |
|
|
|
let checking = true; |
|
|
|
if(p.arcrftSno === 0) { |
|
|
|
arcrftList.forEach(p => { |
|
|
|
|
|
|
|
if(p.arcrftSno !== 0){ |
|
|
|
|
|
|
|
if(p.arcrftSno === arcrftSelect.arcrftSno) { |
|
|
|
|
|
|
|
alert('중복'); |
|
|
|
|
|
|
|
checking = false; |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(checking){ |
|
|
|
|
|
|
|
arcrftList.forEach((p,i) => { |
|
|
|
|
|
|
|
console.log('>>>>>>>>>>', arcrftList); |
|
|
|
|
|
|
|
if(p.arcrftSno === 0){ |
|
|
|
arcrftList[i] = arcrft |
|
|
|
arcrftList[i] = arcrft |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if(i === arcrftList.length-1) { |
|
|
|
|
|
|
|
return arcrftList.push(arcrft); |
|
|
|
return arcrftList.push(arcrft); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
setDetailData(prevState => { |
|
|
|
setDetailData(prevState => { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -302,30 +331,45 @@ const FlightPlanDetailContainer = () => { |
|
|
|
setDetailData(prevState => { |
|
|
|
setDetailData(prevState => { |
|
|
|
const arr = [...prevState[arrName]]; |
|
|
|
const arr = [...prevState[arrName]]; |
|
|
|
const deleteData = arr.splice(index, 1); |
|
|
|
const deleteData = arr.splice(index, 1); |
|
|
|
|
|
|
|
console.log(deleteData); |
|
|
|
|
|
|
|
const id = initFlight.detail['pilotList'] |
|
|
|
|
|
|
|
console.log(id); |
|
|
|
|
|
|
|
if(arr.length > 0) { |
|
|
|
|
|
|
|
debugger |
|
|
|
return { |
|
|
|
return { |
|
|
|
...prevState, |
|
|
|
...prevState, |
|
|
|
[arrName]: arr |
|
|
|
[arrName]: arr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
debugger |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
...prevState, |
|
|
|
|
|
|
|
[arrName]: id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
break; |
|
|
|
case 'arcrft': |
|
|
|
case 'arcrft': |
|
|
|
setDetailData(prevState => { |
|
|
|
setDetailData(prevState => { |
|
|
|
const arr = [...prevState[arrName]]; |
|
|
|
const arr = [...prevState[arrName]]; |
|
|
|
const deleteData = arr.splice(index, 1); |
|
|
|
const deleteData = arr.splice(index, 1); |
|
|
|
|
|
|
|
console.log(deleteData); |
|
|
|
|
|
|
|
const id = initFlight.detail['arcrftList'] |
|
|
|
if(arr.length > 0) { |
|
|
|
if(arr.length > 0) { |
|
|
|
return { |
|
|
|
return { |
|
|
|
...prevState, |
|
|
|
...prevState, |
|
|
|
[arrName]: arr |
|
|
|
[arrName]: arr |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
}
|
|
|
|
|
|
|
|
else{ |
|
|
|
return { |
|
|
|
return { |
|
|
|
...prevState, |
|
|
|
...prevState, |
|
|
|
['pilotList']: initFlightBas[arrName] |
|
|
|
[arrName]: id |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|