From 7df273e2d1aa6363c0579619e2fd77db98b5237c Mon Sep 17 00:00:00 2001 From: Irul24 Date: Tue, 25 Feb 2025 10:43:07 +0700 Subject: [PATCH] Component --- src/component/draftPDAM.tsx | 87 +++++++++++++++++++++++++++- src/component/draftPJU.tsx | 91 ++++++++++++++++++++++++++++-- src/component/draftPermit.tsx | 88 +++++++++++++++++++++++++++-- src/component/inboxPermit.tsx | 2 +- src/component/mapCollectScreen.tsx | 4 +- src/component/sentPDAM.tsx | 87 ++++++++++++++++++++++++++-- src/component/sentPJU.tsx | 89 +++++++++++++++++++++++++++-- src/component/sentPermit.tsx | 85 ++++++++++++++++++++++++++-- 8 files changed, 503 insertions(+), 30 deletions(-) diff --git a/src/component/draftPDAM.tsx b/src/component/draftPDAM.tsx index 97f3f44..e55b05c 100644 --- a/src/component/draftPDAM.tsx +++ b/src/component/draftPDAM.tsx @@ -196,6 +196,8 @@ function DraftPDAM({route,navigation}: sendListDataProps) { const isFocused = useIsFocused(); useEffect(() => { if(isFocused){ + setFilterData([]); + setStingFilter(""); getDataPDAM(); const unsubscribe = NetInfo.addEventListener((state) => { setConnected(state.isConnected!) @@ -213,10 +215,12 @@ function DraftPDAM({route,navigation}: sendListDataProps) { // 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.pipe_name.toLowerCase().includes(formattedQuery) ) setFilterData(filteredData) + // console.log(filteredData); + }; const reSend = async (data:any) => { @@ -373,7 +377,7 @@ function DraftPDAM({route,navigation}: sendListDataProps) { }> { - localStorage.length != 0 ? + localStorage.length != 0 && stringFilter === "" ? localStorage.map((item:any,index:number) => ( @@ -450,6 +454,83 @@ function DraftPDAM({route,navigation}: sendListDataProps) { )) : + filterData.length > 0 ? + filterData.map((item:any,index:number) => ( + + + + Nama Pipa + Jenis + Tanggal Installasi + Status + + + : {item.pipe_name} + : {item.pipe_type} + : {item.installation_date} + : {item.status} + + + + + + + + + { + navigation.navigate('Resend Survey Pipa PDAM',{ screen: 'Resend Survey Pipa PDAM',data: { + nama:item.pipe_name, + jenis:item.pipe_type, + tanggal_installasi:item.installation_date, + status:item.status, + keterangan:item.keterangan, + geom:item.geom + }}); + }} + children={ + + + Open + } + /> + + { + deleteById(item.pipe_name); + removeValue(item.pipe_name+" / "+item.pipe_type+" / "+item.installation_date+" / "+item.status+" / "+item.keterangan+" / "+item.geom+" / draftPDAM"); + }} + children={ + + + Delete + + } + /> + + + + + + + + )) + : Data Kosong diff --git a/src/component/draftPJU.tsx b/src/component/draftPJU.tsx index 5e703bc..4fb9598 100644 --- a/src/component/draftPJU.tsx +++ b/src/component/draftPJU.tsx @@ -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) { }); 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) { }> { - localStorage.length != 0 ? + localStorage.length != 0 && stringFilter === "" ? localStorage.map((item:any,index:number) => ( @@ -454,6 +457,84 @@ function DraftPJU({route,navigation}: sendListDataProps) { )) : + filterData.length > 0 ? + filterData.map((item:any,index:number) => ( + + + + Nama JPU + Jenis + Tanggal Installasi + Status + + + : {item.pju_name} + : {item.pju_type} + : {item.installation_date} + : {item.status} + + + + + + + + + { + 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={ + + + Open + } + /> + + { + deleteById(item.pju_name); + removeValue(item.pju_name+" / "+item.pju_type+" / "+item.installation_date+" / "+item.status+" / "+item.keterangan+" / "+item.long+" / "+item.lat+" / draftPJU"); + }} + children={ + + + Delete + + } + /> + + + + + + + + )) + : Data Kosong diff --git a/src/component/draftPermit.tsx b/src/component/draftPermit.tsx index 53ec071..35f198f 100644 --- a/src/component/draftPermit.tsx +++ b/src/component/draftPermit.tsx @@ -201,6 +201,8 @@ function DraftPermit({route,navigation}: sendListDataProps) { const isFocused = useIsFocused(); useEffect(() => { if(isFocused){ + setFilterData([]); + setStingFilter(""); getDataPermit(); const unsubscribe = NetInfo.addEventListener((state) => { setConnected(state.isConnected!) @@ -215,13 +217,13 @@ function DraftPermit({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.company_name.toLowerCase().includes(formattedQuery) + ); setFilterData(filteredData) + console.log(filteredData); + }; const reSend = async (data:any) => { @@ -382,7 +384,7 @@ function DraftPermit({route,navigation}: sendListDataProps) { } > { - localStorage.length != 0 ? + localStorage.length != 0 && stringFilter === "" ? localStorage.map((item:any,index:number) => ( @@ -455,6 +457,80 @@ function DraftPermit({route,navigation}: sendListDataProps) { )) : + filterData.length > 0 ? + filterData.map((item:any,index:number) => ( + + + + Company Name + Permit Status + Location + + + + : {item.company_name} + : {item.permit_status} + : {item.location} + + + + + + + + + { + navigation.navigate('Resend Survey Land Permit',{ screen: 'Resend Survey Land Permit',data: { + company_name:item.company_name, + permit_status:item.permit_status, + location:item.location, + geom:item.geom + }}); + }} + children={ + + + Open + } + /> + + { + deleteById(item.company_name); + removeValue(item.company_name+" / "+item.permit_status+" / "+item.location+" / "+item.geom+" / draftPermit"); + }} + children={ + + + Delete + + } + /> + + + + + + + + )) + : Data Kosong diff --git a/src/component/inboxPermit.tsx b/src/component/inboxPermit.tsx index f01a5ec..149d061 100644 --- a/src/component/inboxPermit.tsx +++ b/src/component/inboxPermit.tsx @@ -179,7 +179,7 @@ function InboxPermit({route,navigation}: inboxListDataProps) { - Nama Pipa + {/* Nama Pipa */} Company Name Permit Status diff --git a/src/component/mapCollectScreen.tsx b/src/component/mapCollectScreen.tsx index 7b1efb8..e883b5a 100644 --- a/src/component/mapCollectScreen.tsx +++ b/src/component/mapCollectScreen.tsx @@ -249,7 +249,7 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{ - Longitude + Longitude - Latitude + Latitude { if(isFocused){ + setFilterData([]); + setStingFilter(""); getDataPDAM() // getData() // .catch(console.error); @@ -101,7 +103,7 @@ function SentListPDAM({route,navigation}: sendListDataProps) { const handleSearch = (text:string) => { const formattedQuery = text.toLowerCase(); const filteredData = localStorage.filter((data:any) => - data.case_name.toLowerCase().includes(formattedQuery) + data.pipe_name.toLowerCase().includes(formattedQuery) ) setFilterData(filteredData) @@ -156,7 +158,7 @@ function SentListPDAM({route,navigation}: sendListDataProps) { refreshControl={ } > { - localStorage.length != 0 ? + localStorage.length != 0 && stringFilter === "" ? localStorage.map((item:any,index:number) => ( @@ -230,8 +232,85 @@ function SentListPDAM({route,navigation}: sendListDataProps) { borderBottomWidth: 2, }} /> - - )) + + )) + : + filterData.length > 0 ? + filterData.map((item:any,index:number) => ( + + + + Nama Pipa + Jenis + Tanggal Installasi + Status + + + : {item.pipe_name} + : {item.pipe_type} + : {item.installation_date} + : {item.status} + + + + + + + + + { + navigation.navigate('PDAM Editing',{ screen: 'Edit',data: { + id:item.id, + nama:item.pipe_name, + jenis:item.pipe_type, + tanggal_installasi:item.installation_date, + status:item.status, + keterangan:item.keterangan, + }}); + }} + children={ + + + Edit + } + /> + + { + deleteById(item.pipe_name); + removeValue(item.id+" / "+item.pipe_name+" / "+item.pipe_type+" / "+item.installation_date+" / "+item.status+" / "+item.keterangan+" / "+item.geom+" / sentPDAM"); + }} + children={ + + + Delete + + } + /> + + + + + + + + )) : Data Kosong diff --git a/src/component/sentPJU.tsx b/src/component/sentPJU.tsx index d1de277..2e6d4ac 100644 --- a/src/component/sentPJU.tsx +++ b/src/component/sentPJU.tsx @@ -78,6 +78,8 @@ function SentListPJU({route,navigation}: sendListDataProps) { const isFocused = useIsFocused(); useEffect(() => { if(isFocused){ + setFilterData([]); + setStingFilter(""); getDataPJU() const unsubscribe = NetInfo.addEventListener((state) => { setConnected(state.isConnected!) @@ -95,13 +97,13 @@ function SentListPJU({route,navigation}: sendListDataProps) { }); const [stringFilter,setStingFilter] = useState('') const handleSearch = (text:string) => { - console.log(text); - const formattedQuery = text.toLowerCase(); const filteredData = localStorage.filter((data:any) => - data.case_name.toLowerCase().includes(formattedQuery) + data.pju_name.toLowerCase().includes(formattedQuery) ) setFilterData(filteredData) + // console.log(filteredData); + }; const MoreActionCard = ({show,data}:any) => { @@ -195,7 +197,7 @@ function SentListPJU({route,navigation}: sendListDataProps) { refreshControl={ } > { - localStorage.length != 0 ? + localStorage.length != 0 && stringFilter === "" ? localStorage.map((item:any,index:number) => ( @@ -274,6 +276,85 @@ function SentListPJU({route,navigation}: sendListDataProps) { )) : + filterData.length > 0 ? + filterData.map((item:any,index:number) => ( + + + + Nama JPU + Jenis + Tanggal Installasi + Status + + + : {item.pju_name} + : {item.pju_type} + : {item.installation_date} + : {item.status} + + + + + + + + + { + navigation.navigate('Edit',{ screen: 'Edit',data: { + id:item.id, + 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={ + + + Edit + } + /> + + { + deleteById(item.pju_name); + removeValue(item.id+" / "+item.pju_name+" / "+item.pju_type+" / "+item.installation_date+" / "+item.status+" / "+item.keterangan+" / "+item.long+" / "+item.lat+" / sentPJU"); + }} + children={ + + + Delete + + } + /> + + + + + + + + )) + : Data Kosong diff --git a/src/component/sentPermit.tsx b/src/component/sentPermit.tsx index 16ffd65..31ebc48 100644 --- a/src/component/sentPermit.tsx +++ b/src/component/sentPermit.tsx @@ -80,6 +80,8 @@ function SentListPermit({route,navigation}: sendListDataProps) { const isFocused = useIsFocused(); useEffect(() => { if(isFocused){ + setFilterData([]); + setStingFilter(""); getDataPermit() const unsubscribe = NetInfo.addEventListener((state) => { setConnected(state.isConnected!) @@ -96,8 +98,8 @@ function SentListPermit({route,navigation}: sendListDataProps) { const handleSearch = (text:string) => { const formattedQuery = text.toLowerCase(); const filteredData = localStorage.filter((data:any) => - data.case_name.toLowerCase().includes(formattedQuery) - ) + data.company_name.toLowerCase().includes(formattedQuery) + ); setFilterData(filteredData) }; const optionsStyles = { @@ -156,7 +158,7 @@ function SentListPermit({route,navigation}: sendListDataProps) { } > { - localStorage.length != 0 ? + localStorage.length != 0 && stringFilter === "" ? localStorage.map((item:any,index:number) => ( @@ -226,8 +228,81 @@ function SentListPermit({route,navigation}: sendListDataProps) { borderBottomWidth: 2, }} /> - - )) + + )) + : + filterData.length > 0 ? + filterData.map((item:any,index:number) => ( + + + + Company Name + Permit Status + Location + + + : {item.company_name} + : {item.permit_status} + : {item.location} + + + + + + + + + { + navigation.navigate('Permit Editing',{ screen: 'Edit',data: { + id:item.id, + company_name:item.company_name, + permit_status:item.permit_status, + location:item.location, + }}); + }} + children={ + + + Edit + } + /> + + { + deleteById(item.company_name); + removeValue(item.id+" / "+item.company_name+" / "+item.permit_status+" / "+item.location+" / "+item.geom+" / sentPermit"); + }} + children={ + + + Delete + + } + /> + + + + + + + + )) : Data Kosong