TP-57047 | resale (#10325)
This commit is contained in:
committed by
GitHub
parent
17fd00a27b
commit
f10bebedc0
@@ -15,4 +15,5 @@ data class OptionSelectAction(
|
||||
val selectedOption: String?,
|
||||
val dependantWidgetList: List<WidgetAction>?,
|
||||
val additionalData: Map<String, String>?,
|
||||
var type: String? = null
|
||||
) : NaviClickAction()
|
||||
|
||||
@@ -94,7 +94,8 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
widgetId = widgetModel.widgetId,
|
||||
selectedOption = selectedItem.title,
|
||||
dependantWidgetList = selectedItem.dependantWidgetIdList,
|
||||
additionalData = selectedItem.additionalData
|
||||
additionalData = selectedItem.additionalData,
|
||||
type = selectedItem.referenceId
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -74,10 +74,11 @@ class NewOptionListBottomSheet : BottomSheetDialogFragment() {
|
||||
if (index == optionList.size - 1) itemBinding.divider.visibility = View.GONE
|
||||
|
||||
optionViewList.add(item to itemBinding)
|
||||
|
||||
item.referenceId = null
|
||||
itemBinding.root.setOnClickListener {
|
||||
optionViewList.forEach { it.first.isSelected = false }
|
||||
item.isSelected = true
|
||||
item.referenceId = NEW_OPTION_LIST_BOTTOM_SHEET_CLICKED
|
||||
updateSelectionUI()
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
@@ -141,6 +142,8 @@ class NewOptionListBottomSheet : BottomSheetDialogFragment() {
|
||||
private const val TITLE = "TITLE"
|
||||
private const val CARD_TEXT = "CARD_TEXT"
|
||||
private const val SHOW_RADIO_BUTTON = "SHOULD_SHOW_RADIO_BUTTON"
|
||||
private const val NEW_OPTION_LIST_BOTTOM_SHEET_CLICKED =
|
||||
"NEW_OPTION_LIST_BOTTOM_SHEET_CLICKED"
|
||||
|
||||
fun getInstance(
|
||||
itemList: ArrayList<SelectableItem>,
|
||||
|
||||
@@ -124,6 +124,10 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||
widgetBinding.plainTextInput.setText(it)
|
||||
}
|
||||
}
|
||||
?: run {
|
||||
widgetModel.inputData = null
|
||||
widgetBinding.plainTextInput.setText(EMPTY)
|
||||
}
|
||||
if (isNewWidget) {
|
||||
updateNewTheme(widgetModel.widgetData?.isNonEditable.orFalse())
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ import com.navi.hl.utils.Constants.POLLING_TIMEOUT
|
||||
import com.navi.hl.utils.Constants.PROPERTY_NAME
|
||||
import com.navi.hl.utils.Constants.SALARIED
|
||||
import com.navi.hl.utils.Constants.SELF_CONSTRUCTION
|
||||
import com.navi.hl.utils.Constants.SHOW
|
||||
import com.navi.hl.utils.Constants.STATE_WIDGET_ID
|
||||
import com.navi.hl.utils.HlAction
|
||||
import com.navi.hl.utils.NaviHLAnalytics
|
||||
@@ -114,6 +115,7 @@ import com.navi.naviwidgets.widgets.checkboxwithtitle.CheckboxClickAction
|
||||
import com.navi.naviwidgets.widgets.checkboxwithtitle.CheckboxWithTitleWidget
|
||||
import com.navi.naviwidgets.widgets.checkboxwithtitle.InfoIconClickAction
|
||||
import com.navi.naviwidgets.widgets.labeledinputsearch.InputSearchClickAction
|
||||
import com.navi.naviwidgets.widgets.labeledinputsearch.LabeledTextInputSearchWidgetModel
|
||||
import com.navi.naviwidgets.widgets.labledtextinput.ui.LabeledTextInputWidgetV2
|
||||
import com.navi.naviwidgets.widgets.tileoptionselector.LabeledOptionSelectorTileWidgetModel
|
||||
import com.navi.naviwidgets.widgets.tileoptionselector.TileOptionClickAction
|
||||
@@ -582,9 +584,19 @@ class HomeLoanFormScreenFragment :
|
||||
return queryMap[ACTION] == CO_APPLICANT_EMPLOYMENT_DETAILS
|
||||
}
|
||||
|
||||
private fun processDependantWidgets(dependantWidgetList: List<WidgetAction>) {
|
||||
private fun processDependantWidgets(dependantWidgetList: List<WidgetAction>, isPurchaseType: Boolean = false) {
|
||||
val widgetListInAdapter: List<NaviWidget>? = formAdapter?.getDataSet() as? List<NaviWidget>
|
||||
val widgetsToBeAddedHashmap: HashMap<Int, NaviWidget> = hashMapOf()
|
||||
var widgetPos = 0
|
||||
if (isPurchaseType) {
|
||||
viewModel.formGetResponse.value
|
||||
?.content
|
||||
?.widgets?.forEachIndexed { index, widget ->
|
||||
if (widget.widgetId == PURCHASE_TYPE) {
|
||||
widgetPos = index
|
||||
}
|
||||
}
|
||||
}
|
||||
dependantWidgetList.forEach { widgetAction ->
|
||||
val dependantWidget =
|
||||
viewModel.formGetResponse.value?.content?.widgets?.firstOrNull {
|
||||
@@ -604,7 +616,13 @@ class HomeLoanFormScreenFragment :
|
||||
?.content
|
||||
?.widgets
|
||||
?.indexOf(dependantWidget)
|
||||
?.let { index -> widgetsToBeAddedHashmap[index] = it }
|
||||
?.let { index ->
|
||||
if (isPurchaseType) {
|
||||
widgetsToBeAddedHashmap[widgetPos++] = it
|
||||
} else {
|
||||
widgetsToBeAddedHashmap[index] = it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -828,6 +846,15 @@ class HomeLoanFormScreenFragment :
|
||||
const val FINANCIAL_CO_APPLICANT_CHECKBOX= "FinancialCoApplicantCheckbox"
|
||||
const val APPLICANT_RELATION = "applicantRelation"
|
||||
const val CO_APPLICANT_RELATION = "relation"
|
||||
const val PURCHASE_TYPE = "purchaseType"
|
||||
const val PROPERTY_TYPE = "propertyType"
|
||||
const val PROPERTY_NAME = "propertyName"
|
||||
const val RESALE = "Resale"
|
||||
const val FROM_BUILDER = "From builder"
|
||||
const val NEW_OPTION_LIST_BOTTOM_SHEET_CLICKED = "NEW_OPTION_LIST_BOTTOM_SHEET_CLICKED"
|
||||
const val PROPERTY_ID = "propertyId"
|
||||
const val NO_RESULT_NOTE = "Please enter the name of the property for which you intend to apply for a Home Loan"
|
||||
const val ADD_PROPERTY = "+ Add Property"
|
||||
|
||||
fun newInstance(arguments: Bundle?) =
|
||||
HomeLoanFormScreenFragment().apply { this.arguments = arguments }
|
||||
@@ -1010,6 +1037,45 @@ class HomeLoanFormScreenFragment :
|
||||
}
|
||||
formAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
if (naviClickAction.widgetId == PURCHASE_TYPE && naviClickAction.type == NEW_OPTION_LIST_BOTTOM_SHEET_CLICKED) {
|
||||
val selectedPurchaseType = naviClickAction.selectedOption
|
||||
var isTowerVisible = false
|
||||
viewModel.formGetResponse.value?.content?.widgets?.forEach {
|
||||
if (it.widgetId == PROPERTY_TYPE) {
|
||||
val widget = it
|
||||
if (widget is LabeledOptionSelectorTileWidgetModel) {
|
||||
widget.widgetData?.tileSelectorData?.items?.forEach { item ->
|
||||
if (item.id == FLAT) {
|
||||
item.dependantWidgetIdList?.forEach { listItem ->
|
||||
if (listItem.widgetId == PROPERTY_ID && listItem.action == SHOW) {
|
||||
isTowerVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
viewModel.formGetResponse.value?.content?.widgets?.forEach {
|
||||
if (it.widgetId == PROPERTY_NAME) {
|
||||
val widget = it
|
||||
if (selectedPurchaseType == RESALE && widget is LabeledTextInputSearchWidgetModel) {
|
||||
widget.widgetData?.inputTextSearchItemData?.noResultNote = NO_RESULT_NOTE
|
||||
widget.widgetData?.inputTextSearchItemData?.addInputText = ADD_PROPERTY
|
||||
} else if (selectedPurchaseType == FROM_BUILDER && widget is LabeledTextInputSearchWidgetModel) {
|
||||
widget.widgetData?.inputTextSearchItemData?.noResultNote = null
|
||||
widget.widgetData?.inputTextSearchItemData?.addInputText = null
|
||||
if (!isTowerVisible) {
|
||||
widget.inputData = null
|
||||
widget.widgetData?.inputTextSearchItemData?.savedText = null
|
||||
}
|
||||
}
|
||||
formAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
analyticsEventTracker.onFormWidgetItemSelected(
|
||||
queryMap[ACTION],
|
||||
naviClickAction.widgetId,
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
|
||||
package com.navi.hl.steps.repository
|
||||
|
||||
import com.google.common.reflect.TypeToken
|
||||
import com.navi.common.network.models.RepoResult
|
||||
import com.navi.common.network.retrofit.ResponseCallback
|
||||
import com.navi.hl.utils.mockApiResponse
|
||||
import com.navi.hl.utils.retrofitService
|
||||
import com.navi.homeloan.common.models.HomeLoanFormScreenResponse
|
||||
|
||||
class HomeLoanFormScreenRepository : ResponseCallback() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user