Browse Source

added missing validations

PankajBranch
Hemant Khadase 2 years ago
parent
commit
35eaac9a51
11 changed files with 84 additions and 41 deletions
  1. +4
    -4
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt
  2. +10
    -6
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepOneNiveshFDFragment.kt
  3. +30
    -8
      app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepTwoNiveshFDFragment.kt
  4. +6
    -0
      app/src/main/java/com/nivesh/production/niveshfd/util/Common.kt
  5. +3
    -5
      app/src/main/res/layout/fragment_niveshfd_step_four.xml
  6. +4
    -2
      app/src/main/res/layout/fragment_niveshfd_step_one.xml
  7. +10
    -8
      app/src/main/res/layout/fragment_niveshfd_step_two.xml
  8. +2
    -1
      app/src/main/res/layout/item_customer_list_preview.xml
  9. +6
    -2
      app/src/main/res/values-hi-rIN/strings.xml
  10. +7
    -3
      app/src/main/res/values/strings.xml
  11. +2
    -2
      app/src/main/res/values/themes.xml

+ 4
- 4
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepFourNiveshFDFragment.kt View File

@ -98,20 +98,20 @@ class StepFourNiveshFDFragment : Fragment() {
} }
private fun validated(): Boolean { private fun validated(): Boolean {
if (selectedList.isEmpty()) {
return if (selectedList.isEmpty()) {
showDialogValidation( showDialogValidation(
activity as NiveshFdMainActivity, activity as NiveshFdMainActivity,
getString(R.string.validTermsCondition) getString(R.string.validTermsCondition)
) )
return false
false
} else if (!binding.checkBox.isChecked) { } else if (!binding.checkBox.isChecked) {
showDialogValidation( showDialogValidation(
activity as NiveshFdMainActivity, activity as NiveshFdMainActivity,
resources.getString(R.string.validTermsConditions) resources.getString(R.string.validTermsConditions)
) )
return false
false
} else { } else {
return true
true
} }
} }


+ 10
- 6
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepOneNiveshFDFragment.kt View File

@ -258,11 +258,9 @@ class StepOneNiveshFDFragment : Fragment() {
when (code) { when (code) {
200 -> { 200 -> {
listOfMinAmount = getCodeResponse.Response.GetCodesList listOfMinAmount = getCodeResponse.Response.GetCodesList
if (listOfMinAmount.isNotEmpty()) {
binding.txtMinAmount.text = getString(R.string.minAmount).plus(
listOfMinAmount[0].Value
)
}
// if (listOfMinAmount.isNotEmpty()) {
// binding.txtMinAmount.text = getString(R.string.minAmount).plus(listOfMinAmount[0].Value)
// }
maxAmountApi() maxAmountApi()
} }
650 -> "" 650 -> ""
@ -438,7 +436,13 @@ class StepOneNiveshFDFragment : Fragment() {
binding.tlDepositAmount, binding.tlDepositAmount,
getString(R.string.validMinAmount) getString(R.string.validMinAmount)
) )
} else if (binding.edtAmount.text.toString()
} else if (binding.edtAmount.text.toString().toInt() % 1000 != 0) {
commonErrorMethod(
binding.edtAmount,
binding.tlDepositAmount,
getString(R.string.validMultipleAmount)
)
}else if (binding.edtAmount.text.toString()
.toDouble() > listOfMaxAmount[0].Value.toDouble() .toDouble() > listOfMaxAmount[0].Value.toDouble()
) { ) {
commonErrorMethod( commonErrorMethod(


+ 30
- 8
app/src/main/java/com/nivesh/production/niveshfd/ui/fragment/StepTwoNiveshFDFragment.kt View File

@ -39,6 +39,7 @@ import com.nivesh.production.niveshfd.util.Common.Companion.getDate
import com.nivesh.production.niveshfd.util.Common.Companion.isIndianMobileNo import com.nivesh.production.niveshfd.util.Common.Companion.isIndianMobileNo
import com.nivesh.production.niveshfd.util.Common.Companion.isMinor import com.nivesh.production.niveshfd.util.Common.Companion.isMinor
import com.nivesh.production.niveshfd.util.Common.Companion.isValidEmail import com.nivesh.production.niveshfd.util.Common.Companion.isValidEmail
import com.nivesh.production.niveshfd.util.Common.Companion.isValidIndividualPan
import com.nivesh.production.niveshfd.util.Common.Companion.isValidName import com.nivesh.production.niveshfd.util.Common.Companion.isValidName
import com.nivesh.production.niveshfd.util.Common.Companion.isValidPan import com.nivesh.production.niveshfd.util.Common.Companion.isValidPan
import com.nivesh.production.niveshfd.util.Common.Companion.removeError import com.nivesh.production.niveshfd.util.Common.Companion.removeError
@ -564,10 +565,10 @@ class StepTwoNiveshFDFragment : Fragment() {
} }
} }
binding.tvBankDetails.setOnClickListener { binding.tvBankDetails.setOnClickListener {
if (binding.llBankDetails.visibility == View.VISIBLE) {
binding.llBankDetails.visibility = View.GONE
if (binding.llBank.visibility == View.VISIBLE) {
binding.llBank.visibility = View.GONE
} else { } else {
binding.llBankDetails.visibility = View.VISIBLE
binding.llBank.visibility = View.VISIBLE
} }
} }
@ -1487,10 +1488,22 @@ class StepTwoNiveshFDFragment : Fragment() {
listOfOccupation listOfOccupation
) )
binding.spOccupation.setAdapter(adapter) binding.spOccupation.setAdapter(adapter)
binding.spOccupation.setText(
adapter.getItem(0)?.Label,
false
)
val occupationCode = (activity as NiveshFdMainActivity).getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_OCCUPATION_CODE
if (occupationCode.isNullOrEmpty()) {
binding.spOccupation.setText(
adapter.getItem(0)?.Label,
false
)
}else{
for (title in listOfOccupation) {
if (title.Value == occupationCode) {
binding.spOccupation.setText(title.Label, false)
break
}
}
}
} }
} }
// 650 -> refreshToken() // 650 -> refreshToken()
@ -1823,7 +1836,10 @@ class StepTwoNiveshFDFragment : Fragment() {
) )
} else if (binding.edtDOB.text.toString().isEmpty()) { // EditText } else if (binding.edtDOB.text.toString().isEmpty()) { // EditText
commonErrorMethod(binding.edtDOB, binding.tlDOB, getString(R.string.emptyDOB)) commonErrorMethod(binding.edtDOB, binding.tlDOB, getString(R.string.emptyDOB))
} else if (binding.edtPANNumber.text.toString().isEmpty()) { // EditText
}else if (isMinor(binding.edtDOB.text.toString())) { // EditText
commonErrorMethod(binding.edtDOB, binding.tlDOB, getString(R.string.minorApplicant))
}
else if (binding.edtPANNumber.text.toString().isEmpty()) { // EditText
commonErrorMethod( commonErrorMethod(
binding.edtPANNumber, binding.edtPANNumber,
binding.tlPanNumber, binding.tlPanNumber,
@ -1835,6 +1851,12 @@ class StepTwoNiveshFDFragment : Fragment() {
binding.tlPanNumber, binding.tlPanNumber,
getString(R.string.invalidPAN) getString(R.string.invalidPAN)
) )
} else if (!isValidIndividualPan(binding.edtPANNumber.text.toString())) { // EditText
commonErrorMethod(
binding.edtPANNumber,
binding.tlPanNumber,
getString(R.string.invalidIndividualPAN)
)
} else if (binding.spTitle.text.isEmpty()) { // Spinner } else if (binding.spTitle.text.isEmpty()) { // Spinner
commonSpinnerErrorMethod( commonSpinnerErrorMethod(
binding.spTitle, binding.spTitle,


+ 6
- 0
app/src/main/java/com/nivesh/production/niveshfd/util/Common.kt View File

@ -97,6 +97,12 @@ class Common {
return mMatcher.matches() return mMatcher.matches()
} }
fun isValidIndividualPan(pan: String?): Boolean {
val mPattern = Pattern.compile("[A-Z]{3}[P][A-Z][0-9]{4}[A-Z]")
val mMatcher = mPattern.matcher(pan.toString())
return mMatcher.matches()
}
//is Indian mobile Number //is Indian mobile Number
fun isIndianMobileNo(mobileNumber: String?): Boolean { fun isIndianMobileNo(mobileNumber: String?): Boolean {
//(0/91): number starts with (0/91) //(0/91): number starts with (0/91)


+ 3
- 5
app/src/main/res/layout/fragment_niveshfd_step_four.xml View File

@ -221,11 +221,7 @@
android:id="@+id/rvTerms" android:id="@+id/rvTerms"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:listitem="@layout/item_customer_list_preview"
/>
tools:listitem="@layout/item_customer_list_preview" />
</LinearLayout> </LinearLayout>
<CheckBox <CheckBox
@ -292,6 +288,8 @@
android:layout_marginBottom="@dimen/margin_15" android:layout_marginBottom="@dimen/margin_15"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/text_size_14" android:textSize="@dimen/text_size_14"
android:text="@string/pay"
android:background="@color/green"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/btnBack" app:layout_constraintStart_toEndOf="@+id/btnBack"


+ 4
- 2
app/src/main/res/layout/fragment_niveshfd_step_one.xml View File

@ -84,6 +84,7 @@
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
<TextView <TextView
android:visibility="gone"
android:id="@+id/txtMinAmount" android:id="@+id/txtMinAmount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -176,6 +177,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_10" android:layout_marginStart="@dimen/margin_10"
android:layout_marginEnd="@dimen/margin_10" android:layout_marginEnd="@dimen/margin_10"
android:theme="@style/SCBSwitch"
android:text="@string/upto0.25next" android:text="@string/upto0.25next"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="@dimen/text_size_12" /> android:textSize="@dimen/text_size_12" />
@ -186,7 +188,7 @@
<TextView <TextView
android:id="@+id/tvMaturityInstruction" android:id="@+id/tvMaturityInstruction"
style="@style/regularStyle"
style="@style/BoldStyle"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/greyColor3" android:background="@color/greyColor3"
@ -229,7 +231,7 @@
style="@style/semiBoldStyle" style="@style/semiBoldStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_20"
android:layout_marginStart="@dimen/margin_15"
android:layout_marginTop="@dimen/margin_10" android:layout_marginTop="@dimen/margin_10"
android:layout_marginEnd="@dimen/margin_15" android:layout_marginEnd="@dimen/margin_15"
android:text="@string/taxDeductedAtSourceTds" android:text="@string/taxDeductedAtSourceTds"


+ 10
- 8
app/src/main/res/layout/fragment_niveshfd_step_two.xml View File

@ -834,8 +834,12 @@
android:textSize="@dimen/text_size_14" android:textSize="@dimen/text_size_14"
app:drawableRightCompat="@drawable/svg_down_arrow" /> app:drawableRightCompat="@drawable/svg_down_arrow" />
<!-- RecyclerView for bankList and Add Bank-->
<LinearLayout
android:id="@+id/llBank"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- RecyclerView for bankList and Add Bank-->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -846,10 +850,7 @@
android:id="@+id/rvClientBankList" android:id="@+id/rvClientBankList"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="horizontal"
/>
android:orientation="horizontal" />
<TextView <TextView
android:id="@+id/addBankDetail" android:id="@+id/addBankDetail"
@ -868,8 +869,7 @@
</LinearLayout> </LinearLayout>
<!-- Add Bank Field-->
<!-- Add Bank Field-->
<LinearLayout <LinearLayout
android:id="@+id/llBankDetails" android:id="@+id/llBankDetails"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -1019,6 +1019,8 @@
android:textSize="@dimen/text_size_14" /> android:textSize="@dimen/text_size_14" />
</LinearLayout> </LinearLayout>
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"


+ 2
- 1
app/src/main/res/layout/item_customer_list_preview.xml View File

@ -19,7 +19,8 @@
<com.google.android.material.switchmaterial.SwitchMaterial <com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/tvCustomerName" android:id="@+id/tvCustomerName"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:padding="@dimen/margin_4"
android:padding="@dimen/margin_7"
android:theme="@style/SCBSwitch"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.13" android:layout_weight="0.13"
android:checked="false" android:checked="false"


+ 6
- 2
app/src/main/res/values-hi-rIN/strings.xml View File

@ -52,7 +52,8 @@
<string name="emptyAmountFirst">Please enter amount first</string> <string name="emptyAmountFirst">Please enter amount first</string>
<string name="validMinAmount">Entered amount should be greater than minimum amount</string> <string name="validMinAmount">Entered amount should be greater than minimum amount</string>
<string name="validMaxAmount">Entered amount should be less than 5 Cr.</string>
<string name="validMaxAmount">Entered amount should be up to 5 Cr only</string>
<string name="validMultipleAmount">Entered Amount should be multiples of 1000</string>
<string name="emptyInterestPayout">Please select Interest Payout</string> <string name="emptyInterestPayout">Please select Interest Payout</string>
<string name="emptyInterestTenure">Please select Investment Tenure</string> <string name="emptyInterestTenure">Please select Investment Tenure</string>
@ -139,9 +140,12 @@
<string name="inValidMobileNumber">Mobile number should have at least 10 digits</string> <string name="inValidMobileNumber">Mobile number should have at least 10 digits</string>
<string name="inValidIndianMobileNumber">Mobile number should start with 6,7,8 and 9</string> <string name="inValidIndianMobileNumber">Mobile number should start with 6,7,8 and 9</string>
<string name="emptyDOB">Please select date of birth</string> <string name="emptyDOB">Please select date of birth</string>
<string name="minorApplicant">Primary Applicant should not be minor</string>
<string name="emptyPAN">Please enter PAN number</string> <string name="emptyPAN">Please enter PAN number</string>
<string name="invalidPAN">Invalid PAN</string>
<string name="invalidPAN">Please enter valid PAN number</string>
<string name="invalidIndividualPAN">PAN Applicants should be individual</string>
<string name="accountVerified">Account Verified</string> <string name="accountVerified">Account Verified</string>


+ 7
- 3
app/src/main/res/values/strings.xml View File

@ -18,7 +18,7 @@
<string name="selectInterestTenure">Select Investment Tenure</string> <string name="selectInterestTenure">Select Investment Tenure</string>
<string name="upto0.25">Up to 0.25% p.a for </string> <string name="upto0.25">Up to 0.25% p.a for </string>
<string name="upto0.25next">Up to 0.25% p.a for Senior Citizens, 60+</string> <string name="upto0.25next">Up to 0.25% p.a for Senior Citizens, 60+</string>
<string name="maturityInstructions">Maturity Instructions:</string>
<string name="maturityInstructions">Maturity Instructions</string>
<string name="additionalDetailOne">Automatically credit to my bank account</string> <string name="additionalDetailOne">Automatically credit to my bank account</string>
<string name="additionalDetailTwo">Automatically renew principal amount</string> <string name="additionalDetailTwo">Automatically renew principal amount</string>
<string name="additionalDetailThree">Automatically renew both principal and interest amount</string> <string name="additionalDetailThree">Automatically renew both principal and interest amount</string>
@ -52,7 +52,8 @@
<string name="emptyAmountFirst">Please enter amount first</string> <string name="emptyAmountFirst">Please enter amount first</string>
<string name="validMinAmount">Entered amount should be greater than minimum amount</string> <string name="validMinAmount">Entered amount should be greater than minimum amount</string>
<string name="validMaxAmount">Entered amount should be less than 5 Cr.</string>
<string name="validMaxAmount">Entered amount should be up to 5 Cr only</string>
<string name="validMultipleAmount">Entered Amount should be multiples of 1000</string>
<string name="emptyInterestPayout">Please select Interest Payout</string> <string name="emptyInterestPayout">Please select Interest Payout</string>
<string name="emptyInterestTenure">Please select Investment Tenure</string> <string name="emptyInterestTenure">Please select Investment Tenure</string>
@ -139,9 +140,12 @@
<string name="inValidMobileNumber">Mobile number should have at least 10 digits</string> <string name="inValidMobileNumber">Mobile number should have at least 10 digits</string>
<string name="inValidIndianMobileNumber">Mobile number should start with 6,7,8 and 9</string> <string name="inValidIndianMobileNumber">Mobile number should start with 6,7,8 and 9</string>
<string name="emptyDOB">Please select date of birth</string> <string name="emptyDOB">Please select date of birth</string>
<string name="minorApplicant">Primary Applicant should not be minor</string>
<string name="emptyPAN">Please enter PAN number</string> <string name="emptyPAN">Please enter PAN number</string>
<string name="invalidPAN">Invalid PAN</string>
<string name="invalidPAN">Please enter valid PAN number</string>
<string name="invalidIndividualPAN">PAN Applicants should be individual</string>
<string name="accountVerified">Account Verified</string> <string name="accountVerified">Account Verified</string>


+ 2
- 2
app/src/main/res/values/themes.xml View File

@ -16,10 +16,10 @@
<style name="SCBSwitch" parent="Theme.AppCompat.Light"> <style name="SCBSwitch" parent="Theme.AppCompat.Light">
<!-- active thumb & track color (30% transparency) --> <!-- active thumb & track color (30% transparency) -->
<item name="colorControlActivated">@color/red</item>
<item name="colorControlActivated">@color/green</item>
<!-- inactive thumb color --> <!-- inactive thumb color -->
<item name="colorSwitchThumbNormal">@color/red</item>
<item name="colorSwitchThumbNormal">@color/white</item>
<!-- inactive track color (30% transparency) --> <!-- inactive track color (30% transparency) -->
<item name="android:colorForeground">#C68D8D</item> <item name="android:colorForeground">#C68D8D</item>


Loading…
Cancel
Save

Powered by TurnKey Linux.