|
@ -5,7 +5,6 @@ package com.nivesh.production.partnerOnBoarding.ui.fragments |
|
|
import android.Manifest |
|
|
import android.Manifest |
|
|
import android.annotation.SuppressLint |
|
|
import android.annotation.SuppressLint |
|
|
import android.app.Activity |
|
|
import android.app.Activity |
|
|
import android.app.Dialog |
|
|
|
|
|
import android.content.DialogInterface |
|
|
import android.content.DialogInterface |
|
|
import android.content.pm.PackageManager |
|
|
import android.content.pm.PackageManager |
|
|
import android.database.Cursor |
|
|
import android.database.Cursor |
|
@ -33,12 +32,14 @@ import androidx.appcompat.app.AlertDialog |
|
|
import androidx.core.app.ActivityCompat |
|
|
import androidx.core.app.ActivityCompat |
|
|
import androidx.core.content.ContextCompat |
|
|
import androidx.core.content.ContextCompat |
|
|
import androidx.core.content.FileProvider |
|
|
import androidx.core.content.FileProvider |
|
|
|
|
|
import androidx.core.view.isVisible |
|
|
import androidx.lifecycle.ViewModelProvider |
|
|
import androidx.lifecycle.ViewModelProvider |
|
|
import androidx.lifecycle.lifecycleScope |
|
|
import androidx.lifecycle.lifecycleScope |
|
|
import com.google.android.material.textfield.MaterialAutoCompleteTextView |
|
|
import com.google.android.material.textfield.MaterialAutoCompleteTextView |
|
|
import com.google.android.material.textfield.TextInputEditText |
|
|
import com.google.android.material.textfield.TextInputEditText |
|
|
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 com.google.gson.GsonBuilder |
|
|
import com.nivesh.production.partnerOnBoarding.BuildConfig |
|
|
import com.nivesh.production.partnerOnBoarding.BuildConfig |
|
|
import com.nivesh.production.partnerOnBoarding.R |
|
|
import com.nivesh.production.partnerOnBoarding.R |
|
|
import com.nivesh.production.partnerOnBoarding.api.ApiClient |
|
|
import com.nivesh.production.partnerOnBoarding.api.ApiClient |
|
@ -53,12 +54,14 @@ import com.nivesh.production.partnerOnBoarding.repositories.MainRepository |
|
|
import com.nivesh.production.partnerOnBoarding.ui.activities.BaseActivity |
|
|
import com.nivesh.production.partnerOnBoarding.ui.activities.BaseActivity |
|
|
import com.nivesh.production.partnerOnBoarding.ui.activities.SignUpActivity |
|
|
import com.nivesh.production.partnerOnBoarding.ui.activities.SignUpActivity |
|
|
import com.nivesh.production.partnerOnBoarding.util.* |
|
|
import com.nivesh.production.partnerOnBoarding.util.* |
|
|
|
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.getDateFromTimeMills |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.getFileExtension |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.getFileExtension |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.isValidIndividualPan |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.isValidIndividualPan |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogValidation |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogWithTwoButtons |
|
|
import com.nivesh.production.partnerOnBoarding.util.Common.Companion.showDialogWithTwoButtons |
|
|
import com.nivesh.production.partnerOnBoarding.util.Constants.Companion.maxFileSize |
|
|
import com.nivesh.production.partnerOnBoarding.util.Constants.Companion.maxFileSize |
|
|
import com.nivesh.production.partnerOnBoarding.viewModels.OnBoardingViewModel |
|
|
import com.nivesh.production.partnerOnBoarding.viewModels.OnBoardingViewModel |
|
|
|
|
|
import com.squareup.picasso.Picasso |
|
|
import okhttp3.MediaType.Companion.toMediaType |
|
|
import okhttp3.MediaType.Companion.toMediaType |
|
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull |
|
|
import okhttp3.MediaType.Companion.toMediaTypeOrNull |
|
|
import okhttp3.MultipartBody |
|
|
import okhttp3.MultipartBody |
|
@ -86,14 +89,26 @@ class GetStartedFragment : BaseFragment() { |
|
|
private var panFileExt: String? = "" |
|
|
private var panFileExt: String? = "" |
|
|
private var docValue: String = "" |
|
|
private var docValue: String = "" |
|
|
private var isFront: Boolean = false |
|
|
private var isFront: Boolean = false |
|
|
|
|
|
private var isBack: Boolean = false |
|
|
|
|
|
private var isARN: Boolean = false |
|
|
|
|
|
private var isEUIN: Boolean = false |
|
|
private lateinit var viewModel: OnBoardingViewModel |
|
|
private lateinit var viewModel: OnBoardingViewModel |
|
|
private lateinit var listOfDocType: List<Data> |
|
|
|
|
|
|
|
|
private var listOfDocType: List<Data> = emptyList() |
|
|
|
|
|
private var listOfFullDocType: List<Data> = emptyList() |
|
|
private var imageSelectedList = ArrayList<ImageSelectedModel>() |
|
|
private var imageSelectedList = ArrayList<ImageSelectedModel>() |
|
|
private var imageSelectedArnEuinList = ArrayList<ImageSelectedModel>() |
|
|
private var imageSelectedArnEuinList = ArrayList<ImageSelectedModel>() |
|
|
private var arnList = ArrayList<DataX>() |
|
|
private var arnList = ArrayList<DataX>() |
|
|
private var arnData: DataX? = null |
|
|
private var arnData: DataX? = null |
|
|
private lateinit var panRes: PANResponse |
|
|
private lateinit var panRes: PANResponse |
|
|
private var selectedDocPosition = -1 |
|
|
|
|
|
|
|
|
private var selectedDocPosition = -1 |
|
|
|
|
|
private var documentUrlSelected: String = "" |
|
|
|
|
|
private var documentTypeSelected: String = "" |
|
|
|
|
|
private var isDataUpdate: Boolean = false |
|
|
|
|
|
private val pt = PartnerRequest() |
|
|
|
|
|
private var frontUpdatedFileId = 0 |
|
|
|
|
|
private var backUpdatedFileId = 0 |
|
|
|
|
|
private var arnUpdatedFileId = 0 |
|
|
|
|
|
private var euinUpdatedFileId = 0 |
|
|
|
|
|
|
|
|
private val permissions = arrayOf( |
|
|
private val permissions = arrayOf( |
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, |
|
|
Manifest.permission.READ_EXTERNAL_STORAGE, |
|
@ -156,22 +171,23 @@ class GetStartedFragment : BaseFragment() { |
|
|
)[OnBoardingViewModel::class.java] |
|
|
)[OnBoardingViewModel::class.java] |
|
|
|
|
|
|
|
|
var docType = "I" |
|
|
var docType = "I" |
|
|
if (arguments?.getString("arnType").equals("Associate", true)) { |
|
|
|
|
|
|
|
|
if (arguments?.getString("arnType").equals(getString(R.string.associateText), true)) { |
|
|
commonMethodForVisibility(View.GONE) |
|
|
commonMethodForVisibility(View.GONE) |
|
|
docType = "N" |
|
|
docType = "N" |
|
|
} else if (arguments?.getString("arnType").equals("advisory", true)) { |
|
|
|
|
|
|
|
|
} else if (arguments?.getString("arnType").equals(getString(R.string.advisory), true)) { |
|
|
commonMethodForVisibility(View.VISIBLE) |
|
|
commonMethodForVisibility(View.VISIBLE) |
|
|
docType = "I" |
|
|
docType = "I" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
documentTypeFullAPI() |
|
|
documentTypeAPI(docType) |
|
|
documentTypeAPI(docType) |
|
|
|
|
|
|
|
|
binding.edtPassingAMFI.setOnClickListener { |
|
|
binding.edtPassingAMFI.setOnClickListener { |
|
|
Common.datePicker(activity as SignUpActivity, binding.edtPassingAMFI,false) |
|
|
|
|
|
|
|
|
Common.datePicker(activity as SignUpActivity, binding.edtPassingAMFI, false) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
binding.edtExpiryAMFI.setOnClickListener { |
|
|
binding.edtExpiryAMFI.setOnClickListener { |
|
|
Common.datePicker(activity as SignUpActivity, binding.edtExpiryAMFI,true) |
|
|
|
|
|
|
|
|
Common.datePicker(activity as SignUpActivity, binding.edtExpiryAMFI, true) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
selectImageIntent = registerForActivityResult(ActivityResultContracts.GetContent()) |
|
|
selectImageIntent = registerForActivityResult(ActivityResultContracts.GetContent()) |
|
@ -194,24 +210,26 @@ class GetStartedFragment : BaseFragment() { |
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
binding.edtEUINNumber.addTextChangedListener(object : TextWatcher{ |
|
|
|
|
|
|
|
|
binding.edtEUINNumber.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) { |
|
|
Common.removeError(binding.tlEUINNumber) |
|
|
Common.removeError(binding.tlEUINNumber) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
binding.edtEUINNumberNF.addTextChangedListener(object : TextWatcher{ |
|
|
|
|
|
|
|
|
binding.edtEUINNumberNF.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) { |
|
|
Common.removeError(binding.tlEUINNumberNF) |
|
|
Common.removeError(binding.tlEUINNumberNF) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
override fun afterTextChanged(s: Editable?) {} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
binding.ivInfo.setOnClickListener { |
|
|
binding.ivInfo.setOnClickListener { |
|
|
replaceFragment( |
|
|
|
|
|
|
|
|
addFragment( |
|
|
activity as BaseActivity, |
|
|
activity as BaseActivity, |
|
|
R.id.signUpContainer, |
|
|
R.id.signUpContainer, |
|
|
QuestionsFragment(), |
|
|
QuestionsFragment(), |
|
@ -247,10 +265,52 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
binding.saveDraft.setOnClickListener { |
|
|
|
|
|
val partnerRequest = PartnerRequest() |
|
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(binding.edtArnNumber.text.toString().trim())) { |
|
|
|
|
|
partnerRequest.ARNNumber = binding.edtArnNumber.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (binding.tlEUINNumber.isVisible && !TextUtils.isEmpty( |
|
|
|
|
|
binding.edtEUINNumber.text.toString().trim() |
|
|
|
|
|
) |
|
|
|
|
|
) { |
|
|
|
|
|
partnerRequest.EUINNumber = binding.edtEUINNumber.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (binding.tlEUINNumberNF.isVisible && !TextUtils.isEmpty( |
|
|
|
|
|
binding.edtEUINNumberNF.text.toString().trim() |
|
|
|
|
|
) |
|
|
|
|
|
) { |
|
|
|
|
|
partnerRequest.EUINNumber = binding.edtEUINNumberNF.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (!TextUtils.isEmpty(binding.edtPassingAMFI.text.toString().trim())) { |
|
|
|
|
|
partnerRequest.DateOfPassingAMFICertificate = |
|
|
|
|
|
binding.edtPassingAMFI.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (!TextUtils.isEmpty(binding.edtExpiryAMFI.text.toString().trim())) { |
|
|
|
|
|
partnerRequest.DateOfExpiryAMFICertificate = |
|
|
|
|
|
binding.edtExpiryAMFI.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (!TextUtils.isEmpty(binding.edtPanNumber.text.toString().trim())) { |
|
|
|
|
|
partnerRequest.PAN = binding.edtPanNumber.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
if (!TextUtils.isEmpty(binding.edtFullNamePanCard.text.toString().trim())) { |
|
|
|
|
|
partnerRequest.Name = binding.edtFullNamePanCard.text.toString().trim() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
partnerRequest.Mobile = arguments?.getString("mobile")!! |
|
|
|
|
|
partnerRequest.PartnerCode = |
|
|
|
|
|
PreferenceManager((activity as SignUpActivity)).getPartnerCode() |
|
|
|
|
|
partnerRequest.PartnerType = getString(R.string.advisory) |
|
|
|
|
|
partnerRequest.DateOfIncorporation = |
|
|
|
|
|
getDateFromTimeMills(System.currentTimeMillis()) |
|
|
|
|
|
apiPartnerCreation(partnerRequest) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
binding.btnNext.setOnClickListener { |
|
|
binding.btnNext.setOnClickListener { |
|
|
apiUploadDocument() |
|
|
apiUploadDocument() |
|
|
if (arguments?.getString("arnType").equals(getString(R.string.associateText), false)) { |
|
|
if (arguments?.getString("arnType").equals(getString(R.string.associateText), false)) { |
|
|
if(validationAssociate()) { |
|
|
|
|
|
|
|
|
if (validationAssociate()) { |
|
|
val pt = PartnerRequest() |
|
|
val pt = PartnerRequest() |
|
|
pt.Name = binding.edtFullNamePanCard.text.toString() |
|
|
pt.Name = binding.edtFullNamePanCard.text.toString() |
|
|
pt.PAN = binding.edtPanNumber.text.toString() |
|
|
pt.PAN = binding.edtPanNumber.text.toString() |
|
@ -258,14 +318,14 @@ class GetStartedFragment : BaseFragment() { |
|
|
val fragment = AlmostThereFragment() |
|
|
val fragment = AlmostThereFragment() |
|
|
val bundle = Bundle() |
|
|
val bundle = Bundle() |
|
|
bundle.putSerializable("InputValue", pt) |
|
|
bundle.putSerializable("InputValue", pt) |
|
|
if(arnData!=null) |
|
|
|
|
|
bundle.putSerializable("arnData", arnData) |
|
|
|
|
|
|
|
|
if (arnData != null) |
|
|
|
|
|
bundle.putSerializable("arnData", arnData) |
|
|
bundle.putSerializable("panData", panRes) |
|
|
bundle.putSerializable("panData", panRes) |
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
bundle.putString("arnType",arguments?.getString("arnType")) |
|
|
|
|
|
|
|
|
bundle.putString("arnType", arguments?.getString("arnType")) |
|
|
fragment.arguments = bundle |
|
|
fragment.arguments = bundle |
|
|
|
|
|
|
|
|
replaceFragment( |
|
|
|
|
|
|
|
|
addFragment( |
|
|
activity as BaseActivity, |
|
|
activity as BaseActivity, |
|
|
R.id.signUpContainer, |
|
|
R.id.signUpContainer, |
|
|
fragment, |
|
|
fragment, |
|
@ -274,9 +334,11 @@ class GetStartedFragment : BaseFragment() { |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else if (arguments?.getString("arnType").equals(getString(R.string.advisory), false)) { |
|
|
|
|
|
|
|
|
} else if (arguments?.getString("arnType") |
|
|
|
|
|
.equals(getString(R.string.advisory), false) |
|
|
|
|
|
) { |
|
|
if (validationAdvisory()) { |
|
|
if (validationAdvisory()) { |
|
|
val pt = PartnerRequest() |
|
|
|
|
|
|
|
|
|
|
|
pt.ARNNumber = binding.edtArnNumber.text.toString() |
|
|
pt.ARNNumber = binding.edtArnNumber.text.toString() |
|
|
|
|
|
|
|
|
if (binding.edtEUINNumber.visibility == View.VISIBLE) |
|
|
if (binding.edtEUINNumber.visibility == View.VISIBLE) |
|
@ -287,30 +349,20 @@ class GetStartedFragment : BaseFragment() { |
|
|
pt.Name = binding.edtFullNamePanCard.text.toString() |
|
|
pt.Name = binding.edtFullNamePanCard.text.toString() |
|
|
pt.PAN = binding.edtPanNumber.text.toString() |
|
|
pt.PAN = binding.edtPanNumber.text.toString() |
|
|
pt.DateOfPassingAMFICertificate = binding.edtPassingAMFI.text.toString() |
|
|
pt.DateOfPassingAMFICertificate = binding.edtPassingAMFI.text.toString() |
|
|
|
|
|
pt.PartnerType = arguments?.getString("arnType").toString() |
|
|
|
|
|
pt.PartnerCode = |
|
|
|
|
|
PreferenceManager((activity as SignUpActivity)).getPartnerCode() |
|
|
|
|
|
pt.Mobile = arguments?.getString("mobile").toString() |
|
|
|
|
|
pt.DateOfIncorporation = getDateFromTimeMills(System.currentTimeMillis()) |
|
|
|
|
|
|
|
|
val fragment = AlmostThereFragment() |
|
|
|
|
|
val bundle = Bundle() |
|
|
|
|
|
bundle.putSerializable("InputValue", pt) |
|
|
|
|
|
bundle.putSerializable("arnData", arnData) |
|
|
|
|
|
bundle.putSerializable("panData", panRes) |
|
|
|
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
|
|
|
bundle.putString("arnType",arguments?.getString("arnType")) |
|
|
|
|
|
fragment.arguments = bundle |
|
|
|
|
|
|
|
|
|
|
|
replaceFragment( |
|
|
|
|
|
activity as BaseActivity, |
|
|
|
|
|
R.id.signUpContainer, |
|
|
|
|
|
fragment, |
|
|
|
|
|
"GET STARTED", |
|
|
|
|
|
true |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
apiPartnerCreationContinue(pt) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
binding.uploadFront.setOnClickListener { |
|
|
binding.uploadFront.setOnClickListener { |
|
|
actionType = mainPANUpload |
|
|
actionType = mainPANUpload |
|
|
isFront = true |
|
|
|
|
|
|
|
|
setImageUploadType(front = true, back = false, aRN = false, eUIN = false) |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
selectImage() |
|
|
selectImage() |
|
|
} else { |
|
|
} else { |
|
@ -323,9 +375,11 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
binding.mbUploadChangeFront.setOnClickListener { |
|
|
binding.mbUploadChangeFront.setOnClickListener { |
|
|
actionType = mainPANUpload |
|
|
actionType = mainPANUpload |
|
|
isFront = true |
|
|
|
|
|
|
|
|
setImageUploadType(front = true, back = false, aRN = false, eUIN = false) |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
selectImage() |
|
|
selectImage() |
|
|
|
|
|
} else if (binding.ivFront.drawable != null) { |
|
|
|
|
|
selectImage() |
|
|
} else { |
|
|
} else { |
|
|
showDialogValidation( |
|
|
showDialogValidation( |
|
|
activity as SignUpActivity, |
|
|
activity as SignUpActivity, |
|
@ -336,9 +390,11 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
binding.mbUploadChangeBack.setOnClickListener { |
|
|
binding.mbUploadChangeBack.setOnClickListener { |
|
|
actionType = mainPANUpload |
|
|
actionType = mainPANUpload |
|
|
isFront = false |
|
|
|
|
|
|
|
|
setImageUploadType(front = false, back = true, aRN = false, eUIN = false) |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
selectImage() |
|
|
selectImage() |
|
|
|
|
|
} else if (binding.ivBack.drawable != null) { |
|
|
|
|
|
selectImage() |
|
|
} else { |
|
|
} else { |
|
|
showDialogValidation( |
|
|
showDialogValidation( |
|
|
activity as SignUpActivity, |
|
|
activity as SignUpActivity, |
|
@ -349,7 +405,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
binding.uploadBack.setOnClickListener { |
|
|
binding.uploadBack.setOnClickListener { |
|
|
actionType = mainPANUpload |
|
|
actionType = mainPANUpload |
|
|
isFront = false |
|
|
|
|
|
|
|
|
setImageUploadType(front = false, back = true, aRN = false, eUIN = false) |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
if (docValue.isNotBlank() && docValue.isNotEmpty()) { |
|
|
selectImage() |
|
|
selectImage() |
|
|
} else { |
|
|
} else { |
|
@ -362,11 +418,13 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
binding.rlARNUpload.setOnClickListener { |
|
|
binding.rlARNUpload.setOnClickListener { |
|
|
actionType = mainARNPhotoUpload |
|
|
actionType = mainARNPhotoUpload |
|
|
|
|
|
setImageUploadType(front = false, back = false, aRN = true, eUIN = false) |
|
|
selectImage() |
|
|
selectImage() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
binding.rlEUINUpload.setOnClickListener { |
|
|
binding.rlEUINUpload.setOnClickListener { |
|
|
actionType = mainEUINPhotoUpload |
|
|
actionType = mainEUINPhotoUpload |
|
|
|
|
|
setImageUploadType(front = false, back = false, aRN = false, eUIN = true) |
|
|
selectImage() |
|
|
selectImage() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -377,11 +435,14 @@ class GetStartedFragment : BaseFragment() { |
|
|
if (arguments?.getString("arnType").equals(getString(R.string.advisory), true)) { |
|
|
if (arguments?.getString("arnType").equals(getString(R.string.advisory), true)) { |
|
|
if (!isValidIndividualPan(s.toString().trim())) { |
|
|
if (!isValidIndividualPan(s.toString().trim())) { |
|
|
binding.rlEUINUpload.visibility = View.GONE |
|
|
binding.rlEUINUpload.visibility = View.GONE |
|
|
|
|
|
binding.edtEUINNumber.visibility = View.VISIBLE |
|
|
|
|
|
binding.tlEUINNumber.visibility = View.VISIBLE |
|
|
} else { |
|
|
} else { |
|
|
binding.rlEUINUpload.visibility = View.VISIBLE |
|
|
binding.rlEUINUpload.visibility = View.VISIBLE |
|
|
if (!TextUtils.isEmpty(binding.edtEUINNumber.text)) { |
|
|
if (!TextUtils.isEmpty(binding.edtEUINNumber.text)) { |
|
|
binding.edtEUINNumberNF.setText(binding.edtEUINNumber.text.toString()) |
|
|
binding.edtEUINNumberNF.setText(binding.edtEUINNumber.text.toString()) |
|
|
binding.edtEUINNumber.visibility = View.GONE |
|
|
binding.edtEUINNumber.visibility = View.GONE |
|
|
|
|
|
binding.tlEUINNumber.visibility = View.GONE |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -455,12 +516,197 @@ class GetStartedFragment : BaseFragment() { |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getPartnerCreationSaveMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
val res: PartnerResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
PartnerResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
Log.e("check_res_partner", res.toString()) |
|
|
|
|
|
if (res.Status != null) { |
|
|
|
|
|
showDialogValidation((activity as SignUpActivity), "Detail Saved in Draft") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getPartnerCreationContinueMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
val res: PartnerResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
PartnerResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (res.Status != null || res.Status == getString(R.string.successText)) { |
|
|
|
|
|
val fragment = AlmostThereFragment() |
|
|
|
|
|
val bundle = Bundle() |
|
|
|
|
|
bundle.putSerializable("InputValue", pt) |
|
|
|
|
|
bundle.putSerializable("arnData", arnData) |
|
|
|
|
|
bundle.putSerializable("panData", panRes) |
|
|
|
|
|
bundle.putString("mobile", arguments?.getString("mobile")) |
|
|
|
|
|
bundle.putString("arnType", arguments?.getString("arnType")) |
|
|
|
|
|
fragment.arguments = bundle |
|
|
|
|
|
|
|
|
|
|
|
addFragment( |
|
|
|
|
|
activity as BaseActivity, |
|
|
|
|
|
R.id.signUpContainer, |
|
|
|
|
|
fragment, |
|
|
|
|
|
"GET STARTED", |
|
|
|
|
|
true |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentTypeFullMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
val res: DocumentTypeResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentTypeResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
listOfFullDocType = res.Result.Data |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentTypeMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
ProgressUtil.hideLoading() |
|
|
|
|
|
val res: DocumentTypeResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentTypeResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
Log.e("checkDocRes", res.toString()) |
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
listOfDocType = res.Result.Data |
|
|
|
|
|
if (listOfDocType.isNotEmpty()) { |
|
|
|
|
|
setUpDocAdapter(listOfDocType) |
|
|
|
|
|
|
|
|
|
|
|
if (arguments?.containsKey("partnerResponse") == true) { |
|
|
|
|
|
val partnerDetailResponse: PartnerDetailResponse? = |
|
|
|
|
|
(arguments?.getSerializable("partnerResponse") as? PartnerDetailResponse) |
|
|
|
|
|
setUpPartnerResponseData(partnerDetailResponse) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
apiAMFIDetail("Mobile", arguments?.getString("mobile")) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUploadMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
val res: DocumentUploadResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentUploadResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
Toast.makeText(activity as SignUpActivity, res.Message, Toast.LENGTH_LONG) |
|
|
|
|
|
.show() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setImageUploadType(front: Boolean, back: Boolean, aRN: Boolean, eUIN: Boolean) { |
|
|
|
|
|
isFront = front |
|
|
|
|
|
isBack = back |
|
|
|
|
|
isARN = aRN |
|
|
|
|
|
isEUIN = eUIN |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setUpPartnerResponseData(partnerResponse: PartnerDetailResponse?) { |
|
|
|
|
|
if (partnerResponse?.Result?.ARNNumber != null) { |
|
|
|
|
|
binding.edtArnNumber.setText(partnerResponse.Result.ARNNumber) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (partnerResponse?.Result?.EUINNumber != null) { |
|
|
|
|
|
binding.edtEUINNumber.setText(partnerResponse.Result.EUINNumber) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (partnerResponse?.Result?.DateOfPassingAMFICertificate != null) { |
|
|
|
|
|
binding.edtPassingAMFI.setText(partnerResponse.Result.DateOfPassingAMFICertificate) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (partnerResponse?.Result?.DateOfExpiryAMFICertificate != null) { |
|
|
|
|
|
binding.edtExpiryAMFI.setText(partnerResponse.Result.DateOfExpiryAMFICertificate) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (partnerResponse?.Result?.PAN != null) { |
|
|
|
|
|
binding.edtPanNumber.setText(partnerResponse.Result.PAN) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (partnerResponse?.Result?.Name != null) { |
|
|
|
|
|
binding.edtFullNamePanCard.setText(partnerResponse.Result.Name) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (partnerResponse?.Result?.filedetails != null && partnerResponse.Result.filedetails.isNotEmpty()) { |
|
|
|
|
|
if (listOfFullDocType != null && listOfFullDocType.isNotEmpty()) { |
|
|
|
|
|
for (i in listOfFullDocType.indices) { |
|
|
|
|
|
for (j in partnerResponse.Result.filedetails.indices) { |
|
|
|
|
|
if (listOfFullDocType[i].DocumentId == partnerResponse.Result.filedetails[j].DocumentId) { |
|
|
|
|
|
for(k in listOfDocType.indices) { |
|
|
|
|
|
if(listOfFullDocType[i].DocumentType == listOfDocType[k].DocumentType) { |
|
|
|
|
|
binding.spDocType.setText(listOfDocType[k].DocumentType) |
|
|
|
|
|
setUpDocAdapter(listOfDocType) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (partnerResponse.Result.filedetails[j].FilePath != null) { |
|
|
|
|
|
isDataUpdate = true |
|
|
|
|
|
documentUrlSelected = partnerResponse.Result.filedetails[j].FilePath |
|
|
|
|
|
documentTypeSelected = listOfFullDocType[i].DocumentType |
|
|
|
|
|
setVisibilityUrl(documentTypeSelected) |
|
|
|
|
|
setFrontHideVisibleUrl(j, documentUrlSelected,partnerResponse.Result.filedetails[j].DocumentId, |
|
|
|
|
|
partnerResponse.Result.filedetails[j].FileId) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setUpDocAdapter(listOfDocType: List<Data>) { |
|
|
|
|
|
val adapter = ArrayAdapter( |
|
|
|
|
|
activity as SignUpActivity, |
|
|
|
|
|
android.R.layout.simple_list_item_1, |
|
|
|
|
|
listOfDocType |
|
|
|
|
|
) |
|
|
|
|
|
binding.spDocType.setAdapter(adapter) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun apiPartnerCreation(partnerRequest: PartnerRequest) { |
|
|
|
|
|
val data = GsonBuilder().create().toJson(partnerRequest, PartnerRequest::class.java) |
|
|
|
|
|
Log.e("partnerCreation", data.toString()) |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getPartnerCreateSaveData( |
|
|
|
|
|
partnerRequest, |
|
|
|
|
|
"", |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun apiPartnerCreationContinue(partnerRequest: PartnerRequest) { |
|
|
|
|
|
val data = GsonBuilder().create().toJson(partnerRequest, PartnerRequest::class.java) |
|
|
|
|
|
Log.e("partnerCreationContinue", data.toString()) |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getPartnerCreateContinueData( |
|
|
|
|
|
partnerRequest, |
|
|
|
|
|
"", |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun commonMethodForVisibility(visibility: Int) { |
|
|
private fun commonMethodForVisibility(visibility: Int) { |
|
|
binding.edtArnNumber.visibility = visibility |
|
|
binding.edtArnNumber.visibility = visibility |
|
|
binding.tlArnNumber.visibility = visibility |
|
|
binding.tlArnNumber.visibility = visibility |
|
|
binding.edtEUINNumber.visibility = visibility |
|
|
binding.edtEUINNumber.visibility = visibility |
|
|
|
|
|
binding.tlEUINNumber.visibility = visibility |
|
|
binding.tlArnNumber.visibility = visibility |
|
|
binding.tlArnNumber.visibility = visibility |
|
|
binding.edtPassingAMFI.visibility = visibility |
|
|
binding.edtPassingAMFI.visibility = visibility |
|
|
binding.tlPassingAMFI.visibility = visibility |
|
|
binding.tlPassingAMFI.visibility = visibility |
|
@ -468,38 +714,29 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.tlExpiryAMFI.visibility = visibility |
|
|
binding.tlExpiryAMFI.visibility = visibility |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun documentTypeAPI(docType: String) { |
|
|
|
|
|
try { |
|
|
|
|
|
ProgressUtil.showLoading(activity as SignUpActivity) |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentType( |
|
|
|
|
|
|
|
|
private fun documentTypeFullAPI() { |
|
|
|
|
|
|
|
|
|
|
|
if (listOfDocType != null && listOfDocType.isEmpty()) { |
|
|
|
|
|
Log.e("check_activity_name", (activity as SignUpActivity).localClassName) |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentTypeFull( |
|
|
"3",//Currently it is static |
|
|
"3",//Currently it is static |
|
|
docType, |
|
|
|
|
|
// Constants.BASE_URL_COMMON + "User/GetAllDocumentsType", |
|
|
|
|
|
|
|
|
"", |
|
|
(activity as SignUpActivity) |
|
|
(activity as SignUpActivity) |
|
|
) |
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
ProgressUtil.hideLoading() |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentTypeMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
val res: DocumentTypeResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentTypeResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
Log.e("checkDocRes", res.toString()) |
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
listOfDocType = res.Result.Data |
|
|
|
|
|
if (listOfDocType.isNotEmpty()) { |
|
|
|
|
|
val adapter = ArrayAdapter( |
|
|
|
|
|
activity as SignUpActivity, |
|
|
|
|
|
android.R.layout.simple_list_item_1, |
|
|
|
|
|
listOfDocType |
|
|
|
|
|
) |
|
|
|
|
|
binding.spDocType.setAdapter(adapter) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
apiAMFIDetail("Mobile", arguments?.getString("mobile")) |
|
|
|
|
|
|
|
|
@SuppressLint("SuspiciousIndentation") |
|
|
|
|
|
private fun documentTypeAPI(docType: String) { |
|
|
|
|
|
try { |
|
|
|
|
|
if (listOfDocType != null && listOfDocType.isEmpty()) { |
|
|
|
|
|
ProgressUtil.showLoading(activity as SignUpActivity) |
|
|
|
|
|
Log.e("check_activity_name", (activity as SignUpActivity).localClassName) |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentType( |
|
|
|
|
|
"3",//Currently it is static |
|
|
|
|
|
docType, |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} catch (e: Exception) { |
|
|
} catch (e: Exception) { |
|
@ -616,17 +853,13 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.tlPanNumber, |
|
|
binding.tlPanNumber, |
|
|
getString(R.string.pleaseArnNum) |
|
|
getString(R.string.pleaseArnNum) |
|
|
) |
|
|
) |
|
|
}else if (binding.edtFullNamePanCard.text.toString().isEmpty()) { |
|
|
|
|
|
|
|
|
} else if (binding.edtFullNamePanCard.text.toString().isEmpty()) { |
|
|
commonErrorMethod( |
|
|
commonErrorMethod( |
|
|
binding.edtFullNamePanCard, |
|
|
binding.edtFullNamePanCard, |
|
|
binding.tlFullNamePanCard, |
|
|
binding.tlFullNamePanCard, |
|
|
getString(R.string.pleaseArnNum) |
|
|
getString(R.string.pleaseArnNum) |
|
|
) |
|
|
) |
|
|
} else if(imageSelectedList != null && imageSelectedList.size == 0){ |
|
|
|
|
|
showDialogValidation((activity as SignUpActivity),getString(R.string.addressProofType)) |
|
|
|
|
|
return false |
|
|
|
|
|
} |
|
|
|
|
|
else return true |
|
|
|
|
|
|
|
|
} else return true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private fun validationAdvisory(): Boolean { |
|
|
private fun validationAdvisory(): Boolean { |
|
@ -636,13 +869,16 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.tlArnNumber, |
|
|
binding.tlArnNumber, |
|
|
getString(R.string.pleaseArnNum) |
|
|
getString(R.string.pleaseArnNum) |
|
|
) |
|
|
) |
|
|
} else if (binding.edtEUINNumber.visibility != View.VISIBLE && binding.edtEUINNumber.text.toString().isEmpty()) { |
|
|
|
|
|
|
|
|
} else if (binding.edtEUINNumber.visibility != View.VISIBLE && binding.edtEUINNumber.text.toString() |
|
|
|
|
|
.isEmpty() |
|
|
|
|
|
) { |
|
|
commonErrorMethod( |
|
|
commonErrorMethod( |
|
|
binding.edtEUINNumber, |
|
|
binding.edtEUINNumber, |
|
|
binding.tlEUINNumber, |
|
|
binding.tlEUINNumber, |
|
|
getString(R.string.pleaseEuinNum) |
|
|
getString(R.string.pleaseEuinNum) |
|
|
) |
|
|
) |
|
|
} else if (binding.edtEUINNumberNF.visibility != View.VISIBLE && binding.edtEUINNumberNF.text.toString().isEmpty() |
|
|
|
|
|
|
|
|
} else if (binding.edtEUINNumberNF.visibility != View.VISIBLE && binding.edtEUINNumberNF.text.toString() |
|
|
|
|
|
.isEmpty() |
|
|
) { |
|
|
) { |
|
|
commonErrorMethod( |
|
|
commonErrorMethod( |
|
|
binding.edtEUINNumberNF, |
|
|
binding.edtEUINNumberNF, |
|
@ -667,25 +903,39 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.tlPanNumber, |
|
|
binding.tlPanNumber, |
|
|
getString(R.string.emptyPAN) |
|
|
getString(R.string.emptyPAN) |
|
|
) |
|
|
) |
|
|
}else if (!isPanVerify) { |
|
|
|
|
|
|
|
|
} else if (!isPanVerify) { |
|
|
commonErrorMethod( |
|
|
commonErrorMethod( |
|
|
binding.edtPanNumber, |
|
|
binding.edtPanNumber, |
|
|
binding.tlPanNumber, |
|
|
binding.tlPanNumber, |
|
|
getString(R.string.invalidPAN) |
|
|
getString(R.string.invalidPAN) |
|
|
) |
|
|
) |
|
|
} |
|
|
|
|
|
else if (binding.edtFullNamePanCard.text.toString().isEmpty()) { |
|
|
|
|
|
|
|
|
} else if (binding.edtFullNamePanCard.text.toString().isEmpty()) { |
|
|
commonErrorMethod( |
|
|
commonErrorMethod( |
|
|
binding.edtFullNamePanCard, |
|
|
binding.edtFullNamePanCard, |
|
|
binding.tlFullNamePanCard, |
|
|
binding.tlFullNamePanCard, |
|
|
getString(R.string.full_name_as_on_pan_card) |
|
|
getString(R.string.full_name_as_on_pan_card) |
|
|
) |
|
|
) |
|
|
} else if (imageSelectedList != null && imageSelectedList.size == 0) { |
|
|
|
|
|
showDialogValidation( |
|
|
|
|
|
(activity as SignUpActivity), |
|
|
|
|
|
resources.getString(R.string.selectAddressProof) |
|
|
|
|
|
) |
|
|
|
|
|
false |
|
|
|
|
|
|
|
|
} else if (!isDataUpdate) { |
|
|
|
|
|
if (imageSelectedList == null || imageSelectedList.size == 0) { |
|
|
|
|
|
showDialogValidation( |
|
|
|
|
|
(activity as SignUpActivity), |
|
|
|
|
|
resources.getString(R.string.selectAddressProof) |
|
|
|
|
|
) |
|
|
|
|
|
return false |
|
|
|
|
|
} else true |
|
|
|
|
|
} else if (isDataUpdate) { |
|
|
|
|
|
return if (TextUtils.isEmpty(documentTypeSelected) && TextUtils.isEmpty( |
|
|
|
|
|
documentUrlSelected |
|
|
|
|
|
) |
|
|
|
|
|
) { |
|
|
|
|
|
showDialogValidation( |
|
|
|
|
|
(activity as SignUpActivity), |
|
|
|
|
|
getString(R.string.addressProofType) |
|
|
|
|
|
) |
|
|
|
|
|
false |
|
|
|
|
|
} else { |
|
|
|
|
|
true |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
true |
|
|
true |
|
|
} |
|
|
} |
|
@ -786,6 +1036,19 @@ class GetStartedFragment : BaseFragment() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setVisibilityUrl(s: String) { |
|
|
|
|
|
binding.llDoc.visibility = View.VISIBLE |
|
|
|
|
|
if (s.contains(getString(R.string.aadhaarText))) { |
|
|
|
|
|
binding.txtFront.visibility = View.VISIBLE |
|
|
|
|
|
binding.txtBack.visibility = View.VISIBLE |
|
|
|
|
|
binding.llBack.visibility = View.VISIBLE |
|
|
|
|
|
} else { |
|
|
|
|
|
binding.txtFront.visibility = View.VISIBLE |
|
|
|
|
|
binding.txtBack.visibility = View.GONE |
|
|
|
|
|
binding.llBack.visibility = View.GONE |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private fun getTmpFileUri(): Uri { |
|
|
private fun getTmpFileUri(): Uri { |
|
|
val tmpFile = |
|
|
val tmpFile = |
|
|
File.createTempFile("tmp_image_file", ".png", requireActivity().cacheDir).apply { |
|
|
File.createTempFile("tmp_image_file", ".png", requireActivity().cacheDir).apply { |
|
@ -876,12 +1139,15 @@ class GetStartedFragment : BaseFragment() { |
|
|
if (type == "c") { |
|
|
if (type == "c") { |
|
|
encodedPANBase64(fileExtension) |
|
|
encodedPANBase64(fileExtension) |
|
|
if (isFront) imageSelectedList.add(ImageSelectedModel(0, fileExtension)) |
|
|
if (isFront) imageSelectedList.add(ImageSelectedModel(0, fileExtension)) |
|
|
else imageSelectedList.add(ImageSelectedModel(0, fileExtension)) |
|
|
|
|
|
|
|
|
else imageSelectedList.add(ImageSelectedModel(1, fileExtension)) |
|
|
} else { |
|
|
} else { |
|
|
val bitmap: Bitmap = |
|
|
val bitmap: Bitmap = |
|
|
MediaStore.Images.Media.getBitmap(context?.contentResolver, uri) |
|
|
MediaStore.Images.Media.getBitmap(context?.contentResolver, uri) |
|
|
|
|
|
|
|
|
val fileName: String = System.currentTimeMillis().toString() |
|
|
|
|
|
|
|
|
var fileName = "" |
|
|
|
|
|
if (isFront) fileName = "FRONT_".plus(System.currentTimeMillis().toString()) |
|
|
|
|
|
else if (isBack) fileName = |
|
|
|
|
|
"BACK_".plus(System.currentTimeMillis().toString()) |
|
|
|
|
|
|
|
|
val file = File(fileDir, fileName.plus(".png")) |
|
|
val file = File(fileDir, fileName.plus(".png")) |
|
|
val fOut = FileOutputStream(file) |
|
|
val fOut = FileOutputStream(file) |
|
@ -891,7 +1157,7 @@ class GetStartedFragment : BaseFragment() { |
|
|
fOut.close() |
|
|
fOut.close() |
|
|
|
|
|
|
|
|
if (file.exists()) encodedPANBase64(file) |
|
|
if (file.exists()) encodedPANBase64(file) |
|
|
if (isFront) imageSelectedList.add(ImageSelectedModel(1, file)) |
|
|
|
|
|
|
|
|
if (isFront) imageSelectedList.add(ImageSelectedModel(0, file)) |
|
|
else imageSelectedList.add(ImageSelectedModel(1, file)) |
|
|
else imageSelectedList.add(ImageSelectedModel(1, file)) |
|
|
Log.e("check_panString", panString + "\n" + bitmap.toString()) |
|
|
Log.e("check_panString", panString + "\n" + bitmap.toString()) |
|
|
} |
|
|
} |
|
@ -978,83 +1244,62 @@ class GetStartedFragment : BaseFragment() { |
|
|
|
|
|
|
|
|
private fun apiUploadDocument() { |
|
|
private fun apiUploadDocument() { |
|
|
if (imageSelectedList != null && imageSelectedList.size != 0) { |
|
|
if (imageSelectedList != null && imageSelectedList.size != 0) { |
|
|
|
|
|
|
|
|
val part = ArrayList<MultipartBody.Part>() |
|
|
|
|
|
|
|
|
|
|
|
imageSelectedList.forEachIndexed { _, element -> |
|
|
|
|
|
|
|
|
|
|
|
if (element.pos == 0) { |
|
|
|
|
|
part.add(prepareImagePart(element.file, "front")) |
|
|
|
|
|
} else { |
|
|
|
|
|
part.add(prepareImagePart(element.file, "back")) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(selectedDocPosition != -1) { |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUpload( |
|
|
|
|
|
part, |
|
|
|
|
|
PreferenceManager((activity as SignUpActivity)).getPartnerCode().toInt(), |
|
|
|
|
|
5, |
|
|
|
|
|
listOfDocType[selectedDocPosition].DocumentId, |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
|
|
|
}else{ |
|
|
|
|
|
showDialogValidation((activity as SignUpActivity),"Document Not Selected") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUploadMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
Log.e("check_upload_res", response.toString()) |
|
|
|
|
|
val res: DocumentUploadResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentUploadResponse::class.java |
|
|
|
|
|
|
|
|
for (i in 0 until imageSelectedList.size) { |
|
|
|
|
|
if (imageSelectedList[i].pos == 0) { |
|
|
|
|
|
apiUploadRequest( |
|
|
|
|
|
prepareImagePart(imageSelectedList[i].file, "front"), |
|
|
|
|
|
listOfDocType[selectedDocPosition].DocumentId,frontUpdatedFileId |
|
|
|
|
|
) |
|
|
|
|
|
} else if (imageSelectedList[i].pos == 1) { |
|
|
|
|
|
apiUploadRequest( |
|
|
|
|
|
prepareImagePart(imageSelectedList[i].file, "back"), |
|
|
|
|
|
listOfDocType[selectedDocPosition].DocumentId,backUpdatedFileId |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
Toast.makeText(activity as SignUpActivity, res.Message, Toast.LENGTH_LONG) |
|
|
|
|
|
.show() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (imageSelectedArnEuinList != null && imageSelectedList.size != 0) { |
|
|
|
|
|
val part = ArrayList<MultipartBody.Part>() |
|
|
|
|
|
|
|
|
|
|
|
imageSelectedArnEuinList.forEachIndexed { _, element -> |
|
|
|
|
|
if (element.pos == 0) { |
|
|
|
|
|
part.add(prepareImagePart(element.file, "ARN")) |
|
|
|
|
|
} else { |
|
|
|
|
|
part.add(prepareImagePart(element.file, "EUIN")) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUpload( |
|
|
|
|
|
part, |
|
|
|
|
|
3, |
|
|
|
|
|
5, |
|
|
|
|
|
8, |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUploadMutableData.observe( |
|
|
|
|
|
viewLifecycleOwner |
|
|
|
|
|
) { response -> |
|
|
|
|
|
Log.e("check_upload_res", response.toString()) |
|
|
|
|
|
val res: DocumentUploadResponse = |
|
|
|
|
|
Gson().fromJson( |
|
|
|
|
|
response?.data.toString(), |
|
|
|
|
|
DocumentUploadResponse::class.java |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if (res.Status == getString(R.string.successText)) { |
|
|
|
|
|
Toast.makeText(activity as SignUpActivity, res.Message, Toast.LENGTH_LONG) |
|
|
|
|
|
.show() |
|
|
|
|
|
|
|
|
if (imageSelectedArnEuinList != null) { |
|
|
|
|
|
for (i in 0 until imageSelectedArnEuinList.size) { |
|
|
|
|
|
if (imageSelectedArnEuinList[i].pos == 0) { |
|
|
|
|
|
for (j in listOfFullDocType.indices) { |
|
|
|
|
|
if (listOfFullDocType[j].DocumentType.contains("ARN", ignoreCase = true)) { |
|
|
|
|
|
apiUploadRequest( |
|
|
|
|
|
prepareImagePart( |
|
|
|
|
|
imageSelectedArnEuinList[i].file, |
|
|
|
|
|
"front" |
|
|
|
|
|
), listOfFullDocType[j].DocumentId,arnUpdatedFileId |
|
|
|
|
|
) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} else if (imageSelectedArnEuinList[i].pos == 1) { |
|
|
|
|
|
for (element in listOfFullDocType) { |
|
|
|
|
|
if (element.DocumentType.contains("EUIN", ignoreCase = true)) { |
|
|
|
|
|
apiUploadRequest( |
|
|
|
|
|
prepareImagePart( |
|
|
|
|
|
imageSelectedArnEuinList[i].file, |
|
|
|
|
|
"front" |
|
|
|
|
|
), listOfFullDocType[i].DocumentId,euinUpdatedFileId |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun apiUploadRequest(imagePart: MultipartBody.Part, documentId: Int,fileId: Int) { |
|
|
|
|
|
(activity as SignUpActivity).viewModelOne.getDocumentUpload( |
|
|
|
|
|
imagePart, |
|
|
|
|
|
PreferenceManager((activity as SignUpActivity)).getPartnerCode().toInt(), |
|
|
|
|
|
5, |
|
|
|
|
|
documentId, |
|
|
|
|
|
fileId, |
|
|
|
|
|
(activity as SignUpActivity) |
|
|
|
|
|
) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private fun prepareImagePart(file: File, partName: String): MultipartBody.Part { |
|
|
private fun prepareImagePart(file: File, partName: String): MultipartBody.Part { |
|
|
val requestBody: RequestBody = |
|
|
val requestBody: RequestBody = |
|
|
file.asRequestBody("application/octet-stream".toMediaTypeOrNull()) |
|
|
file.asRequestBody("application/octet-stream".toMediaTypeOrNull()) |
|
@ -1080,4 +1325,38 @@ class GetStartedFragment : BaseFragment() { |
|
|
binding.ivBack.setImageURI(uri) |
|
|
binding.ivBack.setImageURI(uri) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setFrontHideVisibleUrl(pos: Int, url: String, documentId: Int, fileId: Int) { |
|
|
|
|
|
if (pos == 0) { |
|
|
|
|
|
binding.uploadFront.visibility = View.GONE |
|
|
|
|
|
binding.ivFrontLayer.setBackgroundColor(Color.parseColor("#99000000")) |
|
|
|
|
|
binding.ivFrontTik.setBackgroundResource(R.drawable.svg_tik) |
|
|
|
|
|
binding.mbUploadChangeFront.visibility = View.VISIBLE |
|
|
|
|
|
frontUpdatedFileId = fileId |
|
|
|
|
|
Picasso.get().load(url).into(binding.ivFront) |
|
|
|
|
|
} else { |
|
|
|
|
|
binding.uploadBack.visibility = View.GONE |
|
|
|
|
|
binding.ivBackLayer.setBackgroundColor(Color.parseColor("#99000000")) |
|
|
|
|
|
binding.ivBackTik.setBackgroundResource(R.drawable.svg_tik) |
|
|
|
|
|
binding.mbUploadChangeBack.visibility = View.VISIBLE |
|
|
|
|
|
backUpdatedFileId = fileId |
|
|
|
|
|
Picasso.get().load(url).into(binding.ivBack) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for(i in listOfFullDocType.indices){ |
|
|
|
|
|
if(documentId == listOfFullDocType[i].DocumentId){ |
|
|
|
|
|
if(listOfFullDocType[i].DocumentType.contains("ARN",ignoreCase = true)){ |
|
|
|
|
|
Picasso.get().load(url).into(binding.ivARNUpload) |
|
|
|
|
|
binding.tvUploadARNTitle.visibility = View.GONE |
|
|
|
|
|
arnUpdatedFileId = fileId |
|
|
|
|
|
break |
|
|
|
|
|
}else if(listOfFullDocType[i].DocumentType.contains("EUIN",ignoreCase = true)){ |
|
|
|
|
|
Picasso.get().load(url).into(binding.ivEUINUpload) |
|
|
|
|
|
binding.tvUploadEUINTitle.visibility = View.GONE |
|
|
|
|
|
euinUpdatedFileId = fileId |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |