diff --git a/app/src/main/java/org/apache/fineract/ui/online/customers/customerpayroll/editcustomerpayroll/EditPayrollAllocationFragment.kt b/app/src/main/java/org/apache/fineract/ui/online/customers/customerpayroll/editcustomerpayroll/EditPayrollAllocationFragment.kt index 3a034018..f6c5271b 100644 --- a/app/src/main/java/org/apache/fineract/ui/online/customers/customerpayroll/editcustomerpayroll/EditPayrollAllocationFragment.kt +++ b/app/src/main/java/org/apache/fineract/ui/online/customers/customerpayroll/editcustomerpayroll/EditPayrollAllocationFragment.kt @@ -1,11 +1,12 @@ package org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll import android.content.Context +import android.content.DialogInterface import android.os.Bundle -import androidx.recyclerview.widget.LinearLayoutManager import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.stepstone.stepper.Step import com.stepstone.stepper.VerificationError @@ -16,12 +17,11 @@ import org.apache.fineract.data.models.payroll.PayrollConfiguration import org.apache.fineract.ui.adapters.PayrollAllocationAdapter import org.apache.fineract.ui.base.FineractBaseActivity import org.apache.fineract.ui.base.FineractBaseFragment -import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll - .editpayrollbottomsheet.EditPayrollBottomSheet -import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll - .editpayrollbottomsheet.OnBottomSheetDialogListener +import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll.editpayrollbottomsheet.EditPayrollBottomSheet +import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll.editpayrollbottomsheet.OnBottomSheetDialogListener import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll.editpayrollbottomsheet.PayrollSource import org.apache.fineract.utils.ConstantKeys +import org.apache.fineract.utils.MaterialDialog import javax.inject.Inject @@ -107,14 +107,15 @@ class EditPayrollAllocationFragment : FineractBaseFragment(), Step, } override fun onClickDelete(payrollAllocation: PayrollAllocation, position: Int) { - payrollAllocations.removeAt(position) - payrollAllocationAdapter.setPayrollAllocations(payrollAllocations) + dialog(position, getString(R.string.dialog_title_confirm_deletion), + getString(R.string.dialog_message_confirm_name_deletion, "Payroll"), + getString(R.string.delete), null) } override fun editPayrollAllocation(payrollAllocation: PayrollAllocation, position: Int) { - payrollAllocations.removeAt(position) - payrollAllocations.add(position, payrollAllocation) - payrollAllocationAdapter.setPayrollAllocations(payrollAllocations) + dialog(position, getString(R.string.dialog_title_confirm_update), + getString(R.string.dialog_message_confirm_name_updation, "Payroll"), + getString(R.string.update), payrollAllocation) } override fun addPayrollAllocation(payrollAllocation: PayrollAllocation) { @@ -131,4 +132,20 @@ class EditPayrollAllocationFragment : FineractBaseFragment(), Step, } -} + fun dialog(position: Int, title: String, message: String, btnMessage: String, payrollAllocation: PayrollAllocation?) { + MaterialDialog.Builder() + .init(context) + .setTitle(title) + .setMessage(message) + .setPositiveButton(btnMessage) { dialog: DialogInterface?, _: Int -> + payrollAllocations.removeAt(position) + if (payrollAllocation != null) { + payrollAllocations.add(position, payrollAllocation) + } + payrollAllocationAdapter.setPayrollAllocations(payrollAllocations) + dialog?.dismiss() + }.setNegativeButton(getString(R.string.dialog_action_cancel)) + .createMaterialDialog() + .show() + } +} \ No newline at end of file diff --git a/app/src/main/res/values-ml-rIN/strings.xml b/app/src/main/res/values-ml-rIN/strings.xml index 937afa57..830e6dbf 100644 --- a/app/src/main/res/values-ml-rIN/strings.xml +++ b/app/src/main/res/values-ml-rIN/strings.xml @@ -307,4 +307,6 @@ ഹലോ ശൂന്യമായ ശകലം നിങ്ങൾ അനുമതി നിഷേധിച്ചു ഈ അനുമതിയില്ലാതെ നിങ്ങൾക്ക് ക്യാമറ സ്കാൻ ചെയ്യാൻ കഴിയില്ല. ഇത് സജ്ജീകരണങ്ങളിൽ പ്രാപ്തമാക്കുകനിങ്ങൾ അനുമതി നിഷേധിച്ചു ഈ അനുമതിയില്ലാതെ നിങ്ങൾക്ക് ക്യാമറ സ്കാൻ ചെയ്യാൻ കഴിയില്ല. ഇത് സജ്ജീകരണങ്ങളിൽ പ്രാപ്തമാക്കുക ക്രമീകരണ പ്രവർത്തനം എന്തോ തെറ്റായി സംഭവിച്ചു. \'ക്രമീകരണങ്ങൾ\' എന്നതിലേക്ക് പോയി സ്വമേധയാ അനുമതി അനുവദിക്കുക. + നിങ്ങൾക്ക് അപ്‌ഡേറ്റ് ചെയ്യണോ %s? + അപ്‌ഡേറ്റ് സ്ഥിരീകരിക്കുക \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index af22aaa1..48f2f39b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -335,6 +335,7 @@ Delete Logout Confirm deletion + Confirm update Confirm logout Do you want to delete this identification card? Do you want to delete this identification card scan? @@ -535,6 +536,7 @@ Please click BACK again to exit Update Do you want to delete %s? + Do you want to update %s? Edit Group Updating Group, please wait... Please verify the following tasks before you can %1$s this group