diff --git a/assets/icon/camorlib.png b/assets/icon/camorlib.png new file mode 100644 index 0000000..03e3613 Binary files /dev/null and b/assets/icon/camorlib.png differ diff --git a/assets/icon/findmylock.png b/assets/icon/findmyloc.png similarity index 100% rename from assets/icon/findmylock.png rename to assets/icon/findmyloc.png diff --git a/src/component/collectscreen.tsx b/src/component/collectscreen.tsx index f7d827e..cef109a 100644 --- a/src/component/collectscreen.tsx +++ b/src/component/collectscreen.tsx @@ -1,6 +1,6 @@ // global.Buffer = require('buffer').Buffer; import React, { useEffect, useRef, useState, useCallback, useMemo } from 'react'; -import { Alert, Animated, Keyboard } from 'react-native'; +import { Alert, Animated, Keyboard, Pressable } from 'react-native'; import { TextInput, Button, @@ -142,7 +142,7 @@ function CollectScreen({route,navigation}: collectScreenProps) { const [pju_name, setPJUname] = useState(''); const [selectedPJUType, setselectedPJUType] = useState(""); const [pju_info, setPJUinfo] = useState(''); - const [checkedStatus, setCheckedStatus] = useState(''); + const [checkedStatus, setCheckedStatus] = useState('Baik'); const [install_date, setInstallDate] = useState(new Date()); const momentDate = Moment(install_date).format('YYYY-MM-DD') const [attachmentImgError, setattachmentImgError] = useState(false); @@ -363,209 +363,288 @@ function CollectScreen({route,navigation}: collectScreenProps) { const handleCancelAlertOffline = () => { setAlertOffline(false); }; + const DATA = [ + { + id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba', + title: 'First Item', + }, + { + id: 'bd7acbea-c1b1-46c2-aed5-3ad53abbsss28ba', + title: 'First Item', + }, + { + id: 'bd7acbea-c1b1-46c2-aed5-3ad53abbssssss28ba', + title: 'First Item', + } + + ]; + const [selectedId, setSelectedId] = useState(); + const [imagenotNull,setImagenotNull] = useState(false); + const Item = ({item, onPress, backgroundColor, textColor}:any) => ( + + {item.title} + + ); + const renderItem = ({item}:any) => { + return ( + + ); + }; return( - - Form Survey PJU - - Image - - {imgUrl.length === 0 ? currentIndex :currentIndex+1}/{imgUrl.length} - - - { - const x = e.nativeEvent.contentOffset.x; - setCurrentIndex(parseFloat((x/330).toFixed(0))); - }} - horizontal - renderItem={({item,index}) => { - return( - - ) - }} - /> - - - - + + + + + + navigation.navigate('PJU Map Collect', { screen: 'PJU Map Collect'})} style={{alignItems:'center'}}> + - {/* - Open Camera - */} - - - - - + {fixCoordinate.lat}, + {fixCoordinate.long} + + + } + id={"pjuCoordinate"} + coordinate={[fixCoordinate.long, fixCoordinate.lat]} + /> + + + + + {/* navigation.navigate('PJU Map Collect', { screen: 'PJU Map Collect'})}> + + Change Location + + */} - - - - - } - id={"pjuCoordinate"} - coordinate={[fixCoordinate.long, fixCoordinate.lat]} - /> - - - navigation.navigate('PJU Map Collect', { screen: 'PJU Map Collect'})}> - - Change Location - - - - - - Name* - { - setPJUname(text) - }} - onChange={()=> { - setPJUNameError(false) + - {pjuNameError ? Name is Required!:null} - - - - PJU Type * - ( - [setPJUTypeError(false)] - )} + + {/* Name* */} + Name + { + setPJUname(text) + }} + onChange={()=> { + setPJUNameError(false) + }} + /> + {pjuNameError ? Name is Required!:null} + + + + {/* PJU Type * */} + PJU Type + ( + [setPJUTypeError(false)] + )} + /> + {PJUTypeError ? PJU Type is Required!:null} - - - Status * - - {setCheckedStatus('Baik'); setPJUStatusError(false)}} - /> - Baik - - - {setCheckedStatus('Rusak'); setPJUStatusError(false); }} + - Rusak - - {PJUStatusError ? Status is Required!:null} - - - Information * - { - setPJUinfo(text) + + {/* Status* */} + Status + + {setCheckedStatus('Baik'); setPJUStatusError(false)}} + /> + Baik + + + {setCheckedStatus('Rusak'); setPJUStatusError(false); }} + /> + Rusak + + {PJUStatusError ? Status is Required!:null} + + { - setPJUInfoError(false) + /> + + Attachment + Lampirkan foto / gambar + { + !imagenotNull ? + setImagenotNull(true)}> + + + Klik untuk menambahkan foto / gambar + + + : + renderItem(item.index)} + keyExtractor={item => item.id} + extraData={selectedId} + /> + + } + + - {PJUInfoError ? Information is Required!:null} - - - - Installation Date - setOpen(true)} - value={String(momentDate)} + + {/* Information * */} + Information + { + setPJUinfo(text) + }} + onChange={()=> { + setPJUInfoError(false) + }} + /> + {PJUInfoError ? Information is Required!:null} + + - { - setOpen(false) - setInstallDate(survey_date) + + Installation Date + setOpen(true)} + value={String(momentDate)} + /> + { + setOpen(false) + setInstallDate(survey_date) + }} + onCancel={() => { + setOpen(false) + }} + /> + + { - setOpen(false) + /> + - - - - - -