mirror of
https://github.com/shaulascr/ecommerce_serang.git
synced 2025-08-14 02:52:22 +00:00
add account name
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package com.alya.ecommerce_serang.ui.profile.mystore
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
@ -20,7 +19,6 @@ import android.widget.Toast
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.drawable.toDrawable
|
||||
import androidx.core.view.ViewCompat
|
||||
@ -101,8 +99,12 @@ class RegisterStoreActivity : AppCompatActivity() {
|
||||
setupObservers()
|
||||
Log.d(TAG, "onCreate: Observers setup completed")
|
||||
|
||||
setupMap()
|
||||
Log.d(TAG, "onCreate: Map setup completed")
|
||||
viewModel.latitude.value = "-6.2088"
|
||||
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()
|
||||
Log.d(TAG, "onCreate: Document uploads setup completed")
|
||||
@ -161,16 +163,17 @@ class RegisterStoreActivity : AppCompatActivity() {
|
||||
viewModel.ktpUri != null &&
|
||||
viewModel.nibUri != null &&
|
||||
viewModel.npwpUri != null &&
|
||||
viewModel.selectedCouriers.isNotEmpty()
|
||||
|
||||
binding.btnRegister.isEnabled = isFormValid
|
||||
viewModel.selectedCouriers.isNotEmpty() &&
|
||||
!viewModel.accountName.value.isNullOrBlank()
|
||||
|
||||
binding.btnRegister.isEnabled = true
|
||||
if (isFormValid) {
|
||||
binding.btnRegister.setBackgroundResource(R.drawable.bg_button_active)
|
||||
binding.btnRegister.setTextColor(ContextCompat.getColor(this, R.color.white))
|
||||
} else {
|
||||
binding.btnRegister.setBackgroundResource(R.drawable.bg_button_disabled)
|
||||
binding.btnRegister.setTextColor(ContextCompat.getColor(this, R.color.black_300))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -500,44 +503,44 @@ class RegisterStoreActivity : AppCompatActivity() {
|
||||
validateRequiredFields()
|
||||
}
|
||||
|
||||
private fun setupMap() {
|
||||
Log.d(TAG, "setupMap: Setting up map container")
|
||||
// This would typically integrate with Google Maps SDK
|
||||
// For simplicity, we're just using a placeholder
|
||||
binding.mapContainer.setOnClickListener {
|
||||
Log.d(TAG, "Map container clicked, checking location permission")
|
||||
// Request location permission if not granted
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
Log.d(TAG, "Location permission not granted, requesting permission")
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
||||
LOCATION_PERMISSION_REQUEST
|
||||
)
|
||||
viewModel.latitude.value = "-6.2088"
|
||||
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()
|
||||
} else {
|
||||
Log.d(TAG, "Location permission already granted, setting location")
|
||||
// Show map selection UI
|
||||
// This would typically launch Maps UI for location selection
|
||||
// For now, we'll just set some dummy coordinates
|
||||
viewModel.latitude.value = "-6.2088"
|
||||
viewModel.longitude.value = "106.8456"
|
||||
Log.d(TAG, "Location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
||||
Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "setupMap: Map container setup completed")
|
||||
}
|
||||
// private fun setupMap() {
|
||||
// Log.d(TAG, "setupMap: Setting up map container")
|
||||
// // This would typically integrate with Google Maps SDK
|
||||
// // For simplicity, we're just using a placeholder
|
||||
// binding.mapContainer.setOnClickListener {
|
||||
// Log.d(TAG, "Map container clicked, checking location permission")
|
||||
// // Request location permission if not granted
|
||||
// if (ContextCompat.checkSelfPermission(
|
||||
// this,
|
||||
// Manifest.permission.ACCESS_FINE_LOCATION
|
||||
// ) != PackageManager.PERMISSION_GRANTED
|
||||
// ) {
|
||||
// Log.d(TAG, "Location permission not granted, requesting permission")
|
||||
// ActivityCompat.requestPermissions(
|
||||
// this,
|
||||
// arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
||||
// LOCATION_PERMISSION_REQUEST
|
||||
// )
|
||||
// viewModel.latitude.value = "-6.2088"
|
||||
// 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()
|
||||
// } else {
|
||||
// Log.d(TAG, "Location permission already granted, setting location")
|
||||
// // Show map selection UI
|
||||
// // This would typically launch Maps UI for location selection
|
||||
// // For now, we'll just set some dummy coordinates
|
||||
// viewModel.latitude.value = "-6.2088"
|
||||
// viewModel.longitude.value = "106.8456"
|
||||
// Log.d(TAG, "Location set - Lat: ${viewModel.latitude.value}, Long: ${viewModel.longitude.value}")
|
||||
// Toast.makeText(this, "Lokasi dipilih", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Log.d(TAG, "setupMap: Map container setup completed")
|
||||
// }
|
||||
|
||||
private fun setupDataBinding() {
|
||||
Log.d(TAG, "setupDataBinding: Setting up two-way data binding for text fields")
|
||||
@ -638,6 +641,17 @@ class RegisterStoreActivity : AppCompatActivity() {
|
||||
}
|
||||
})
|
||||
|
||||
binding.etAccountName.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.accountName.value = s.toString()
|
||||
Log.d(TAG, "Account Name updated: ${s.toString()}")
|
||||
validateRequiredFields()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
Log.d(TAG, "setupDataBinding: Text field data binding setup completed")
|
||||
}
|
||||
|
||||
|
@ -583,6 +583,48 @@
|
||||
|
||||
</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 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@ -598,7 +640,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="12. Pilih Kurir Pengiriman"
|
||||
android:text="13. Pilih Kurir Pengiriman"
|
||||
style="@style/body_medium"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
@ -651,7 +693,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="13. Foto Profil Toko"
|
||||
android:text="14. Foto Profil Toko"
|
||||
style="@style/body_medium"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
@ -707,7 +749,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="14. Dokumen KTP"
|
||||
android:text="15. Dokumen KTP"
|
||||
style="@style/body_medium"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
@ -774,7 +816,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="15. Dokumen NIB"
|
||||
android:text="16. Dokumen NIB"
|
||||
style="@style/body_medium"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
@ -841,7 +883,7 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="16. Dokumen NPWP"
|
||||
android:text="17. Dokumen NPWP"
|
||||
style="@style/body_medium"
|
||||
android:layout_marginEnd="4dp"/>
|
||||
|
||||
@ -896,7 +938,8 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
@ -916,12 +959,14 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/map_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@android:color/darker_gray">
|
||||
android:background="@android:color/darker_gray"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
@ -933,7 +978,7 @@
|
||||
<Button
|
||||
android:id="@+id/btn_register"
|
||||
style="@style/button.large.disabled.long"
|
||||
android:enabled="false"
|
||||
android:enabled="true"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="Daftar" />
|
||||
|
Reference in New Issue
Block a user