|
@@ -31,11 +31,13 @@ import com.pan_american.android.base.BaseResponse
|
|
|
import com.pan_american.android.base.ListAdapter
|
|
|
import com.pan_american.android.data.model.common.entity.Selector
|
|
|
import com.pan_american.android.data.model.common.entity.SiftListItem
|
|
|
+import com.pan_american.android.data.model.common.network.SelectorResponse
|
|
|
import com.pan_american.android.data.model.customer_resource.company_customer.entity.MarketCustomer
|
|
|
import com.pan_american.android.data.model.customer_resource.company_customer.network.BusinessCardInfoRequest
|
|
|
import com.pan_american.android.data.model.customer_resource.company_customer.network.BusinessCardInfoResponse
|
|
|
import com.pan_american.android.data.model.customer_resource.company_customer.network.MarketCustomerDetailRequest
|
|
|
import com.pan_american.android.data.model.customer_resource.company_customer.network.MarketCustomerDetailResponse
|
|
|
+import com.pan_american.android.data.model.customer_resource.company_customer.network.UpdateClientTypeRequest
|
|
|
import com.pan_american.android.data.network.APIService
|
|
|
import com.pan_american.android.data.network.ServiceCreator
|
|
|
import com.pan_american.android.databinding.ActivityAddNewCustomerBinding
|
|
@@ -235,7 +237,11 @@ class AddNewCustomerActivity : BaseActivity<ActivityAddNewCustomerBinding>() {
|
|
|
}
|
|
|
|
|
|
binding.customerClassify.setOnClickListener {
|
|
|
- initCustomerClassifySelector()
|
|
|
+ if (marketCustomer.lvlid == 0) {
|
|
|
+ showMessage(resources.getString(R.string.customer_level_select_hint))
|
|
|
+ } else {
|
|
|
+ initCustomerClassifySelector()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
binding.customerLeader.setOnClickListener {
|
|
@@ -315,11 +321,6 @@ class AddNewCustomerActivity : BaseActivity<ActivityAddNewCustomerBinding>() {
|
|
|
customerLevel.add(item)
|
|
|
}
|
|
|
|
|
|
- for (item in OASystem.customerClass) {
|
|
|
- item.isChecked = false
|
|
|
- customerClass.add(item)
|
|
|
- }
|
|
|
-
|
|
|
for (item in OASystem.serviceClass) {
|
|
|
item.isChecked = false
|
|
|
customerServiceClass.add(item)
|
|
@@ -476,6 +477,12 @@ class AddNewCustomerActivity : BaseActivity<ActivityAddNewCustomerBinding>() {
|
|
|
binding.customerLevel.text = customerLevel[position].name
|
|
|
marketCustomer.lvlid = customerLevel[position].id
|
|
|
|
|
|
+ binding.customerClassify.text = ""
|
|
|
+ marketCustomer.category = 0
|
|
|
+
|
|
|
+ customerClass.clear()
|
|
|
+ getCustomerClassWithLevelId(marketCustomer.lvlid)
|
|
|
+
|
|
|
popupWindow.dismiss()
|
|
|
}
|
|
|
}
|
|
@@ -938,4 +945,28 @@ class AddNewCustomerActivity : BaseActivity<ActivityAddNewCustomerBinding>() {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ private fun getCustomerClassWithLevelId(position: Int) {
|
|
|
+ apiService.updateClientTypeList(UpdateClientTypeRequest(listOf(position))).enqueue(object : Callback<SelectorResponse> {
|
|
|
+ override fun onResponse(call: Call<SelectorResponse>, response: Response<SelectorResponse>) {
|
|
|
+ val selectorResponse = response.body()
|
|
|
+
|
|
|
+ if (selectorResponse != null) {
|
|
|
+ if (selectorResponse.code == 200) {
|
|
|
+
|
|
|
+ for (item in selectorResponse.data) {
|
|
|
+ customerClass.add(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ showMessage(selectorResponse.msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onFailure(p0: Call<SelectorResponse>, p1: Throwable) {
|
|
|
+ showErrorInfo(R.string.interface_request_error)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|