package com.example.ui.screens import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.* import androidx.compose.material3.* import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.testTag import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.data.model.AppLanguage import com.example.ui.components.CustomLabeledTextField import com.example.ui.components.VisibleFieldLabel import com.example.ui.theme.* @OptIn(ExperimentalMaterial3Api::class) @Composable fun ReportFormScreen( targetName: String, contactInfo: String, category: String, city: String, description: String, moneyLost: String, incidentDate: String, isAnonymous: Boolean, reporterName: String, reporterPhone: String, errors: Map, lang: AppLanguage, onFieldChange: ( targetName: String?, contactInfo: String?, category: String?, city: String?, description: String?, moneyLost: String?, isAnonymous: Boolean?, reporterName: String?, reporterPhone: String? ) -> Unit, onProceedToProof: () -> Unit, onCancel: () -> Unit, modifier: Modifier = Modifier ) { val categories = listOf( "Fake E-commerce", "Visa & Overseas Job Fraud", "Loan App Blackmail & Extortion", "bKash / Nagad Lottery Phishing", "Telegram Task & Ponzi Scheme", "Fake Facebook Marketplace Seller" ) val cities = listOf("Dhaka", "Chittagong", "Sylhet", "Rajshahi", "Khulna", "Barisal", "Rangpur", "Mymensingh") var categoryDropdownExpanded by remember { mutableStateOf(false) } var cityDropdownExpanded by remember { mutableStateOf(false) } Scaffold( containerColor = MaterialTheme.colorScheme.background, bottomBar = { Surface( color = MaterialTheme.colorScheme.surface, tonalElevation = 8.dp, border = androidx.compose.foundation.BorderStroke(1.dp, LightOutline), modifier = Modifier.fillMaxWidth() ) { Row( modifier = Modifier .fillMaxWidth() .padding(16.dp) .navigationBarsPadding(), horizontalArrangement = Arrangement.spacedBy(12.dp) ) { OutlinedButton( onClick = onCancel, shape = RoundedCornerShape(12.dp), modifier = Modifier .weight(1f) .height(50.dp) ) { Text(if (lang == AppLanguage.BN) "বাতিল" else "Cancel") } Button( onClick = onProceedToProof, colors = ButtonDefaults.buttonColors(containerColor = BrandNavyPrimary), shape = RoundedCornerShape(12.dp), modifier = Modifier .weight(1.8f) .height(50.dp) .testTag("btn_proceed_to_proof") ) { Text( text = if (lang == AppLanguage.BN) "প্রমাণ আপলোডে যান (Step 2) ›" else "Proceed to Proof (Step 2) ›", fontWeight = FontWeight.Bold ) } } } }, modifier = modifier.fillMaxSize() ) { innerPadding -> Column( modifier = Modifier .fillMaxSize() .padding(innerPadding) .verticalScroll(rememberScrollState()) .padding(16.dp) ) { // Step Progress Header Surface( color = BrandNavyPrimary.copy(alpha = 0.08f), shape = RoundedCornerShape(12.dp), modifier = Modifier.fillMaxWidth() ) { Row( modifier = Modifier .fillMaxWidth() .padding(12.dp), verticalAlignment = Alignment.CenterVertically ) { Box( modifier = Modifier .size(28.dp) .clip(RoundedCornerShape(6.dp)) .background(BrandNavyPrimary), contentAlignment = Alignment.Center ) { Text( text = "1/2", color = Color.White, style = MaterialTheme.typography.labelMedium.copy(fontWeight = FontWeight.Bold) ) } Spacer(modifier = Modifier.width(10.dp)) Column { Text( text = if (lang == AppLanguage.BN) "ধাপ ১: ঘটনার প্রাথমিক বিবরণ" else "Step 1: Incident & Scammer Details", style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.Bold) ) Text( text = if (lang == AppLanguage.BN) "সঠিক তথ্য দিলে দ্রুত সত্যতা যাচাই করা সম্ভব হবে" else "Provide accurate information to speed up verification", style = MaterialTheme.typography.bodySmall.copy(color = LightTextMuted, fontSize = 11.sp) ) } } } Spacer(modifier = Modifier.height(20.dp)) // 1. Entity / Scammer Name CustomLabeledTextField( label = if (lang == AppLanguage.BN) "প্রতারক বা অভিযুক্ত প্রতিষ্ঠানের নাম" else "Suspect Company or Entity Name", value = targetName, onValueChange = { onFieldChange(it, null, null, null, null, null, null, null, null) }, placeholder = if (lang == AppLanguage.BN) "যেমন: BD Gadget Hub 24 / কুইক লোন অ্যাপ" else "e.g., Euro Visa Agency, Facebook Page Name", isRequired = true, errorMessage = errors["targetName"], leadingIcon = Icons.Default.Business, testTag = "input_report_target_name" ) Spacer(modifier = Modifier.height(16.dp)) // 2. Contact Info (bKash/Phone/URL) CustomLabeledTextField( label = if (lang == AppLanguage.BN) "প্রতারকের মোবাইল / বিকাশ নম্বর বা ফেসবুক লিংক" else "Scammer Mobile, bKash No, or Facebook Link", value = contactInfo, onValueChange = { onFieldChange(null, it, null, null, null, null, null, null, null) }, placeholder = "018XXXXXXXX, https://facebook.com/...", isRequired = true, errorMessage = errors["contactInfo"], leadingIcon = Icons.Default.PhoneIphone, testTag = "input_report_contact_info" ) Spacer(modifier = Modifier.height(16.dp)) // 3. Scam Category Dropdown Column(modifier = Modifier.fillMaxWidth()) { VisibleFieldLabel( label = if (lang == AppLanguage.BN) "প্রতারণার ধরন (Scam Category)" else "Scam Category", isRequired = true ) ExposedDropdownMenuBox( expanded = categoryDropdownExpanded, onExpandedChange = { categoryDropdownExpanded = !categoryDropdownExpanded } ) { OutlinedTextField( value = category, onValueChange = {}, readOnly = true, trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = categoryDropdownExpanded) }, shape = RoundedCornerShape(10.dp), colors = OutlinedTextFieldDefaults.colors( focusedBorderColor = BrandBlueAccent, unfocusedBorderColor = LightOutline ), modifier = Modifier .fillMaxWidth() .menuAnchor() .testTag("dropdown_scam_category") ) ExposedDropdownMenu( expanded = categoryDropdownExpanded, onDismissRequest = { categoryDropdownExpanded = false } ) { categories.forEach { cat -> DropdownMenuItem( text = { Text(cat) }, onClick = { onFieldChange(null, null, cat, null, null, null, null, null, null) categoryDropdownExpanded = false } ) } } } } Spacer(modifier = Modifier.height(16.dp)) // 4. Money Lost & City Row Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp) ) { Column(modifier = Modifier.weight(1.2f)) { CustomLabeledTextField( label = if (lang == AppLanguage.BN) "ক্ষতির পরিমাণ (BDT ৳)" else "Amount Lost (BDT ৳)", value = moneyLost, onValueChange = { onFieldChange(null, null, null, null, null, it, null, null, null) }, placeholder = "e.g., 15000", isRequired = false, leadingIcon = Icons.Default.AttachMoney, keyboardType = KeyboardType.Number, testTag = "input_report_money_lost" ) } Column(modifier = Modifier.weight(1f)) { VisibleFieldLabel( label = if (lang == AppLanguage.BN) "বিভাগ / শহর" else "Division / City", isRequired = false ) ExposedDropdownMenuBox( expanded = cityDropdownExpanded, onExpandedChange = { cityDropdownExpanded = !cityDropdownExpanded } ) { OutlinedTextField( value = city, onValueChange = {}, readOnly = true, trailingIcon = { ExposedDropdownMenuDefaults.TrailingIcon(expanded = cityDropdownExpanded) }, shape = RoundedCornerShape(10.dp), colors = OutlinedTextFieldDefaults.colors( focusedBorderColor = BrandBlueAccent, unfocusedBorderColor = LightOutline ), modifier = Modifier .fillMaxWidth() .menuAnchor() .testTag("dropdown_city") ) ExposedDropdownMenu( expanded = cityDropdownExpanded, onDismissRequest = { cityDropdownExpanded = false } ) { cities.forEach { c -> DropdownMenuItem( text = { Text(c) }, onClick = { onFieldChange(null, null, null, c, null, null, null, null, null) cityDropdownExpanded = false } ) } } } } } Spacer(modifier = Modifier.height(16.dp)) // 5. Detailed Description CustomLabeledTextField( label = if (lang == AppLanguage.BN) "ঘটনার বিস্তারিত বিবরণ" else "Detailed Description of Incident", value = description, onValueChange = { onFieldChange(null, null, null, null, it, null, null, null, null) }, placeholder = if (lang == AppLanguage.BN) "কীভাবে যোগাযোগ হয়েছিল, অগ্রিম টাকা নেওয়ার পর কী হয়েছিল তা লিখুন..." else "Describe how they contacted you, payment method, and what happened...", isRequired = true, singleLine = false, maxLines = 4, errorMessage = errors["description"], testTag = "input_report_description", modifier = Modifier.heightIn(min = 120.dp) ) Spacer(modifier = Modifier.height(16.dp)) // 6. Anonymous Report Option Surface( color = MaterialTheme.colorScheme.surface, shape = RoundedCornerShape(12.dp), border = androidx.compose.foundation.BorderStroke(1.dp, LightOutline), modifier = Modifier.fillMaxWidth() ) { Row( modifier = Modifier .fillMaxWidth() .padding(12.dp), verticalAlignment = Alignment.CenterVertically ) { Checkbox( checked = isAnonymous, onCheckedChange = { onFieldChange(null, null, null, null, null, null, it, null, null) }, colors = CheckboxDefaults.colors(checkedColor = BrandNavyPrimary), modifier = Modifier.testTag("checkbox_anonymous") ) Spacer(modifier = Modifier.width(8.dp)) Column { Text( text = if (lang == AppLanguage.BN) "রিপোর্টে আমার পরিচয় গোপন রাখুন" else "File as Anonymous Citizen Report", style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Bold) ) Text( text = if (lang == AppLanguage.BN) "পাবলিক সতর্কবার্তা প্রকাশের সময় আপনার নাম দেখানো হবে না।" else "Your name and contact will remain hidden from the public feed.", style = MaterialTheme.typography.bodySmall.copy(color = LightTextMuted, fontSize = 11.sp) ) } } } Spacer(modifier = Modifier.height(24.dp)) } } }