diff --git a/App.tsx b/App.tsx index cba21c2..5288687 100644 --- a/App.tsx +++ b/App.tsx @@ -46,6 +46,8 @@ import MapViewLineScreen from './src/component/mapViewLineScreen'; import SettingScreen from './src/component/settingScreen'; import MyAccount from './src/component/myAccount'; import ChangePass from './src/component/changePassword'; +import ResendPJU from './src/component/resendPJU'; +import ResendPDAM from './src/component/resendPDAM'; import { USER_API_URL } from "../SurveyApp/urlConfig"; import { PermissionsAndroid } from 'react-native'; @@ -549,6 +551,28 @@ export const Nav = () => { fontSize:20 } }}/> + + ([]); + const isFocused = useIsFocused(); + const [userID,setUserID] = useState(); useEffect(()=>{ - let centCord = turfcenter(points(route.params.coordinates)); - console.log('center'); - console.log(centCord.geometry.coordinates); - setCenterCoords(centCord.geometry.coordinates); - const unsubscribe = NetInfo.addEventListener((state) => { - setConnected(state.isConnected!) - }); - return () => { - unsubscribe(); + if(isFocused){ + const getKey = async () =>{ + const jsonValue = await AsyncStorage.getItem('USER_DATA') + console.log(JSON.parse(jsonValue!)); + const data = JSON.parse(jsonValue!); + console.log("user_data",data.id); + setUserID(data.id) + }; + getKey() + let centCord = turfcenter(points(route.params.coordinates)); + // console.log('center'); + // console.log(centCord.geometry.coordinates); + setCenterCoords(centCord.geometry.coordinates); + const unsubscribe = NetInfo.addEventListener((state) => { + setConnected(state.isConnected!) + }); + return () => { + unsubscribe(); + }; }; - },[]) + },[isFocused]) const ref = useRef(); const [connected, setConnected] = useState(true); @@ -68,7 +78,7 @@ export default function CollectLineScreen({route,navigation}:collectLineScreenPr const [pipeTyeError, setPipeTypeError] = useState(false); const [pipeStatusError, setPipeStatusError] = useState(false); const [pipeInfoError, setPipeInfoError] = useState(false); - const [ModalAttachment, setModalAttachment] = useState(false); + const [ModalAttachment, setModalAttachment] = useState(false); const openCameraLib = async () => { const result = await launchCamera({ @@ -198,6 +208,16 @@ export default function CollectLineScreen({route,navigation}:collectLineScreenPr status: 0, body: {}, } + let date = new Date(); + const milliseconds = Date.UTC( + date.getFullYear(), + date.getMonth(), + date.getDate(), + date.getHours(), + date.getMinutes(), + date.getSeconds(), + ); + const localTime = new Date(milliseconds); const geom = route.params.coordinates.map((item:any)=>{ return String(item).replace(',',' ') }) @@ -207,7 +227,9 @@ export default function CollectLineScreen({route,navigation}:collectLineScreenPr tanggal_installasi: momentDate, status: checkedStatus, keterangan: Information, - geom: `MULTILINESTRING((${geom}))` + geom: `MULTILINESTRING((${geom}))`, + created_by: userID, + created_at: localTime } await RNFetchBlob.config({ trusty : true @@ -284,298 +306,298 @@ export default function CollectLineScreen({route,navigation}:collectLineScreenPr - - - - + + + + + - - - - - { - route.params.coordinates.map((item:any,index:number)=>( - } - key={index} - id={String(index)} - coordinate={item} - draggable={false} - /> - )) - } - - {/* */} - navigation.navigate('PDAM Map Collect', { screen: 'PDAM Map Collect'})}> - Change Location - - - - - {/* Name* */} - Pipe Name - { - setPipeName(text) - }} - onChange={()=> { - setPipeNameError(false) - }} - /> - {pipeNameError ? Pipe Name is Required!:null} - - - - {/* PJU Type * */} - PJU Type - ( - [setPipeTypeError(false)] - )} - /> - {pipeTyeError ? Pipe Type is Required!:null} - - - - {/* Status* */} - Status - - {setCheckedStatus('Baik'); setPipeStatusError(false)}} - /> - Baik - - - {setCheckedStatus('Rusak'); setPipeStatusError(false); }} - /> - Rusak - - {pipeStatusError ? Status is Required!:null} - - + { + route.params.coordinates.map((item:any,index:number)=>( + } + key={index} + id={String(index)} + coordinate={item} + draggable={false} + /> + )) + } + + {/* */} + navigation.navigate('PDAM Map Collect', { screen: 'PDAM Map Collect'})}> + Change Location + + + + + {/* Name* */} + Pipe Name + { + setPipeName(text) + }} + onChange={()=> { + setPipeNameError(false) + }} /> - - Information - { - setInformation(text) - }} - onChange={()=> { - setPipeInfoError(false) - }} - /> - {pipeInfoError ? Information is Required!:null} - - Pipe Name is Required!:null} + + + + {/* PJU Type * */} + Pipe Type + ( + [setPipeTypeError(false)] + )} /> - - Installation Date - setOpen(true)} - value={String(momentDate)} + {pipeTyeError ? Pipe Type is Required!:null} + + + + {/* Status* */} + Status + + {setCheckedStatus('Baik'); setPipeStatusError(false)}} /> - { - setOpen(false) - setInstallDate(survey_date) - }} - onCancel={() => { - setOpen(false) - }} + Baik + + + {setCheckedStatus('Rusak'); setPipeStatusError(false); }} /> + Rusak - Status is Required!:null} + + + + Information + { + setInformation(text) + }} + onChange={()=> { + setPipeInfoError(false) }} /> - - Attachment - Lampirkan foto / gambar - { - imgUrl.length === 0 ? - setModalAttachment(true)}> - - - Klik untuk menambahkan foto / gambar - - - : - - setModalAttachment(true)}> - - - - - } - contentContainerStyle={{flexDirection:'row',flexWrap:'wrap',columnGap:25,rowGap:10}} - data={imgUrl} - renderItem={({item,index})=>renderItem({item,index})} - /> - } - - Information is Required!:null} + + + + Installation Date + setOpen(true)} + value={String(momentDate)} + /> + { + setOpen(false) + setInstallDate(survey_date) + }} + onCancel={() => { + setOpen(false) }} /> + + + + Attachment + Lampirkan foto / gambar + { + imgUrl.length === 0 ? + setModalAttachment(true)}> + + + Klik untuk menambahkan foto / gambar + + + : + + setModalAttachment(true)}> + + + + + } + contentContainerStyle={{flexDirection:'row',flexWrap:'wrap',columnGap:25,rowGap:10}} + data={imgUrl} + renderItem={({item,index})=>renderItem({item,index})} + /> + } + + -