mirror of
https://github.com/shaulascr/ecommerce_serang.git
synced 2025-08-13 10:42:21 +00:00
fix detail order, kecamata, bank name, checkbox tnc
This commit is contained in:
@ -90,7 +90,7 @@ data class OrdersItem(
|
||||
val orderId: Int,
|
||||
|
||||
@field:SerializedName("city_id")
|
||||
val cityId: Int,
|
||||
val cityId: String,
|
||||
|
||||
var displayStatus: String? = null
|
||||
)
|
||||
|
@ -119,7 +119,7 @@ data class Orders(
|
||||
val orderId: Int,
|
||||
|
||||
@field:SerializedName("city_id")
|
||||
val cityId: Int
|
||||
val cityId: String
|
||||
)
|
||||
|
||||
data class OrderListItemsItem(
|
||||
|
@ -114,7 +114,7 @@ data class Store(
|
||||
val storeDescription: String,
|
||||
|
||||
@field:SerializedName("city_id")
|
||||
val cityId: Int
|
||||
val cityId: String
|
||||
)
|
||||
|
||||
data class ShippingItem(
|
||||
|
@ -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?,
|
||||
|
@ -132,5 +132,5 @@ data class Orders(
|
||||
val username: String? = null,
|
||||
|
||||
@field:SerializedName("city_id")
|
||||
val cityId: Int? = null
|
||||
val cityId: String? = null
|
||||
)
|
@ -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
|
||||
)
|
||||
|
@ -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 {
|
||||
|
@ -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", "")
|
||||
}
|
||||
}
|
||||
}
|
@ -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(
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user