fix detail order, kecamata, bank name, checkbox tnc

This commit is contained in:
shaulascr
2025-08-12 16:28:18 +07:00
parent 0a8dac4d23
commit d4eacf6c7c
10 changed files with 46 additions and 13 deletions

View File

@ -90,7 +90,7 @@ data class OrdersItem(
val orderId: Int,
@field:SerializedName("city_id")
val cityId: Int,
val cityId: String,
var displayStatus: String? = null
)

View File

@ -119,7 +119,7 @@ data class Orders(
val orderId: Int,
@field:SerializedName("city_id")
val cityId: Int
val cityId: String
)
data class OrderListItemsItem(

View File

@ -114,7 +114,7 @@ data class Store(
val storeDescription: String,
@field:SerializedName("city_id")
val cityId: Int
val cityId: String
)
data class ShippingItem(

View File

@ -35,7 +35,7 @@ data class Store(
val detail: String,
@SerializedName("is_store_location") val isStoreLocation: Boolean,
@SerializedName("user_id") val userId: Int,
@SerializedName("city_id") val cityId: Int,
@SerializedName("city_id") val cityId: String,
@SerializedName("province_id") val provinceId: Int,
val phone: String?,
val recipient: String?,

View File

@ -132,5 +132,5 @@ data class Orders(
val username: String? = null,
@field:SerializedName("city_id")
val cityId: Int? = null
val cityId: String? = null
)

View File

@ -129,7 +129,7 @@ data class OrdersItem(
val status: String? = null,
@field:SerializedName("city_id")
val cityId: Int? = null,
val cityId: String? = null,
var displayStatus: String? = null
)

View File

@ -32,6 +32,7 @@ import com.google.android.material.button.MaterialButton
import com.google.android.material.textfield.TextInputLayout
import com.google.gson.Gson
import java.io.File
import java.text.NumberFormat
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
@ -88,7 +89,8 @@ class OrderHistoryAdapter(
tvStoreName.text = storeName
// Set total amount
tvTotalAmount.text = order.totalAmount
tvTotalAmount.text = formatCurrency(order.totalAmount.toDouble())
// Set item count
val itemCount = order.orderItems.size
@ -599,6 +601,11 @@ class OrderHistoryAdapter(
}
}
private fun formatCurrency(amount: Double): String {
val formatter = NumberFormat.getCurrencyInstance(Locale("in", "ID"))
return formatter.format(amount).replace(",00", "")
}
}
companion object {

View File

@ -10,6 +10,8 @@ import com.alya.ecommerce_serang.BuildConfig.BASE_URL
import com.alya.ecommerce_serang.R
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderItemsItem
import com.bumptech.glide.Glide
import java.text.NumberFormat
import java.util.Locale
class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductViewHolder>() {
@ -46,7 +48,7 @@ class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductView
tvQuantity.text = "${product.quantity} buah"
// Set price with currency format
tvProductPrice.text = formatCurrency(product.price)
tvProductPrice.text = formatCurrency(product.price.toDouble())
val fullImageUrl = when (val img = product.productImage) {
is String -> {
@ -65,10 +67,9 @@ class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductView
private fun formatCurrency(amount: Int): String {
// In a real app, you would use NumberFormat for proper currency formatting
// For simplicity, just return a basic formatted string
return "Rp${amount}"
private fun formatCurrency(amount: Double): String {
val formatter = NumberFormat.getCurrencyInstance(Locale("in", "ID"))
return formatter.format(amount).replace(",00", "")
}
}
}

View File

@ -91,6 +91,8 @@ class RegisterStoreActivity : AppCompatActivity() {
provinceAdapter = ProvinceAdapter(this)
cityAdapter = CityAdapter(this)
subdistrictAdapter = SubdsitrictAdapter(this)
bankAdapter = BankAdapter(this)
Log.d(TAG, "onCreate: Adapters initialized")
setupDataBinding()
@ -242,6 +244,7 @@ class RegisterStoreActivity : AppCompatActivity() {
}
is Result.Success -> {
Log.d(TAG, "setupobservers: Subdistrict loaded successfullti: ${state.data.size} subdistrict")
binding.subdistrictProgressBar.visibility = View.GONE
binding.spinnerSubdistrict.isEnabled = true
subdistrictAdapter.updateData(state.data)
@ -460,7 +463,6 @@ class RegisterStoreActivity : AppCompatActivity() {
}
}
bankAdapter = BankAdapter(this)
binding.spinnerBankName.adapter = bankAdapter
binding.spinnerBankName.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(

View File

@ -344,6 +344,29 @@
</LinearLayout>
<!-- Kecamatan -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6. Kecamatan"
style="@style/body_medium"
android:layout_marginEnd="4dp"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="*"
style="@style/body_medium"
android:textColor="@color/red_required"
android:layout_gravity="end"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"