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,
|
val orderId: Int,
|
||||||
|
|
||||||
@field:SerializedName("city_id")
|
@field:SerializedName("city_id")
|
||||||
val cityId: Int,
|
val cityId: String,
|
||||||
|
|
||||||
var displayStatus: String? = null
|
var displayStatus: String? = null
|
||||||
)
|
)
|
||||||
|
@ -119,7 +119,7 @@ data class Orders(
|
|||||||
val orderId: Int,
|
val orderId: Int,
|
||||||
|
|
||||||
@field:SerializedName("city_id")
|
@field:SerializedName("city_id")
|
||||||
val cityId: Int
|
val cityId: String
|
||||||
)
|
)
|
||||||
|
|
||||||
data class OrderListItemsItem(
|
data class OrderListItemsItem(
|
||||||
|
@ -114,7 +114,7 @@ data class Store(
|
|||||||
val storeDescription: String,
|
val storeDescription: String,
|
||||||
|
|
||||||
@field:SerializedName("city_id")
|
@field:SerializedName("city_id")
|
||||||
val cityId: Int
|
val cityId: String
|
||||||
)
|
)
|
||||||
|
|
||||||
data class ShippingItem(
|
data class ShippingItem(
|
||||||
|
@ -35,7 +35,7 @@ data class Store(
|
|||||||
val detail: String,
|
val detail: String,
|
||||||
@SerializedName("is_store_location") val isStoreLocation: Boolean,
|
@SerializedName("is_store_location") val isStoreLocation: Boolean,
|
||||||
@SerializedName("user_id") val userId: Int,
|
@SerializedName("user_id") val userId: Int,
|
||||||
@SerializedName("city_id") val cityId: Int,
|
@SerializedName("city_id") val cityId: String,
|
||||||
@SerializedName("province_id") val provinceId: Int,
|
@SerializedName("province_id") val provinceId: Int,
|
||||||
val phone: String?,
|
val phone: String?,
|
||||||
val recipient: String?,
|
val recipient: String?,
|
||||||
|
@ -132,5 +132,5 @@ data class Orders(
|
|||||||
val username: String? = null,
|
val username: String? = null,
|
||||||
|
|
||||||
@field:SerializedName("city_id")
|
@field:SerializedName("city_id")
|
||||||
val cityId: Int? = null
|
val cityId: String? = null
|
||||||
)
|
)
|
@ -129,7 +129,7 @@ data class OrdersItem(
|
|||||||
val status: String? = null,
|
val status: String? = null,
|
||||||
|
|
||||||
@field:SerializedName("city_id")
|
@field:SerializedName("city_id")
|
||||||
val cityId: Int? = null,
|
val cityId: String? = null,
|
||||||
|
|
||||||
var displayStatus: 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.android.material.textfield.TextInputLayout
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.text.NumberFormat
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
@ -88,7 +89,8 @@ class OrderHistoryAdapter(
|
|||||||
tvStoreName.text = storeName
|
tvStoreName.text = storeName
|
||||||
|
|
||||||
// Set total amount
|
// Set total amount
|
||||||
tvTotalAmount.text = order.totalAmount
|
tvTotalAmount.text = formatCurrency(order.totalAmount.toDouble())
|
||||||
|
|
||||||
|
|
||||||
// Set item count
|
// Set item count
|
||||||
val itemCount = order.orderItems.size
|
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 {
|
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.R
|
||||||
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderItemsItem
|
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderItemsItem
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
import java.text.NumberFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductViewHolder>() {
|
class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductViewHolder>() {
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductView
|
|||||||
tvQuantity.text = "${product.quantity} buah"
|
tvQuantity.text = "${product.quantity} buah"
|
||||||
|
|
||||||
// Set price with currency format
|
// Set price with currency format
|
||||||
tvProductPrice.text = formatCurrency(product.price)
|
tvProductPrice.text = formatCurrency(product.price.toDouble())
|
||||||
|
|
||||||
val fullImageUrl = when (val img = product.productImage) {
|
val fullImageUrl = when (val img = product.productImage) {
|
||||||
is String -> {
|
is String -> {
|
||||||
@ -65,10 +67,9 @@ class OrderProductAdapter : RecyclerView.Adapter<OrderProductAdapter.ProductView
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private fun formatCurrency(amount: Int): String {
|
private fun formatCurrency(amount: Double): String {
|
||||||
// In a real app, you would use NumberFormat for proper currency formatting
|
val formatter = NumberFormat.getCurrencyInstance(Locale("in", "ID"))
|
||||||
// For simplicity, just return a basic formatted string
|
return formatter.format(amount).replace(",00", "")
|
||||||
return "Rp${amount}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -91,6 +91,8 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
provinceAdapter = ProvinceAdapter(this)
|
provinceAdapter = ProvinceAdapter(this)
|
||||||
cityAdapter = CityAdapter(this)
|
cityAdapter = CityAdapter(this)
|
||||||
|
subdistrictAdapter = SubdsitrictAdapter(this)
|
||||||
|
bankAdapter = BankAdapter(this)
|
||||||
Log.d(TAG, "onCreate: Adapters initialized")
|
Log.d(TAG, "onCreate: Adapters initialized")
|
||||||
|
|
||||||
setupDataBinding()
|
setupDataBinding()
|
||||||
@ -242,6 +244,7 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
is Result.Success -> {
|
is Result.Success -> {
|
||||||
Log.d(TAG, "setupobservers: Subdistrict loaded successfullti: ${state.data.size} subdistrict")
|
Log.d(TAG, "setupobservers: Subdistrict loaded successfullti: ${state.data.size} subdistrict")
|
||||||
|
binding.subdistrictProgressBar.visibility = View.GONE
|
||||||
binding.spinnerSubdistrict.isEnabled = true
|
binding.spinnerSubdistrict.isEnabled = true
|
||||||
|
|
||||||
subdistrictAdapter.updateData(state.data)
|
subdistrictAdapter.updateData(state.data)
|
||||||
@ -460,7 +463,6 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bankAdapter = BankAdapter(this)
|
|
||||||
binding.spinnerBankName.adapter = bankAdapter
|
binding.spinnerBankName.adapter = bankAdapter
|
||||||
binding.spinnerBankName.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
binding.spinnerBankName.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
override fun onItemSelected(
|
override fun onItemSelected(
|
||||||
|
@ -344,6 +344,29 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Kecamatan -->
|
<!-- 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
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
Reference in New Issue
Block a user