import React, { useState } from "react"; import { View, Text, StyleSheet, TouchableOpacity, Image, TextInput, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { useNavigation } from "@react-navigation/native"; // Import useNavigation untuk navigasi const DetailVerifikasi = () => { const navigation = useNavigation(); // State untuk mengatur status tombol const [isVerified, setIsVerified] = useState(false); // Menyimpan status verifikasi const [showTolakForm, setShowTolakForm] = useState(false); // Menyimpan status tampilkan form alasan tolak const [alasanTolak, setAlasanTolak] = useState(""); // Menyimpan alasan tolak pengaduan const [isTolakClicked, setIsTolakClicked] = useState(false); // Status tombol tolak pengaduan sudah diklik // Fungsi untuk menangani klik tombol verifikasi const handleVerifikasi = () => { setIsVerified(true); // Mengubah status menjadi diverifikasi }; // Fungsi untuk mengirim alasan tolak pengaduan const handleKirimTolak = () => { setIsTolakClicked(true); // Mengubah status tombol tolak menjadi sudah diklik setShowTolakForm(false); // Menutup form setelah alasan dikirim // Navigasi ke halaman DitolakScreen dan mengirim alasan penolakan navigation.navigate("DitolakScreen"); }; return ( {/* Header */} navigation.navigate("PengaduanSampahScreenAdmin")} > VERIFIKASI {/* First Report */} {/* Second Report */} Jihan Pangesti 10/04/2025 13.00 WIB {/* Status */} Dalam Proses Sampah berserakan di Pasar Lama - JI. Sukarno, Nganjuk Catatan: Mohon segera ditindaklanjuti karena sangat mengganggu masyarakat sekitar. {/* Images */} {/* Button to contribute (Verifikasi) */} {isVerified ? "Sudah Diverifikasi" : "Verifikasi"} {/* Button to reject the report, will hide if verified */} {!isVerified && ( setShowTolakForm(true)} disabled={isTolakClicked} // Menonaktifkan tombol jika sudah diklik > {isTolakClicked ? "Tolak Pengaduan" : "Tolak Pengaduan"} )} {/* Form Alasan Tolak Pengaduan */} {showTolakForm && ( Alasan Tolak Pengaduan Kirim )} ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: "#fff", padding: 16, marginTop: 0, }, header: { marginTop: 40, flexDirection: "row", alignItems: "center", marginBottom: 20, }, backButton: { marginRight: 10, }, headerTitle: { fontSize: 20, fontWeight: "bold", color: "#000", }, reportContainer: { marginBottom: 20, padding: 12, borderRadius: 15, backgroundColor: "#fff", borderWidth: 0.5, borderColor: "#000", }, reportHeader: { flexDirection: "row", justifyContent: "space-between", paddingBottom: 10, }, profileContainer: { flexDirection: "row", alignItems: "center", }, profileImage: { width: 40, height: 40, borderRadius: 20, marginRight: 10, }, reporterName: { fontSize: 16, fontWeight: "bold", }, time: { fontSize: 14, color: "#555", }, statusButton: { backgroundColor: "#DDD", borderRadius: 8, paddingVertical: 5, paddingHorizontal: 5, marginVertical: 8, alignItems: "center", width: "32%", borderWidth: 0.5, }, reportStatus: { color: "#000", fontSize: 14, }, reportDescription: { fontSize: 16, color: "#333", marginBottom: 8, }, reportNote: { fontSize: 14, color: "#000", marginBottom: 12, }, imageContainer: { flexDirection: "row", justifyContent: "flex-start", marginBottom: 12, }, reportImage: { width: 100, height: 100, borderRadius: 8, marginRight: 5, marginLeft: 5, }, contributeButton: { backgroundColor: "#2D572C", padding: 10, borderRadius: 8, alignItems: "center", width: "50%", alignContent: "center", justifyContent: "center", marginLeft: 90, marginTop: 20, }, contributeButtonTolak: { backgroundColor: "#8b0000", padding: 10, borderRadius: 8, alignItems: "center", width: "50%", alignContent: "center", justifyContent: "center", marginLeft: 90, marginTop: 20, }, tolakButtonDisabled: { backgroundColor: "#A9A9A9", // Disabled gray padding: 10, borderRadius: 8, alignItems: "center", width: "50%", alignContent: "center", justifyContent: "center", marginLeft: 90, marginTop: 20, }, verifiedButton: { backgroundColor: "#777b7e", padding: 10, borderRadius: 8, alignItems: "center", width: "50%", alignContent: "center", justifyContent: "center", marginLeft: 90, marginTop: 20, borderWidth: 0.5, }, contributeTextSudah: { color: "#fff", fontSize: 16, }, contributeText: { color: "#fff", fontSize: 16, }, formContainer: { marginTop: 20, }, formTitle: { fontSize: 18, fontWeight: "bold", marginBottom: 10, }, textInput: { height: 100, borderColor: "#ddd", borderWidth: 1, borderRadius: 8, padding: 10, fontSize: 16, textAlignVertical: "top", }, submitButton: { backgroundColor: "#2D572C", padding: 10, borderRadius: 8, marginTop: 10, alignItems: "center", }, submitText: { color: "#fff", fontSize: 16, }, }); export default DetailVerifikasi;