|
|
|
|
@ -199,6 +199,8 @@ function DraftPJU({route,navigation}: sendListDataProps) {
@@ -199,6 +199,8 @@ function DraftPJU({route,navigation}: sendListDataProps) {
|
|
|
|
|
const isFocused = useIsFocused(); |
|
|
|
|
useEffect(() => { |
|
|
|
|
if(isFocused){ |
|
|
|
|
setFilterData([]); |
|
|
|
|
setStingFilter(""); |
|
|
|
|
getDataPJU(); |
|
|
|
|
const unsubscribe = NetInfo.addEventListener((state) => { |
|
|
|
|
setConnected(state.isConnected!) |
|
|
|
|
@ -213,13 +215,14 @@ function DraftPJU({route,navigation}: sendListDataProps) {
@@ -213,13 +215,14 @@ function DraftPJU({route,navigation}: sendListDataProps) {
|
|
|
|
|
}); |
|
|
|
|
const [stringFilter,setStingFilter] = useState('') |
|
|
|
|
const handleSearch = (text:string) => { |
|
|
|
|
// console.log(text);
|
|
|
|
|
|
|
|
|
|
const formattedQuery = text.toLowerCase(); |
|
|
|
|
const filteredData = localStorage.filter(data => |
|
|
|
|
data.case_name.toLowerCase().includes(formattedQuery) |
|
|
|
|
const filteredData = localStorage.filter((data:any) => |
|
|
|
|
data.pju_name.toLowerCase().includes(formattedQuery) |
|
|
|
|
|
|
|
|
|
) |
|
|
|
|
setFilterData(filteredData) |
|
|
|
|
// console.log(filteredData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
const reSend = async (data:any) => { |
|
|
|
|
@ -376,7 +379,7 @@ function DraftPJU({route,navigation}: sendListDataProps) {
@@ -376,7 +379,7 @@ function DraftPJU({route,navigation}: sendListDataProps) {
|
|
|
|
|
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} /> |
|
|
|
|
}> |
|
|
|
|
{
|
|
|
|
|
localStorage.length != 0 ?
|
|
|
|
|
localStorage.length != 0 && stringFilter === "" ?
|
|
|
|
|
localStorage.map((item:any,index:number) => ( |
|
|
|
|
<View key={index}> |
|
|
|
|
<View style={{flexDirection:'row'}}> |
|
|
|
|
@ -454,6 +457,84 @@ function DraftPJU({route,navigation}: sendListDataProps) {
@@ -454,6 +457,84 @@ function DraftPJU({route,navigation}: sendListDataProps) {
|
|
|
|
|
</View>
|
|
|
|
|
)) |
|
|
|
|
: |
|
|
|
|
filterData.length > 0 ? |
|
|
|
|
filterData.map((item:any,index:number) => ( |
|
|
|
|
<View key={index}> |
|
|
|
|
<View style={{flexDirection:'row'}}> |
|
|
|
|
<View style={{ flexDirection:'column',paddingLeft:0,width:'35%'}}> |
|
|
|
|
<Text style={{fontSize:14,color:'#000000',fontWeight:'600',padding:5}}>Nama JPU</Text> |
|
|
|
|
<Text style={{fontSize:14,color:'#000000',fontWeight:'600',padding:5}}>Jenis</Text> |
|
|
|
|
<Text style={{fontSize:14,color:'#000000',fontWeight:'600',padding:5}}>Tanggal Installasi</Text> |
|
|
|
|
<Text style={{fontSize:14,color:'#000000',fontWeight:'600',padding:5}}>Status</Text> |
|
|
|
|
</View> |
|
|
|
|
<View style={{ flexDirection:'column',paddingLeft:0,width:'65%'}}> |
|
|
|
|
<Text style={{fontSize:14,fontWeight:'400',color:'#000000',padding:5}}>: {item.pju_name}</Text> |
|
|
|
|
<Text style={{fontSize:14,fontWeight:'400',color:'#000000',padding:5}}>: {item.pju_type}</Text> |
|
|
|
|
<Text style={{fontSize:14,fontWeight:'400',color:'#000000',padding:5}}>: {item.installation_date}</Text> |
|
|
|
|
<Text style={{fontSize:14,fontWeight:'400',color:'#000000',padding:5}}>: {item.status}</Text> |
|
|
|
|
</View> |
|
|
|
|
<View style={{ marginLeft:'55%',marginTop:0,width:150,height:100,position:'absolute'}}> |
|
|
|
|
<MenuProvider skipInstanceCheck={true} style={{flexDirection:'column'}}> |
|
|
|
|
<Menu> |
|
|
|
|
<MenuTrigger> |
|
|
|
|
<Image |
|
|
|
|
style={{justifyContent:'center',alignSelf:'flex-end'}} |
|
|
|
|
source={require('../../assets/icon/Actions.png')} |
|
|
|
|
resizeMode='cover' |
|
|
|
|
/> |
|
|
|
|
</MenuTrigger> |
|
|
|
|
<MenuOptions customStyles={optionsStyles}> |
|
|
|
|
<MenuOption |
|
|
|
|
onSelect={()=>{ |
|
|
|
|
navigation.navigate('Resend Survey PJU',{ screen: 'Resend Survey PJU',data: { |
|
|
|
|
nama:item.pju_name, |
|
|
|
|
jenis:item.pju_type, |
|
|
|
|
tanggal_installasi:item.installation_date, |
|
|
|
|
status:item.status, |
|
|
|
|
keterangan:item.keterangan, |
|
|
|
|
long:item.long, |
|
|
|
|
lat:item.lat |
|
|
|
|
}}); |
|
|
|
|
}} |
|
|
|
|
children={ |
|
|
|
|
<View style={{flexDirection:'row',alignItems:'center',justifyContent:'center'}}> |
|
|
|
|
<Image source={require('../../assets/icon/edit.png')} /> |
|
|
|
|
<Text style={{marginLeft:10,color:'#6B5E5EB2',fontSize:14,fontWeight:400}}>Open</Text> |
|
|
|
|
</View>}
|
|
|
|
|
/> |
|
|
|
|
<View style={{marginVertical: 5, width:85, |
|
|
|
|
marginHorizontal: 2, |
|
|
|
|
borderBottomWidth: 1, |
|
|
|
|
borderColor: '#ccc'}} |
|
|
|
|
/> |
|
|
|
|
<MenuOption |
|
|
|
|
onSelect={()=> { |
|
|
|
|
deleteById(item.pju_name); |
|
|
|
|
removeValue(item.pju_name+" / "+item.pju_type+" / "+item.installation_date+" / "+item.status+" / "+item.keterangan+" / "+item.long+" / "+item.lat+" / draftPJU"); |
|
|
|
|
}} |
|
|
|
|
children={ |
|
|
|
|
<View style={{flexDirection:'row',alignItems:'center',justifyContent:'center'}}> |
|
|
|
|
<Image source={require('../../assets/icon/dell.png')} /> |
|
|
|
|
<Text style={{marginLeft:10,color:'#6B5E5EB2',fontSize:14,fontWeight:400}}>Delete</Text> |
|
|
|
|
</View> |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
</MenuOptions> |
|
|
|
|
</Menu> |
|
|
|
|
</MenuProvider> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={{ |
|
|
|
|
marginTop: 10, |
|
|
|
|
marginBottom: 10, |
|
|
|
|
borderBottomColor: '#E2E2E2', |
|
|
|
|
borderBottomWidth: 2, |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
</View>
|
|
|
|
|
)) |
|
|
|
|
: |
|
|
|
|
<View style={{alignItems:'center',padding:20}}> |
|
|
|
|
<Text style={{fontSize:16,color:'grey'}}>Data Kosong</Text> |
|
|
|
|
</View> |
|
|
|
|
|