This commit is contained in:
Gracia Hotmauli
2025-04-25 13:05:51 +07:00
parent 6da871d28a
commit bf6118ab39
15 changed files with 110 additions and 183 deletions

View File

@ -33,16 +33,7 @@
android:name=".ui.order.detail.PaymentActivity"
android:exported="false" />
<activity
android:name=".ui.order.detail.AddEvidencePaymentActivity"
android:exported="false" />
<activity
android:name=".ui.order.history.HistoryActivity"
android:exported="false" />
<activity
android:name=".ui.order.detail.PaymentActivity"
android:exported="false" />
<activity
android:name=".data.api.response.cart.CartActivity"
android:name=".data.api.response.customer.cart.CartActivity"
android:exported="false" />
<activity
android:name=".ui.order.address.EditAddressActivity"

View File

@ -1,59 +1,94 @@
package com.alya.ecommerce_serang.data.api.dto
import com.alya.ecommerce_serang.data.api.response.store.orders.Address
import com.alya.ecommerce_serang.data.api.response.store.orders.OrderItemsItem
import com.alya.ecommerce_serang.data.api.response.store.orders.Payment
import com.alya.ecommerce_serang.data.api.response.store.orders.Shipment
import com.alya.ecommerce_serang.data.api.response.store.orders.Voucher
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderItemsItem
import com.google.gson.annotations.SerializedName
data class OrdersItem(
@field:SerializedName("address")
val address: Address? = null,
@field:SerializedName("receipt_num")
val receiptNum: Int? = null,
@field:SerializedName("shipment")
val shipment: Shipment? = null,
@field:SerializedName("voucher")
val voucher: Voucher? = null,
@field:SerializedName("address_id")
val addressId: Int? = null,
@field:SerializedName("is_negotiable")
val isNegotiable: Boolean? = null,
@field:SerializedName("latitude")
val latitude: String,
@field:SerializedName("created_at")
val createdAt: String? = null,
val createdAt: String,
@field:SerializedName("payment_method_id")
val paymentMethodId: Int? = null,
@field:SerializedName("voucher_code")
val voucherCode: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String? = null,
val updatedAt: String,
@field:SerializedName("user_id")
val userId: Int? = null,
@field:SerializedName("etd")
val etd: String,
@field:SerializedName("total_amount")
val totalAmount: String? = null,
@field:SerializedName("street")
val street: String,
@field:SerializedName("voucher_id")
val voucherId: Any? = null,
@field:SerializedName("cancel_date")
val cancelDate: String? = null,
@field:SerializedName("payment")
val payment: Payment? = null,
@field:SerializedName("longitude")
val longitude: String,
@field:SerializedName("order_id")
val orderId: Int? = null,
@field:SerializedName("username")
val username: String? = null,
@field:SerializedName("status")
val status: String? = null,
@field:SerializedName("shipment_status")
val shipmentStatus: String,
@field:SerializedName("order_items")
val orderItems: List<OrderItemsItem?>? = null
val orderItems: List<OrderItemsItem>,
@field:SerializedName("auto_completed_at")
val autoCompletedAt: String? = null,
@field:SerializedName("is_store_location")
val isStoreLocation: Boolean? = null,
@field:SerializedName("voucher_name")
val voucherName: String? = null,
@field:SerializedName("address_id")
val addressId: Int,
@field:SerializedName("cancel_reason")
val cancelReason: String? = null,
@field:SerializedName("total_amount")
val totalAmount: String,
@field:SerializedName("user_id")
val userId: Int,
@field:SerializedName("province_id")
val provinceId: Int,
@field:SerializedName("courier")
val courier: String,
@field:SerializedName("subdistrict")
val subdistrict: String,
@field:SerializedName("service")
val service: String,
@field:SerializedName("shipment_price")
val shipmentPrice: String,
@field:SerializedName("voucher_id")
val voucherId: Int? = null,
@field:SerializedName("payment_info_id")
val paymentInfoId: Int? = null,
@field:SerializedName("detail")
val detail: String,
@field:SerializedName("postal_code")
val postalCode: String,
@field:SerializedName("order_id")
val orderId: Int,
@field:SerializedName("city_id")
val cityId: Int
)

View File

@ -1,5 +1,6 @@
package com.alya.ecommerce_serang.data.api.response.customer.order
import com.alya.ecommerce_serang.data.api.dto.OrdersItem
import com.google.gson.annotations.SerializedName
data class OrderListResponse(
@ -37,93 +38,3 @@ data class OrderItemsItem(
@field:SerializedName("product_name")
val productName: String
)
data class OrdersItem(
@field:SerializedName("receipt_num")
val receiptNum: Int? = null,
@field:SerializedName("latitude")
val latitude: String,
@field:SerializedName("created_at")
val createdAt: String,
@field:SerializedName("voucher_code")
val voucherCode: String? = null,
@field:SerializedName("updated_at")
val updatedAt: String,
@field:SerializedName("etd")
val etd: String,
@field:SerializedName("street")
val street: String,
@field:SerializedName("cancel_date")
val cancelDate: String? = null,
@field:SerializedName("longitude")
val longitude: String,
@field:SerializedName("shipment_status")
val shipmentStatus: String,
@field:SerializedName("order_items")
val orderItems: List<OrderItemsItem>,
@field:SerializedName("auto_completed_at")
val autoCompletedAt: String? = null,
@field:SerializedName("is_store_location")
val isStoreLocation: Boolean? = null,
@field:SerializedName("voucher_name")
val voucherName: String? = null,
@field:SerializedName("address_id")
val addressId: Int,
@field:SerializedName("cancel_reason")
val cancelReason: String? = null,
@field:SerializedName("total_amount")
val totalAmount: String,
@field:SerializedName("user_id")
val userId: Int,
@field:SerializedName("province_id")
val provinceId: Int,
@field:SerializedName("courier")
val courier: String,
@field:SerializedName("subdistrict")
val subdistrict: String,
@field:SerializedName("service")
val service: String,
@field:SerializedName("shipment_price")
val shipmentPrice: String,
@field:SerializedName("voucher_id")
val voucherId: Int? = null,
@field:SerializedName("payment_info_id")
val paymentInfoId: Int? = null,
@field:SerializedName("detail")
val detail: String,
@field:SerializedName("postal_code")
val postalCode: String,
@field:SerializedName("order_id")
val orderId: Int,
@field:SerializedName("city_id")
val cityId: Int
)

View File

@ -28,8 +28,8 @@ import com.alya.ecommerce_serang.data.api.response.customer.order.CourierCostRes
import com.alya.ecommerce_serang.data.api.response.customer.order.CreateOrderResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.ListCityResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.ListProvinceResponse
import com.alya.ecommerce_serang.data.api.response.order.OrderDetailResponse
import com.alya.ecommerce_serang.data.api.response.order.OrderListResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderDetailResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderListResponse
import com.alya.ecommerce_serang.data.api.response.customer.product.AllProductResponse
import com.alya.ecommerce_serang.data.api.response.customer.product.CategoryResponse
import com.alya.ecommerce_serang.data.api.response.customer.product.DetailStoreProductResponse
@ -39,12 +39,12 @@ import com.alya.ecommerce_serang.data.api.response.customer.product.StoreRespons
import com.alya.ecommerce_serang.data.api.response.customer.profile.AddressResponse
import com.alya.ecommerce_serang.data.api.response.customer.profile.CreateAddressResponse
import com.alya.ecommerce_serang.data.api.response.customer.profile.ProfileResponse
import com.alya.ecommerce_serang.data.api.response.store.orders.OrderListResponse
import com.alya.ecommerce_serang.data.api.response.store.product.DeleteProductResponse
import com.alya.ecommerce_serang.data.api.response.store.product.UpdateProductResponse
import retrofit2.Call
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.GET
@ -211,18 +211,6 @@ interface ApiService {
suspend fun getOrdersByStatus(
@Query("status") status: String
): Response<OrderListResponse>
@PUT("store/order/update")
suspend fun confirmOrder(
@Body confirmOrder : CompletedOrderRequest
): Response<CompletedOrderResponse>
@Multipart
@POST("addcomplaint")
suspend fun addComplaint(
@Part("order_id") orderId: RequestBody,
@Part("description") description: RequestBody,
@Part complaintimg: MultipartBody.Part
): Response<ComplaintResponse>
@PUT("store/order/update")
suspend fun confirmOrder(
@ -236,4 +224,5 @@ interface ApiService {
@Part("description") description: RequestBody,
@Part complaintimg: MultipartBody.Part
): Response<ComplaintResponse>
}

View File

@ -7,22 +7,23 @@ import com.alya.ecommerce_serang.data.api.dto.CourierCostRequest
import com.alya.ecommerce_serang.data.api.dto.CreateAddressRequest
import com.alya.ecommerce_serang.data.api.dto.OrderRequest
import com.alya.ecommerce_serang.data.api.dto.OrderRequestBuy
import com.alya.ecommerce_serang.data.api.dto.OrdersItem
import com.alya.ecommerce_serang.data.api.dto.UserProfile
import com.alya.ecommerce_serang.data.api.response.cart.DataItem
import com.alya.ecommerce_serang.data.api.response.customer.cart.DataItem
import com.alya.ecommerce_serang.data.api.response.customer.order.CreateOrderResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderDetailResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderListResponse
import com.alya.ecommerce_serang.data.api.response.customer.product.ProductResponse
import com.alya.ecommerce_serang.data.api.response.order.AddEvidenceResponse
import com.alya.ecommerce_serang.data.api.response.order.ComplaintResponse
import com.alya.ecommerce_serang.data.api.response.order.CompletedOrderResponse
import com.alya.ecommerce_serang.data.api.response.order.CourierCostResponse
import com.alya.ecommerce_serang.data.api.response.order.CreateOrderResponse
import com.alya.ecommerce_serang.data.api.response.order.ListCityResponse
import com.alya.ecommerce_serang.data.api.response.order.ListProvinceResponse
import com.alya.ecommerce_serang.data.api.response.order.OrderDetailResponse
import com.alya.ecommerce_serang.data.api.response.order.OrderListResponse
import com.alya.ecommerce_serang.data.api.response.product.ProductResponse
import com.alya.ecommerce_serang.data.api.response.product.StoreProduct
import com.alya.ecommerce_serang.data.api.response.product.StoreResponse
import com.alya.ecommerce_serang.data.api.response.profile.AddressResponse
import com.alya.ecommerce_serang.data.api.response.profile.CreateAddressResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.CourierCostResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.ListCityResponse
import com.alya.ecommerce_serang.data.api.response.customer.order.ListProvinceResponse
import com.alya.ecommerce_serang.data.api.response.customer.product.StoreProduct
import com.alya.ecommerce_serang.data.api.response.customer.product.StoreResponse
import com.alya.ecommerce_serang.data.api.response.customer.profile.AddressResponse
import com.alya.ecommerce_serang.data.api.response.customer.profile.CreateAddressResponse
import com.alya.ecommerce_serang.data.api.retrofit.ApiService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
@ -233,7 +234,7 @@ class OrderRepository(private val apiService: ApiService) {
return if (response.isSuccessful) response.body() else null
}
suspend fun fetchSells(): List<OrdersItem?> {
suspend fun fetchSells(): List<OrdersItem> {
return try {
val response = apiService.getAllOrders() // Replace with the actual method from your ApiService
if (response.isSuccessful) {

View File

@ -8,8 +8,8 @@ import androidx.lifecycle.viewModelScope
import com.alya.ecommerce_serang.data.api.dto.AddEvidenceMultipartRequest
import com.alya.ecommerce_serang.data.api.response.order.AddEvidenceResponse
import com.alya.ecommerce_serang.data.api.response.order.CompletedOrderResponse
import com.alya.ecommerce_serang.data.api.response.order.OrderListItemsItem
import com.alya.ecommerce_serang.data.api.response.order.Orders
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderListItemsItem
import com.alya.ecommerce_serang.data.api.response.customer.order.Orders
import com.alya.ecommerce_serang.data.repository.OrderRepository
import com.alya.ecommerce_serang.data.repository.Result
import kotlinx.coroutines.launch

View File

@ -6,8 +6,8 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.alya.ecommerce_serang.data.api.dto.CompletedOrderRequest
import com.alya.ecommerce_serang.data.api.dto.OrdersItem
import com.alya.ecommerce_serang.data.api.response.order.CompletedOrderResponse
import com.alya.ecommerce_serang.data.api.response.order.OrdersItem
import com.alya.ecommerce_serang.data.repository.OrderRepository
import com.alya.ecommerce_serang.data.repository.Result
import com.alya.ecommerce_serang.ui.order.address.ViewState

View File

@ -21,7 +21,7 @@ import androidx.lifecycle.findViewTreeLifecycleOwner
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.alya.ecommerce_serang.R
import com.alya.ecommerce_serang.data.api.response.order.OrdersItem
import com.alya.ecommerce_serang.data.api.dto.OrdersItem
import com.alya.ecommerce_serang.ui.order.detail.PaymentActivity
import com.google.android.material.button.MaterialButton
import com.google.android.material.textfield.TextInputLayout

View File

@ -8,7 +8,7 @@ import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import com.alya.ecommerce_serang.data.api.response.order.OrdersItem
import com.alya.ecommerce_serang.data.api.dto.OrdersItem
import com.alya.ecommerce_serang.data.api.retrofit.ApiConfig
import com.alya.ecommerce_serang.data.repository.OrderRepository
import com.alya.ecommerce_serang.data.repository.Result

View File

@ -7,7 +7,7 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.alya.ecommerce_serang.R
import com.alya.ecommerce_serang.data.api.response.order.OrderItemsItem
import com.alya.ecommerce_serang.data.api.response.customer.order.OrderItemsItem
import com.bumptech.glide.Glide
import com.google.android.material.button.MaterialButton

View File

@ -61,7 +61,7 @@ class SellsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
// Determine the view type based on the order status
override fun getItemViewType(position: Int): Int {
val order = orderList[position]
return when (order?.status) {
return when (order?.shipmentStatus) {
"pending" -> TYPE_PENDING
"paid" -> TYPE_PAYMENT
"shipped" -> TYPE_SHIPMENT
@ -94,7 +94,7 @@ class SellsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
fun bind(order: OrdersItem?) {
tvOrderNumber.text = "Order #${order?.orderId}"
tvOrderCustomer.text = order?.username
tvOrderCustomer.text = order?.userId.toString()
tvOrderPrice.text = "Total: ${order?.totalAmount}"
}
}
@ -107,7 +107,7 @@ class SellsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
fun bind(order: OrdersItem?) {
tvPaymentNumber.text = "Order #${order?.orderId}"
tvPaymentCustomer.text = order?.username
tvPaymentCustomer.text = order?.userId.toString()
tvPaymentPrice.text = "Paid: ${order?.totalAmount}"
}
}
@ -119,7 +119,7 @@ class SellsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
fun bind(order: OrdersItem?) {
tvShipmentNumber.text = "Shipment #${order?.orderId}"
tvShipmentLocation.text = "Location: ${order?.address?.subdistrict}"
tvShipmentLocation.text = "Location: ${order?.addressId.toString()}"
}
}

View File

@ -51,7 +51,7 @@ class OrderAdapter : RecyclerView.Adapter<OrderAdapter.OrderViewHolder>() {
fun bind(order: OrdersItem?) {
tvOrderNumber.text = "No. Pesanan: ${order?.orderId}"
tvOrderCustomer.text = order?.username
tvOrderCustomer.text = order?.userId.toString()
tvOrderDue.text = order?.createdAt + 7
tvOrderQty.text = "${order?.orderItems?.size} produk"
tvOrderPrice.text = "Rp${order?.totalAmount}"

View File

@ -54,8 +54,8 @@ class PaymentAdapter : RecyclerView.Adapter<PaymentAdapter.PaymentViewHolder>()
tvPaymentDue.text = order?.createdAt + 7
tvPaymentQty.text = "${order?.orderItems?.size} produk"
tvPaymentPrice.text = "Rp${order?.totalAmount}"
tvPaymentCustomer.text = order?.username
tvPaymentLocation.text = order?.address?.subdistrict
tvPaymentCustomer.text = order?.userId.toString()
tvPaymentLocation.text = order?.addressId.toString()
}
}
}

View File

@ -49,8 +49,8 @@ class ShipmentAdapter : RecyclerView.Adapter<ShipmentAdapter.ShipmentViewHolder>
fun bind(order: OrdersItem) {
tvShipmentNumber.text = "No. Pesanan: ${order.orderId}"
tvShipmentDue.text = order.createdAt + 7
tvShipmentCustomer.text = order.username
tvShipmentLocation.text = order.address?.subdistrict
tvShipmentCustomer.text = order.userId.toString()
tvShipmentLocation.text = order.addressId.toString()
}
}
}

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.profile.DetailProfileFragment">
tools:context=".ui.profile.DetailProfileActivity">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_nama"