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.CircleShape 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.material.icons.outlined.* 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.style.TextAlign import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.data.model.AppLanguage import com.example.data.model.EvidenceItem import com.example.ui.theme.* @Composable fun ProofUploadScreen( step: Int, evidenceList: List, isSubmitting: Boolean, submittedReportId: String?, lang: AppLanguage, onAddSampleEvidence: (type: String, title: String, note: String) -> Unit, onRemoveEvidence: (String) -> Unit, onSubmitReport: () -> Unit, onBackToStep1: () -> Unit, onViewTracking: (String) -> Unit, onFinish: () -> Unit, modifier: Modifier = Modifier ) { var declarationAgreed by remember { mutableStateOf(true) } if (step == 3 && submittedReportId != null) { // Step 3: SUCCESS STATE Scaffold( containerColor = MaterialTheme.colorScheme.background, modifier = modifier.fillMaxSize() ) { innerPadding -> Column( modifier = Modifier .fillMaxSize() .padding(innerPadding) .padding(24.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center ) { Box( modifier = Modifier .size(80.dp) .clip(CircleShape) .background(StatusVerifiedGreenBg), contentAlignment = Alignment.Center ) { Icon( imageVector = Icons.Default.CheckCircle, contentDescription = "Success", tint = StatusVerifiedGreen, modifier = Modifier.size(48.dp) ) } Spacer(modifier = Modifier.height(20.dp)) Text( text = if (lang == AppLanguage.BN) "অভিযোগ সফলভাবে গৃহীত হয়েছে!" else "Complaint Submitted Successfully!", style = MaterialTheme.typography.titleLarge.copy( fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onBackground ), textAlign = TextAlign.Center ) Spacer(modifier = Modifier.height(8.dp)) Text( text = if (lang == AppLanguage.BN) "আপনার অভিযোগের ট্র্যাকিং আইডি নিচে দেওয়া হলো। আমাদের তদন্তকারী দল প্রমাণাদি যাচাই করছে।" else "Your tracking ID is generated. Our verification team is analyzing the submitted evidence.", style = MaterialTheme.typography.bodyMedium.copy( color = LightTextSecondary, textAlign = TextAlign.Center ) ) Spacer(modifier = Modifier.height(24.dp)) // Tracking ID Card Surface( color = BrandNavyPrimary.copy(alpha = 0.08f), shape = RoundedCornerShape(14.dp), border = androidx.compose.foundation.BorderStroke(1.5.dp, BrandNavyPrimary.copy(alpha = 0.3f)), modifier = Modifier.fillMaxWidth() ) { Column( modifier = Modifier.padding(16.dp), horizontalAlignment = Alignment.CenterHorizontally ) { Text( text = if (lang == AppLanguage.BN) "কেস ট্র্যাকিং নম্বর (Case ID)" else "Case Tracking Reference", style = MaterialTheme.typography.labelMedium.copy(color = LightTextMuted) ) Spacer(modifier = Modifier.height(4.dp)) Text( text = submittedReportId, style = MaterialTheme.typography.headlineMedium.copy( fontWeight = FontWeight.Black, color = BrandNavyPrimary, letterSpacing = 1.sp ) ) Spacer(modifier = Modifier.height(4.dp)) Text( text = if (lang == AppLanguage.BN) "আনুমানিক যাচাই সময়: ২-৪ ঘণ্টা" else "Estimated verification: 2-4 Hours", style = MaterialTheme.typography.bodySmall.copy( color = StatusAmber, fontWeight = FontWeight.SemiBold ) ) } } Spacer(modifier = Modifier.height(32.dp)) Button( onClick = { onViewTracking(submittedReportId) }, colors = ButtonDefaults.buttonColors(containerColor = BrandNavyPrimary), shape = RoundedCornerShape(12.dp), modifier = Modifier .fillMaxWidth() .height(52.dp) .testTag("btn_view_tracking_from_success") ) { Icon( imageVector = Icons.Default.TrackChanges, contentDescription = null, modifier = Modifier.size(18.dp) ) Spacer(modifier = Modifier.width(8.dp)) Text( text = if (lang == AppLanguage.BN) "কেসের অগ্রগতি ট্র্যাক করুন" else "Track Report Status", fontWeight = FontWeight.Bold ) } Spacer(modifier = Modifier.height(12.dp)) OutlinedButton( onClick = onFinish, shape = RoundedCornerShape(12.dp), modifier = Modifier .fillMaxWidth() .height(50.dp) ) { Text(if (lang == AppLanguage.BN) "হোম পেজে ফিরে যান" else "Return to Home") } } } return } // Step 2: PROOF UPLOAD SCREEN 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 = onBackToStep1, shape = RoundedCornerShape(12.dp), modifier = Modifier .weight(1f) .height(50.dp) ) { Text(if (lang == AppLanguage.BN) "পূর্ববর্তী ধাপ" else "Back") } Button( onClick = onSubmitReport, enabled = declarationAgreed && !isSubmitting, colors = ButtonDefaults.buttonColors(containerColor = StatusWarningRed), shape = RoundedCornerShape(12.dp), modifier = Modifier .weight(1.8f) .height(50.dp) .testTag("btn_final_submit_report") ) { if (isSubmitting) { CircularProgressIndicator(color = Color.White, modifier = Modifier.size(20.dp)) } else { Icon( imageVector = Icons.Default.Send, contentDescription = null, modifier = Modifier.size(18.dp) ) Spacer(modifier = Modifier.width(6.dp)) Text( text = if (lang == AppLanguage.BN) "চূড়ান্ত অভিযোগ দাখিল" else "Submit Report Now", fontWeight = FontWeight.Bold ) } } } } }, modifier = modifier.fillMaxSize() ) { innerPadding -> Column( modifier = Modifier .fillMaxSize() .padding(innerPadding) .verticalScroll(rememberScrollState()) .padding(16.dp) ) { // Step Progress Header Surface( color = StatusWarningRed.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(StatusWarningRed), contentAlignment = Alignment.Center ) { Text( text = "2/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 2: Attach Evidence & Screenshots", style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.Bold) ) Text( text = if (lang == AppLanguage.BN) "বিকাশ/নগদ এসএমএস, চ্যাট বা জাল নথির প্রমাণ যুক্ত করুন" else "Add bKash SMS, WhatsApp chats, or forged document proofs", style = MaterialTheme.typography.bodySmall.copy(color = LightTextMuted, fontSize = 11.sp) ) } } } Spacer(modifier = Modifier.height(20.dp)) Text( text = if (lang == AppLanguage.BN) "দ্রুত প্রমাণ যোগ করুন (Quick Proof Presets)" else "Quick Proof Presets", style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.Bold) ) Spacer(modifier = Modifier.height(10.dp)) // Quick Add Preset Buttons Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp) ) { FilledTonalButton( onClick = { onAddSampleEvidence( "bKash SMS", "bKash TrxID: 9J28A4KL91 (৳12,500)", "Official bKash transaction confirmation SMS receipt" ) }, shape = RoundedCornerShape(8.dp), modifier = Modifier .weight(1f) .testTag("btn_add_bkash_proof") ) { Text( text = if (lang == AppLanguage.BN) "+ বিকাশ SMS" else "+ bKash SMS", fontSize = 11.sp, fontWeight = FontWeight.Bold ) } FilledTonalButton( onClick = { onAddSampleEvidence( "Messenger Chat", "Messenger Deal & Blocking Proof", "Screenshots showing promise of delivery followed by blocking" ) }, shape = RoundedCornerShape(8.dp), modifier = Modifier .weight(1f) .testTag("btn_add_chat_proof") ) { Text( text = if (lang == AppLanguage.BN) "+ চ্যাট স্ক্রিনশট" else "+ Chat Logs", fontSize = 11.sp, fontWeight = FontWeight.Bold ) } FilledTonalButton( onClick = { onAddSampleEvidence( "Fake Contract", "Forged Embassy Stamp Document", "Counterfeit letterhead with unauthorized QR code" ) }, shape = RoundedCornerShape(8.dp), modifier = Modifier .weight(1f) .testTag("btn_add_contract_proof") ) { Text( text = if (lang == AppLanguage.BN) "+ জাল নথি" else "+ Fake Paper", fontSize = 11.sp, fontWeight = FontWeight.Bold ) } } Spacer(modifier = Modifier.height(20.dp)) // Uploaded Evidence List Text( text = "${if (lang == AppLanguage.BN) "সংযুক্ত প্রমাণাদি" else "Attached Evidence"} (${evidenceList.size})", style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold) ) Spacer(modifier = Modifier.height(10.dp)) if (evidenceList.isEmpty()) { Surface( color = LightSurfaceVariant, shape = RoundedCornerShape(12.dp), border = androidx.compose.foundation.BorderStroke(1.dp, LightOutline), modifier = Modifier.fillMaxWidth() ) { Column( modifier = Modifier.padding(24.dp), horizontalAlignment = Alignment.CenterHorizontally ) { Icon( imageVector = Icons.Outlined.UploadFile, contentDescription = null, tint = LightTextMuted, modifier = Modifier.size(36.dp) ) Spacer(modifier = Modifier.height(8.dp)) Text( text = if (lang == AppLanguage.BN) "এখনও কোনো প্রমাণ যুক্ত করেননি" else "No evidence attached yet", style = MaterialTheme.typography.bodyMedium.copy(color = LightTextMuted) ) Spacer(modifier = Modifier.height(4.dp)) Text( text = if (lang == AppLanguage.BN) "উপরের বাটনগুলো চাপুন বা প্রমাণ নির্বাচন করুন" else "Tap preset buttons above to attach proof files", style = MaterialTheme.typography.bodySmall.copy(color = BrandNavyPrimary, fontWeight = FontWeight.Bold) ) } } } else { Column(verticalArrangement = Arrangement.spacedBy(8.dp)) { evidenceList.forEach { item -> Surface( color = MaterialTheme.colorScheme.surface, shape = RoundedCornerShape(10.dp), border = androidx.compose.foundation.BorderStroke(1.dp, LightOutline), modifier = Modifier.fillMaxWidth() ) { Row( modifier = Modifier .fillMaxWidth() .padding(12.dp), verticalAlignment = Alignment.CenterVertically ) { Box( modifier = Modifier .size(36.dp) .clip(RoundedCornerShape(8.dp)) .background(StatusReviewBlueBg), contentAlignment = Alignment.Center ) { Icon( imageVector = Icons.Default.ReceiptLong, contentDescription = null, tint = BrandBlueAccent, modifier = Modifier.size(20.dp) ) } Spacer(modifier = Modifier.width(10.dp)) Column(modifier = Modifier.weight(1f)) { Text( text = item.title, style = MaterialTheme.typography.bodyMedium.copy(fontWeight = FontWeight.Bold), maxLines = 1 ) Text( text = "${item.type} • ${item.note}", style = MaterialTheme.typography.bodySmall.copy( color = LightTextSecondary, fontSize = 11.sp ), maxLines = 1 ) } IconButton( onClick = { onRemoveEvidence(item.id) }, modifier = Modifier.size(32.dp) ) { Icon( imageVector = Icons.Default.DeleteOutline, contentDescription = "Remove", tint = StatusWarningRed, modifier = Modifier.size(18.dp) ) } } } } } } Spacer(modifier = Modifier.height(24.dp)) // Declaration Checkbox 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.Top ) { Checkbox( checked = declarationAgreed, onCheckedChange = { declarationAgreed = it }, colors = CheckboxDefaults.colors(checkedColor = BrandNavyPrimary) ) Spacer(modifier = Modifier.width(6.dp)) Text( text = if (lang == AppLanguage.BN) "আমি সজ্ঞানে ঘোষণা করছি যে উপরে প্রদত্ত তথ্য ও প্রমাণাদি সত্য ও নির্ভুল। কোনো মিথ্যা বা উদ্দেশ্যপ্রণোদিত রিপোর্ট আইনত দণ্ডনীয়।" else "I hereby declare that all submitted facts and evidence are authentic and truthful. Providing false information is punishable by law.", style = MaterialTheme.typography.bodySmall.copy( color = MaterialTheme.colorScheme.onSurface, lineHeight = 16.sp ) ) } } Spacer(modifier = Modifier.height(24.dp)) } } }