mirror of
https://github.com/shaulascr/ecommerce_serang.git
synced 2025-08-14 02:52:22 +00:00
Compare commits
4 Commits
gracia
...
screen-fea
Author | SHA1 | Date | |
---|---|---|---|
d4eacf6c7c | |||
0a8dac4d23 | |||
ed60528049 | |||
a9c2f9c103 |
13
.idea/deviceManager.xml
generated
13
.idea/deviceManager.xml
generated
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DeviceTable">
|
|
||||||
<option name="columnSorters">
|
|
||||||
<list>
|
|
||||||
<ColumnSorterState>
|
|
||||||
<option name="column" value="Name" />
|
|
||||||
<option name="order" value="ASCENDING" />
|
|
||||||
</ColumnSorterState>
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -124,4 +124,7 @@ dependencies {
|
|||||||
implementation(platform("com.google.firebase:firebase-bom:33.13.0"))
|
implementation(platform("com.google.firebase:firebase-bom:33.13.0"))
|
||||||
implementation("com.google.firebase:firebase-analytics")
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
implementation("com.google.firebase:firebase-messaging-ktx")
|
implementation("com.google.firebase:firebase-messaging-ktx")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,9 +29,6 @@
|
|||||||
android:theme="@style/Theme.Ecommerce_serang"
|
android:theme="@style/Theme.Ecommerce_serang"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:targetApi="31">
|
tools:targetApi="31">
|
||||||
<activity
|
|
||||||
android:name=".ui.profile.mystore.StoreSuspendedActivity"
|
|
||||||
android:exported="false" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.profile.mystore.StoreOnReviewActivity"
|
android:name=".ui.profile.mystore.StoreOnReviewActivity"
|
||||||
android:exported="false" />
|
android:exported="false" />
|
||||||
@ -85,11 +82,12 @@
|
|||||||
<!-- android:name="androidx.startup.InitializationProvider" -->
|
<!-- android:name="androidx.startup.InitializationProvider" -->
|
||||||
<!-- android:authorities="${applicationId}.androidx-startup" -->
|
<!-- android:authorities="${applicationId}.androidx-startup" -->
|
||||||
<!-- tools:node="remove" /> -->
|
<!-- tools:node="remove" /> -->
|
||||||
<!-- <service -->
|
<!-- <service-->
|
||||||
<!-- android:name=".ui.notif.SimpleWebSocketService" -->
|
<!-- android:name=".ui.notif.SimpleWebSocketService"-->
|
||||||
<!-- android:enabled="true" -->
|
<!-- android:enabled="true"-->
|
||||||
<!-- android:exported="false" -->
|
<!-- android:exported="false"-->
|
||||||
<!-- android:foregroundServiceType="dataSync" /> -->
|
<!-- android:foregroundServiceType="dataSync" />-->
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.profile.mystore.chat.ChatStoreActivity"
|
android:name=".ui.profile.mystore.chat.ChatStoreActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
|
@ -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
|
||||||
)
|
)
|
||||||
|
@ -278,6 +278,11 @@ class UserRepository(private val apiService: ApiService) {
|
|||||||
val requestFile = compressedFile.asRequestBody(mimeType.toMediaTypeOrNull())
|
val requestFile = compressedFile.asRequestBody(mimeType.toMediaTypeOrNull())
|
||||||
Log.d(TAG, "$formName compressed size: ${compressedFile.length() / 1024} KB")
|
Log.d(TAG, "$formName compressed size: ${compressedFile.length() / 1024} KB")
|
||||||
|
|
||||||
|
val compressedSizeMB = compressedFile.length().toDouble() / (1024 * 1024)
|
||||||
|
if (compressedSizeMB > 1) {
|
||||||
|
throw IllegalArgumentException("$formName lebih dari 1 MB setelah kompresi")
|
||||||
|
}
|
||||||
|
|
||||||
MultipartBody.Part.createFormData(formName, compressedFile.name, requestFile)
|
MultipartBody.Part.createFormData(formName, compressedFile.name, requestFile)
|
||||||
} else {
|
} else {
|
||||||
throw IllegalArgumentException("$formName harus berupa file gambar (JPEG, JPG, atau PNG)")
|
throw IllegalArgumentException("$formName harus berupa file gambar (JPEG, JPG, atau PNG)")
|
||||||
|
@ -3,6 +3,7 @@ package com.alya.ecommerce_serang.ui.order.address
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
import android.widget.Spinner
|
||||||
import com.alya.ecommerce_serang.data.api.response.customer.order.CitiesItem
|
import com.alya.ecommerce_serang.data.api.response.customer.order.CitiesItem
|
||||||
import com.alya.ecommerce_serang.data.api.response.customer.order.ProvincesItem
|
import com.alya.ecommerce_serang.data.api.response.customer.order.ProvincesItem
|
||||||
import com.alya.ecommerce_serang.data.api.response.customer.order.SubdistrictsItem
|
import com.alya.ecommerce_serang.data.api.response.customer.order.SubdistrictsItem
|
||||||
@ -97,4 +98,75 @@ class VillagesAdapter(
|
|||||||
fun getPostalCode(position: Int): String?{
|
fun getPostalCode(position: Int): String?{
|
||||||
return villages.getOrNull(position)?.postalCode
|
return villages.getOrNull(position)?.postalCode
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BankAdapter(
|
||||||
|
context: Context,
|
||||||
|
resource: Int = android.R.layout.simple_dropdown_item_1line
|
||||||
|
) : ArrayAdapter<String>(context, resource, ArrayList()) {
|
||||||
|
|
||||||
|
data class BankItem(
|
||||||
|
val bankName: String,
|
||||||
|
val bankCode: String? = null,
|
||||||
|
val description: String? = null
|
||||||
|
)
|
||||||
|
|
||||||
|
private val banks = ArrayList<BankItem>()
|
||||||
|
|
||||||
|
init {
|
||||||
|
loadHardcodedData()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadHardcodedData() {
|
||||||
|
val defaultBanks = listOf(
|
||||||
|
BankItem("Bank Mandiri", "008", "PT Bank Mandiri (Persero) Tbk"),
|
||||||
|
BankItem("Bank BRI", "002", "PT Bank Rakyat Indonesia (Persero) Tbk"),
|
||||||
|
BankItem("Bank BCA", "014", "PT Bank Central Asia Tbk"),
|
||||||
|
BankItem("Bank BNI", "009", "PT Bank Negara Indonesia (Persero) Tbk"),
|
||||||
|
BankItem("Bank BTN", "200", "PT Bank Tabungan Negara (Persero) Tbk"),
|
||||||
|
BankItem("Bank CIMB Niaga", "022", "PT Bank CIMB Niaga Tbk"),
|
||||||
|
BankItem("Bank Danamon", "011", "PT Bank Danamon Indonesia Tbk"),
|
||||||
|
BankItem("Bank Permata", "013", "PT Bank Permata Tbk"),
|
||||||
|
BankItem("Bank OCBC NISP", "028", "PT Bank OCBC NISP Tbk"),
|
||||||
|
BankItem("Bank Maybank", "016", "PT Bank Maybank Indonesia Tbk"),
|
||||||
|
BankItem("Bank Panin", "019", "PT Bank Panin Dubai Syariah Tbk"),
|
||||||
|
BankItem("Bank UOB", "023", "PT Bank UOB Indonesia"),
|
||||||
|
BankItem("Bank Mega", "426", "PT Bank Mega Tbk"),
|
||||||
|
BankItem("Bank Bukopin", "441", "PT Bank Bukopin Tbk"),
|
||||||
|
BankItem("Bank BJB", "110", "PT Bank Pembangunan Daerah Jawa Barat dan Banten Tbk")
|
||||||
|
)
|
||||||
|
updateData(defaultBanks)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateData(newBanks: List<BankItem>) {
|
||||||
|
banks.clear()
|
||||||
|
banks.addAll(newBanks)
|
||||||
|
|
||||||
|
clear()
|
||||||
|
addAll(banks.map { it.bankName })
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBankName(position: Int): String? {
|
||||||
|
return banks.getOrNull(position)?.bankName
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBankItem(position: Int): BankItem? {
|
||||||
|
return banks.getOrNull(position)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBankCode(position: Int): String? {
|
||||||
|
return banks.getOrNull(position)?.bankCode
|
||||||
|
}
|
||||||
|
|
||||||
|
fun findPositionByName(bankName: String): Int {
|
||||||
|
return banks.indexOfFirst { it.bankName == bankName }
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDefaultSelection(spinner: Spinner, defaultBankName: String) {
|
||||||
|
val position = findPositionByName(defaultBankName)
|
||||||
|
if (position >= 0) {
|
||||||
|
spinner.setSelection(position)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -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}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -25,7 +25,6 @@ import com.alya.ecommerce_serang.ui.order.address.AddressActivity
|
|||||||
import com.alya.ecommerce_serang.ui.order.history.HistoryActivity
|
import com.alya.ecommerce_serang.ui.order.history.HistoryActivity
|
||||||
import com.alya.ecommerce_serang.ui.profile.mystore.MyStoreActivity
|
import com.alya.ecommerce_serang.ui.profile.mystore.MyStoreActivity
|
||||||
import com.alya.ecommerce_serang.ui.profile.mystore.StoreOnReviewActivity
|
import com.alya.ecommerce_serang.ui.profile.mystore.StoreOnReviewActivity
|
||||||
import com.alya.ecommerce_serang.ui.profile.mystore.StoreSuspendedActivity
|
|
||||||
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
||||||
import com.alya.ecommerce_serang.utils.SessionManager
|
import com.alya.ecommerce_serang.utils.SessionManager
|
||||||
import com.alya.ecommerce_serang.utils.viewmodel.MyStoreViewModel
|
import com.alya.ecommerce_serang.utils.viewmodel.MyStoreViewModel
|
||||||
@ -74,11 +73,13 @@ class ProfileFragment : Fragment() {
|
|||||||
|
|
||||||
observeUserProfile()
|
observeUserProfile()
|
||||||
|
|
||||||
observeStoreStatus()
|
|
||||||
|
|
||||||
viewModel.loadUserProfile()
|
viewModel.loadUserProfile()
|
||||||
viewModel.checkStoreUser()
|
viewModel.checkStoreUser()
|
||||||
|
|
||||||
|
val hasStore = viewModel.checkStore.value
|
||||||
|
Log.d("Profile Fragment", "Check store $hasStore")
|
||||||
|
binding.tvBukaToko.text = if (hasStore == true) "Toko Saya" else "Buka Toko"
|
||||||
|
|
||||||
binding.cardBukaToko.setOnClickListener{
|
binding.cardBukaToko.setOnClickListener{
|
||||||
// if (hasStore == true) startActivity(Intent(requireContext(), MyStoreActivity::class.java))
|
// if (hasStore == true) startActivity(Intent(requireContext(), MyStoreActivity::class.java))
|
||||||
// else startActivity(Intent(requireContext(), RegisterStoreActivity::class.java))
|
// else startActivity(Intent(requireContext(), RegisterStoreActivity::class.java))
|
||||||
@ -87,11 +88,8 @@ class ProfileFragment : Fragment() {
|
|||||||
myStoreViewModel.myStoreProfile.observe(viewLifecycleOwner) { store ->
|
myStoreViewModel.myStoreProfile.observe(viewLifecycleOwner) { store ->
|
||||||
store?.let {
|
store?.let {
|
||||||
when (store.storeStatus) {
|
when (store.storeStatus) {
|
||||||
"process" -> startActivity(Intent(requireContext(), StoreOnReviewActivity::class.java))
|
|
||||||
"active" -> startActivity(Intent(requireContext(), MyStoreActivity::class.java))
|
"active" -> startActivity(Intent(requireContext(), MyStoreActivity::class.java))
|
||||||
"inactive" -> startActivity(Intent(requireContext(), MyStoreActivity::class.java))
|
else -> startActivity(Intent(requireContext(), StoreOnReviewActivity::class.java))
|
||||||
"suspended" -> startActivity(Intent(requireContext(), StoreSuspendedActivity::class.java))
|
|
||||||
else -> startActivity(Intent(requireContext(), RegisterStoreActivity::class.java))
|
|
||||||
}
|
}
|
||||||
} ?: run {
|
} ?: run {
|
||||||
Toast.makeText(requireContext(), "Gagal memuat data toko", Toast.LENGTH_SHORT).show()
|
Toast.makeText(requireContext(), "Gagal memuat data toko", Toast.LENGTH_SHORT).show()
|
||||||
@ -134,12 +132,6 @@ class ProfileFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun observeStoreStatus() {
|
|
||||||
viewModel.checkStore.observe(viewLifecycleOwner) { hasStore ->
|
|
||||||
binding.tvBukaToko.text = if (hasStore) "Toko Saya" else "Buka Toko"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateUI(user: UserProfile) = with(binding){
|
private fun updateUI(user: UserProfile) = with(binding){
|
||||||
val fullImageUrl = when (val img = user.image) {
|
val fullImageUrl = when (val img = user.image) {
|
||||||
is String -> {
|
is String -> {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.alya.ecommerce_serang.ui.profile.mystore
|
package com.alya.ecommerce_serang.ui.profile.mystore
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
@ -20,7 +19,6 @@ import android.widget.Toast
|
|||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.app.ActivityCompat
|
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.graphics.drawable.toDrawable
|
import androidx.core.graphics.drawable.toDrawable
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
@ -32,8 +30,10 @@ import com.alya.ecommerce_serang.data.api.retrofit.ApiConfig
|
|||||||
import com.alya.ecommerce_serang.data.repository.Result
|
import com.alya.ecommerce_serang.data.repository.Result
|
||||||
import com.alya.ecommerce_serang.data.repository.UserRepository
|
import com.alya.ecommerce_serang.data.repository.UserRepository
|
||||||
import com.alya.ecommerce_serang.databinding.ActivityRegisterStoreBinding
|
import com.alya.ecommerce_serang.databinding.ActivityRegisterStoreBinding
|
||||||
|
import com.alya.ecommerce_serang.ui.order.address.BankAdapter
|
||||||
import com.alya.ecommerce_serang.ui.order.address.CityAdapter
|
import com.alya.ecommerce_serang.ui.order.address.CityAdapter
|
||||||
import com.alya.ecommerce_serang.ui.order.address.ProvinceAdapter
|
import com.alya.ecommerce_serang.ui.order.address.ProvinceAdapter
|
||||||
|
import com.alya.ecommerce_serang.ui.order.address.SubdsitrictAdapter
|
||||||
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
||||||
import com.alya.ecommerce_serang.utils.SessionManager
|
import com.alya.ecommerce_serang.utils.SessionManager
|
||||||
import com.alya.ecommerce_serang.utils.viewmodel.RegisterStoreViewModel
|
import com.alya.ecommerce_serang.utils.viewmodel.RegisterStoreViewModel
|
||||||
@ -45,6 +45,9 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private lateinit var provinceAdapter: ProvinceAdapter
|
private lateinit var provinceAdapter: ProvinceAdapter
|
||||||
private lateinit var cityAdapter: CityAdapter
|
private lateinit var cityAdapter: CityAdapter
|
||||||
|
private lateinit var subdistrictAdapter: SubdsitrictAdapter
|
||||||
|
private lateinit var bankAdapter: BankAdapter
|
||||||
|
|
||||||
// Request codes for file picking
|
// Request codes for file picking
|
||||||
private val PICK_STORE_IMAGE_REQUEST = 1001
|
private val PICK_STORE_IMAGE_REQUEST = 1001
|
||||||
private val PICK_KTP_REQUEST = 1002
|
private val PICK_KTP_REQUEST = 1002
|
||||||
@ -88,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()
|
||||||
@ -101,8 +106,12 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
setupObservers()
|
setupObservers()
|
||||||
Log.d(TAG, "onCreate: Observers setup completed")
|
Log.d(TAG, "onCreate: Observers setup completed")
|
||||||
|
|
||||||
setupMap()
|
viewModel.latitude.value = "-6.2088"
|
||||||
Log.d(TAG, "onCreate: Map setup completed")
|
viewModel.longitude.value = "106.8456"
|
||||||
|
Log.d(TAG, "Location permission granted, setting default location")
|
||||||
|
// Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||||
|
Log.d(TAG, "Default location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
||||||
|
// Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||||
|
|
||||||
setupDocumentUploads()
|
setupDocumentUploads()
|
||||||
Log.d(TAG, "onCreate: Document uploads setup completed")
|
Log.d(TAG, "onCreate: Document uploads setup completed")
|
||||||
@ -161,16 +170,17 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
viewModel.ktpUri != null &&
|
viewModel.ktpUri != null &&
|
||||||
viewModel.nibUri != null &&
|
viewModel.nibUri != null &&
|
||||||
viewModel.npwpUri != null &&
|
viewModel.npwpUri != null &&
|
||||||
viewModel.selectedCouriers.isNotEmpty()
|
viewModel.selectedCouriers.isNotEmpty() &&
|
||||||
|
!viewModel.accountName.value.isNullOrBlank()
|
||||||
binding.btnRegister.isEnabled = isFormValid
|
|
||||||
|
|
||||||
|
binding.btnRegister.isEnabled = true
|
||||||
if (isFormValid) {
|
if (isFormValid) {
|
||||||
binding.btnRegister.setBackgroundResource(R.drawable.bg_button_active)
|
binding.btnRegister.setBackgroundResource(R.drawable.bg_button_active)
|
||||||
binding.btnRegister.setTextColor(ContextCompat.getColor(this, R.color.white))
|
binding.btnRegister.setTextColor(ContextCompat.getColor(this, R.color.white))
|
||||||
} else {
|
} else {
|
||||||
binding.btnRegister.setBackgroundResource(R.drawable.bg_button_disabled)
|
binding.btnRegister.setBackgroundResource(R.drawable.bg_button_disabled)
|
||||||
binding.btnRegister.setTextColor(ContextCompat.getColor(this, R.color.black_300))
|
binding.btnRegister.setTextColor(ContextCompat.getColor(this, R.color.black_300))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +235,28 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewModel.subdistrictState.observe(this) { state ->
|
||||||
|
when (state) {
|
||||||
|
is Result.Loading -> {
|
||||||
|
Log.d(TAG, "setupobservers: Loading Subdistrict...")
|
||||||
|
binding.subdistrictProgressBar.visibility = View.VISIBLE
|
||||||
|
binding.spinnerSubdistrict.isEnabled = false
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
is Result.Error -> {
|
||||||
|
Log.e(TAG, "setupObservers: Error loading subdistrict: ${state.exception.message}")
|
||||||
|
binding.subdistrictProgressBar.visibility = View.GONE
|
||||||
|
binding.spinnerCity.isEnabled = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Observe registration state
|
// Observe registration state
|
||||||
viewModel.registerState.observe(this) { result ->
|
viewModel.registerState.observe(this) { result ->
|
||||||
when (result) {
|
when (result) {
|
||||||
@ -395,6 +427,11 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
if (cityId != null) {
|
if (cityId != null) {
|
||||||
Log.d(TAG, "Setting city ID: $cityId")
|
Log.d(TAG, "Setting city ID: $cityId")
|
||||||
viewModel.cityId.value = cityId
|
viewModel.cityId.value = cityId
|
||||||
|
Log.d(TAG, "Fetching subdistrict for city ID: $cityId")
|
||||||
|
viewModel.getSubdistrict(cityId)
|
||||||
|
|
||||||
|
subdistrictAdapter.clear()
|
||||||
|
binding.spinnerSubdistrict.setSelection(0)
|
||||||
viewModel.selectedCityId = cityId
|
viewModel.selectedCityId = cityId
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Invalid city ID for position: $position")
|
Log.e(TAG, "Invalid city ID for position: $position")
|
||||||
@ -406,6 +443,61 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Setup Subdistrict spinner
|
||||||
|
binding.spinnerSubdistrict.adapter = subdistrictAdapter
|
||||||
|
binding.spinnerSubdistrict.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||||
|
Log.d(TAG, "Subdistrict selected at position: $position")
|
||||||
|
val subdistrictId = subdistrictAdapter.getSubdistrictId(position)
|
||||||
|
if (subdistrictId != null) {
|
||||||
|
Log.d(TAG, "Setting subdistrict ID: $subdistrictId")
|
||||||
|
viewModel.subdistrict.value = subdistrictId
|
||||||
|
viewModel.selectedSubdistrict = subdistrictId
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Invalid subdistrict ID for position: $position")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||||
|
Log.d(TAG, "No city selected")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.spinnerBankName.adapter = bankAdapter
|
||||||
|
binding.spinnerBankName.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||||
|
override fun onItemSelected(
|
||||||
|
parent: AdapterView<*>?,
|
||||||
|
view: View?,
|
||||||
|
position: Int,
|
||||||
|
id: Long
|
||||||
|
) {
|
||||||
|
Log.d(TAG, "Bank selected at position: $position")
|
||||||
|
val bankName = bankAdapter.getBankName(position)
|
||||||
|
if (bankName != null) {
|
||||||
|
Log.d(TAG, "Setting bank name: $bankName")
|
||||||
|
viewModel.bankName.value = bankName
|
||||||
|
viewModel.selectedBankName = bankName
|
||||||
|
|
||||||
|
// Optional: Log the selected bank details
|
||||||
|
val selectedBank = bankAdapter.getBankItem(position)
|
||||||
|
selectedBank?.let {
|
||||||
|
Log.d(TAG, "Selected bank: ${it.bankName} (Code: ${it.bankCode})")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hide progress bar if it was showing
|
||||||
|
binding.storeTypeProgressBar.visibility = View.GONE
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "Invalid bank name for position: $position")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNothingSelected(parent: AdapterView<*>?) {
|
||||||
|
Log.d(TAG, "No bank selected")
|
||||||
|
viewModel.selectedBankName = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add initial hints to the spinners
|
// Add initial hints to the spinners
|
||||||
if (provinceAdapter.isEmpty) {
|
if (provinceAdapter.isEmpty) {
|
||||||
Log.d(TAG, "Adding default province hint")
|
Log.d(TAG, "Adding default province hint")
|
||||||
@ -417,6 +509,16 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
cityAdapter.add("Pilih Kabupaten/Kota")
|
cityAdapter.add("Pilih Kabupaten/Kota")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subdistrictAdapter.isEmpty) {
|
||||||
|
Log.d(TAG, "Adding default kecamatan hint")
|
||||||
|
subdistrictAdapter.add("Pilih Kecamatan")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bankAdapter.isEmpty) {
|
||||||
|
Log.d(TAG, "Adding default bank hint")
|
||||||
|
bankAdapter.add("Pilih Bank")
|
||||||
|
}
|
||||||
|
|
||||||
Log.d(TAG, "setupSpinners: Province and city spinners setup completed")
|
Log.d(TAG, "setupSpinners: Province and city spinners setup completed")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,44 +602,44 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
validateRequiredFields()
|
validateRequiredFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupMap() {
|
// private fun setupMap() {
|
||||||
Log.d(TAG, "setupMap: Setting up map container")
|
// Log.d(TAG, "setupMap: Setting up map container")
|
||||||
// This would typically integrate with Google Maps SDK
|
// // This would typically integrate with Google Maps SDK
|
||||||
// For simplicity, we're just using a placeholder
|
// // For simplicity, we're just using a placeholder
|
||||||
binding.mapContainer.setOnClickListener {
|
// binding.mapContainer.setOnClickListener {
|
||||||
Log.d(TAG, "Map container clicked, checking location permission")
|
// Log.d(TAG, "Map container clicked, checking location permission")
|
||||||
// Request location permission if not granted
|
// // Request location permission if not granted
|
||||||
if (ContextCompat.checkSelfPermission(
|
// if (ContextCompat.checkSelfPermission(
|
||||||
this,
|
// this,
|
||||||
Manifest.permission.ACCESS_FINE_LOCATION
|
// Manifest.permission.ACCESS_FINE_LOCATION
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
// ) != PackageManager.PERMISSION_GRANTED
|
||||||
) {
|
// ) {
|
||||||
Log.d(TAG, "Location permission not granted, requesting permission")
|
// Log.d(TAG, "Location permission not granted, requesting permission")
|
||||||
ActivityCompat.requestPermissions(
|
// ActivityCompat.requestPermissions(
|
||||||
this,
|
// this,
|
||||||
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
// arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
||||||
LOCATION_PERMISSION_REQUEST
|
// LOCATION_PERMISSION_REQUEST
|
||||||
)
|
// )
|
||||||
viewModel.latitude.value = "-6.2088"
|
// viewModel.latitude.value = "-6.2088"
|
||||||
viewModel.longitude.value = "106.8456"
|
// viewModel.longitude.value = "106.8456"
|
||||||
Log.d(TAG, "Location permission granted, setting default location")
|
// Log.d(TAG, "Location permission granted, setting default location")
|
||||||
Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
// Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||||
Log.d(TAG, "Default location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
// Log.d(TAG, "Default location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
||||||
Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
// Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||||
} else {
|
// } else {
|
||||||
Log.d(TAG, "Location permission already granted, setting location")
|
// Log.d(TAG, "Location permission already granted, setting location")
|
||||||
// Show map selection UI
|
// // Show map selection UI
|
||||||
// This would typically launch Maps UI for location selection
|
// // This would typically launch Maps UI for location selection
|
||||||
// For now, we'll just set some dummy coordinates
|
// // For now, we'll just set some dummy coordinates
|
||||||
viewModel.latitude.value = "-6.2088"
|
// viewModel.latitude.value = "-6.2088"
|
||||||
viewModel.longitude.value = "106.8456"
|
// viewModel.longitude.value = "106.8456"
|
||||||
Log.d(TAG, "Location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
// Log.d(TAG, "Location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
||||||
Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
// Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Log.d(TAG, "setupMap: Map container setup completed")
|
// Log.d(TAG, "setupMap: Map container setup completed")
|
||||||
}
|
// }
|
||||||
|
|
||||||
private fun setupDataBinding() {
|
private fun setupDataBinding() {
|
||||||
Log.d(TAG, "setupDataBinding: Setting up two-way data binding for text fields")
|
Log.d(TAG, "setupDataBinding: Setting up two-way data binding for text fields")
|
||||||
@ -617,25 +719,36 @@ class RegisterStoreActivity : AppCompatActivity() {
|
|||||||
validateRequiredFields()
|
validateRequiredFields()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
//
|
||||||
|
// binding.etSubdistrict.addTextChangedListener(object : TextWatcher {
|
||||||
|
// override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||||
|
// override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
||||||
|
// override fun afterTextChanged(s: Editable?) {
|
||||||
|
// viewModel.subdistrict.value = s.toString()
|
||||||
|
// Log.d(TAG, "Subdistrict updated: ${s.toString()}")
|
||||||
|
// validateRequiredFields()
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
binding.etSubdistrict.addTextChangedListener(object : TextWatcher {
|
// binding.etBankName.addTextChangedListener(object: TextWatcher {
|
||||||
|
// override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||||
|
// override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
||||||
|
// override fun afterTextChanged(s: Editable?) {
|
||||||
|
// viewModel.bankName.value = s.toString()
|
||||||
|
// Log.d(TAG, "Bank name updated: ${s.toString()}")
|
||||||
|
// validateRequiredFields()
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
|
binding.etAccountName.addTextChangedListener(object : TextWatcher {
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
||||||
override fun afterTextChanged(s: Editable?) {
|
override fun afterTextChanged(s: Editable?) {
|
||||||
viewModel.subdistrict.value = s.toString()
|
viewModel.accountName.value = s.toString()
|
||||||
Log.d(TAG, "Subdistrict updated: ${s.toString()}")
|
Log.d(TAG, "Account Name updated: ${s.toString()}")
|
||||||
validateRequiredFields()
|
validateRequiredFields()
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
binding.etBankName.addTextChangedListener(object: TextWatcher {
|
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
viewModel.bankName.value = s.toString()
|
|
||||||
Log.d(TAG, "Bank name updated: ${s.toString()}")
|
|
||||||
validateRequiredFields()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
Log.d(TAG, "setupDataBinding: Text field data binding setup completed")
|
Log.d(TAG, "setupDataBinding: Text field data binding setup completed")
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
package com.alya.ecommerce_serang.ui.profile.mystore
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import androidx.activity.enableEdgeToEdge
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.core.view.WindowInsetsCompat
|
|
||||||
import com.alya.ecommerce_serang.R
|
|
||||||
import com.alya.ecommerce_serang.databinding.ActivityStoreSuspendedBinding
|
|
||||||
|
|
||||||
class StoreSuspendedActivity : AppCompatActivity() {
|
|
||||||
|
|
||||||
private lateinit var binding: ActivityStoreSuspendedBinding
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
binding = ActivityStoreSuspendedBinding.inflate(layoutInflater)
|
|
||||||
setContentView(binding.root)
|
|
||||||
|
|
||||||
binding.header.headerTitle.text = "Toko Dinonaktifkan"
|
|
||||||
binding.header.headerLeftIcon.setOnClickListener {
|
|
||||||
onBackPressedDispatcher.onBackPressed()
|
|
||||||
finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,8 +27,6 @@ import com.alya.ecommerce_serang.data.repository.ProductRepository
|
|||||||
import com.alya.ecommerce_serang.data.repository.Result
|
import com.alya.ecommerce_serang.data.repository.Result
|
||||||
import com.alya.ecommerce_serang.databinding.ActivityDetailStoreProductBinding
|
import com.alya.ecommerce_serang.databinding.ActivityDetailStoreProductBinding
|
||||||
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
import com.alya.ecommerce_serang.utils.BaseViewModelFactory
|
||||||
import com.alya.ecommerce_serang.utils.FileUtils.compressFile
|
|
||||||
import com.alya.ecommerce_serang.utils.ImageUtils.compressImage
|
|
||||||
import com.alya.ecommerce_serang.utils.SessionManager
|
import com.alya.ecommerce_serang.utils.SessionManager
|
||||||
import com.alya.ecommerce_serang.utils.viewmodel.ProductViewModel
|
import com.alya.ecommerce_serang.utils.viewmodel.ProductViewModel
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
@ -42,7 +40,7 @@ class DetailStoreProductActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private lateinit var binding: ActivityDetailStoreProductBinding
|
private lateinit var binding: ActivityDetailStoreProductBinding
|
||||||
private lateinit var sessionManager: SessionManager
|
private lateinit var sessionManager: SessionManager
|
||||||
private var categoryList: List<CategoryItem> = emptyList()
|
private lateinit var categoryList: List<CategoryItem>
|
||||||
private var imageUri: Uri? = null
|
private var imageUri: Uri? = null
|
||||||
private var sppirtUri: Uri? = null
|
private var sppirtUri: Uri? = null
|
||||||
private var halalUri: Uri? = null
|
private var halalUri: Uri? = null
|
||||||
@ -62,10 +60,7 @@ class DetailStoreProductActivity : AppCompatActivity() {
|
|||||||
if (result.resultCode == Activity.RESULT_OK) {
|
if (result.resultCode == Activity.RESULT_OK) {
|
||||||
imageUri = result.data?.data
|
imageUri = result.data?.data
|
||||||
imageUri?.let {
|
imageUri?.let {
|
||||||
compressImage(this, it, "productimg").let { compressedImageFile ->
|
binding.ivPreviewFoto.setImageURI(it)
|
||||||
binding.ivPreviewFoto.setImageURI(Uri.fromFile(compressedImageFile))
|
|
||||||
imageUri = Uri.fromFile(compressedImageFile)
|
|
||||||
}
|
|
||||||
binding.switcherFotoProduk.showNext()
|
binding.switcherFotoProduk.showNext()
|
||||||
hasImage = true
|
hasImage = true
|
||||||
}
|
}
|
||||||
@ -75,21 +70,17 @@ class DetailStoreProductActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
private val sppirtLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) { uri ->
|
private val sppirtLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) { uri ->
|
||||||
if (uri != null && isValidFile(uri)) {
|
if (uri != null && isValidFile(uri)) {
|
||||||
compressFile(this, uri).let { compressedFile ->
|
sppirtUri = uri
|
||||||
sppirtUri = compressedFile?.toUri()
|
binding.tvSppirtName.text = getFileName(uri)
|
||||||
binding.tvSppirtName.text = getFileName(sppirtUri!!)
|
binding.switcherSppirt.showNext()
|
||||||
binding.switcherSppirt.showNext()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val halalLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) { uri ->
|
private val halalLauncher = registerForActivityResult(ActivityResultContracts.GetContent()) { uri ->
|
||||||
if (uri != null && isValidFile(uri)) {
|
if (uri != null && isValidFile(uri)) {
|
||||||
compressFile(this, uri).let { compressedFile ->
|
halalUri = uri
|
||||||
halalUri = compressedFile?.toUri()
|
binding.tvHalalName.text = getFileName(uri)
|
||||||
binding.tvHalalName.text = getFileName(halalUri!!)
|
binding.switcherHalal.showNext()
|
||||||
binding.switcherHalal.showNext()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,46 +8,13 @@ import okhttp3.MediaType.Companion.toMediaTypeOrNull
|
|||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import okhttp3.RequestBody.Companion.asRequestBody
|
import okhttp3.RequestBody.Companion.asRequestBody
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
import java.util.zip.GZIPOutputStream
|
|
||||||
|
|
||||||
object FileUtils {
|
object FileUtils {
|
||||||
private const val TAG = "FileUtils"
|
private const val TAG = "FileUtils"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compress a file to GZIP format to reduce its size to below 1MB
|
* Creates a temporary file from a URI in the app's cache directory
|
||||||
* @param context The context
|
|
||||||
* @param uri The URI of the file to compress
|
|
||||||
* @param maxSize The target size limit in bytes (1MB = 1048576 bytes)
|
|
||||||
* @return The compressed file, or null if compression failed
|
|
||||||
*/
|
|
||||||
fun compressFile(context: Context, uri: Uri, maxSize: Long = 1048576L): File? {
|
|
||||||
try {
|
|
||||||
// Create a temporary file for compressed content
|
|
||||||
val originalFile = createTempFileFromUri(context, uri, "compressed")
|
|
||||||
val compressedFile = File(context.cacheDir, "compressed_${System.currentTimeMillis()}.gz")
|
|
||||||
|
|
||||||
// Compress the original file into the GZIP file
|
|
||||||
compressToGZIP(originalFile, compressedFile)
|
|
||||||
|
|
||||||
// Check if the compressed file is larger than the allowed size
|
|
||||||
if (compressedFile.length() <= maxSize) {
|
|
||||||
Log.d(TAG, "Compression successful. Compressed file size: ${compressedFile.length()} bytes.")
|
|
||||||
return compressedFile
|
|
||||||
} else {
|
|
||||||
// If the file is still too large, you can handle it by reducing quality or adjusting compression logic
|
|
||||||
Log.e(TAG, "Compressed file exceeds the size limit. Size: ${compressedFile.length()} bytes.")
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
Log.e(TAG, "Error during file compression: ${e.message}", e)
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a temporary file from the URI in the app's cache directory.
|
|
||||||
*/
|
*/
|
||||||
fun createTempFileFromUri(context: Context, uri: Uri, prefix: String = "temp"): File? {
|
fun createTempFileFromUri(context: Context, uri: Uri, prefix: String = "temp"): File? {
|
||||||
try {
|
try {
|
||||||
@ -74,23 +41,6 @@ object FileUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Compress the input file into a GZIP file.
|
|
||||||
*/
|
|
||||||
private fun compressToGZIP(inputFile: File?, outputFile: File) {
|
|
||||||
FileInputStream(inputFile).use { inputStream ->
|
|
||||||
FileOutputStream(outputFile).use { fileOutputStream ->
|
|
||||||
GZIPOutputStream(fileOutputStream).use { gzipOutputStream ->
|
|
||||||
val buffer = ByteArray(1024)
|
|
||||||
var bytesRead: Int
|
|
||||||
while (inputStream.read(buffer).also { bytesRead = it } != -1) {
|
|
||||||
gzipOutputStream.write(buffer, 0, bytesRead)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the file extension from a URI using ContentResolver
|
* Gets the file extension from a URI using ContentResolver
|
||||||
*/
|
*/
|
||||||
|
@ -47,15 +47,15 @@ class ProfileViewModel(private val userRepository: UserRepository) : ViewModel()
|
|||||||
val response: HasStoreResponse = userRepository.checkStore()
|
val response: HasStoreResponse = userRepository.checkStore()
|
||||||
|
|
||||||
// Log and store success message
|
// Log and store success message
|
||||||
Log.d("ProfileViewModel", "Has store: ${response.hasStore}")
|
Log.d("RegisterViewModel", "OTP Response: ${response.hasStore}")
|
||||||
_checkStore.postValue(response.hasStore) // Store the message for UI feedback
|
_checkStore.value = response.hasStore // Store the message for UI feedback
|
||||||
|
|
||||||
} catch (exception: Exception) {
|
} catch (exception: Exception) {
|
||||||
// Handle any errors and update state
|
// Handle any errors and update state
|
||||||
_checkStore.postValue(false)
|
_checkStore.value = false
|
||||||
|
|
||||||
// Log the error for debugging
|
// Log the error for debugging
|
||||||
Log.e(":ProfileViewModel", "Error:", exception)
|
Log.e("RegisterViewModel", "Error:", exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import com.alya.ecommerce_serang.data.api.response.auth.RegisterStoreResponse
|
|||||||
import com.alya.ecommerce_serang.data.api.response.auth.StoreTypesItem
|
import com.alya.ecommerce_serang.data.api.response.auth.StoreTypesItem
|
||||||
import com.alya.ecommerce_serang.data.api.response.customer.order.CitiesItem
|
import com.alya.ecommerce_serang.data.api.response.customer.order.CitiesItem
|
||||||
import com.alya.ecommerce_serang.data.api.response.customer.order.ProvincesItem
|
import com.alya.ecommerce_serang.data.api.response.customer.order.ProvincesItem
|
||||||
|
import com.alya.ecommerce_serang.data.api.response.customer.order.SubdistrictsItem
|
||||||
|
import com.alya.ecommerce_serang.data.api.response.customer.order.VillagesItem
|
||||||
import com.alya.ecommerce_serang.data.repository.Result
|
import com.alya.ecommerce_serang.data.repository.Result
|
||||||
import com.alya.ecommerce_serang.data.repository.UserRepository
|
import com.alya.ecommerce_serang.data.repository.UserRepository
|
||||||
import com.alya.ecommerce_serang.utils.ImageUtils
|
import com.alya.ecommerce_serang.utils.ImageUtils
|
||||||
@ -41,8 +43,17 @@ class RegisterStoreViewModel(
|
|||||||
private val _citiesState = MutableLiveData<Result<List<CitiesItem>>>()
|
private val _citiesState = MutableLiveData<Result<List<CitiesItem>>>()
|
||||||
val citiesState: LiveData<Result<List<CitiesItem>>> = _citiesState
|
val citiesState: LiveData<Result<List<CitiesItem>>> = _citiesState
|
||||||
|
|
||||||
|
private val _subdistrictState = MutableLiveData<Result<List<SubdistrictsItem>>>()
|
||||||
|
val subdistrictState: LiveData<Result<List<SubdistrictsItem>>> = _subdistrictState
|
||||||
|
|
||||||
|
private val _villagesState = MutableLiveData<Result<List<VillagesItem>>>()
|
||||||
|
val villagesState: LiveData<Result<List<VillagesItem>>> = _villagesState
|
||||||
|
|
||||||
var selectedProvinceId: Int? = null
|
var selectedProvinceId: Int? = null
|
||||||
var selectedCityId: String? = null
|
var selectedCityId: String? = null
|
||||||
|
var selectedSubdistrict: String? = null
|
||||||
|
var selectedVillages: String? = null
|
||||||
|
var selectedBankName: String? = null
|
||||||
|
|
||||||
// Form fields
|
// Form fields
|
||||||
val storeName = MutableLiveData<String>()
|
val storeName = MutableLiveData<String>()
|
||||||
@ -72,47 +83,89 @@ class RegisterStoreViewModel(
|
|||||||
val selectedCouriers = mutableListOf<String>()
|
val selectedCouriers = mutableListOf<String>()
|
||||||
|
|
||||||
fun registerStore(context: Context) {
|
fun registerStore(context: Context) {
|
||||||
|
Log.d(TAG, "Starting registerStore()")
|
||||||
|
|
||||||
val allowedFileTypes = Regex("^(jpeg|jpg|png|pdf)$", RegexOption.IGNORE_CASE)
|
val allowedFileTypes = Regex("^(jpeg|jpg|png|pdf)$", RegexOption.IGNORE_CASE)
|
||||||
|
|
||||||
// Check each file if present
|
fun logFileInfo(label: String, uri: Uri?) {
|
||||||
|
if (uri == null) {
|
||||||
|
Log.d(TAG, "$label URI: null")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Log.d(TAG, "$label URI: $uri")
|
||||||
|
try {
|
||||||
|
val fileSizeBytes = context.contentResolver.openFileDescriptor(uri, "r")?.use {
|
||||||
|
it.statSize
|
||||||
|
} ?: -1
|
||||||
|
Log.d(TAG, "$label original size: ${fileSizeBytes / 1024} KB")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Error getting size for $label", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log all file info before validation
|
||||||
|
logFileInfo("Store Image", storeImageUri)
|
||||||
|
logFileInfo("KTP", ktpUri)
|
||||||
|
logFileInfo("NPWP", npwpUri)
|
||||||
|
logFileInfo("NIB", nibUri)
|
||||||
|
logFileInfo("Persetujuan", persetujuanUri)
|
||||||
|
logFileInfo("QRIS", qrisUri)
|
||||||
|
|
||||||
|
// Check file types
|
||||||
if (storeImageUri != null && !ImageUtils.isAllowedFileType(context, storeImageUri, allowedFileTypes)) {
|
if (storeImageUri != null && !ImageUtils.isAllowedFileType(context, storeImageUri, allowedFileTypes)) {
|
||||||
_errorMessage.value = "Foto toko harus berupa file JPEG, JPG, atau PNG"
|
_errorMessage.value = "Foto toko harus berupa file JPEG, JPG, atau PNG"
|
||||||
|
Log.e(TAG, _errorMessage.value ?: "Invalid file type for store image")
|
||||||
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ktpUri != null && !ImageUtils.isAllowedFileType(context, ktpUri, allowedFileTypes)) {
|
if (ktpUri != null && !ImageUtils.isAllowedFileType(context, ktpUri, allowedFileTypes)) {
|
||||||
_errorMessage.value = "KTP harus berupa file JPEG, JPG, atau PNG"
|
_errorMessage.value = "KTP harus berupa file JPEG, JPG, atau PNG"
|
||||||
|
Log.e(TAG, _errorMessage.value ?: "Invalid file type for KTP")
|
||||||
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npwpUri != null && !ImageUtils.isAllowedFileType(context, npwpUri, allowedFileTypes)) {
|
if (npwpUri != null && !ImageUtils.isAllowedFileType(context, npwpUri, allowedFileTypes)) {
|
||||||
_errorMessage.value = "NPWP harus berupa file JPEG, JPG, PNG, atau PDF"
|
_errorMessage.value = "NPWP harus berupa file JPEG, JPG, PNG, atau PDF"
|
||||||
|
Log.e(TAG, _errorMessage.value ?: "Invalid file type for NPWP")
|
||||||
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nibUri != null && !ImageUtils.isAllowedFileType(context, nibUri, allowedFileTypes)) {
|
if (nibUri != null && !ImageUtils.isAllowedFileType(context, nibUri, allowedFileTypes)) {
|
||||||
_errorMessage.value = "NIB harus berupa file JPEG, JPG, PNG, atau PDF"
|
_errorMessage.value = "NIB harus berupa file JPEG, JPG, PNG, atau PDF"
|
||||||
|
Log.e(TAG, _errorMessage.value ?: "Invalid file type for NIB")
|
||||||
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (persetujuanUri != null && !ImageUtils.isAllowedFileType(context, persetujuanUri, allowedFileTypes)) {
|
if (persetujuanUri != null && !ImageUtils.isAllowedFileType(context, persetujuanUri, allowedFileTypes)) {
|
||||||
_errorMessage.value = "Persetujuan harus berupa file JPEG, JPG, PNG, atau PDF"
|
_errorMessage.value = "Persetujuan harus berupa file JPEG, JPG, PNG, atau PDF"
|
||||||
|
Log.e(TAG, _errorMessage.value ?: "Invalid file type for Persetujuan")
|
||||||
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qrisUri != null && !ImageUtils.isAllowedFileType(context, qrisUri, allowedFileTypes)) {
|
if (qrisUri != null && !ImageUtils.isAllowedFileType(context, qrisUri, allowedFileTypes)) {
|
||||||
_errorMessage.value = "QRIS harus berupa file JPEG, JPG, PNG, atau PDF"
|
_errorMessage.value = "QRIS harus berupa file JPEG, JPG, PNG, atau PDF"
|
||||||
|
Log.e(TAG, _errorMessage.value ?: "Invalid file type for QRIS")
|
||||||
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
_registerState.value = Result.Error(Exception(_errorMessage.value ?: "Invalid file type"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.d(TAG, "File type checks passed. Starting repository.registerStoreUser() call.")
|
||||||
|
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
try {
|
try {
|
||||||
_registerState.value = Result.Loading
|
_registerState.value = Result.Loading
|
||||||
|
Log.d(TAG, "Register store request payload: " +
|
||||||
|
"storeName=${storeName.value}, storeTypeId=${storeTypeId.value}, " +
|
||||||
|
"lat=${latitude.value}, long=${longitude.value}, " +
|
||||||
|
"street=${street.value}, subdistrict=${subdistrict.value}, " +
|
||||||
|
"cityId=${cityId.value}, provinceId=${provinceId.value}, postalCode=${postalCode.value}, " +
|
||||||
|
"bankName=${bankName.value}, bankNum=${bankNumber.value}, accountName=${accountName.value}, " +
|
||||||
|
"selectedCouriers=$selectedCouriers")
|
||||||
|
|
||||||
val result = repository.registerStoreUser(
|
val result = repository.registerStoreUser(
|
||||||
context = context,
|
context = context,
|
||||||
@ -139,25 +192,15 @@ class RegisterStoreViewModel(
|
|||||||
accountName = accountName.value ?: ""
|
accountName = accountName.value ?: ""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Log.d(TAG, "Repository returned result: $result")
|
||||||
_registerState.value = result
|
_registerState.value = result
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
Log.e(TAG, "Exception during registerStore", e)
|
||||||
_registerState.value = Result.Error(e)
|
_registerState.value = Result.Error(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Helper function to convert Uri to File
|
|
||||||
// private fun getFileFromUri(context: Context, uri: Uri): File {
|
|
||||||
// val inputStream = context.contentResolver.openInputStream(uri)
|
|
||||||
// val tempFile = File(context.cacheDir, "temp_file_${System.currentTimeMillis()}")
|
|
||||||
// inputStream?.use { input ->
|
|
||||||
// tempFile.outputStream().use { output ->
|
|
||||||
// input.copyTo(output)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return tempFile
|
|
||||||
// }
|
|
||||||
|
|
||||||
fun validateForm(): Boolean {
|
fun validateForm(): Boolean {
|
||||||
// Implement form validation logic
|
// Implement form validation logic
|
||||||
return !(storeName.value.isNullOrEmpty() ||
|
return !(storeName.value.isNullOrEmpty() ||
|
||||||
@ -174,8 +217,6 @@ class RegisterStoreViewModel(
|
|||||||
nibUri == null)
|
nibUri == null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Function to fetch store types
|
// Function to fetch store types
|
||||||
fun fetchStoreTypes() {
|
fun fetchStoreTypes() {
|
||||||
_isLoadingType.value = true
|
_isLoadingType.value = true
|
||||||
@ -235,6 +276,52 @@ class RegisterStoreViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getSubdistrict(cityId: String) {
|
||||||
|
_subdistrictState.value = Result.Loading
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
|
||||||
|
selectedSubdistrict = cityId
|
||||||
|
val result = repository.getListSubdistrict(cityId)
|
||||||
|
result?.let {
|
||||||
|
_subdistrictState.postValue(Result.Success(it.subdistricts))
|
||||||
|
Log.d(TAG, "Cities loaded for province $cityId: ${it.subdistricts.size}")
|
||||||
|
} ?: run {
|
||||||
|
_subdistrictState.postValue(Result.Error(Exception("Failed to load cities")))
|
||||||
|
Log.e(TAG, "City result was null for province $cityId")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
_subdistrictState.postValue(Result.Error(Exception(e.message ?: "Error loading cities")))
|
||||||
|
Log.e(TAG, "Error fetching cities for province $cityId", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getVillages(subdistrictId: String) {
|
||||||
|
_villagesState.value = Result.Loading
|
||||||
|
viewModelScope.launch {
|
||||||
|
try {
|
||||||
|
|
||||||
|
selectedVillages = subdistrictId
|
||||||
|
val result = repository.getListVillages(subdistrictId)
|
||||||
|
result?.let {
|
||||||
|
_villagesState.postValue(Result.Success(it.villages))
|
||||||
|
Log.d(TAG, "Cities loaded for province $subdistrictId: ${it.villages.size}")
|
||||||
|
} ?: run {
|
||||||
|
_villagesState.postValue(Result.Error(Exception("Failed to load cities")))
|
||||||
|
Log.e(TAG, "City result was null for province $subdistrictId")
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
_villagesState.postValue(Result.Error(Exception(e.message ?: "Error loading cities")))
|
||||||
|
Log.e(TAG, "Error fetching cities for province $subdistrictId", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isBankSelected(): Boolean {
|
||||||
|
return !selectedBankName.isNullOrEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "RegisterStoreUserViewModel"
|
private const val TAG = "RegisterStoreUserViewModel"
|
||||||
}
|
}
|
||||||
|
@ -347,41 +347,57 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="horizontal">
|
||||||
android:layout_marginBottom="24dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:text="6. Kecamatan"
|
||||||
|
style="@style/body_medium"
|
||||||
|
android:layout_marginEnd="4dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
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>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/et_subdistrict"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_text_field"
|
android:layout_weight="1"
|
||||||
android:hint="Isi kecamatan tempat toko Anda di sini"
|
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"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/bg_text_field"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/spinner_subdistrict"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
style="@style/body_small"
|
style="@style/body_small"
|
||||||
android:layout_marginTop="10dp"/>
|
android:background="@null"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/subdistrict_progress_bar"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<!-- Chevron Down Icon -->
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:src="@drawable/ic_down"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:contentDescription="Chevron Down" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@ -503,7 +519,8 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_marginBottom="24dp">
|
android:layout_marginBottom="24dp"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -540,6 +557,74 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Nama Bank-->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginBottom="24dp">
|
||||||
|
|
||||||
|
<!-- Label Jenis UMKM -->
|
||||||
|
<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="10. Bank"
|
||||||
|
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>
|
||||||
|
|
||||||
|
<!-- Spinner Dropdown dengan Chevron -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@drawable/bg_text_field"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_marginTop="10dp">
|
||||||
|
|
||||||
|
<Spinner
|
||||||
|
android:id="@+id/spinner_bank_name"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:padding="8dp"
|
||||||
|
style="@style/body_small"
|
||||||
|
android:background="@null"/>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/bank_name_progress_bar"
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:padding="4dp"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
<!-- Chevron Down Icon -->
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="16dp"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:src="@drawable/ic_down"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:contentDescription="Chevron Down" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Nomor Rekening -->
|
<!-- Nomor Rekening -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -583,6 +668,48 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Nama Pemilik Rekening -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginBottom="24dp">
|
||||||
|
|
||||||
|
<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="12. Nama Pemilik Rekening"
|
||||||
|
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>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_account_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_text_field"
|
||||||
|
android:hint="Isi nama pemilik rekening"
|
||||||
|
android:padding="8dp"
|
||||||
|
style="@style/body_small"
|
||||||
|
android:layout_marginTop="10dp"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- Kurir -->
|
<!-- Kurir -->
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -598,7 +725,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="12. Pilih Kurir Pengiriman"
|
android:text="13. Pilih Kurir Pengiriman"
|
||||||
style="@style/body_medium"
|
style="@style/body_medium"
|
||||||
android:layout_marginEnd="4dp"/>
|
android:layout_marginEnd="4dp"/>
|
||||||
|
|
||||||
@ -651,7 +778,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="13. Foto Profil Toko"
|
android:text="14. Foto Profil Toko"
|
||||||
style="@style/body_medium"
|
style="@style/body_medium"
|
||||||
android:layout_marginEnd="4dp"/>
|
android:layout_marginEnd="4dp"/>
|
||||||
|
|
||||||
@ -707,7 +834,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="14. Dokumen KTP"
|
android:text="15. Dokumen KTP"
|
||||||
style="@style/body_medium"
|
style="@style/body_medium"
|
||||||
android:layout_marginEnd="4dp"/>
|
android:layout_marginEnd="4dp"/>
|
||||||
|
|
||||||
@ -774,7 +901,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="15. Dokumen NIB"
|
android:text="16. Dokumen NIB"
|
||||||
style="@style/body_medium"
|
style="@style/body_medium"
|
||||||
android:layout_marginEnd="4dp"/>
|
android:layout_marginEnd="4dp"/>
|
||||||
|
|
||||||
@ -841,7 +968,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="16. Dokumen NPWP"
|
android:text="17. Dokumen NPWP"
|
||||||
style="@style/body_medium"
|
style="@style/body_medium"
|
||||||
android:layout_marginEnd="4dp"/>
|
android:layout_marginEnd="4dp"/>
|
||||||
|
|
||||||
@ -896,7 +1023,8 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -916,12 +1044,26 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/checkbox_approve"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Saya telah membaca dan menyetujui Syarat dan Ketentuan aplikasi" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/map_container"
|
android:id="@+id/map_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:background="@android:color/darker_gray">
|
android:background="@android:color/darker_gray"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -933,7 +1075,7 @@
|
|||||||
<Button
|
<Button
|
||||||
android:id="@+id/btn_register"
|
android:id="@+id/btn_register"
|
||||||
style="@style/button.large.disabled.long"
|
style="@style/button.large.disabled.long"
|
||||||
android:enabled="false"
|
android:enabled="true"
|
||||||
android:layout_marginTop="24dp"
|
android:layout_marginTop="24dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:text="Daftar" />
|
android:text="Daftar" />
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/main"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".ui.profile.mystore.StoreSuspendedActivity"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:fitsSystemWindows="true">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/header"
|
|
||||||
layout="@layout/header" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center"
|
|
||||||
android:padding="16dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="200dp"
|
|
||||||
android:src="@drawable/ic_settings"
|
|
||||||
app:tint="@color/blue_500"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Toko Anda telah dinonaktifkan oleh Admin. Harap hubungi Admin untuk melakukan reaktivasi."
|
|
||||||
style="@style/body_large"
|
|
||||||
android:fontFamily="@font/dmsans_extrabold"
|
|
||||||
android:textAlignment="center" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -146,5 +146,30 @@
|
|||||||
<string name="typing">User is typing...</string>
|
<string name="typing">User is typing...</string>
|
||||||
<string name="buka_toko_desc">Mohon untuk melengkapi formulir pendaftaran ini agar dapat mengakses fitur penjual pada aplikasi.</string>
|
<string name="buka_toko_desc">Mohon untuk melengkapi formulir pendaftaran ini agar dapat mengakses fitur penjual pada aplikasi.</string>
|
||||||
|
|
||||||
|
<!-- List Bank -->
|
||||||
|
<string-array name="bank_name_array">
|
||||||
|
<item>Allo Bank Indonesia</item>
|
||||||
|
<item>Bank Digital BCA</item>
|
||||||
|
<item>Bank Central Asia (BCA)</item>
|
||||||
|
<item>Bank BCA Syariah</item>
|
||||||
|
<item>Bank Jago</item>
|
||||||
|
<item>Bank Mandiri </item>
|
||||||
|
<item>Bank Kb Bukopi</item>
|
||||||
|
<item>Bank Jabar Banten Syariah</item>
|
||||||
|
<item> Bank Mandiri Taspen</item>
|
||||||
|
<item>Bank Maybank Indonesia </item>
|
||||||
|
<item>Bank Negara Indonesia (BNI)</item>
|
||||||
|
<item>Bank Permata</item>
|
||||||
|
<item>Bank Rakyat Indonesia (BRI)</item>
|
||||||
|
<item>Bank Saqu Indonesia</item>
|
||||||
|
<item>Bank Seabank Indonesia</item>
|
||||||
|
<item>Bank Sinarmas </item>
|
||||||
|
<item>Bank Syariah Indonesia (BSI)</item>
|
||||||
|
<item>Bank Tabungan Negara (BTN)</item>
|
||||||
|
<item>Bank UOB Indonesia</item>
|
||||||
|
<item>BPD Jawa Barat dan Banten</item>
|
||||||
|
<item>Super Bank Indonesia</item>
|
||||||
|
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -1,5 +1,5 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "8.12.0"
|
agp = "8.9.2"
|
||||||
glide = "4.16.0"
|
glide = "4.16.0"
|
||||||
gson = "2.11.0"
|
gson = "2.11.0"
|
||||||
hiltAndroid = "2.56.2" # Updated from 2.44 for better compatibility
|
hiltAndroid = "2.56.2" # Updated from 2.44 for better compatibility
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Wed Oct 16 14:37:43 ICT 2024
|
#Wed Oct 16 14:37:43 ICT 2024
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
Reference in New Issue
Block a user